pax_global_header00006660000000000000000000000064121514276010014511gustar00rootroot0000000000000052 comment=dea0da72655f1defccaea643dbe37373f6692243 .qmake.conf000066400000000000000000000000561215142760100131010ustar00rootroot00000000000000load(qt_build_config) MODULE_VERSION = 0.0.0 .tag000066400000000000000000000000511215142760100116250ustar00rootroot00000000000000dea0da72655f1defccaea643dbe37373f6692243 LGPL_EXCEPTION.txt000066400000000000000000000022431215142760100137730ustar00rootroot00000000000000Digia Qt LGPL Exception version 1.1 As an additional permission to the GNU Lesser General Public License version 2.1, the object code form of a "work that uses the Library" may incorporate material from a header file that is part of the Library. You may distribute such object code under terms of your choice, provided that: (i) the header files of the Library have not been modified; and (ii) the incorporated material is limited to numerical parameters, data structure layouts, accessors, macros, inline functions and templates; and (iii) you comply with the terms of Section 6 of the GNU Lesser General Public License version 2.1. Moreover, you may apply this exception to a modified version of the Library, provided that such modification does not involve copying material from the Library into the modified Library's header files unless such material is limited to (i) numerical parameters; (ii) data structure layouts; (iii) accessors; and (iv) small macros, templates and inline functions of five lines or less in length. Furthermore, you are not required to apply this additional permission to a modified version of the Library. LICENSE.FDL000066400000000000000000000546611215142760100125020ustar00rootroot00000000000000 GNU Free Documentation License Version 1.3, 3 November 2008 Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 0. PREAMBLE The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and publisher a way to get credit for their work, while not being considered responsible for modifications made by others. This License is a kind of "copyleft", which means that derivative works of the document must themselves be free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for free software. We have designed this License in order to use it for manuals for free software, because free software needs free documentation: a free program should come with manuals providing the same freedoms that the software does. But this License is not limited to software manuals; it can be used for any textual work, regardless of subject matter or whether it is published as a printed book. We recommend this License principally for works whose purpose is instruction or reference. 1. APPLICABILITY AND DEFINITIONS This License applies to any manual or other work, in any medium, that contains a notice placed by the copyright holder saying it can be distributed under the terms of this License. Such a notice grants a world-wide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The "Document", below, refers to any such manual or work. Any member of the public is a licensee, and is addressed as "you". You accept the license if you copy, modify or distribute the work in a way requiring permission under copyright law. A "Modified Version" of the Document means any work containing the Document or a portion of it, either copied verbatim, or with modifications and/or translated into another language. A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively with the relationship of the publishers or authors of the Document to the Document's overall subject (or to related matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship could be a matter of historical connection with the subject or with related matters, or of legal, commercial, philosophical, ethical or political position regarding them. The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant Sections, in the notice that says that the Document is released under this License. If a section does not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none. The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5 words, and a Back-Cover Text may be at most 25 words. A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose specification is available to the general public, that is suitable for revising the document straightforwardly with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is not "Transparent" is called "Opaque". Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only. The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold, legibly, the material this License requires to appear in the title page. For works in formats which do not have any title page as such, "Title Page" means the text near the most prominent appearance of the work's title, preceding the beginning of the body of the text. The "publisher" means any person or entity that distributes copies of the Document to the public. A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To "Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled XYZ" according to this definition. The Document may include Warranty Disclaimers next to the notice which states that this License applies to the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has no effect on the meaning of this License. 2. VERBATIM COPYING You may copy and distribute the Document in any medium, either commercially or noncommercially, provided that this License, the copyright notices, and the license notice saying this License applies to the Document are reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not use technical measures to obstruct or control the reading or further copying of the copies you make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough number of copies you must also follow the conditions in section 3. You may also lend copies, under the same conditions stated above, and you may publicly display copies. 3. COPYING IN QUANTITY If you publish printed copies (or copies in media that commonly have printed covers) of the Document, numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies. The front cover must present the full title with all words of the title equally prominent and visible. You may add other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects. If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages. If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a computer-network location from which the general network-using public has access to download using public-standard network protocols a complete Transparent copy of the Document, free of added material. If you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that edition to the public. It is requested, but not required, that you contact the authors of the Document well before redistributing any large number of copies, to give them a chance to provide you with an updated version of the Document. 4. MODIFICATIONS You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3 above, provided that you release the Modified Version under precisely this License, with the Modified Version filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever possesses a copy of it. In addition, you must do these things in the Modified Version: A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from those of previous versions (which should, if there were any, be listed in the History section of the Document). You may use the same title as a previous version if the original publisher of that version gives permission. B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the modifications in the Modified Version, together with at least five of the principal authors of the Document (all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. State on the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving the public permission to use the Modified Version under the terms of this License, in the form shown in the Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the Document's license notice. H. Include an unaltered copy of this License. I. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title, year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the Document as given on its Title Page, then add an item describing the Modified Version as stated in the previous sentence. J. Preserve the network location, if any, given in the Document for public access to a Transparent copy of the Document, and likewise the network locations given in the Document for previous versions it was based on. These may be placed in the "History" section. You may omit a network location for a work that was published at least four years before the Document itself, or if the original publisher of the version it refers to gives permission. K. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and preserve in the section all the substance and tone of each of the contributor acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of the section titles. M. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Version. N. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant Section. O. Preserve any Warranty Disclaimers. If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections and contain no material copied from the Document, you may at your option designate some or all of these sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's license notice. These titles must be distinct from any other section titles. You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modified Version by various parties--for example, statements of peer review or that the text has been approved by an organization as the authoritative definition of a standard. You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the Document already includes a cover text for the same cover, previously added by you or by arrangement made by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on explicit permission from the previous publisher that added the old one. The author(s) and publisher(s) of the Document do not by this License give permission to use their names for publicity for or to assert or imply endorsement of any Modified Version. 5. COMBINING DOCUMENTS You may combine the Document with other documents released under this License, under the terms defined in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its license notice, and that you preserve all their Warranty Disclaimers. The combined work need only contain one copy of this License, and multiple identical Invariant Sections may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the original author or publisher of that section if known, or else a unique number. Make the same adjustment to the section titles in the list of Invariant Sections in the license notice of the combined work. In the combination, you must combine any sections Entitled "History" in the various original documents, forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sections Entitled "Dedications". You must delete all sections Entitled "Endorsements". 6. COLLECTIONS OF DOCUMENTS You may make a collection consisting of the Document and other documents released under this License, and replace the individual copies of this License in the various documents with a single copy that is included in the collection, provided that you follow the rules of this License for verbatim copying of each of the documents in all other respects. You may extract a single document from such a collection, and distribute it individually under this License, provided you insert a copy of this License into the extracted document, and follow this License in all other respects regarding verbatim copying of that document. 7. AGGREGATION WITH INDEPENDENT WORKS A compilation of the Document or its derivatives with other separate and independent documents or works, in or on a volume of a storage or distribution medium, is called an "aggregate" if the copyright resulting from the compilation is not used to limit the legal rights of the compilation's users beyond what the individual works permit. When the Document is included in an aggregate, this License does not apply to the other works in the aggregate which are not themselves derivative works of the Document. If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate. 8. TRANSLATION Translation is considered a kind of modification, so you may distribute translations of the Document under the terms of section 4. Replacing Invariant Sections with translations requires special permission from their copyright holders, but you may include translations of some or all Invariant Sections in addition to the original versions of these Invariant Sections. You may include a translation of this License, and all the license notices in the Document, and any Warranty Disclaimers, provided that you also include the original English version of this License and the original versions of those notices and disclaimers. In case of a disagreement between the translation and the original version of this License or a notice or disclaimer, the original version will prevail. If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title. 9. TERMINATION You may not copy, modify, sublicense, or distribute the Document except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automatically terminate your rights under this License. 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, receipt of a copy of some or all of the same material does not give you any rights to use it. 10. FUTURE REVISIONS OF THIS LICENSE The Free Software Foundation may publish new, revised versions of the GNU Free Documentation 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. See http://www.gnu.org/copyleft/. Each version of the License is given a distinguishing version number. If the Document specifies that a particular numbered version of this License "or any later version" applies to it, you have the option of following the terms and conditions either of that specified version or of any later version that has been published (not as a draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you may choose any version ever published (not as a draft) by the Free Software Foundation. If the Document specifies that a proxy can decide which future versions of this License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Document. 11. RELICENSING "Massive Multiauthor Collaboration Site" (or "MMC Site") means any World Wide Web server that publishes copyrightable works and also provides prominent facilities for anybody to edit those works. A public wiki that anybody can edit is an example of such a server. A "Massive Multiauthor Collaboration" (or "MMC") contained in the site means any set of copyrightable works thus published on the MMC site. "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 license published by Creative Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco, California, as well as future copyleft versions of that license published by that same organization. "Incorporate" means to publish or republish a Document, in whole or in part, as part of another Document. An MMC is "eligible for relicensing" if it is licensed under this License, and if all works that were first published under this License somewhere other than this MMC, and subsequently incorporated in whole or in part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to November 1, 2008. The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the same site at any time before August 1, 2009, provided the MMC is eligible for relicensing. ADDENDUM: How to use this License for your documents To use this License in a document you have written, include a copy of the License in the document and put the following copyright and license notices just after the title page: Copyright (c) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the "with...Texts." line with this: with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST. If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two alternatives to suit the situation. If your document contains nontrivial examples of program code, we recommend releasing these examples in parallel under your choice of free software license, such as the GNU General Public License, to permit their use in free software. LICENSE.GPL000066400000000000000000001045131215142760100125070ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. 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. Copyright (C) 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 . 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: Copyright (C) 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 . 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 . LICENSE.LGPL000066400000000000000000000643011215142760100126230ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE The Qt Toolkit is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). Contact: http://www.qt-project.org/legal You may use, distribute and copy the Qt GUI Toolkit under the terms of GNU Lesser General Public License version 2.1, which is displayed below. ------------------------------------------------------------------------- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! doc/000077500000000000000000000000001215142760100116225ustar00rootroot00000000000000doc/compat.qdocconf000066400000000000000000000024531215142760100146270ustar00rootroot00000000000000alias.i = e alias.include = input macro.0 = "\\\\0" macro.b = "\\\\b" macro.n = "\\\\n" macro.r = "\\\\r" macro.i = "\\li" macro.i11 = "\\li{1,1}" macro.i12 = "\\li{1,2}" macro.i13 = "\\li{1,3}" macro.i14 = "\\li{1,4}" macro.i15 = "\\li{1,5}" macro.i16 = "\\li{1,6}" macro.i17 = "\\li{1,7}" macro.i18 = "\\li{1,8}" macro.i19 = "\\li{1,9}" macro.i21 = "\\li{2,1}" macro.i31 = "\\li{3,1}" macro.i41 = "\\li{4,1}" macro.i51 = "\\li{5,1}" macro.i61 = "\\li{6,1}" macro.i71 = "\\li{7,1}" macro.i81 = "\\li{8,1}" macro.i91 = "\\li{9,1}" macro.img = "\\image" macro.endquote = "\\endquotation" macro.relatesto = "\\relates" spurious = "Missing comma in .*" \ "Missing pattern .*" doc/macros.qdocconf000066400000000000000000000031761215142760100146330ustar00rootroot00000000000000macro.aacute.HTML = "á" macro.Aring.HTML = "Å" macro.aring.HTML = "å" macro.Auml.HTML = "Ä" macro.author = "\\b{Author:}" macro.br.HTML = "
" macro.BR.HTML = "
" macro.copyright.HTML = "©" macro.eacute.HTML = "é" macro.gui = "\\b" macro.hr.HTML = "
" macro.iacute.HTML = "í" macro.key = "\\b" macro.menu = "\\b" macro.note = "\\b{Note:}" macro.oslash.HTML = "ø" macro.ouml.HTML = "ö" macro.QA = "Qt Assistant" macro.QC = "Creator" macro.QD = "Qt Designer" macro.QL = "Qt Linguist" macro.QMLD = "Qt Quick Designer" macro.QQV = "Qt QML Viewer" macro.QSDK = "Qt SDK" #macro.qtcversion = $QTC_VERSION macro.qtcversion = "0.0" macro.param = "\\e" macro.raisedaster.HTML = "*" macro.rarrow.HTML = "→" macro.reg.HTML = "®" macro.return = "Returns" macro.starslash = "\\c{*/}" macro.begincomment = "\\c{/*}" macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" macro.pi.HTML = "Π" macro.beginfloatleft.HTML = "
" macro.beginfloatright.HTML = "
" macro.endfloat.HTML = "
" macro.clearfloat.HTML = "
" macro.emptyspan.HTML = "" doc/qt-cpp-ignore.qdocconf000066400000000000000000000110301215142760100160200ustar00rootroot00000000000000Cpp.ignoretokens = QAXFACTORY_EXPORT \ QDESIGNER_COMPONENTS_LIBRARY \ QDESIGNER_EXTENSION_LIBRARY \ QDESIGNER_SDK_LIBRARY \ QDESIGNER_SHARED_LIBRARY \ QDESIGNER_UILIB_LIBRARY \ QM_EXPORT_CANVAS \ QM_EXPORT_DNS \ QM_EXPORT_DOM \ QM_EXPORT_FTP \ QM_EXPORT_HTTP \ QM_EXPORT_ICONVIEW \ QM_EXPORT_NETWORK \ QM_EXPORT_OPENGL \ QM_EXPORT_OPENVG \ QM_EXPORT_SQL \ QM_EXPORT_TABLE \ QM_EXPORT_WORKSPACE \ QM_EXPORT_XML \ QT_ASCII_CAST_WARN \ QT_ASCII_CAST_WARN_CONSTRUCTOR \ QT_BEGIN_HEADER \ QT_DESIGNER_STATIC \ QT_END_HEADER \ QT_FASTCALL \ QT_WIDGET_PLUGIN_EXPORT \ Q_COMPAT_EXPORT \ Q_CORE_EXPORT \ Q_CORE_EXPORT_INLINE \ Q_EXPLICIT \ Q_EXPORT \ Q_EXPORT_CODECS_CN \ Q_EXPORT_CODECS_JP \ Q_EXPORT_CODECS_KR \ Q_EXPORT_PLUGIN \ Q_GFX_INLINE \ Q_AUTOTEST_EXPORT \ Q_GUI_EXPORT \ Q_GUI_EXPORT_INLINE \ Q_GUI_EXPORT_STYLE_CDE \ Q_GUI_EXPORT_STYLE_COMPACT \ Q_GUI_EXPORT_STYLE_MAC \ Q_GUI_EXPORT_STYLE_MOTIF \ Q_GUI_EXPORT_STYLE_MOTIFPLUS \ Q_GUI_EXPORT_STYLE_PLATINUM \ Q_GUI_EXPORT_STYLE_POCKETPC \ Q_GUI_EXPORT_STYLE_SGI \ Q_GUI_EXPORT_STYLE_WINDOWS \ Q_GUI_EXPORT_STYLE_WINDOWSXP \ QHELP_EXPORT \ Q_INLINE_TEMPLATE \ Q_INTERNAL_WIN_NO_THROW \ Q_LOCATION_EXPORT \ Q_NETWORK_EXPORT \ Q_OPENGL_EXPORT \ Q_OPENVG_EXPORT \ Q_OUTOFLINE_TEMPLATE \ Q_SQL_EXPORT \ Q_SVG_EXPORT \ Q_SCRIPT_EXPORT \ Q_SCRIPTTOOLS_EXPORT \ Q_TESTLIB_EXPORT \ Q_TYPENAME \ Q_XML_EXPORT \ Q_XMLSTREAM_EXPORT \ Q_XMLPATTERNS_EXPORT \ QDBUS_EXPORT \ Q_DBUS_EXPORT \ QT_BEGIN_NAMESPACE \ QT_BEGIN_INCLUDE_NAMESPACE \ QT_END_NAMESPACE \ QT_END_INCLUDE_NAMESPACE \ PHONON_EXPORT \ Q_DECLARATIVE_EXPORT \ Q_GADGET \ QWEBKIT_EXPORT \ Q_INVOKABLE \ Q_DECL_CONSTEXPR Cpp.ignoredirectives = Q_DECLARE_HANDLE \ Q_DECLARE_INTERFACE \ Q_DECLARE_METATYPE \ Q_DECLARE_OPERATORS_FOR_FLAGS \ Q_DECLARE_PRIVATE \ Q_DECLARE_PUBLIC \ Q_DECLARE_SHARED \ Q_DECLARE_TR_FUNCTIONS \ Q_DECLARE_TYPEINFO \ Q_DISABLE_COPY \ QT_FORWARD_DECLARE_CLASS \ Q_DUMMY_COMPARISON_OPERATOR \ Q_ENUMS \ Q_FLAGS \ Q_INTERFACES \ __attribute__ \ K_DECLARE_PRIVATE \ PHONON_OBJECT \ PHONON_HEIR \ Q_PRIVATE_PROPERTY \ Q_DECLARE_PRIVATE_D \ Q_CLASSINFO doc/qt-defines.qdocconf000066400000000000000000000012101215142760100153710ustar00rootroot00000000000000defines = Q_QDOC \ QT_.*_SUPPORT \ QT_.*_LIB \ QT_COMPAT \ QT_KEYPAD_NAVIGATION \ QT_NO_EGL \ QT3_SUPPORT \ Q_WS_.* \ Q_OS_.* \ Q_BYTE_ORDER \ QT_DEPRECATED \ Q_NO_USING_KEYWORD \ __cplusplus \ Q_COMPILER_INITIALIZER_LISTS versionsym = QT_VERSION_STR codeindent = 1 doc/qt5-dita.qdocconf000066400000000000000000000014521215142760100147720ustar00rootroot00000000000000# Name of the project. project = projectname include(macros.qdocconf) include(compat.qdocconf) include(qt-cpp-ignore.qdocconf) include(qt-defines.qdocconf) # Directories in which to search for files to document and images. # By default set to the root directory of the project for sources # and headers and qdoc will therefore generate output for each file. # Images should be placed in /dic/images and examples in # /examples. # Paths are relative to the location of this file. exampledirs += . headerdirs += .. sourcedirs += .. imagedirs += images #Do not change the variables after this line unless you know what you are doing. outputdir = ditaxml outputformats = DITAXML sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" doc/qtfeedback.qdocconf000066400000000000000000000055121215142760100154340ustar00rootroot00000000000000include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) # Name of the project. project = qtfeedback include(macros.qdocconf) include(compat.qdocconf) include(qt-cpp-ignore.qdocconf) include(qt-defines.qdocconf) # Directories in which to search for files to document and images. # By default set to the root directory of the project for sources # and headers and qdoc will therefore generate output for each file. # Images should be placed in /dic/images and examples in # /examples. # Paths are relative to the location of this file. exampledirs += src/snippets .. headerdirs += .. imagedirs += src/images sourcedirs += .. # The following parameters are for creating a qhp file, the qhelpgenerator # program can convert the qhp file into a qch file which can be opened in # Qt Assistant and/or Qt Creator. # Defines the name of the project. You cannot use operators (+, =, -) in # the name. Properties for this project are set using a qhp..property # format. qhp.projects = qtfeedback # Sets the name of the output qhp file. qhp.qtfeedback.file = qtfeedback.qhp # Namespace for the output file. This namespace is used to distinguish between # different documentation files in Creator/Assistant. Normal format for MP # projects should be: com.nokia.mp..version with version being # a number containing a major, minor and revision element. E.g. version 1.0 # becomes 100. qhp.qtfeedback.namespace = com.nokia.mp.qtfeedback.100 # Title for the package, will be the main title for the package in # Assistant/Creator. qhp.qtfeedback.indexTitle = Qt Feedback Documentation # Extra files to add to the output which are not linked to from anywhere # using a qdoc \l command. qhp.qtfeedback.extraFiles = style/style.css \ index.html # Only updtae the name of the project for the next variables. qhp.qtfeedback.virtualFolder = qdoc qhp.qtfeedback.subprojects = classes qhp.qtfeedback.subprojects.classes.title = Classes qhp.qtfeedback.subprojects.classes.selectors = class fake:headerfile qhp.qtfeedback.subprojects.classes.sortPages = true # Do NOT change the variables after this line unless you know what you are doing. outputformats = HTML examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml" examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng" headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" HTML.nobreadcrumbs = "true" HTML.templatedir = . HTML.stylesheets = style/style.css HTML.headerstyles = " \n" HTML.endheader = "\n\n" HTML.footer = "
Copyright (c) 2011 Nokia Corporation and/or its subsidiaries. All rights reserved.
\n" doc/src/000077500000000000000000000000001215142760100124115ustar00rootroot00000000000000doc/src/examples/000077500000000000000000000000001215142760100142275ustar00rootroot00000000000000doc/src/examples/hapticsplayer.qdoc000066400000000000000000000062531215142760100177550ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \example hapticsplayer \title Haptics Player \tableofcontents \section1 Overview This example shows how to use various haptic effects in an application via the \l{Feedback}{Qt Feedback API}. It provides an example of how to use the QtMobility libraries to: \list \li play "system theme" haptic effects corresponding to certain predefined events \li play a dynamic custom effect, single or repeating \li play a custom effect which is stored in a file \endlist \section2 Use Case This example is more feature complete than the \l{hapticsquare}{Haptic Square} example, but is intended more as a way to test the haptics provider plugins which are available on a system, than as an example for application developers. It is useful for people who wish to learn how to use the API to create and play custom effects dynamically, or to allow users of an application to select which haptic effect to play when a particular event occurs. It is also useful to test how effects are implemented on specific devices. It is a more complex example than the \l{hapticsquare}{Haptic Square} example, so it is suggested that developers look at that example first. \section2 Interface The application is designed to work on desktop and mobile platforms with minimal differences in code between the platforms. The interface consists of three tabs which allow the user to select and play different custom, system theme, and file effects, respectively. The custom effect tab also allows the user to modify the custom effect dynamically, and see the effect of attack and fade, intensity and duration, and periodicity, on the user experience. \section2 Known Issues The example will not work correctly on platforms which do not have a QFeedbackHapticInterface (haptic effect provider) plugin loaded. On such platforms, the example will do nothing. */ doc/src/examples/hapticsquare.qdoc000066400000000000000000000164271215142760100176020ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \example hapticsquare \title Haptic Square Example \section1 Overview This example shows how to use simple haptic effects in an application via the \l{Feedback}{Qt Feedback API}. It provides an example of how to use the Qt Feedback \list \li play "system theme" haptic effects corresponding to certain predefined events \li play a custom effect, single or repeating \endlist \section2 Use Case Compelling applications attempt to immerse the user in the application experience. There are many elements to an immersive experience, including a consistent and beautiful graphical user interface design, unobtrusive yet informative sound design, and intuitive program flow. Another important aspect of immersive applications is tactile feedback and haptic effects. The \l{Feedback}{QtFeedback API} allows application developers to include tactile feedback into their application via a simple to use and extensible API. Some common uses for tactile feedback are: \list \li maintain consistency with system theme for tactile feedback about interface events (button clicks, scrolling, etc) \li notify the user of an application-specific event (invalid operation, status change, etc) \li multisensory user interface (status can be "read" by touching the screen, tactile interfaces, etc) \li immersive gaming experiences (explosions, impacts, collisions, etc) \endlist This example application provides some short snippets which illustrate how the first two of those use cases may be fulfilled. \section1 The Application The application is designed to work on desktop and mobile platforms with minimal differences in code between the platforms. The interface consists of four buttons arranged into a square, each of which causes a different tactile effect to be played by the default tactile effect provider plugin on the platform. \image hapticsquare-example.png \list \li "Rumble!" plays a non-repeating effect with symmetric attack and decay \li "Ocean" is a toggle button which plays a repeating ocean wave-like effect \li "Click" plays the system theme effect for a basic button click \li "Oops!" plays the system theme effect for a negative or invalid response \endlist The example implements two classes: \list \li \c {HapticButton}: Implementation of a button. It inherits QWidget and sends signals for button clicks. \li \c {Dialog}: A QDialog subclass that displays the four \c{HapticButton}s mentioned above, connects them to its slots, and implements the functionality to play the haptic effects. \endlist \section2 The Dialog Class We will now go through the code for the \c Dialog class. Here is its definition: \snippet examples/hapticsquare/hapticsquare.h 0 The buttons are connected to the slots, which play the effects. We will now go through the implementation of \c Dialog. The constructor starts by setting up the non-repeating haptic effect, which is played by clicking the \gui {Rumble! Button}. \snippet examples/hapticsquare/hapticsquare.cpp 0 Custom haptics effects are created by setting up a QFeedbackHapticsEffect. A haptics effect provides a fade-in of the effect's \l{QFeedbackHapticsEffect::}{intensity()}. With vibration, you can think of the intensity as how hard the device will vibrate. The effect will start at \l{QFeedbackHapticsEffect::}{attackIntensity()} and interpolate to \l{QFeedbackHapticsEffect::}{intensity()} in \l{QFeedbackHapticsEffect::}{attackTime()} milliseconds. When the effect ends, we have a similar fade-out, where the haptics effect's intensity will interpolate from \l{QFeedbackHapticsEffect::}{intensity()} to \l{QFeedbackHapticsEffect::}{fadeTime()} in \l{QFeedbackHapticsEffect::}{fadeTime()} milliseconds. The effect will last for a total duration of \l{QFeedbackHapticsEffect::}{duration()} milliseconds. We next set up the effect for the \gui {Ocean Button}. \snippet examples/hapticsquare/hapticsquare.cpp 1 The \c m_ocean is a periodic effect, i.e., it repeats after \l{QFeedbackHapticsEffect::}{period()} milliseconds. Note that the \l{QFeedbackHapticsEffect::}{duration()} must be greater than the period in order for the periodicity of the effect to be discernable. We then set up the GUI and connects the buttons to slots that will play the effects. \snippet examples/hapticsquare/hapticsquare.cpp 2 Let's look at the slots to see how the effects are played. \snippet examples/hapticsquare/hapticsquare.cpp 3 With the \c m_rumble, we only have to call \l{QFeedbackEffect::}{start()}. It will stop when the effect has finished, and can be played again by calling \l{QFeedbackEffect::}{start()} again. The periodic \c m_ocean effect is started the same way as the \c m_rumble effect, and may be stopped with the \l{QFeedbackEffect::}{stop()} function. It will start playing from the beginning again when \l{QFeedbackEffect::}{start()} is called. We could also have paused the effect with \l{QFeedbackEffect::}{pause()}. \snippet examples/hapticsquare/hapticsquare.cpp 4 System theme effects are played with the static QFeedbackEffect::playThemeEffect() function. Theme effects cannot be stopped or paused. There is no guarantee that the backend can play the effect; \l{QFeedbackEffect::}{playThemeEffect()} will return false if the effect could not be played. \section1 Known Issues The example is not intended to exercise the entire API. Instead, it is a simple example which illustrates some simple uses of the API. Also, the example will not work correctly on platforms which do not have a QFeedbackHapticInterface (haptic effect provider) plugin loaded. On such platforms, clicking the buttons will have no effect. On Maemo5, periodic effects do not support attack or fade, and so the ocean effect is not smooth. */ doc/src/images/000077500000000000000000000000001215142760100136565ustar00rootroot00000000000000doc/src/images/hapticsquare-example.png000066400000000000000000000063751215142760100205210ustar00rootroot00000000000000PNG  IHDR5 pHYs:duh IDATxoPwf)$W,=QOk4*xuڂ^z;gjX:禭V)⍽ (7 b3hP! (dmneK:\!>+X l V`@b6+  r#VM`z 2Vߠ,(C<(ı`zC h,YfڬVPLo0#&&0az[W<`')V, 䂕>V, d@b6+X l V`@b6+X l V`@b6+X l V`@b6+X l V`@b6iO>9̧ϟgv''' >FCCtnܴ1333+++7pѽScǎ'j=e6|F i V)h[%K+*R>/'VTcj{UFӍ gijjvFcd>==7nT__tPlcSYU7o|Us%N8QYNRTZ,phnnnjj&"Cl2bzE͘1cȁ]pG'OްaVM=6vӉhFRRCçA^t:nT՚{n\uƍ8Z7'Oz=hrȁ47mͮɓ'^U*IN2Ẋk]]ĉ>ٷ2==]R v{* QH!QQ|EQ7WKHH=))9~l?(&&C ( "R($MΟ9?w6?m??鯧[/Nnݺ^"joUT盈(-mv[[n'"5@=vlLL }]g%+WL j4U4qG'N~Ju鿗_..)jyۺaCiooMJJ*)@D>\S]#CY把lAZmqqY(..nӦKR3f*ѐ$2b +X l V`@b6+X l V`@b6+X l V`@b6+X l V`@b6+X l V`cXV[b8'#b6$Ŋe䂕Ux`($NOjXB+ B1~  ЁkTy_ &V=+X l V`P>yd #^u$,(}֑<(ı`zC h,Yf$Q7XEd䁿X I C(0=`e6 C(0=ae6+X l V`@b6+X l V`@b6+X l V`@b6+X l V`@b6+XHtVnϟ3(/zDnN/ߜNM333rsojj將4/1r(YT{b)a}Zw?a=a<TPJT544DGGm.YR^QjL y,bu8MM111DgѢϞ=GD_57WVUy<^"\؇, E$bDdH0MZ_G|+~PII nw1_vg2Ν{¿^Bw}YCXmSNzwիzm^|22^ɻ'mz^V$Ϝz;]ti}Q{v.,,ܹk]y]v'N 8pnݺ;(A#TudKjQ(^?-CRݵD{ED ̙3XD?|SZRRj&?@Ś`8?]kԔ_]  vΞ9#x<7MoNoiiy%%%M{~E\:[N"OmmmvnwWWo{7n+N/y222֭[KD|K.Ѿ{g&TTjhv6mիWU*ռy,ˏ7n $Yl[srr޾QFefe+/..nӦKRdժUUUҭ[EEEee+*ʳAjųf"qƭYf$BlR*JG 9]%%Zs6>+yycƌ!S #t\r=QTNv)S"AEm GTFڲ*b6+X l V`@b6+X l V`@b6+X l V`@b6+X l V`@b6+XcZmaz2 l V`CRY LO.XYOdDƊ!,j(Oo 8.@0H`@A:`b ܳ@b6+X l V`?kV6#IENDB`doc/src/images/non-periodic-effect.png000066400000000000000000000310111215142760100202000ustar00rootroot00000000000000PNG  IHDR J|qwsBIT|d pHYstEXtSoftwarewww.inkscape.org< IDATxyXu "{Z%▊%D[*v.oMSSK\s75E˖oVZij R悹J&oN9|\׹gfr^{f>Naȅ ,"( ","(2(\zUwVFFK\7(C˗//NϞ=5k(--ȅÇu]wܹs+Wh͚5:U7(ݻW'O,N:ÇE.8իwyG>>> .h?RU[ɺt$)!!AY ŋMϞ=D}j:p֥iJffvޭ})%%ŴW\MguY%$$(33SgϞյknobbB6Gʕ'8xᇍÇ+V4\\\ caƞ={ʕ+ oooJ*=c~nƎ;L׬Yc6l0 wwwC1ydFixzz5k4jԨa{1 0oH2㍄ېdxzzUT1ׯo\|4VXadXre~^.fx?~\[K/$Iر IdرC_^… 'Ow4hM/(11QǏ״itQIRttVZݻwٳ:w> Tk-Iںuu yyy'вeP}Ѣ|k+E +W֌3TfMխ[W> ,,Lݻw׈#ի7Tbb[80ꫯ]vrwws=lEDDH"77765R5 u5JSddi5x`yxxj_أ E(00CUVŋUV-[f+VǏST {Mk׮-]pAԳgOYfܹ5l0URP_G6mԥK-_\K,޽{P^)(TT콓g򒝝:'i]ӦMM"WWWquu?{jƍ3g&L{UVR4j(= u]wuօHA!?9_rly֭~}ᇦpQ;vTǎf͚iժU3gM㼽tS=4h Zl6nܨŋ.E5k&///K%Q>b *..N۷o/(k"""Ծ}! /_֑#G ءb8 0 +~O:UPi&egg[szpbos޽{駟x- e`ܹZxZhaRP*99Y#Gv)ndQ 2DWlllI$I Җ-[榴7JÇթS'ڵKZv9(VX7ᄈv)nPk߯HVV PlΝ;`RܠXAիBF4gcZ؁jժ{͛] +(DEE)++`:3fh͚5<%&$$Dp"_/***~ .¸F6eeeK.8p^}Uk;:u(>>^5j԰v9w=̟?$@9&IPL~lG:3gޣRA=H]ղeKk;!(@1cX1???u֍BP@~7͜9P&GY CP@rZ&L1(Ԯ]h?6<͞=[...zW] `ozPh?\r5~lA5k\\\V~شiKA7o5kٙX_l0r8q7onrh?63o\]]V@`YfޣL2> Iv횆 _lFΝv)"(@CŊ/[jժ K͞=lTpp`h?EPppoh9f~<@lɓi9%J*h?@P{ҥK(ArZ3gTÆ ]`w _PD+PO(|_+VXyڵjݺ.\ݻwk%^=4i->k;yLM4I?t\EDD}R=ڳg-[F(C<| (<ŋO>4&##C111JKKӰa[orPo>@!U… Z~vܩ?Si 9bbb<tE]|]zc˓I&N:zg] P~x]PnX ^uyrwwWddM"""$Iڵ@g֒%K \= ͝;Wqqq+֊+ @!8aܸ0::ZnZvw*11QG1ꫯ҉'J mٲEnnnJKK+}[KZZݕJ*Y\tI:rj׮mrr!3 cƌQBB:udZvq?^/_i92(/%*sŌ7o֭ު(޽8q 01++KFpp0w?`5c M4馁9+;(:tHƀo>{0g [n՝wީ'OjfnݪcJ~Qŋ/G$M2\frp1#Ҳ~z-[L?KlBp8i?@Ppu~ !34PP0)@ _GPh?#(pX8@ Z~h?y (phzh?8<~,#(px9w?:uڥ6yyy` s?@@K ?!!!GA'×_0GP#(xyygϞ!( An@An@ArAׯ"##i? <| 0@P诿v)OOOٓ `ph8:!pT_##(@>h?  P!!! P> 8$zEpD( pD( pD(~!(@!<APBGCPB APBi?hk("~# (@1pAo߾` P ` PL{FPb۷<| v#փOP8u%I:sٸedd( #88FA_ev/|8CnƏ%KWx,ؒ}j:Wnrb3([K.5-{'n:sZjyhܸqzg \O?[x< UTIW\!(ܳx{^xlo[ VU0#׋8 0 YYYBFTAarvvߞƇRjj*A;e233գG͙3G...ӧ-[/}QIҔ)Sx9vWWW}pRL ,"( ","( ","( ","( ","( ","( ","( ","( ","( ","( ")k֬ј1c]MNNݻݻWW^-c\zUk*jҠA4vX͝;W~ \5k,o߮^{-1-ZРAԯ_?]vM...E:VIضm 'Nq*T>P=,xzz_$EEEi̘1S?Piii_ݺujzUREfz[oU󎜝8m4=Zz+gմidQQPPl"77BPت4+55U*Uv9J8 ZrĉwUTQHH ]zߓ&MҜ9stJJJRZ$IxjԨ EGGyRi~MaUVrrrX UNr-O?ɓ'UZ5IRffUF eff***J͚5iC)++KZ)(I&JU~}m۶M]tɵ&(lNUr\]tI+Vw߭ƍ7ѣG}̭[_YYY;w_V@UVM˖-ӱcԨQ#uAvz!/*88X5kT~ԨQ#K/^̳_]t10߻wvZSիWעEM* @[Vm6,,L5jP=_֭3^.kk222L鮼!jРA|˻|=zTSLє)StwjĈ 1-Z~Amڴф +E S~jէOIѣ~I]tOh̘1z,+66V[u݂ m6kN'Oָqzj͘1CAAAڼyBCC+((H.]ԩSvZ 8P3~6mXF#F0$ŋ/^~u8zϗ_i_|aH2]fa|$cժU1!>|iYVVcL60 8y!XrΝkTXʲXf6$K,1-;r!xV^ݘ8qaqQCnxaf2Vjq͞Qٳ*UڥlmݺU/))W\޽{ս{wkrlj֬VjRJw}Ν;ڥ[vRJJJƺkzմi3w%Iz2-svvVӦMMmWXavJӧUnݛdU^=:7n *!I͚5SRR$[nСCջwoS{駟VڵͶ^.77kAAunݺYs1n73>|X v)(:uꤷzK.hڵ\XDaXF! !C[nc;ιF`С^g8uҲk֬ф ~1NzIDATz}'>}6mڤ?~\5$H6ѣJMMi> :TAAABuykݺt)5P۶lRG)z6mj_~zw͂‘#GԲeKo]YhnMfɓ'7ɐ ]nÓO>˗kx ÇtҺuo>j5o,$l޼Y>}$iwZci֬Y1bn3#ڴi~DQ#GiPrJ=jРڶmHǍTŊumYb9F]vi„ 8qnTEvv{͛7OJOOtG7m?3{ZŋZp7QFqU=;wQVʿ ؏W\1 0ƌcH2N>P# :7o^\\\Yf~\ҨTRTrӾ\b3b2dFWWW͚5Kmڴڵkk.?#6lXZ dԩ;vkN M#""O}ʕlھ}齏5rH31B͚5ŋm6%&&ֵnZ ,uܮ RVVN[X|}dd}/_6KVø~FN:l|FfffXe|ʕ+^^^FRRR_hd\|@;fH26o\ԒANNNFݍ{HII)[ē>k8uA...8p^}B+>>^ׯ#<ƍh륗^RFL˲ԲeK飏>2O?{ѯ:ƽ{ )@r>SU^gF~o޼Y?N8Q;|r=E( 0g;믿㏵jժֵo^)))?̖/X@cǎUJJS@y׮];5o\7n,'jٲe:|)W_4ϊ!22Rڵ+cΟ?_?\]]u…edd?ɓtZ~4s̛ʻJѮ]Ǐ[@\Riii 46?8P ZRppLRfܹs233%I;wVŊs]{Giiiڽ{>t"WW2ɁVZoFϟWvvΝN:Y4 O"zi&Y6̙3qȑ#→iӦ.":x𠲳ծ];˗/[$6(%%EzRhh&O,EEEKM4vy@ Et^zڼyƎkؠk*))IǏ7-;pڶm+'''+V \*Ν;kРAѣ7n3gZ$6h8p\\\LS۔k (Q5 | ǔ={hȑevܩzʊGJI ﯣGJRSSMg=[%`8YSNȑ#7(;;[}UJԲeKkGa,[Lǎ$yxxA[ԩS'QSNlLyyy>S^ʼ&d?^M6Մ uVݻeBcZn?h͟?_{V&Mr2[nZh2ggg⌡(|||LKؿ?m+PڷoovjRR&LzJ ) 0qqqg}Vɓ'5w\+.glٳg5w\.jڵytfΜGyllbbZh(IҥKԢE })777m޼YL?:+;;[WFF$),,L5kThh6nܨ7QF2 CqqqM}衇kܸqꫯ@ƚ3fΟ? 6hpR9:???EFFQF֭V\K.Y,Dz(CahӦMZfo߮+W5iD۷o^q\fTv"oߨQ#IR\\4hPmnaҤIfnٲ7o_~EݺuSZjm۶9zصkmۦui_PZ5͘1C|ilڵfӘoF7n\_pA111:u0 5zhuY1b*T,7~HffƏy)++6lІ P}XdCm ի$OOBo fϞ%%%0 9;;رc֭[-IM\\\ԣGӺ=;O>?X m߾]?"""4w\U\eEFP(# + 6hƍڿiQ4c +VXyxxk?CԼyscr xnܹsҥڶmÇe˖P׮]^._,www-[gZjf]]]1BՅ,^X'N4o߾BCCcN:V (2Vvm;VcǎÇn:_^[n… ͞k…;L7]Vw}d[NjՒ$رtmCWWW]v-}5jHڵkٙ.).WWWȾ7|z'А!CԢE k(.f-Z^l/kP.](!!AW6t9ΝҥK ͛+33SOty4k׮3,V-ZdO?Ull XObb&OǏkƌ% pvvV= } o<==UjU_zbbbtm 8P:tP``5h@w_ݻs TCBCC!___5l0 TիWoUÆ զM=C ՓO>YoO{U #08dIիZjY%/R/^=ܣFiΝj߾u5Ϻ{ڷoڶm;j׮][o6...NgΜQTreرCmڴQժUMcN>~IIIIj۶:ud;w[n1ĉ:w:vXE V$zhIENDB`doc/src/images/non-periodic-effect.svg000066400000000000000000000474171215142760100202340ustar00rootroot00000000000000 image/svg+xml AT FT t q FI AI I Duration Time (ms) Intensity doc/src/images/periodic-effect.png000066400000000000000000000375551215142760100174330ustar00rootroot00000000000000PNG  IHDReUxsBIT|d pHYstEXtSoftwarewww.inkscape.org< IDATxw\U7ˁhpו}K$g M!5!K3GkeYtffY DfV pH'9EE?q8w{9~83\L&I@] %BC P*4 %BC 8dCM6)==R^ eNx|mĉZ`RSS \5Թsg]zUt-X@rm(mۦ'Okѣuڵf VR$I'OѣoH=,#D]tIt)mٲEW\1~ %$$HΞ=x癮];vh׮]Yb&''ٳ$̙3ru+""cʕ5h yxx(==]ϟ$?^:wRRR,=廡 ?nݺ P͚5믿JyD$kN7C=d~[o;C:uRvT^=__l7nE|֭W3gZkȐ!߿*V}IO)))IGU%I{VƍյkW]xQ5kԚ5k,{ijƍpJ(oQ5t ;vLM6s='I_-ISbb6l Iꫯ4~x-\PgϞU\\:uA)99ټK.髯RTTΝ;gyF'O6Wڿbccu۷O~~~YjmР~wI7D޽[ׯ-ZdҥKUJp:j(5}tU\Y5jРAg}sQϞ=*OOOiԩ:q6md^/##CZh2eh̘1JKKݻ%ݼb\ݨQ#UP!__ǘ1cX~,YÇ=_pVj(t%J?oҤu۾o߾}:x:v쨀kСrwwÇ)SF:t0^~}yxxυ8p5k _~ayԩ7nl}:qFm8˼z:K1L2L РAިQ#K(!WW^}xzz*<<\5k,M0A{Q͚5=ZfԩSh"+pfE2-W$իt!l޼vܩe˖~ڷok٪UVX &ܶ Մ pBo 6gQ$Oʹ;%KСCLi$=C֙3ga+@&8B9c >|X&MRݺu%I={UJK.\_] Zd%DC(e5.]rgȁMLfvDC EC P*4 %BC P*4 %BC P*4 %BC P*4 %BC P*4 %BC P*4 %BC P*4 %BC P*nƍJOO7!777k7 ;aʧzJM4Qrԯ_?oQG(,XRJ &ؑB9rΝj۶mal v2!!AqqqjӦMa;c;22Rrm(O>PݻUzu)O?J*7xR 2 [㌙Qtt4 HΟtBzo:?իW]A&ak5pNV5/__NW^Qݺu5|pK)VJIIю;.@&ɤqL97nh۶m2Lj֬n)-[]v]Jsuuj*yFG&ɤqL9q4}tuQ'O_uFepx ըQr 2$5dΨ?¬vW_Uڵ5bK1_;vpDI2ik$3jYxx.]ݻw]\]]5`^ F&o"LYʣ_G}To&#I\Yk02iLL™P"OXucIKdxdΌ7re}G\x F"YIcI8;P2G8oj֬it96+kA&sF&A&JbĉYqK9:tPrrvit)NLLLqZd #:biQŃL,~d#V_gsd2od!0F[nŋmt)6c yG&,qRRR裏j٪UFEL,ZdȊ&MU2ɇ:ڵk4D&L-2 df۶mӢE-˱#UVM6FPdɢC&qnp Yf1)`n(]Ȥud#@h(!ICV,$^Yۺuk˱KdpII o8BRSS裏2)d L 2Ypd;J'5uTU\YG6ˆd G&cvء>W2b;2YtdI 8Bd2G83fP:u.!1b2YdI h(k+j̘1FtFyD&2 #o'sNdS\]]2b2YѥtGdұI`mۧ7xC[ne nGdIƥkذazWըQ#A!#t\d@APڸ7xCz.cǎJHH#t\d@A1a믿F8GdұIOJOOף>W^yE76{1I@& z7ekt)"΁L(F6h={"""ft9(Bnnn߿V^͛]NȤ #6&s/3qZjeL:2 h(m̜9sRPL:v .숑L:2 yې͚5K[laDnFd9IJ9™0a4ibt9(fxe-tnd@~PڈzK&I.ԩΟ?}]tnd@~Pڀh̙8\A&A& 2G8/6mjt90$2IyECis*==]Ǐ7VFd$*o]'#X99b$ =BvZըQC2LβNzzvޭ6mYQ$눑L"7d@nrl(SSS5m4͜9SZlڵk4y4o<ݸqr9bܿL"7d@nryϛ7O!!!X<==榨,EFFJR ++V买gy]{ɓ'+""rtqE/2 rmC5kh͒$OOO5l0džJ*Zmw4zh幰c*<<<ۃ˗/͍rqdyE&N /d :Լ,11QϟWjjJ(a^qwUz<uGӹsgڿ?KM n'9;vЅ j提ݸqC{5k2mkрҀ- n'KC /hܹ]G@@$ s>$.>>uV]xѼYfQFW w}:tbcc.D&{mCyUEEEi޼yQN,^?qℼ_j׮]Zlۧ &vP6kpe-l [ Ə^{MO=^y?C%%%IFJwy^z饢@ c=ftW $(99Ym۶5/KKKӧ*w522R>hV Pw}JII1 L+Njr"##%ɢܾ}^xyyyTRǏ… jӦM 0e>Gd_9ܹs\]]շo_ .hĈY֓,YFy.СCy^@o5 L)dž222Rݺu'|b^6n8n:zjРAU HtޝIæI>ePfdd(::Z>|}} FFFUVrqq뗯QFtt4E]˗7 L)s(>+Wd9/2((HʕXN,ۆ23g(>>ei(´vZ.]ZWLLLoܾ}-[&I|=Z6Y4 WF /(""Bپ1**J)))LUT)|TRPSn]hUlY)44Trqq>hÆ ְtR.]Z}1/;qFSNi֬Yӧ}Y=zT駟*88X ЦM,wyGSn4bڵzΝX͏`Xk}9sFڶm[(_mGal}8> c6˗;(}dΞ= דO>͛k {Zgj…2eʖ- .h…VҥեK}ڴiBCCxb 2DׯW H֯_뮻R``6oެ޽{O>ѐ!Cra˖-׿%W<OOOuI6oެkҥ2d֭[OTݺu%I=<==$OOOEEEi޽jٲyZ9&jPI||G}T\4n8sC}$SRR$ә3gL&ɴk.$Ӱa&I&MJ.m6md2M7[l駟6UV=RVLO?ŲH$ӈ#6mddj޼yM%K4͚5d2L{1I28p|WLuy'1ce!u1/ 4]vrwwW-۶m[I9:믿ԺukƍaԩS9d29zkwu\]]-,YRmڴ1ѨQ#UTI#G_|aSu1dM5o޼\\yY(u͚5Ks1qT]EQFiXbֹ֕s4a-YĦ겇mOed[ſ#FhniӦիƍի究+Y<<<4}JMMtEIZj֬Yc޿o]|Y~~~Y2eڵkQ^=K.-wwweud6ڴi̙\4tPM2E\zueǦ-ZEFQhbcc[oi̘1FRhuq1RO?|X^,4ilt)P 'O5jhС UƍժUKsiСzo&M_Z-M6ҥK`O;vʖ-7xü_FYy+yζm۲h˔)mܸQ9s5{Z6iDWzzk935iD.:nW%N:)<}Zj ۧێ{+W*))IVձn:ݻyV;c^'%%Ezs %;[nՑ#G4c FK'OV%,W^]'O67UTɓ;wN3|^{bquuرc|?ʕ3o҆L<߷Vqqq0::PݻW:t/I:~jժ{|թS~\͙詧Rjjۧ}dɒׯ__ ԧ~*Iڽ{Zle˖sΒg}6˹1(y?.]ŋw޺xb1~x󽢢K(aKk$ܼysu5}|'>|6oޜg:} 3f͚ei&M&yUP,wy:tvޭ={jŊ9 4@zz֭[AW#GTÆ UB|okruuՈ#eP6kL={4 *X\P2`<]`2x`}ر֭I&MUMDDƌ#??? 8P.]r5_n"##նm[e!!!:p飶m۪cǎעTN=êRJjժRSS5tPӦMP(ʻO T%tUzSn/ hʕQuI9o߾JNNƍs^+Vdy"A TbEmݺբqDqqqjذJ.K.Y֪U+VժU-]rEʕS@@n˗+...ۋTJ}W9oԩSپyf_87q٣ ]ns(ԧO 0඗K7yqCt…lߛӑ%KgϞ{onZJHH=zo[Mr|-)))˲DiFQQQQFF~wիWO111Y^?{"""}ovZtt222ԣGթSGgeLfdd(::Z&Lm{ѡC}βڵkj޼vڥs%`L(K.\\\L?C޷gMUV5I2I2M2%_HLL45ne1ĘLbd_od/[eb 0-^tҥo^8q4k,S&M߿~kՔd^{nܹs]&I~u?z[nmzMw@&FsN};w^yUX1Hdƍ'(::Zys=X-[ּ,11Q}̙bYzҁԨQ<ט׳>P9۷koe˖S-[VݻwWjC"m6%$$HJ???5l0-CiȑZzH7N 4رc `iذaJHHڵk.E7?۷G)))JLLT:ub s=Vmڵk֍73::'@Rvt1թSrPyۈt%'']F֭㕐?S RzzUmժyx.0:v(wwwm޼RPh( {n=j׮ѥ o^ÇשS+Ir劦Mx@z-m۶iرJLL/ݻ+,,LǏרQh^7--MsU7|Su$''kҤIѣFݻwo5lP'NÇ.zw`=#F"@Ci[sUVԲeK͝;W}Qҥ.\rEᡋ/UVZlZlziڴi}6lkxѥPYFbbb׮]۷Tu>Cխ[뤧~֭[e˖I&QƏ .ԩS$SNڶm.IRFF'sN|7ڸq~gC4x`hŊ w}?C^IR=׺n:y˱!2y˖-ڲeƎ{G/#WW~ e1qww|||榴4ծ]ۘTD\-룏>Ծ}{mݺUPZZ<==}vsC)I}~~wyyyK.e۷wܡ]!!!ڲeվ}{:ݺumߧ3gdYVT)U^]kצ e1qssS=ԣG%%%iZ|6o,ɤm74"ӱcG-X|۠2eʘ_˗5ahBjٲmsi5o*u5_]ؽ{nܸ%K(((as03.ծ]['NTDDJ*et9ӧ{?~bdruvnudeG:wk׮),,̼w}4GҴiSmڴIÇ:Pڐ&N_~E 6T^'NhڵꫯԶmSCC mܸQKVҥUdI+WN-ZА!CgϞb',,L?x?# % %b7(&&F?^|E>}Z-[[oUu>|X~m/ϟ_#6ĉR.(2kVƍ%I۷СC5vXѣ7o}ҥ*Wl~-[IuUmVׯ޽{sϩL2 ׶mtUթSG$ѣڹsRRRrJs]w}㕔z~A111^z*U_߻wN8]jݺuڿ7ox>$$$(!!GŒ#r劖/_]W^*W%nƌ2L/$I.]o>{=͙3E4~xuEǏWDD.]e˖i WTTƎf͚Ӓ6+WԖ-[$IK.̙38 8Pz)5o\yիW'T~4n8} ȑ# 0E)11`0b7*44TzGWC +8ժUK{wء9rD?jԨ|PqqqܹsЌ3$Iݺuȑ#UlYYFk֬ѳ>Lcǎi ӱcԢE 1Biii={GGՖ-[4{l}G:w\Rꪇ~Xz'`?pիW5k,JJJyh"* ׺uԴi|;(PUdI1◱+55U[lщ'ƍ+***u}y:CBBci޽jժ$MG6ѧOK믿TR%m߿_{w-v)))ZzV^2eh̘1kիpeԩSzUzu5JͱrҥH7/ټysyILjݺuԬYS/_VJJJqqqQ6mf<,,L%KTfT.\ ={6ͤշo_R"~u!㏪VV\e˚׻h"U\Y^^^?V} image/svg+xml AT FT t q FI AI I Period Time (ms) Intensity Duration doc/src/legal/000077500000000000000000000000001215142760100134755ustar00rootroot00000000000000doc/src/legal/3rdparty.qdoc000066400000000000000000000314741215142760100161260ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page 3rdparty.html \title Third-Party Licenses Used in Qt \ingroup licensing \brief License information for third-party libraries supplied with Qt. Qt includes a number of third-party libraries that are used to provide certain features. Unlike the code described in the \l{Other Licenses Used in Qt}{code used in Qt} document, these libraries are supplied alongside the Qt modules. Third Party Software may impose additional restrictions and it is the user's responsibility to ensure that they have met the licensing requirements of the GPL, LGPL, or Qt Commercial license and the relevant license of the Third Party Software they are using. Run \c{configure -help} to see any options that may be available for controlling the use of these libraries. \tableofcontents \section1 DES (\c des.cpp) \e{Implementation of DES encryption for NTLM\br Copyright 1997-2005 Simon Tatham.\br This software is released under the MIT license.} See \c src/3rdparty/des/des.cpp for more information about the terms and conditions under which the code is supplied. \section1 FreeType 2 (\c freetype) version 2.3.6 \e{The FreeType project is a team of volunteers who develop free, portable and high-quality software solutions for digital typography. We specifically target embedded systems and focus on bringing small, efficient and ubiquitous products.} -- quoted from \c 3rdparty/freetype/docs/freetype2.html. See \c src/3rdparty/freetype/docs/FTL.txt and \c src/3rdparty/freetype/docs/GPL.txt for license details. See also the files in \c src/3rdparty/harfbuzz, which are used by FreeType. Parts of the FreeType projects have been modified and put into Qt for use in the painting subsystem. These files are ftraster.h, ftraster.c, ftgrays.h and ftgrays.c. The following modifications has been made to these files: \list \li Renamed FT_ and ft_ symbols to QT_FT_ and qt_ft_ to avoid name conflicts. \li Removed parts of code not relevant when compiled with _STANDALONE_ defined. \li Changed behavior in ftraster.c to follow X polygon filling rules. \li Implemented support in ftraster.c for winding / odd even polygon fill rules. \li Replaced bitmap generation with span generation in ftraster.c \li Renamed: ftraster.h to qblackraster_p.h \li Renamed: ftraster.c to qblackraster.c \li Renamed: ftgrays.h to qgrayraster_p.h \li Renamed: ftgrays.c to qgrayraster.c \endlist \section1 HarfBuzz (\c harfbuzz) \e{This is HarfBuzz, an OpenType Layout engine.} \e{It was derived originally from the OpenType code in FreeType-1.x, ported to FreeType2. (This code has been abandoned for FreeType2, but until something better comes along, should serve our purposes.) In addition to porting to FreeType-2, it has been modified in various other ways.} -- quoted from \c src/3rdparty/harfbuzz/README. See \c src/3rdparty/harfbuzz/COPYING.FTL and src/3rdparty/harfbuzz/COPYING.GPL for license details. \section1 The Independent JPEG Group's JPEG Software (\c libjpeg) version 6b \e{This package contains C software to implement JPEG image compression and decompression. JPEG (pronounced "jay-peg") is a standardized compression method for full-color and gray-scale images. JPEG is intended for compressing "real-world" scenes; line drawings, cartoons and other non-realistic images are not its strong suit. JPEG is lossy, meaning that the output image is not exactly identical to the input image.} -- quoted from \c src/3rdparty/libjpeg/README. See \c src/3rdparty/libjpeg/README for license details. \section1 MD4 (\c md4.cpp and \c md4.h) \e{MD4 (RFC-1320) message digest.\br Modified from MD5 code by Andrey Panin \br\br Written by Solar Designer in 2001, and placed in\br the public domain. There's absolutely no warranty.} See \c src/3rdparty/md4/md4.cpp and \c src/3rdparty/md4/md4.h for more information about the terms and conditions under which the code is supplied. \section1 MD5 (\c md5.cpp and \c md5.h) \e{This code implements the MD5 message-digest algorithm. The algorithm is due to Ron Rivest. This code was written by Colin Plumb in 1993, no copyright is claimed. This code is in the public domain; do with it what you wish.} -- quoted from \c src/3rdparty/md5/md5.h See \c src/3rdparty/md5/md5.cpp and \c src/3rdparty/md5/md5.h for more information about the terms and conditions under which the code is supplied. \section1 MNG Library (\c libmng) version 1.0.10 \e{The libmng library supports decoding, displaying, encoding, and various other manipulations of the Multiple-image Network Graphics (MNG) format image files. It uses the zlib compression library, and optionally the JPEG library by the Independant JPEG Group (IJG) and/or lcms (little cms), a color-management library by Marti Maria Saguer.} -- quoted from \c src/3rdparty/libmng/doc/libmng.txt See \c src/3rdparty/libmng/LICENSE for license details. \section1 PNG Reference Library (\c libpng) version 1.2.29 \e{Libpng was written as a companion to the PNG specification, as a way of reducing the amount of time and effort it takes to support the PNG file format in application programs.} -- quoted from \c src/3rdparty/libpng/libpng.txt. See \c src/3rdparty/libpng/LICENSE for license details. \section1 The ptmalloc memory allocator (\c ptmalloc3) version 1.8 \e ptmcalloc3 is a scalable concurrent memory allocator suitable for use in multi-threaded programs. \hr Copyright (c) 2001-2006 Wolfram Gloger Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the name of Wolfram Gloger may not be used in any advertising or publicity relating to the software. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL WOLFRAM GLOGER BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \hr See \c src/3rdparty/ptmalloc/COPYRIGHT for license details. \section1 SHA-1 (\c sha1.cpp) \e{Based on the public domain implementation of the SHA-1 algorithm\br Copyright (C) Dominik Reichl } See \c src/3rdparty/sha1/sha1.cpp for more information about the terms and conditions under which the code is supplied. \section1 SQLite (\c sqlite) version 3.5.9 \e{SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.} -- quoted from \l{http://www.sqlite.org/}{www.sqlite.org}. According to the comments in the source files, the code is in the public domain. See the \l{http://www.sqlite.org/copyright.html}{SQLite Copyright} page on the SQLite web site for further information. \section1 TIFF Software Distribution (\c libtiff) version 3.8.2 \e {libtiff is a set of C functions (a library) that support the manipulation of TIFF image files.} -- quoted from \c src/libtiff/html/libtiff.html \hr Copyright (c) 1988-1997 Sam Leffler\br Copyright (c) 1991-1997 Silicon Graphics, Inc.\br Copyright (C) 2004, Andrey Kiselev \br Copyright (c) 1997 Greg Ward Larson Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Sam Leffler and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \hr Copyright (c) 1996-1997 Sam Leffler\br Copyright (c) 1996 Pixar Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that (i) the above copyright notices and this permission notice appear in all copies of the software and related documentation, and (ii) the names of Pixar, Sam Leffler and Silicon Graphics may not be used in any advertising or publicity relating to the software without the specific, prior written permission of Pixar, Sam Leffler and Silicon Graphics. THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL PIXAR, SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \hr See \c src/3rdparty/libtiff/COPYRIGHT for license details. \section1 Wintab API (\c wintab) Wintab is a de facto API for pointing devices on Windows. The wintab code is from \l{http://www.pointing.com/WINTAB.HTM}. See \c src/3rdparty/wintab/wintab.h for license details. \section1 Data Compression Library (\c zlib) version 1.2.3 \e{zlib is a general purpose data compression library. All the code is thread safe. The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952} -- quoted from \c src/3rdparty/zlib/README. See \c src/3rdparty/zlib/README for license details. */ doc/src/legal/editions.qdoc000066400000000000000000000053431215142760100161700ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page editions.html \title Qt Editions \ingroup licensing \brief Information about the different editions of Qt. Qt can be used to create both commercial and non-commercial software for a wide range of different deployment environments, and is supplied in a number of different forms to suit the needs of different kinds of developers. In terms of license conditions, there are two main forms of Qt: \list \li The \l{Qt Commercial Edition} are the commercial versions of \l{About Qt}{Qt}. \li The \l{Open Source Versions of Qt} are freely available for download. \endlist On the Qt web site, you can find a \l{Qt Licensing Overview} and information on \l{Qt License Pricing} for commercial editions of Qt and other Qt-related products. */ doc/src/legal/gpl.qdoc000066400000000000000000000056601215142760100151360ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page lgpl.html \title GNU Lesser General Public License (LGPL) \ingroup licensing \brief About the LGPL license used for Qt. The Qt GUI Toolkit is Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).\br Contact: http://www.qt-project.org/legal Qt is available under the LGPL. \section1 The GNU Lesser General Public License (Version 2.1) Reference: \l{GNU Lesser General Public License, version 2.1} \snippet doc/src/snippets/code/doc_src_lgpl.qdoc LGPL v2.1 \section1 Nokia Qt LGPL Exception version 1.0 As a special exception to the GNU Lesser General Public License version 2.1, the object code form of a "work that uses the Library" may incorporate material from a header file that is part of the Library. You may distribute such object code under terms of your choice, provided that the incorporated material (i) does not exceed more than 5% of the total size of the Library; and (ii) is limited to numerical parameters, data structure layouts, accessors, macros, inline functions and templates. */ doc/src/legal/opensourceedition.qdoc000066400000000000000000000101551215142760100201050ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page opensourceedition.html \title Open Source Versions of Qt \ingroup licensing \brief Information about the license and features of the Open Source Edition. Free (or open source) software is software that comes with a license that gives users certain rights. In particular the right to use the software, to modify it, to obtain its source, and to pass it on (under the same terms). Notice that the term "free" is about rights, not money. The Free Software Foundation (creators of the GNU GPL) speaks of free in this context as in "free speech", not as in "no cost". Nokia supports the free software concept by providing the Qt Open Source Edition, which is licensed under the \l{GNU General Public License (GPL)} (version 3) and the \l{GNU Lesser General Public License (LGPL)} (version 2.1). You can use this edition of Qt to create and distribute software with licenses that are compatible to these free software licenses. The support of open source with the Open Source Versions of Qt has enabled large successful software projects like KDE to thrive, with thousands of developers around the world using open source versions of Qt at no cost to themselves. With the release of Qt 4, open source versions of Qt became available for Unix/X11, Mac OS X, and Windows platforms. The Open Source Edition can be downloaded from the \l{Downloads}{Qt website}. Please refer to the online \l{License FAQ} for answers to frequently asked questions on open source licensing and its implications. More information on Free and Open Source software is available online: \list \li GNU GPL: \l http://www.gnu.org/. \li Open Source licensing: \l http://www.opensource.org/. \endlist See \l{Licensing Information} for a collection of documents about licenses used in Qt. Information about Qt Commercial License Agreements is available in the \l{Qt Licensing Overview} on the Qt website or by contacting the sales department at http://qt.nokia.com/contact. If you are in doubt what edition of Qt is right for your project, please contact \l{mailto:qt-info@nokia.com}{qt-info@nokia.com}. */ doc/src/legal/trademarks.qdoc000066400000000000000000000072221215142760100165050ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page trademarks.html \title Trademarks \ingroup licensing \brief Information about trademarks owned by Nokia and other organisations. Nokia, the Nokia logo, Qt, and the Qt logo are trademarks of Nokia \reg Corporation and/or its subsidiaries in Finland and other countries. \list \li Intel, Intel Inside (logos), MMX and Pentium are \reg trademarks of Intel Corporation in the United States, other countries, or both. \li Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. \li Linux is a \reg trademark of Linus Torvalds in the United States, other countries or both. \li Mac, Mac OS and Macintosh are \reg trademarks of Apple Computer, Inc., registered in the U.S. and other countries. \li Microsoft, Windows, Windows NT, XP, Visual Studio and the Windows logo are \reg trademarks of Microsoft Corporation in the United States, other countries, or both. \li Motif is a registered trademark of The Open Group in the United States, other countries, or both. \li OpenGL is a \reg trademark of Silicon Graphics, Inc. in the United States and other countries. \li UNIX is a registered trademark of The Open Group in the United States and other countries. \li Versit is a \reg trademark of the Internet Mail Consortium in the United States and other countries. \li All other company, product, or service names may be trademarks or service marks of others and are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Nokia and any other company. \endlist */ doc/src/plugins/000077500000000000000000000000001215142760100140725ustar00rootroot00000000000000doc/src/plugins/qml-feedback.qdoc000066400000000000000000000034061215142760100172600ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \group qml-feedback \title QML Feedback API Plugin for QML Support for the Qt Feedback API. */ /*! \page qml-feedback-api.html \title QML Feedback API \brief A QML plugin for the QtFeedback API. \section1 Overview The QML Feedback API allows application developers to implement various types of feedback (usually vibration) to their QML applications. Use this with the QML \e {QtFeedback import} statement. \section1 Feedback elements \annotatedlist qml-feedback-api */ doc/src/qtfeedback.qdoc000066400000000000000000000222651215142760100153610ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:FDL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Free Documentation License Usage ** Alternatively, this file may be used under the terms of the GNU Free ** Documentation License version 1.3 as published by the Free Software ** Foundation and appearing in the file included in the packaging of ** this file. Please review the following information to ensure ** the GNU Free Documentation License version 1.3 requirements ** will be met: http://www.gnu.org/copyleft/fdl.html. ** $QT_END_LICENSE$ ** ****************************************************************************/ /*! \page qtfeedback-index.html \title C++ Feedback API \brief An API enabling a client to provide tactile and audio feedback to user actions. \ingroup mobility The C++ Feedback API enables a client to control and provide tactile and audio feedback to the user. The feedback is in response to user actions. For example, touching an onscreen button. Control of the feedback involves control of the vibration of the device, when a vibrator is used, or the piezo feedback from the screen. \tableofcontents \section1 Overview The Feedback API allows application developers to implement feedback and programmatic vibration in their applications. The API provides abstractions for various types of feedback, and allows custom implementations of these types of feedback. The QFeedbackEffect class provides a simple interface to allow developers to start, stop or pause the playback of an effect. It is an abstract class which is implemented by QFeedbackHapticsEffect and QFeedbackFileEffect. In addition, it allows the instantaneous playback of feedback effects which match the system theme. A QFeedbackHapticsEffect is a custom effect which allows a program to play a haptic effect on an actuator. Such an effect might have a duration, intensity, and envelope of playback (including attack time and intensity, and fade time and intensity), as well as a period if it is a periodic (repeating) effect. A QFeedbackFileEffect is a haptic tune or audio file saved in a file which may be played back. These effects must be created by third-party applications, and a plugin which supports the specific file format must be installed. In particular, note that audio effects are generally limited to simple formats, to reduce latency. You can check what formats are supported by the system by calling QFeedbackFileEffect::supportedMimeTypes(). For the vast majority of use cases, the QFeedbackEffect, QFeedbackHapticsEffect and QFeedbackFileEffect classes are the only classes which developers will use in their programs. There are some special cases, however, where they may wish to implement their own feedback plugin. The QtFeedback API allows third party developers to implement QFeedbackInterface in a plugin which may be loaded by the plugin loading mechanism to play feedback effects. Note that in any application, only the highest priority plugin for each of the three types of feedback will be used to provide the feedback effects, except for file feedback plugins (where only the highest priority plugin for each supported mime-type is used). The interface classes which must be implemented by a plugin to provide effects to clients are: \list \li \l{QFeedbackHapticsInterface} for \l{QFeedbackHapticsEffect} \li \l{QFeedbackFileInterface} for \l{QFeedbackFileEffect} \li \l{QFeedbackThemeInterface} for the built-in theme effects (\l{QFeedbackEffect::ThemeEffect}). \endlist Generally, the device platform will provide an implementation of each of the three different interfaces, which will be the default plugins used for the various \l {QFeedbackEffect}s. \section2 Platform Issues \note Platforms might have user settings that enable/disables the vibration. \section1 Using Effects \section2 Theme Effects The most common use of the API is to play system theme effects for user interface interaction notifications, for example, button clicks. These system theme effects can be played instantaneously, but cannot be paused or stopped. They are played via the static QFeedbackEffect::playThemeEffect() function: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Play the system theme button click effect There are many different theme effects defined, to cover a variety of interactions and notifications, to allow an application to maintain greater consistency with the platform user experience. \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Play the system theme bounce effect \section2 Custom Effects The next most common use of the API is to define a custom effect which can be used to notify the user of application-specific events or to increase the immersiveness of an application. A custom effect may be either periodic or non-periodic. The following diagram shows the graph of intensity over time of a non-periodic effect which was started at time \c t and ended at time \c q, with an \l{QFeedbackHapticsEffect::intensity()}{intensity} of \c{I}, an \l{QFeedbackHapticsEffect::attackIntensity()}{attack intensity} of \c{AI}, a \l{QFeedbackHapticsEffect::fadeIntensity()}{fade intensity} of \c{FI}, an \l{QFeedbackHapticsEffect::attackTime()}{attack time} of \c{AT}, and a \l{QFeedbackHapticsEffect::fadeTime()}{fade time} of \c{FT}, with a total \l{QFeedbackEffect::duration()}{duration} of \c{Duration} milliseconds: \image non-periodic-effect.png The following diagram shows the graph of intensity over time of a periodic effect which was started at time \c t and ended at time \c q, with an \l{QFeedbackHapticsEffect::intensity()}{intensity} of \c{I}, an \l{QFeedbackHapticsEffect::attackIntensity()}{attack intensity} of \c{AI}, a \l{QFeedbackHapticsEffect::fadeIntensity()}{fade intensity} of \c{FI}, an \l{QFeedbackHapticsEffect::attackTime()}{attack time} of \c{AT}, and a \l{QFeedbackHapticsEffect::fadeTime()}{fade time} of \c{FT}, with a \l{QFeedbackHapticsEffect::period()}{period} of \c{Period} milliseconds and a total \l{QFeedbackEffect::duration()}{duration} of \c{Duration} milliseconds: \image periodic-effect.png A custom haptic effect may be defined in the following manner: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Define a custom haptic effect \note No periodicity was defined for the effect, although that can be done by calling QFeedbackHapticsEffect::setPeriod() if required. Once the effect has been defined, it may be played via the API offered in the QFeedbackEffect base class: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Start playing a custom haptic effect Custom haptic effects are stateful, and so they may be paused: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Pause a custom haptic effect Or stopped: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Stop playing a custom haptic effect Certain operations cannot be performed on an effect if it is in a certain state. The current state of the effect may be queried via the base-class API: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Query the state of a custom haptic effect All custom effects are played using a specific \l{QFeedbackActuator}{device actuator}. By default, the effect is played via the actuator which the current haptic effect provider plugin considers to be the system default actuator, and so most application developers will not need to change which actuator is used. In some cases, however, it may be desirable to set which actuator the effect is played on; doing so requires prior knowledge of either the name or the id of the actuator on which the developer wishes the effect to be played: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Set the actuator which should play the custom effect Finally, there is software available which allows "haptic tunes" to be saved to file, for later playback. If the haptic file effect provider plugin on the system understands that file format, the file can be played on device: \snippet doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp Play a haptic effect from a file In addition, small audio effects can be played as feedback. If you wish to see a simple example application which demonstrates some of the above code in use, please see the \l{hapticsquare}{Haptic Square} example application. \section1 Main Classes \list \li \l{QFeedbackEffect} \li \l{QFeedbackHapticsEffect} \li \l{QFeedbackFileEffect} \li \l{QFeedbackActuator} \li \l{QFeedbackInterface} \endlist \section1 Examples \list \li \l{hapticsquare}{Haptic Square} \li \l{hapticsplayer}{Haptics Player} \endlist */ doc/src/snippets/000077500000000000000000000000001215142760100142565ustar00rootroot00000000000000doc/src/snippets/code/000077500000000000000000000000001215142760100151705ustar00rootroot00000000000000doc/src/snippets/code/doc_src_lgpl.qdoc000066400000000000000000000674761215142760100205160ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //! [LGPL v2.1] GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! //! [LGPL v2.1] doc/src/snippets/declarative/000077500000000000000000000000001215142760100165415ustar00rootroot00000000000000doc/src/snippets/declarative/declarative-feedback.qml000066400000000000000000000133441215142760100232660ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ import QtQuick 2.0 Rectangle { id: page width: 800 height: 350 color: "olive" //![File Effect] import QtFeedback 5.0 FileEffect { id: myFileEffect loaded: false source: "file:///myfile.ivs" } MouseArea { onClicked: myFileEffect.start(); } //![File Effect] //![Haptics Effect] import QtFeedback 5.0 HapticsEffect { id: rumbleEffect attackIntensity: 0.0 attackTime: 250 intensity: 1.0 duration: 100 fadeTime: 250 fadeIntensity: 0.0 } MouseArea { onClicked: { rumbleEffect.start(); // plays a rumble effect } //![Haptics Effect] //![Theme] //Example 1: using ThemeEffect declaring element import QtFeedback 5.0 Rectangle { width: 180; height: 20 radius:5 color: "lightgrey" Text { anchors.centerIn: parent text: "Play Theme: Press" } ThemeEffect { id: myOtherThemeEffect effect: "Press" } MouseArea { anchors.fill: parent onClicked: { myOtherThemeEffect.play(); } } } //Example 2: using ThemeEffect without declaring element import QtFeedback.ThemeEffect 5.0 as Effect Rectangle { width: 180; height: 20 radius:5 color: "lightgrey" Text { anchors.centerIn: parent text: "Play Theme: Press" } MouseArea { anchors.fill: parent onClicked: { Effect.effect = "Press" Effect.play(); } } } //Example 3: using ThemeEffect without declaring element and calling overloaded play function import QtFeedback.ThemeEffect 5.0 as Effect Rectangle { width: 180; height: 20 radius:5 color: "lightgrey" Text { anchors.centerIn: parent text: "Play Theme: Press" } MouseArea { anchors.fill: parent onClicked: { Effect.play(Effect.Press) } } } //![Theme] //! [Play the system theme button click effect] import QtFeedback.ThemeEffect 5.0 as Effect Rectangle { width: 180; height: 20 radius:5 color: "lightgrey" Text { anchors.centerIn: parent text: "Play Theme: Press" } MouseArea { anchors.fill: parent onClicked: { Effect.play(Effect.Press) } } } //! [Play the system theme button click effect] //! [Start playing a custom haptic effect] rumble.start(); //! [Start playing a custom haptic effect] //! [Pause a custom haptic effect] rumble.pause(); //! [Pause a custom haptic effect] //! [Stop playing a custom haptic effect] rumble.stop(); //! [Stop playing a custom haptic effect] //! [Query the state of a custom haptic effect] if (rumble.state === Feedback.Stopped) console.log("The device has stopped rumbling.") //! [Query the state of a custom haptic effect] //! [Set the actuator which should play the custom effect] for (var i = 0; rumble.availableActuators[i]; i++) { if (rumble.availableActuators[i].name === "ExampleActuatorName") { rumble.actuator = rumble.availableActuators[i] } } //! [Set the actuator which should play the custom effect] doc/src/snippets/qtfeedbackdocsample/000077500000000000000000000000001215142760100202375ustar00rootroot00000000000000doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.cpp000066400000000000000000000074451215142760100247360ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include void completeExample(); void completeExample() { //! [Play the system theme button click effect] QFeedbackEffect::playThemeEffect(QFeedbackEffect::Press); //! [Play the system theme button click effect] //! [Play the system theme bounce effect] QFeedbackEffect::playThemeEffect(QFeedbackEffect::DragStart); //! [Play the system theme bounce effect] //! [Define a custom haptic effect] QFeedbackHapticsEffect rumble; rumble.setAttackIntensity(0.0); rumble.setAttackTime(250); rumble.setIntensity(1.0); rumble.setDuration(1000); rumble.setFadeTime(250); rumble.setFadeIntensity(0.0); //! [Define a custom haptic effect] //! [Start playing a custom haptic effect] rumble.start(); //! [Start playing a custom haptic effect] //! [Pause a custom haptic effect] rumble.pause(); //! [Pause a custom haptic effect] //! [Stop playing a custom haptic effect] rumble.stop(); //! [Stop playing a custom haptic effect] //! [Query the state of a custom haptic effect] if (rumble.state() == QFeedbackEffect::Stopped) qDebug() << "The device has stopped rumbling!"; //! [Query the state of a custom haptic effect] //! [Set the actuator which should play the custom effect] QFeedbackActuator *actuator = 0; // default system actuator QList actuators = QFeedbackActuator::actuators(); foreach (QFeedbackActuator* temp, actuators) { if (temp->name() == "ExampleActuatorName") { actuator = temp; } } rumble.setActuator(actuator); //! [Set the actuator which should play the custom effect] //! [Play a haptic effect from a file] QFeedbackFileEffect hapticTune; hapticTune.setSource(QUrl::fromLocalFile("mySavedRumble.ivt")); hapticTune.load(); hapticTune.start(); //! [Play a haptic effect from a file] } doc/src/snippets/qtfeedbackdocsample/qtfeedbackdocsample.pro000066400000000000000000000007021215142760100247410ustar00rootroot00000000000000###################################################################### # # Simple example of how to use the feedback API # ###################################################################### TEMPLATE = lib TARGET = qtfeedbackdocsample include(../../../../features/basic_examples_setup.pri) INCLUDEPATH += ../../../../src/global \ ../../../../src/feedback CONFIG += mobility MOBILITY = feedback SOURCES += qtfeedbackdocsample.cpp doc/style/000077500000000000000000000000001215142760100127625ustar00rootroot00000000000000doc/style/style.css000066400000000000000000000043601215142760100146370ustar00rootroot00000000000000a:link, a:visited { color: #00732F; text-decoration: none; font-weight: bold; } body { font: normal 400 14px/1.2 Arial; margin-top: 85px; } h1 { margin: 0; } h2 { font: 500 20px/1.2 Arial; } h3.fn, span.fn { -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; background-color: #F6F6F6; border-width: 1px; border-style: solid; border-color: #E6E6E6; word-spacing: 3px; padding: 3px 5px; } table, pre { -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; background-color: #F6F6F6; border: 1px solid #E6E6E6; border-collapse: separate; font-size: 12px; line-height: 1.2; margin-bottom: 25px; margin-left: 15px; } table td { padding: 3px 15px 3px 20px; } table tr.even { background-color: white; color: #66666E; } table tr.odd { background-color: #F6F6F6; color: #66666E; } li { margin-bottom: 10px; padding-left: 12px; } .cpp { display: block; margin: 10; overflow: hidden; overflow-x: hidden; overflow-y: hidden; padding: 20px 0 20px 0; } .footer { margin-top: 50px; } .memItemLeft { padding-right: 3px; } .memItemRight { padding: 3px 15px 3px 0; } .qml { display: block; margin: 10; overflow: hidden; overflow-x: hidden; overflow-y: hidden; padding: 20px 0 20px 0; } .qmldefault { padding-left: 5px; float: right; color: red; } .qmlreadonly { padding-left: 5px; float: right; color: #254117; } .rightAlign { padding: 3px 5px 3px 10px; text-align: right; } .title { background-color: white; color: #44A51C; font-family: Verdana; font-size: 35px; font-weight: normal; left: 0; padding-bottom: 5px; padding-left: 16px; padding-top: 20px; position: absolute; right: 0; top: 0; } .toc { float: right; -moz-border-radius: 7px 7px 7px 7px; -webkit-border-radius: 7px 7px 7px 7px; border-radius: 7px 7px 7px 7px; background-color: #F6F6F6; border: 1px solid #DDD; margin: 0 20px 10px 10px; padding: 20px 15px 20px 20px; height: auto; width: 200px; } examples/000077500000000000000000000000001215142760100126735ustar00rootroot00000000000000examples/examples.pri000066400000000000000000000002141215142760100152220ustar00rootroot00000000000000!plugin { target.path=$$QT_MOBILITY_EXAMPLES } else { target.path = $${QT_MOBILITY_PLUGINS}/$${PLUGIN_TYPE} } INSTALLS += target examples/examples.pro000066400000000000000000000002671215142760100152400ustar00rootroot00000000000000TEMPLATE = subdirs # Feedback API examples contains(mobility_modules, feedback) { SUBDIRS += hapticsplayer hapticsquare # this not a good UI for mobile screens at the moment } examples/hapticsplayer/000077500000000000000000000000001215142760100155435ustar00rootroot00000000000000examples/hapticsplayer/hapticsplayer.cpp000066400000000000000000000265361215142760100211330ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Feedback. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "hapticsplayer.h" #include #include #include static const char ENUM_THEME_EFFECT[] = "ThemeEffect"; static const char ENUM_ANIMATION_STATE[] = "State"; HapticsPlayer::HapticsPlayer() : actuator(0) { ui.setupUi(this); #if defined(Q_WS_MAEMO_5) // maemo5 style problem: title of groupboxes is rendered badly if there isn't enough space // that is, the sizehint of the title area is Preferred rather than Minimum. // to fix that, we manually tweak some spacers. ui.verticalSpacer_2->changeSize(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed); ui.verticalSpacer_3->changeSize(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed); ui.verticalSpacer_4->changeSize(20, 30, QSizePolicy::Expanding, QSizePolicy::Fixed); ui.verticalSpacer_5->changeSize(20, 30, QSizePolicy::Expanding, QSizePolicy::Fixed); ui.verticalSpacer_6->changeSize(20, 20, QSizePolicy::Expanding, QSizePolicy::Fixed); ui.verticalSpacer_7->changeSize(20, 30, QSizePolicy::Expanding, QSizePolicy::Fixed); #endif connect(ui.actuators, SIGNAL(currentIndexChanged(int)), SLOT(actuatorChanged())); connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(enabledChanged(bool))); connect(ui.playPause, SIGNAL(pressed()), SLOT(playPauseClicked())); connect(ui.stop, SIGNAL(pressed()), &effect, SLOT(stop())); connect(ui.duration, SIGNAL(valueChanged(int)), SLOT(durationChanged(int))); connect(ui.intensity, SIGNAL(valueChanged(int)), SLOT(intensityChanged(int))); //for the envelope connect(ui.attackTime, SIGNAL(valueChanged(int)), SLOT(attackTimeChanged(int))); connect(ui.attackIntensity, SIGNAL(valueChanged(int)), SLOT(attackIntensityChanged(int))); connect(ui.fadeTime, SIGNAL(valueChanged(int)), SLOT(fadeTimeChanged(int))); connect(ui.fadeIntensity, SIGNAL(valueChanged(int)), SLOT(fadeIntensityChanged(int))); //for the period connect(ui.grpPeriod, SIGNAL(toggled(bool)), SLOT(periodToggled(bool))); connect(ui.period, SIGNAL(valueChanged(int)), SLOT(periodChanged(int))); connect(ui.instantPlay, SIGNAL(pressed()), SLOT(instantPlayClicked())); //file API connect(ui.browse, SIGNAL(pressed()), SLOT(browseClicked())); connect(ui.filePlayPause, SIGNAL(pressed()), SLOT(filePlayPauseClicked())); connect(ui.fileStop, SIGNAL(pressed()), &fileEffect, SLOT(stop())); // if pausing a playing effect is not supported then stop playback connect(&fileEffect, SIGNAL(error(QFeedbackEffect::ErrorType)), &fileEffect, SLOT(stop())); foreach (QFeedbackActuator *dev, QFeedbackActuator::actuators()) { ui.actuators->addItem(dev->name()); } if (QFeedbackActuator::actuators().count() > 0) ui.actuators->setCurrentIndex(0); //adding the instant effects const QMetaObject &mo = QFeedbackEffect::staticMetaObject; const QMetaEnum &me = mo.enumerator(mo.indexOfEnumerator(ENUM_THEME_EFFECT)); Q_ASSERT(me.keyCount()); for (int i = 0 ; i < me.keyCount(); ++i) { ui.instantEffect->addItem(me.key(i)); } //initialization durationChanged(effect.duration()); intensityChanged(ui.intensity->value()); attackTimeChanged(ui.attackTime->value()); attackIntensityChanged(ui.attackIntensity->value()); fadeTimeChanged(ui.fadeTime->value()); fadeIntensityChanged(ui.fadeIntensity->value()); ui.tabWidget->setTabEnabled(1, QFeedbackEffect::supportsThemeEffect()); ui.tabWidget->setTabEnabled(2, !QFeedbackFileEffect::supportedMimeTypes().isEmpty()); #ifdef Q_OS_SYMBIAN // Due to focus handling problems when using tabwidget in Qt/s60 with old non-touch-screen devices // we have to handle focus explicitly here, this might get fixed at some point connect(ui.tabWidget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int))); // force initial focus to a button on the first tab ui.tabWidget->setCurrentIndex(0); ui.playPause->setFocus(); #endif //that is a hackish way of updating the info concerning the effects startTimer(50); } QFeedbackActuator* HapticsPlayer::currentActuator() { QList devs = QFeedbackActuator::actuators(); int index = ui.actuators->currentIndex(); if (index == -1 || devs.count() == 0 || index > devs.count()) { if (!actuator) { actuator = new QFeedbackActuator(this); } return actuator; } return devs.at(index); } void HapticsPlayer::actuatorChanged() { QFeedbackActuator* dev = currentActuator(); if (dev) { enabledChanged(dev->isEnabled()); effect.setActuator(dev); } } #ifdef Q_OS_SYMBIAN void HapticsPlayer::tabChanged(int index) { switch (index) { case 0: ui.playPause->setFocus(); break; case 1: ui.instantPlay->setFocus(); break; case 2: ui.browse->setFocus(); break; } } #endif void HapticsPlayer::enabledChanged(bool on) { if (!on) effect.stop(); QFeedbackActuator* dev = currentActuator(); if (dev) { dev->setEnabled(on); ui.enabled->setChecked(dev->isEnabled()); if (dev->isEnabled() && (dev->isCapabilitySupported(QFeedbackActuator::Envelope))) { ui.envelope->setEnabled(true); ui.envelope->show(); } else { ui.envelope->setEnabled(true); ui.envelope->hide(); } if (dev->isEnabled() && (dev->isCapabilitySupported(QFeedbackActuator::Period))) { ui.grpPeriod->setEnabled(true); ui.grpPeriod->show(); } else { ui.grpPeriod->setEnabled(false); ui.grpPeriod->hide(); } } #ifdef Q_OS_SYMBIAN ui.playPause->setFocus(); #endif } void HapticsPlayer::playPauseClicked() { if (effect.state() == QFeedbackEffect::Running) { effect.pause(); } else { effect.start(); } } void HapticsPlayer::durationChanged(int duration) { effect.setDuration(duration); ui.attackTime->setMaximum(duration); ui.fadeTime->setMaximum(duration); attackTimeChanged(ui.attackTime->value()); } void HapticsPlayer::intensityChanged(int value) { effect.setIntensity(qreal(value) / ui.intensity->maximum()); ui.lblIntensity->setText(QString::number(effect.intensity())); } void HapticsPlayer::timerEvent(QTimerEvent *e) { //update the display for effect { QFeedbackEffect::State newState = effect.state(); const QMetaObject *mo = effect.metaObject(); ui.effectState->setText(mo->enumerator(mo->indexOfEnumerator(ENUM_ANIMATION_STATE)).key(newState)); ui.stop->setEnabled(newState != QFeedbackEffect::Stopped); if (effect.state() == QFeedbackEffect::Paused || effect.state() == QFeedbackEffect::Stopped) ui.playPause->setText(tr("Play")); else ui.playPause->setText(tr("Pause")); } //update the display for effect { QFeedbackEffect::State newState = fileEffect.state(); const QMetaObject *mo = fileEffect.metaObject(); ui.fileEffectState->setText(mo->enumerator(mo->indexOfEnumerator(ENUM_ANIMATION_STATE)).key(newState)); ui.fileStop->setEnabled(newState != QFeedbackEffect::Stopped); ui.filePlayPause->setEnabled(fileEffect.isLoaded()); ui.browse->setEnabled(newState == QFeedbackEffect::Stopped); ui.fileStatus->setText( fileEffect.isLoaded() ? QString::fromLatin1("%1 : %2 ms").arg(tr("Loaded")).arg(fileEffect.duration()) : tr("Not Loaded") ); } QWidget::timerEvent(e); } void HapticsPlayer::attackTimeChanged(int attackTime) { effect.setAttackTime(attackTime); //let's check the boundaries if (attackTime + ui.fadeTime->value() > ui.duration->value()) ui.fadeTime->setValue(ui.duration->value() - attackTime); } void HapticsPlayer::attackIntensityChanged(int attackIntensity) { effect.setAttackIntensity(qreal(attackIntensity) / ui.attackIntensity->maximum()); ui.lblAttackIntensity->setText(QString::number(effect.attackIntensity())); } void HapticsPlayer::fadeTimeChanged(int fadeTime) { effect.setFadeTime(fadeTime); //let's check the boundaries if (fadeTime + ui.attackTime->value() > ui.duration->value()) ui.attackTime->setValue(ui.duration->value() - fadeTime); } void HapticsPlayer::fadeIntensityChanged(int fadeIntensity) { effect.setFadeIntensity(qreal(fadeIntensity) / ui.fadeIntensity->maximum()); ui.lblFadeIntensity->setText(QString::number(effect.fadeIntensity())); } void HapticsPlayer::periodToggled(bool on) { effect.setPeriod(on ? ui.period->value() : 0); } void HapticsPlayer::periodChanged(int value) { effect.setPeriod(value); } void HapticsPlayer::instantPlayClicked() { const QMetaObject &mo = QFeedbackEffect::staticMetaObject; const QMetaEnum &me = mo.enumerator(mo.indexOfEnumerator(ENUM_THEME_EFFECT)); QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeEffect(me.keyToValue(ui.instantEffect->currentText().toLatin1()))); } void HapticsPlayer::browseClicked() { QString filename = QFileDialog::getOpenFileName(this, tr("Feedback file")); if (!filename.isEmpty()) { ui.filename->setText(QDir::toNativeSeparators(filename)); fileEffect.setSource(QUrl::fromLocalFile(filename)); fileEffect.load(); } } void HapticsPlayer::filePlayPauseClicked() { if (fileEffect.state() == QFeedbackEffect::Running) fileEffect.pause(); else fileEffect.start(); } #include "moc_hapticsplayer.cpp" examples/hapticsplayer/hapticsplayer.h000066400000000000000000000057211215142760100205710ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Feedback. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "ui_hapticsplayer.h" #include #include #ifndef HAPTICSPLAYER_H_ #define HAPTICSPLAYER_H_ class HapticsPlayer : public QWidget { Q_OBJECT public: HapticsPlayer(); private Q_SLOTS: void actuatorChanged(); void enabledChanged(bool); void playPauseClicked(); void durationChanged(int); void intensityChanged(int); void attackTimeChanged(int); void attackIntensityChanged(int); void fadeTimeChanged(int); void fadeIntensityChanged(int); void periodChanged(int value); void periodToggled(bool on); //High-level API void instantPlayClicked(); //File API void browseClicked(); void filePlayPauseClicked(); #ifdef Q_OS_SYMBIAN void tabChanged(int index); #endif protected: void timerEvent(QTimerEvent *); private: QFeedbackActuator* currentActuator(); Ui_HapticsPlayer ui; QFeedbackActuator* actuator; QFeedbackHapticsEffect effect; QFeedbackFileEffect fileEffect; }; #endif examples/hapticsplayer/hapticsplayer.pro000066400000000000000000000007101215142760100211330ustar00rootroot00000000000000INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/src/feedback # # mobility.prf should do this (since it's platform and release/debug dependent, # it can't just be -lQtFeedback (might QtFeedback1, QtFeedbackd, QtFeedback1d etc) # # if it isn't doing it, mobility.prf is probably not in the right place # # LIBS += -lQtFeedback HEADERS += hapticsplayer.h SOURCES += hapticsplayer.cpp main.cpp FORMS += hapticsplayer.ui CONFIG = feedback include(../examples.pri) examples/hapticsplayer/hapticsplayer.ui000066400000000000000000000573161215142760100207660ustar00rootroot00000000000000 HapticsPlayer 0 0 423 778 10 HapticsPlayer QTabWidget::North 1 true false low-level true 0 0 379 712 0 0 true Qt::Vertical QSizePolicy::Maximum 20 20 0 0 effect player true true Qt::Vertical QSizePolicy::Preferred 20 20 0 0 duration 0 0 -1 100000000 250 0 0 intensity 1000 1000 Qt::Horizontal 0 0 30 0 Qt::Vertical QSizePolicy::Maximum 20 20 0 0 Envelope true 0 0 Attack 0 0 1000 Qt::Horizontal 0 0 Fade 0 0 1000 Qt::Horizontal 30 0 30 0 Qt::Vertical QSizePolicy::Maximum 20 20 Qt::Vertical QSizePolicy::Maximum 20 20 0 0 period true true false Qt::Vertical QSizePolicy::Maximum 20 20 0 0 1 1000 100 0 0 Play 0 0 Stop 0 0 Qt::AlignCenter high-level true 0 0 379 712 11 11 247 92 0 0 Qt::Vertical 20 28 Qt::Horizontal 78 20 0 0 Play Qt::Horizontal 78 20 File true 0 0 379 712 true ... Qt::Vertical 20 40 false Play/pause false Stop 0 0 examples/hapticsplayer/main.cpp000066400000000000000000000044371215142760100172030ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Feedback. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "hapticsplayer.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); a.addLibraryPath("../../plugins"); //allows the plugins to be loaded HapticsPlayer w; #if defined Q_OS_SYMBIAN || defined (Q_OS_WINCE) w.showMaximized(); #endif w.show(); return a.exec(); } examples/hapticsquare/000077500000000000000000000000001215142760100153645ustar00rootroot00000000000000examples/hapticsquare/hapticbutton.cpp000066400000000000000000000046451215142760100206050ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Feedback. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "hapticbutton.h" #include HapticButton::HapticButton(const QString &label) : QWidget(0), m_label(label) { setMinimumSize(100, 100); } void HapticButton::setLabel(const QString& label) { m_label = label; } void HapticButton::mousePressEvent(QMouseEvent *) { emit clicked(); } void HapticButton::paintEvent(QPaintEvent *) { QPainter paint(this); QRect r(1, 1, width()-2, height()-2); paint.drawRoundedRect(r, 10, 10); paint.drawText(r, Qt::AlignCenter, m_label); } examples/hapticsquare/hapticbutton.h000066400000000000000000000044521215142760100202460ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Feedback. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef HAPTICBUTTON_H #define HAPTICBUTTON_H #include class HapticButton : public QWidget { Q_OBJECT public: explicit HapticButton(const QString &label); void setLabel(const QString& label); protected: void mousePressEvent(QMouseEvent *e); void paintEvent(QPaintEvent *e); private: QString m_label; signals: void clicked(); }; #endif // HAPTICBUTTON_H examples/hapticsquare/hapticsquare.cpp000066400000000000000000000077101215142760100205660ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "hapticsquare.h" #include "hapticbutton.h" #include #include //! [0] HapticSquare::HapticSquare() { m_rumble.setAttackIntensity(0.1); m_rumble.setAttackTime(250); m_rumble.setIntensity(1.0); m_rumble.setDuration(1000); m_rumble.setFadeTime(250); m_rumble.setFadeIntensity(0.1); //! [0] //! [1] m_ocean.setAttackIntensity(0.1); m_ocean.setAttackTime(450); m_ocean.setIntensity(0.8); m_ocean.setDuration(6000); m_ocean.setFadeTime(900); m_ocean.setFadeIntensity(0.05); m_ocean.setPeriod(1500); //! [1] //! [2] m_btnRumble = new HapticButton(tr("Rumble!")); m_btnOcean = new HapticButton(tr("Ocean")); m_btnButtonClick = new HapticButton(tr("Click")); m_btnNegativeEffect = new HapticButton(tr("Oops!")); QGridLayout *topLayout = new QGridLayout(this); topLayout->addWidget(m_btnRumble, 0, 0); topLayout->addWidget(m_btnOcean, 0, 1); topLayout->addWidget(m_btnButtonClick, 1, 0); topLayout->addWidget(m_btnNegativeEffect, 1, 1); connect(m_btnRumble, SIGNAL(clicked()), this, SLOT(playRumble())); connect(m_btnOcean, SIGNAL(clicked()), this, SLOT(playOcean())); connect(m_btnButtonClick, SIGNAL(clicked()), this, SLOT(playButtonClick())); connect(m_btnNegativeEffect, SIGNAL(clicked()), this, SLOT(playNegativeEffect())); } //! [2] HapticSquare::~HapticSquare() { delete m_btnRumble; delete m_btnOcean; delete m_btnButtonClick; delete m_btnNegativeEffect; } //! [3] void HapticSquare::playRumble() { m_rumble.start(); } void HapticSquare::playOcean() { if (m_ocean.state() == QFeedbackEffect::Stopped) { m_ocean.start(); } else { m_ocean.stop(); } } //! [3] //! [4] void HapticSquare::playButtonClick() { QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeBasicButton); } void HapticSquare::playNegativeEffect() { QFeedbackEffect::playThemeEffect(QFeedbackEffect::ThemeNegativeTacticon); } //! [4] #include "moc_hapticsquare.cpp" examples/hapticsquare/hapticsquare.h000066400000000000000000000050451215142760100202320ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include class HapticButton; #ifndef HAPTICSQUARE_H_ #define HAPTICSQUARE_H_ //! [0] class HapticSquare : public QWidget { Q_OBJECT public: HapticSquare(); ~HapticSquare(); private Q_SLOTS: void playRumble(); void playOcean(); void playButtonClick(); void playNegativeEffect(); private: HapticButton *m_btnRumble; HapticButton *m_btnOcean; HapticButton *m_btnButtonClick; HapticButton *m_btnNegativeEffect; QFeedbackHapticsEffect m_rumble; QFeedbackHapticsEffect m_ocean; }; //! [0] #endif examples/hapticsquare/hapticsquare.pro000066400000000000000000000007301215142760100205770ustar00rootroot00000000000000INCLUDEPATH += $$QT_MOBILITY_SOURCE_TREE/src/feedback # # mobility.prf should do this (since it's platform and release/debug dependent, # it can't just be -lQtFeedback (might QtFeedback1, QtFeedbackd, QtFeedback1d etc) # # if it isn't doing it, mobility.prf is probably not in the right place # # LIBS += -lQtFeedback HEADERS += hapticsquare.h \ hapticbutton.h SOURCES += hapticsquare.cpp main.cpp \ hapticbutton.cpp CONFIG = feedback include(../examples.pri) examples/hapticsquare/main.cpp000066400000000000000000000044721215142760100170230ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the examples of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:BSD$ ** You may use this file under the terms of the BSD license as follows: ** ** "Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are ** met: ** * Redistributions of source code must retain the above copyright ** notice, this list of conditions and the following disclaimer. ** * Redistributions in binary form must reproduce the above copyright ** notice, this list of conditions and the following disclaimer in ** the documentation and/or other materials provided with the ** distribution. ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names ** of its contributors may be used to endorse or promote products derived ** from this software without specific prior written permission. ** ** ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "hapticsquare.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); a.addLibraryPath("../../plugins"); // allows the plugins to be loaded HapticSquare w; #if defined Q_OS_SYMBIAN || defined (Q_OS_WINCE) w.setWindowState(Qt::WindowMaximized); #endif w.show(); return a.exec(); } qtfeedback.pro000066400000000000000000000000171215142760100136660ustar00rootroot00000000000000load(qt_parts) src/000077500000000000000000000000001215142760100116445ustar00rootroot00000000000000src/feedback/000077500000000000000000000000001215142760100133705ustar00rootroot00000000000000src/feedback/feedback.pro000066400000000000000000000010241215142760100156330ustar00rootroot00000000000000TARGET = QtFeedback QT = core QMAKE_DOCS = $$PWD/../../doc/qtfeedback.qdocconf load(qt_module) PUBLIC_HEADERS += qfeedbackglobal.h \ qfeedbackactuator.h \ qfeedbackeffect.h \ qfeedbackplugininterfaces.h \ qfeedbackpluginsearch.h PRIVATE_HEADERS += qfeedbackeffect_p.h \ qfeedbackplugin_p.h HEADERS = $$PUBLIC_HEADERS $$PRIVATE_HEADERS SOURCES += qfeedbackactuator.cpp \ qfeedbackeffect.cpp \ qfeedbackplugin.cpp src/feedback/qfeedbackactuator.cpp000066400000000000000000000166661215142760100175630ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qfeedbackactuator.h" #include "qfeedbackplugininterfaces.h" #include QT_BEGIN_NAMESPACE /*! \class QFeedbackActuator \brief The QFeedbackActuator class describes actuators for tactile feedback. \inmodule QtFeedback An actuator knows how to play a \l{QFeedbackEffect}{tactile effect}. The class gives access to a specified actuator. An actuator can be used to play \l{QFeedbackHapticsEffect}s using \l{QFeedbackHapticsEffect::}{setActuator()}. Usually, you will not have to set an actuator directly on a QFeedbackHapticsEffect. QFeedbackHapticsEffect and QFeedbackFileEffect uses an appropriate actuator by default. However, you can query which actuators are available with actuators(). \code QFeedbackActuator actuator; // default system actuator QList actuators = QFeedbackActuator::actuators(); foreach (const QFeedbackActuator& temp, actuators) { if (temp.name() == "ExampleActuatorName") { actuator = temp; } } \endcode The QFeedbackActuator class gives access to information about the actuator it represents. You can query if the actuator \l{isEnabled()}{is enabled} and if it \l{isValid()}{is valid }. Whether an actuator is ready to play an effect can be queried by checking the actuator's state(). The \l{QFeedbackActuator::}{State} enum describes the states and actuator can have. You can also get a human readable name for the actuator with the name() function. \sa QFeedbackHapticsEffect, QFeedbackFileEffect, QFeedbackEffect */ /*! \enum QFeedbackActuator::Capability \value Envelope Capability defining the wave type with attack/fade times and levels. \value Period Capability defining that the device can play periodic effects. */ /*! \enum QFeedbackActuator::State \value Busy The actuator is busy. \value Ready The actuator is ready to play an effect. \value Unknown The actuator is in an unknown state. */ /*! Constructs a QFeedbackActuator, passing \a parent to the QObject constructor. The object will represent the default actuator on the system. If there are no actuators attached to the system, isValid() will return false. \sa isValid() */ QFeedbackActuator::QFeedbackActuator(QObject *parent) : QObject(parent), m_id(-1) { QList list = actuators(); if (!list.isEmpty()) { QFeedbackActuator* defaultActuator = list.first(); m_id = defaultActuator->id(); } } /*! Constructs a QFeedbackActuator with id \a id, passing \a parent to the QObject constructor. This is used by plugins to represents their actuators. \sa isValid() */ QFeedbackActuator::QFeedbackActuator(QObject *parent, int id) : QObject(parent), m_id(id) { } /*! \property QFeedbackActuator::id \brief id of the feedback actuator. */ /*! Returns the id of the actuator. \since 1.1 */ int QFeedbackActuator::id() const { return m_id; } /*! \property QFeedbackActuator::valid \brief validity of the feedback actuator */ /*! Returns true if the actuator is valid. */ bool QFeedbackActuator::isValid() const { return m_id >= 0; } /*! \property QFeedbackActuator::name \brief name of the feedback actuator */ /*! Returns the name of the actuator. */ QString QFeedbackActuator::name() const { return QFeedbackHapticsInterface::instance()->actuatorProperty(*this, QFeedbackHapticsInterface::Name).toString(); } /*! \property QFeedbackActuator::state \brief state of the feedback actuator */ /*! Returns the state of the actuator. */ QFeedbackActuator::State QFeedbackActuator::state() const { return QFeedbackActuator::State(QFeedbackHapticsInterface::instance()->actuatorProperty(*this, QFeedbackHapticsInterface::State).toInt()); } /*! Returns if the actuator supports the supplied \a capability. */ bool QFeedbackActuator::isCapabilitySupported(Capability capability) const { return QFeedbackHapticsInterface::instance()->isActuatorCapabilitySupported(*this, capability); } /*! \property QFeedbackActuator::enabled \brief whether the feedback actuator is enabled */ /*! Returns true if you can use this actuator to start effects. */ bool QFeedbackActuator::isEnabled() const { return QFeedbackHapticsInterface::instance()->actuatorProperty(*this, QFeedbackHapticsInterface::Enabled).toBool(); } /*! Allows you to enable or disable an actuator. If \a enabled is true, the actuator will be enabled, and otherwise it will be disabled. \note Some systems may not allow you to change whether an actuator is enabled. */ void QFeedbackActuator::setEnabled(bool enabled) { if (isEnabled() != enabled) { QFeedbackHapticsInterface::instance()->setActuatorProperty(*this, QFeedbackHapticsInterface::Enabled, enabled); emit enabledChanged(); } } /*! \fn void QFeedbackActuator::enabledChanged() This signal is emitted when the actuator is requested to enable or disable itself. \sa isEnabled() */ /*! \fn QFeedbackActuator::actuators() Returns the list of actuators available on the system. */ QList QFeedbackActuator::actuators() { return QFeedbackHapticsInterface::instance()->actuators(); } /*! \fn QFeedbackActuator::operator==(const QFeedbackActuator &other) const Returns true if this actuator is equal to \a other. */ bool QFeedbackActuator::operator==(const QFeedbackActuator &other) const { return m_id == other.m_id; } QT_END_NAMESPACE src/feedback/qfeedbackactuator.h000066400000000000000000000062551215142760100172210ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKACTUATOR_H #define QFEEDBACKACTUATOR_H #include "qfeedbackglobal.h" #include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QFeedbackEffect; class Q_FEEDBACK_EXPORT QFeedbackActuator : public QObject { Q_OBJECT Q_ENUMS(Capability) Q_ENUMS(State) Q_PROPERTY(int id READ id) Q_PROPERTY(QString name READ name) Q_PROPERTY(QFeedbackActuator::State state READ state) Q_PROPERTY(bool valid READ isValid) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) public: enum Capability { Envelope, Period }; enum State { Busy, Ready, Unknown }; QFeedbackActuator(QObject *parent = 0); int id() const; bool isValid() const; QString name() const; State state() const; Q_INVOKABLE bool isCapabilitySupported(Capability) const; bool isEnabled() const; void setEnabled(bool); static QList actuators(); bool operator==(const QFeedbackActuator&) const; Q_SIGNALS: void enabledChanged(); private: QFeedbackActuator(QObject *parent, int id); friend class QFeedbackHapticsInterface; int m_id; }; QT_END_NAMESPACE QT_END_HEADER #endif // QFEEDBACKACTUATOR_H src/feedback/qfeedbackeffect.cpp000066400000000000000000000623141215142760100171640ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qfeedbackeffect.h" #include "qfeedbackeffect_p.h" #include "qfeedbackplugininterfaces.h" #include #include QT_BEGIN_NAMESPACE /*! \class QFeedbackEffect \brief The QFeedbackEffect class is the abstract base class for feedback effects. \ingroup feedback \inmodule QtFeedback It represents an effect to provide feedback to a person (i.e., an effect that affect human senses). The technology available today usually only provides haptic effects, which deal with the sense of touch, and audio effects. The QFeedbackHapticsEffect and QFeedbackFileEffect are implementations of haptic effects and can be used to control a mobile device's vibrator. In addition, the QFeedbackFileEffect can also be used to play audio feedback. Feedback effects have a duration, which is measured in milliseconds. Subclasses reimplement duration() to inform how long the effect lasts. The duration is the total time the effect will last, and thus includes any envelope modifiers (attack and fade). At any given time, a feedback effect is in one of four states: Loading, Stopped, Running, or Paused. See the \l{QFeedbackEffect::}{State} enum documentation for further details. Subclasses must reimplement state() to report which state an effect is in, and setState() to receive state change requests. The start(), pause(), and stop() slots calls setState() with the corresponding new \l{QFeedbackEffect::}{State}. Changes in state are reported through the stateChanged() signal and may happen asynchronously some time after the state change request. A system often has a set of standard feedback effects for user interface interaction (e.g., button clicks). The \l{QFeedbackEffect::}{Effect} describes the standard effects that QFeedbackEffect supports. It is named so because the effects often depend on the theme of the user interface. You can play these effects using the playThemeEffect() function. \code QFeedbackEffect::playThemeEffect(QFeedbackEffect::Press); \endcode The playThemeEffect() function returns true if the effect was played successfully. An effect may not be played if the system does not support it or if an error occurred. */ /*! \fn void QFeedbackEffect::error(QFeedbackEffect::ErrorType error) const This signal is emitted by subclasses if an \a error occurred during playback of an effect. The \l{QFeedbackEffect::}{ErrorType} enum describes the errors that can be reported. */ /*! \fn void QFeedbackEffect::stateChanged() This signal is emitted by subclasses when the \l State of the effect changes. \sa state() */ /*! \enum QFeedbackEffect::State This enum describes the state of the effect. An effect will be in one of these states. \value Stopped The effect is not running. This is the initial state. The state changes to either Loading when loading an effect or to Running when the effect is started by calling start(). When an effect has finished playing, it will enter the Stopped state again. \value Paused The effect is paused. Calling start() will resume it. \value Running The effect is running. You can control the current state by calling the stop() or pause() functions. \value Loading The effect is loading. That can happen when loading is done asynchronously. When the effect has loaded, the state will change to either Running (if start() has been called) or Stopped. \sa state() */ /*! \enum QFeedbackEffect::ErrorType This enum describes the possible errors happening on the effect. \value UnknownError An unknown error occurred. \value DeviceBusy The feedback could not start because the device is busy. \sa error() */ /*! \enum QFeedbackEffect::Effect This enum describes all possible effect types. Effects might be tactile, or audio or visual. Not all platforms and devices have distinct effects for each type. \value Effect.Undefined - Undefined feedback. No feedback is given. \value Effect.Press - Feedback for when the screen is pressed. \value Effect.Release - Feedback for touch release. \value Effect.PressWeak - A weak feedback for press. \value Effect.ReleaseWeak - A weak feedback for release. \value Effect.PressStrong - A strong feedback for press. \value Effect.ReleaseStrong - A strong feedback for release. \value Effect.DragStart - Feedback for when dragging starts. \value Effect.DragDropInZone - Feedback for when dragging ends and touch is released inside a drop zone. \value Effect.DragDropOutOfZone - Feedback for when dragging ends and touch is released outside a drop zone. \value Effect.DragCrossBoundary - Feedback for when crossing a boundary while dragging. \value Effect.Appear - Feedback for when an item is shown. \value Effect.Disappear - Feedback for when an item is closed. \value Effect.Move - Feedback for dragging on screen. \value NumberOfEffects The number of built-in effects. \value UserEffect The starting point for any user defined effects, where supported. */ /*! \enum QFeedbackEffect::Duration This enum describes the possible effect predefined duration types. Generally a specific milliseconds value can be supplied instead of one of these values. \value Infinite Infinite effect duration */ /*! \property QFeedbackEffect::state \brief state of the feedback effect. This returns the state of the feedback effect. The \l State enumeration reports the possible states. */ /*! \property QFeedbackEffect::duration \brief duration of the feedback effect, in milliseconds. In some cases the duration will be unknown, which will be reported as 0. If the duration is infinite, QFeedbackEffect::Infinite will be returned. Some subclasses may have more than one type of duration (for example, \l QFeedbackHapticsEffect), and this property will return the total duration of the effect. */ /*! Constructs the QFeedbackEffect base class, and passes \a parent to QObject's constructor. This is called by the classes that inherit from this class. */ QFeedbackEffect::QFeedbackEffect(QObject *parent) : QObject(parent) { } /*! \fn void QFeedbackEffect::start() Starts playing the effect. If an error occurs the error() signal will be emitted. \sa stop() */ void QFeedbackEffect::start() { setState(Running); } /*! \fn void QFeedbackEffect::stop() Stops a playing effect. If an error occurs the error() signal will be emitted. \sa start(), pause(), setState() */ void QFeedbackEffect::stop() { setState(Stopped); } /*! \fn void QFeedbackEffect::pause() Pauses a playing effect. If an error occurs the error() signal will be emitted. Not all systems support pausing an effect during playback. */ void QFeedbackEffect::pause() { setState(Paused); } /*! \fn QFeedbackEffect::playThemeEffect(Effect effect) This function plays \a effect instantly and returns true if the effect could be played; otherwise, returns false. */ bool QFeedbackEffect::playThemeEffect(Effect effect) { if (QFeedbackThemeInterface *iface = QFeedbackThemeInterface::instance()) return iface->play(effect); return false; } /*! \fn QFeedbackEffect::supportsThemeEffect() Returns true if playing themed feedback is available. */ bool QFeedbackEffect::supportsThemeEffect() { return QFeedbackThemeInterface::instance() != 0; } /*! \class QFeedbackHapticsEffect \ingroup feedback \inmodule QtFeedback \brief The QFeedbackHapticsEffect class allows you to play a haptics effect. A haptics effect is an effect that takes advantage of the sense of touch. Most mobile devices today supports one such effect, vibration, which will then be the default when you create a QFeedbackHapticsEffect. A haptics effect has a few parameters that must be set up before it can be played: \list \li duration(): The total duration of the effect in milliseconds. \li intensity(): The intensity, e.g., how hard the device will vibrate. \endlist An effect can, for example, be set up as follows: \omit I'm right that this is all that is required to be set? \endomit \code QFeedbackHapticsEffect rumble; rumble.setIntensity(1.0); rumble.setDuration(100); \endcode You can now start() the effect. \code rumble.start(); \endcode At any given time, the effect is in one of four states: \l{QFeedbackEffect::}{Stopped}, \l{QFeedbackEffect::}{Paused}, \l{QFeedbackEffect::}{Running}, or \l{QFeedbackEffect::}{Loading}. You can request a state change by calling start(), pause(), or stop(). The state is queried with state(). The haptics effect also supports a fade-in of the effect. For vibration, this means that the vibration will grow (or sink) in intensity from when the effect starts until intensity() is reached. You can set that up as follows: \code rumble.setAttackIntensity(0.0); rumble.setAttackTime(250); \endcode Attack intensity is the start intensity and attack time is the duration of the fade-in. We have a similar fade-out: \code rumble.setFadeTime(250); rumble.setFadeIntensity(0.0); \endcode When using fade-in and fade-out the total duration of the haptics effect will be: duration(); the main intensity() will be played for (duration() - (attackTime() + fadeTime())) milliseconds. A QFeedbackHapticsEffect is played on an \l{QFeedbackHapticsEffect::}{actuator()}, which is the physical component that performs the effect. You can query if other actuators are available - see the QFeedbackActuator::actuators() function documentation for details. Errors occurring during playback are notified through the error() signal. \sa QFeedbackActuator */ /*! \fn virtual void QFeedbackEffect::setState(State state) = 0 Requests the effect to change its State to change to the specified \a state. Subclasses reimplement this function to handle state change requests for the effect. */ /*! Constructs the QFeedbackHapticsEffect class, and passes \a parent to QObject's constructor. The default QFeedbackActuator will be used. \sa QFeedbackActuator::actuators() */ QFeedbackHapticsEffect::QFeedbackHapticsEffect(QObject *parent) : QFeedbackEffect(parent), priv(new QFeedbackHapticsEffectPrivate) { setActuator(0); } /*! Destroys this effect and stops the feedback if it is running. */ QFeedbackHapticsEffect::~QFeedbackHapticsEffect() { stop(); } /*! \property QFeedbackHapticsEffect::duration \brief the expected duration of the effect. This property defines the total duration of the feedback effect, in milliseconds. It includes the duration of any fade-in or fade-out parts, if any, in non-periodic effects, and includes all repetitions of the period in periodic-effects, if any. If the duration is set to a value less than attackTime() + fadeTime(), or less than the period() of the effect, the waveform which will result is backend-specific. \sa fadeTime(), attackTime(), period() */ int QFeedbackHapticsEffect::duration() const { return priv->duration; } void QFeedbackHapticsEffect::setDuration(int msecs) { if (priv->duration == msecs) return; priv->duration = msecs; QFeedbackHapticsInterface::instance()->updateEffectProperty(this, QFeedbackHapticsInterface::Duration); } /*! \property QFeedbackHapticsEffect::intensity \brief the intensity of the effect. This property defines the intensity of the feedback effect. The value can be between 0 and 1. For non-periodic effects, the effect will be at this intensity for (duration() - (attackTime() + fadeTime())) milliseconds. For periodic effects, the effect will be at this intensity once per period for (period() - (attackTime() + fadeTime())) milliseconds. */ qreal QFeedbackHapticsEffect::intensity() const { return priv->intensity; } void QFeedbackHapticsEffect::setIntensity(qreal intensity) { if (priv->intensity == intensity) return; priv->intensity = intensity; QFeedbackHapticsInterface::instance()->updateEffectProperty(this, QFeedbackHapticsInterface::Intensity); } /*! \property QFeedbackHapticsEffect::attackTime \brief the duration of the fade-in effect. This property defines the duration of the fade-in effect in milliseconds. The effect will ramp up (or down) from attackIntensity() to intensity() in attackTime() milliseconds. If the attack time is set to a value such that attackTime() + fadeTime() is greater than duration() for non-periodic effects, or greater than period() for periodic effects, the waveform which will result is backend-specific. \sa duration(), period() */ int QFeedbackHapticsEffect::attackTime() const { return priv->attackTime; } void QFeedbackHapticsEffect::setAttackTime(int msecs) { if (priv->attackTime == msecs) return; priv->attackTime = msecs; QFeedbackHapticsInterface::instance()->updateEffectProperty(this, QFeedbackHapticsInterface::AttackTime); } /*! \property QFeedbackHapticsEffect::attackIntensity \brief the initial intensity of the effect. This property defines the initial intensity of the effect, before it fades in. It is usually lower than \l intensity. The effect will ramp up (or down) from attackIntensity() to intensity() in attackTime() milliseconds. */ qreal QFeedbackHapticsEffect::attackIntensity() const { return priv->attackIntensity; } void QFeedbackHapticsEffect::setAttackIntensity(qreal intensity) { if (priv->attackIntensity == intensity) return; priv->attackIntensity = intensity; QFeedbackHapticsInterface::instance()->updateEffectProperty(this, QFeedbackHapticsInterface::AttackIntensity); } /*! \property QFeedbackHapticsEffect::fadeTime \brief the duration of the fade-out effect. This property defines the duration of the fade-out effect in milliseconds. The effect will ramp down (or up) from intensity() to fadeIntensity() in fadeTime() milliseconds. If the fade time is set to a value such that attackTime() + fadeTime() is greater than duration() for non-periodic effects, or greater than period() for periodic effects, the waveform which will result is backend-specific. \sa duration(), period() */ int QFeedbackHapticsEffect::fadeTime() const { return priv->fadeTime; } void QFeedbackHapticsEffect::setFadeTime(int msecs) { if (priv->fadeTime == msecs) return; priv->fadeTime = msecs; QFeedbackHapticsInterface::instance()->updateEffectProperty(this, QFeedbackHapticsInterface::FadeTime); } /*! \property QFeedbackHapticsEffect::fadeIntensity \brief the final intensity of the effect. This property defines the final intensity of the effect, after it fades out. It is usually lower than \l intensity. The effect will ramp down (or up) from intensity() to fadeIntensity() in fadeTime() milliseconds. */ qreal QFeedbackHapticsEffect::fadeIntensity() const { return priv->fadeIntensity; } void QFeedbackHapticsEffect::setFadeIntensity(qreal intensity) { if (priv->fadeIntensity == intensity) return; priv->fadeIntensity = intensity; QFeedbackHapticsInterface::instance()->updateEffectProperty(this, QFeedbackHapticsInterface::FadeIntensity); } /*! \property QFeedbackHapticsEffect::actuator \brief the actuator on which the effect operates. This property defines the actuator on which the effect operates. You can only change the actuator used when the effect is stopped. Setting a null actuator resets the effect to use the default actuator. */ QFeedbackActuator* QFeedbackHapticsEffect::actuator() const { return priv->actuator; } void QFeedbackHapticsEffect::setActuator(QFeedbackActuator *actuator) { if (state() != Stopped) { qWarning("QFeedbackHapticsEffect::setActuator: The effect is not stopped"); return; } if (actuator) { priv->actuator = actuator; } else { QList list = QFeedbackActuator::actuators(); if (!list.isEmpty()) { priv->actuator = list.first(); } else { priv->actuator = new QFeedbackActuator(this); } } } /*! \property QFeedbackHapticsEffect::period \brief set the period for the effect. It has a default value of -1, which means that it is not a periodic effect. You can only change the period when the effect is stopped. The duration of the effect should be set to a value larger than the period of the effect if you wish the periodicity to be discernable. \note Not all actuators support periodic effects The period defines the total length of the periodic envelope, which will be repeated up until duration() milliseconds has elapsed. For a periodic effect, the intensity will start at attackIntensity(), ramp to intensity() (where it stays for (period() - (attackTime() + fadeTime())) milliseconds), then ramp to fadeIntensity(). This waveform will be repeated as many times as required until the duration() has elapsed. If the period is set to a value which is less than attackTime() + fadeTime(), the waveform which will result is backend-specific. */ int QFeedbackHapticsEffect::period() const { return priv->period; } void QFeedbackHapticsEffect::setPeriod(int msecs) { if (state() != Stopped) { qWarning("QFeedbackHapticsEffect::setPeriod: the period can only be changed if the effect is stopped"); return; } priv->period = msecs; } /*! \internal */ void QFeedbackHapticsEffect::setState(State state) { State oldState = this->state(); if (oldState != state) { QFeedbackHapticsInterface::instance()->setEffectState(this, state); emit stateChanged(); } } /*! \internal */ QFeedbackEffect::State QFeedbackHapticsEffect::state() const { return QFeedbackHapticsInterface::instance()->effectState(this); } /*! \internal \class QFeedbackFileEffect \ingroup feedback \inmodule QtFeedback \brief The QFeedbackFileEffect class allows to play feedback from a file. Several different mime types may be supported on a system, including both haptic data files, and audio files. The files containing haptics data are usually suffixed \c .ivt. The feedback is usually varying in \l{QFeedbackHapticsEffect::}{intensity()}, and is for that reason often referred to as a "haptic tune". They are created, for instance, from music files where the feedback is based on a specific feature in the audio data. For example, you could have a phone vibrating along with the bass of a rock song. Although Qt Feedback does not let you record \c .ivt files, it lets you play them back using the QFeedbackFileEffect class. Setting up a QFeedbackFileEffect and starting it is done as follows: \code QFeedbackFileEffect hapticTune; hapticTune.setSource(QUrl::fromLocalFile("mySavedRumble.ivt")); hapticTune.load(); hapticTune.start(); \endcode As with other \l{QFeedbackEffect}s, QFeedbackFileEffect is at any given time in one of four states: \l{QFeedbackEffect::}{Loading}, \l{QFeedbackEffect::}{Running}, \l{QFeedbackEffect::}{Paused}, or \l{QFeedbackEffect::}{Stopped}. You request state changes with start(), pause(), and stop(). You can load() and unload() the file at will to free resources or be as fast as possible. The file must be loaded before it can be started, and it cannot be unloaded while playing. After the file is loaded, you can query its duration(). Some mime types may not support duration information - in these cases, 0 will be returned. QFeedbackFileEffect reports errors through the error() signal. \sa QFeedbackHapticsEffect */ /*! \internal */ void QFeedbackFileEffectPrivate::loadFinished(bool success) { loaded = success; if( !success) backendUsed = -1; } /*! \internal Constructs the QFeedbackFileEffect class, and passes \a parent to QObject's constructor. */ QFeedbackFileEffect::QFeedbackFileEffect(QObject *parent) : QFeedbackEffect(parent), priv(new QFeedbackFileEffectPrivate(this)) { } /*! \internal Stops the feedback and unloads the file if necessary. */ QFeedbackFileEffect::~QFeedbackFileEffect() { setLoaded(false); //ensures we unload the file and frees resources } /*! \reimp */ int QFeedbackFileEffect::duration() const { return QFeedbackFileInterface::instance()->effectDuration(this); } /*! \internal \property QFeedbackFileEffect::source \brief the url of the file that is loaded. Setting that property will automatically unload the previous file (if any) and load the new one. Some backends may not support all URL schemes - for example, they may only support local files. You can only change the source of an effect when it is stopped. */ QUrl QFeedbackFileEffect::source() const { return priv->url; } void QFeedbackFileEffect::setSource(const QUrl &source) { if (state() != QFeedbackEffect::Stopped) { qWarning("QFeedbackFileEffect::setSource: can't set the file while the feedback is running"); return; } if (source != priv->url) { setLoaded(false); priv->url = source; setLoaded(true); } } /*! \internal \property QFeedbackFileEffect::loaded \brief reports if the file has been successfully loaded. */ bool QFeedbackFileEffect::isLoaded() const { return priv->loaded; } void QFeedbackFileEffect::setLoaded(bool load) { if (priv->loaded == load) return; if (state() != QFeedbackEffect::Stopped) { qWarning() << "QFeedbackFileEffect::setLoaded: can't load/unload a file while the effect is not stopped"; return; } QFeedbackFileInterface::instance()->setLoaded(this, load); } /*! \internal \fn void QFeedbackFileEffect::load() Makes sure that the file associated with the feedback object is loaded. It will be automatically loaded when the setSource() or start() functions are called. */ void QFeedbackFileEffect::load() { setLoaded(true); } /*! \internal \fn void QFeedbackFileEffect::unload() makes sure that the file associated with the feedback object is unloaded. It will be automatically unloaded when the setSource function is called with another file or the object is destroyed. */ void QFeedbackFileEffect::unload() { setLoaded(false); } /*! \internal \fn QStringList QFeedbackFileEffect::supportedMimeTypes() returns the MIME types supported for playing effects from file. */ QStringList QFeedbackFileEffect::supportedMimeTypes() { return QFeedbackFileInterface::instance()->supportedMimeTypes(); } /*! \reimp */ void QFeedbackFileEffect::setState(State newState) { State oldState = state(); if (oldState != newState) { if (newState != Stopped && state() == Stopped) load(); // makes sure the file is loaded QFeedbackFileInterface::instance()->setEffectState(this, newState); emit stateChanged(); } } /*! \reimp */ QFeedbackEffect::State QFeedbackFileEffect::state() const { return QFeedbackFileInterface::instance()->effectState(this); } QT_END_NAMESPACE src/feedback/qfeedbackeffect.h000066400000000000000000000136471215142760100166360ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKEFFECT_H #define QFEEDBACKEFFECT_H #include "qfeedbackglobal.h" #include #include #include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QFeedbackActuator; class QFeedbackFileEffectPrivate; class QFeedbackHapticsEffectPrivate; class Q_FEEDBACK_EXPORT QFeedbackEffect : public QObject { Q_OBJECT Q_ENUMS(Effect) Q_ENUMS(Duration) Q_ENUMS(State) Q_ENUMS(ErrorType) Q_PROPERTY(int duration READ duration) Q_PROPERTY(State state READ state NOTIFY stateChanged) public: // Make sure these are kept up to date with the declarative version enum Effect { Undefined = -1, Press, Release, PressWeak, ReleaseWeak, PressStrong, ReleaseStrong, DragStart, DragDropInZone, DragDropOutOfZone, DragCrossBoundary, Appear, Disappear, Move, NumberOfEffects, UserEffect = 65535 }; enum Duration { Infinite = -1 }; enum State { Stopped, Paused, Running, Loading }; enum ErrorType { UnknownError, DeviceBusy }; explicit QFeedbackEffect(QObject *parent = 0); virtual State state() const = 0; virtual int duration() const = 0; //for themes static bool supportsThemeEffect(); static bool playThemeEffect(Effect effect); public Q_SLOTS: void start(); void stop(); void pause(); protected: virtual void setState(State) = 0; Q_SIGNALS: void error(QFeedbackEffect::ErrorType) const; //when an error occurs void stateChanged(); private: friend class QFeedbackInterface; }; class Q_FEEDBACK_EXPORT QFeedbackHapticsEffect : public QFeedbackEffect { Q_OBJECT Q_PROPERTY(int duration READ duration WRITE setDuration) Q_PROPERTY(qreal intensity READ intensity WRITE setIntensity) Q_PROPERTY(int attackTime READ attackTime WRITE setAttackTime) Q_PROPERTY(qreal attackIntensity READ attackIntensity WRITE setAttackIntensity) Q_PROPERTY(int fadeTime READ fadeTime WRITE setFadeTime) Q_PROPERTY(qreal fadeIntensity READ fadeIntensity WRITE setFadeIntensity) Q_PROPERTY(int period READ period WRITE setPeriod) Q_PROPERTY(QFeedbackActuator* actuator READ actuator WRITE setActuator) public: explicit QFeedbackHapticsEffect(QObject *parent = 0); ~QFeedbackHapticsEffect(); void setDuration(int msecs); int duration() const; void setIntensity(qreal intensity); qreal intensity() const; //the envelope void setAttackTime(int msecs); int attackTime() const; void setAttackIntensity(qreal intensity); qreal attackIntensity() const; void setFadeTime(int msecs); int fadeTime() const; void setFadeIntensity(qreal intensity); qreal fadeIntensity() const; void setPeriod(int msecs); int period() const; void setActuator(QFeedbackActuator *actuator); QFeedbackActuator* actuator() const; //reimplementations from QFeedbackEffect virtual State state() const; protected: virtual void setState(State); private: Q_DISABLE_COPY(QFeedbackHapticsEffect) friend class QFeedbackHapticsEffectPrivate; QScopedPointer priv; }; class Q_FEEDBACK_EXPORT QFeedbackFileEffect : public QFeedbackEffect { Q_OBJECT Q_PROPERTY(bool loaded READ isLoaded WRITE setLoaded) Q_PROPERTY(QUrl source READ source WRITE setSource) public: explicit QFeedbackFileEffect(QObject *parent = 0); ~QFeedbackFileEffect(); int duration() const; bool isLoaded() const; void load(); void unload(); void setLoaded(bool); QUrl source() const; void setSource(const QUrl &); static QStringList supportedMimeTypes(); //reimplementations from QFeedbackEffect virtual State state() const; protected: virtual void setState(State); private: Q_DISABLE_COPY(QFeedbackFileEffect) friend class QFeedbackFileEffectPrivate; QScopedPointer priv; }; QT_END_NAMESPACE QT_END_HEADER #endif // QFEEDBACKEFFECT_H src/feedback/qfeedbackeffect_p.h000066400000000000000000000066521215142760100171530ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QFEEDBACKEFFECT_P_H #define QFEEDBACKEFFECT_P_H #include #include QT_BEGIN_NAMESPACE class QFeedbackHapticsEffectPrivate { public: QFeedbackHapticsEffectPrivate() : duration(250) , attackTime(0) , fadeTime(0) , period(-1) , actuator(0) , intensity(1) , attackIntensity(0) , fadeIntensity(0) { } // Try to avoid holes (mostly where qreal == double) int duration; int attackTime; int fadeTime; int period; QFeedbackActuator *actuator; qreal intensity; qreal attackIntensity; qreal fadeIntensity; }; class QFeedbackFileEffectPrivate { public: QFeedbackFileEffectPrivate(QFeedbackFileEffect *effect) : effect(effect) , loaded(false) , backendUsed(-1) { } static QFeedbackFileEffectPrivate *get(QFeedbackFileEffect *e) { return e->priv.data(); } static const QFeedbackFileEffectPrivate *get(const QFeedbackFileEffect *e) { return e->priv.data(); } void loadFinished(bool success); QFeedbackFileEffect *effect; QUrl url; bool loaded; //used for loading the file int backendUsed; }; QT_END_NAMESPACE #endif // QFEEDBACKEFFECT_P_H src/feedback/qfeedbackglobal.h000066400000000000000000000043561215142760100166370ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKGLOBAL_H #define QFEEDBACKGLOBAL_H #include #ifndef QT_STATIC # if defined(QT_BUILD_FEEDBACK_LIB) # define Q_FEEDBACK_EXPORT Q_DECL_EXPORT # else # define Q_FEEDBACK_EXPORT Q_DECL_IMPORT # endif #else # define Q_FEEDBACK_EXPORT #endif #endif // QFEEDBACKGLOBAL_H src/feedback/qfeedbackplugin.cpp000066400000000000000000000403021215142760100172170ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qfeedbackplugininterfaces.h" #include "qfeedbackplugin_p.h" #include "qfeedbackeffect_p.h" #include "qfeedbackpluginsearch.h" #include #include #include #include #include #include QT_BEGIN_NAMESPACE /*! \class QFeedbackInterface \ingroup feedback \inmodule QtFeedback \brief The QFeedbackInterface class is the base class for plugins providing feedback. This interface gives the possibility to report errors from within a backend plugin. */ /*! \fn QFeedbackInterface::reportError(const QFeedbackEffect *effect, QFeedbackEffect::ErrorType error) Allows a plugin to report the specified \a error whenever necessary. Errors most likely can happen trying to play or pause an effect, which should be supplied as the parameter \a effect. */ /*! \enum QFeedbackInterface::PluginPriority This enum describes the priority that the plugin should have in case more than one of the same type (Haptics or Theme) is found. If more than one plugin has the same priority, the first one that has been loaded will be used. However, multiple file effect plugins can be loaded at the same time. \value PluginLowPriority The plugin will have a low priority. This is usually the case for platform specific-APIs. \value PluginNormalPriority The plugin will have a normal priority. This is usually the case for advanced technologies. \value PluginHighPriority The plugin will have higher priority. Use this priority if you want your own plugin to be used. */ void QFeedbackInterface::reportError(const QFeedbackEffect *effect, QFeedbackEffect::ErrorType error) { if (effect) emit effect->error(error); } // These are really useless docs, so I've marked them as internal /*! \internal \fn QFeedbackThemeInterface::~QFeedbackThemeInterface() Destroys any resources used by this interface. */ /*! \internal \fn QFeedbackFileInterface::~QFeedbackFileInterface() Destroys any resources used by this interface. */ /*! \internal \fn QFeedbackHapticsInterface::~QFeedbackHapticsInterface() Destroys any resources used by this interface. */ template class BackendLoader { public: BackendLoader() : inst(0) { } ~BackendLoader() { pl.unload(); } void setInstance(T *newInst) { inst = newInst; } T * instance() { return inst; } void tryLoad(QPluginLoader &loader) { if (T *newInst = qobject_cast(loader.instance())) { if (!inst || inst->pluginPriority() < newInst->pluginPriority()) { inst = newInst; pl.unload(); //release any reference to a previous plugin instance pl.setFileName(loader.fileName()); pl.load(); //Adds a ref to the library } } } private: QPluginLoader pl; T *inst; }; class FileBackend : public QFeedbackFileInterface { public: FileBackend() { } //this class is used to redirect the calls to all the file backends available virtual void setLoaded(QFeedbackFileEffect *effect, bool load) { if (load) { //start loading tryBackendLoad(effect); } else { //unload if (QFeedbackFileInterface *subBackend = getBackend(effect)) subBackend->setLoaded(effect, load); QFeedbackFileEffectPrivate::get(effect)->loadFinished(false); // make sure it's marked unloaded [XXX this isn't allowed to fail!] } } virtual void setEffectState(QFeedbackFileEffect *effect, QFeedbackEffect::State state) { if (QFeedbackFileInterface *subBackend = getBackend(effect)) subBackend->setEffectState(effect, state); else QFeedbackInterface::reportError(effect, QFeedbackEffect::UnknownError); } virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *effect) { if (QFeedbackFileInterface *subBackend = getBackend(effect)) return subBackend->effectState(effect); return QFeedbackEffect::Stopped; } virtual int effectDuration(const QFeedbackFileEffect *effect) { if (QFeedbackFileInterface *subBackend = getBackend(effect)) return subBackend->effectDuration(effect); return 0; } virtual QStringList supportedMimeTypes() { QStringList ret; for (int i = 0; i < subBackends.count(); ++i) { ret += subBackends.at(i)->supportedMimeTypes(); } return ret; } void addFileBackend(QFeedbackFileInterface *backend) { subBackends.append(backend); } void reportLoadFinished(QFeedbackFileEffect *effect, bool success) { if (success) { //the file was loaded by the current backend QFeedbackFileEffectPrivate::get(effect)->loadFinished(true); return; } //let's try the next backend tryBackendLoad(effect); } private: QList subBackends; QFeedbackFileInterface *getBackend(const QFeedbackFileEffect *effect) { const QFeedbackFileEffectPrivate *priv = QFeedbackFileEffectPrivate::get(effect); if (priv->backendUsed >= 0 && priv->backendUsed < subBackends.count()) return subBackends.at(priv->backendUsed); return 0; } void tryBackendLoad(QFeedbackFileEffect *effect) { QFeedbackFileEffectPrivate *p = QFeedbackFileEffectPrivate::get(effect); p->backendUsed++; //let's try to load the file if (p->backendUsed >= subBackends.count()) { //the file couldn't be loaded p->loadFinished(false); reportError(effect, QFeedbackEffect::UnknownError); // Do a state change as well, (to stopped) QMetaObject::invokeMethod(effect, "stateChanged"); return; } subBackends.at(p->backendUsed)->setLoaded(effect, true); //now we're waiting for the reply (call to asyncLoadFinished) } }; class BackendManager { public: BackendManager() { QStringList pluginPaths = getPluginPaths(QLatin1String("feedback")); foreach (const QString& pluginPath, pluginPaths) { QPluginLoader loader(pluginPath); hapticsBackend.tryLoad(loader); themeBackend.tryLoad(loader); if (QFeedbackFileInterface *newFile = qobject_cast(loader.instance())) { fileBackend.addFileBackend(newFile); } else { loader.unload(); } } if (!hapticsBackend.instance()) hapticsBackend.setInstance(new QDummyBackend); } QFeedbackHapticsInterface* hapticsBackendInstance() { return hapticsBackend.instance(); } QFeedbackThemeInterface* themeBackendInstance() { return themeBackend.instance(); } FileBackend *fileBackendInstance() { return &fileBackend; } private: BackendLoader hapticsBackend; BackendLoader themeBackend; FileBackend fileBackend; }; Q_GLOBAL_STATIC(BackendManager, backendManager) /*! \class QFeedbackHapticsInterface \ingroup feedback \brief The QFeedbackHapticsInterface class is the base class for plugins providing custom haptics effects. This interface will be used to try to play custom effects with specific duration, intensity, envelope and period. An effect is always played on a specified actuator. */ /*! \enum QFeedbackHapticsInterface::EffectProperty This enum describes all effect properties for haptics effects. \value Duration The effect duration (in milliseconds) \value Intensity The effect intensity \value AttackTime The effect attack time (in milliseconds) \value AttackIntensity The effect attack intensity \value FadeTime The effect fade time (in milliseconds) \value FadeIntensity The effect fade intensity \value Period The effect period, this is an optional effect property. */ /*! \enum QFeedbackHapticsInterface::ActuatorProperty This enum describes all actuator properties. \value Name The actuator name. \value State The actuator state. \value Enabled The actuator enabled state. */ /*! \fn QFeedbackHapticsInterface::actuators() Return the available actuators provided by this plugin. The ownership of the actuator objects stays with the plugin. */ /*! \fn QFeedbackHapticsInterface::pluginPriority() Returns the priority for the plugin. \sa QFeedbackInterface::PluginPriority */ // XXX TODO.. these should have been pointers to QFA :/ /*! \fn QFeedbackHapticsInterface::setActuatorProperty(const QFeedbackActuator& actuator, ActuatorProperty property, const QVariant & value) Sets a \a value for \a property on the \a actuator. \sa ActuatorProperty */ /*! \fn QFeedbackHapticsInterface::actuatorProperty(const QFeedbackActuator & actuator, ActuatorProperty property) Returns the value for the \a property for an \a actuator. \sa ActuatorProperty */ /*! \fn QFeedbackHapticsInterface::isActuatorCapabilitySupported(const QFeedbackActuator &actuator, QFeedbackActuator::Capability capability) Returns true if the \a actuator supports the \a capability. */ /*! \fn QFeedbackHapticsInterface::updateEffectProperty(const QFeedbackHapticsEffect *effect, EffectProperty property) Tells the backend that the \a property has been updated for the supplied \a effect. */ /*! \fn QFeedbackHapticsInterface::setEffectState(const QFeedbackHapticsEffect *effect, QFeedbackEffect::State state) Sets the state to \a state for the effect \a effect. If that fails the backend should report an error by calling reportError and \a effect will in turn emit an error signal. */ /*! \fn QFeedbackHapticsInterface::effectState(const QFeedbackHapticsEffect *effect) Get the current state for the effect \a effect. */ /*! \internal \fn QFeedbackHapticsInterface::instance() Returns the instance of the object managing haptics custom effects. If no backend has been loaded, this will return a null pointer. */ QFeedbackHapticsInterface *QFeedbackHapticsInterface::instance() { return backendManager()->hapticsBackendInstance(); } /*! \fn QFeedbackHapticsInterface::createFeedbackActuator(QObject *parent, int id) Creates an instance of QFeedbackActuator with the identifier \a id and parent \a parent. This allows backends to create instances of actuators. It is then up to the each backend to manage the identifiers according to its needs. */ QFeedbackActuator* QFeedbackHapticsInterface::createFeedbackActuator(QObject* parent, int id) { return new QFeedbackActuator(parent, id); } /*! \class QFeedbackThemeInterface \ingroup feedback \brief The QFeedbackThemeInterface class is the base class for plugins providing themed effects. They can be of any nature (tactile, audio...). This simple interface will be used to play those themed effects by a simple call to the play method. */ /*! \fn QFeedbackThemeInterface::pluginPriority() Returns the priority for the plugin. */ /*! \fn QFeedbackThemeInterface::play(QFeedbackEffect::Effect effect) Plays the theme effect \a effect. Returns false in case of an error. */ /*! \internal \fn QFeedbackThemeInterface::instance() Returns the instance of the object managing theme effects. If no backend has been loaded, this will return a null pointer. */ QFeedbackThemeInterface *QFeedbackThemeInterface::instance() { return backendManager()->themeBackendInstance(); } /*! \internal \class QFeedbackFileInterface \ingroup feedback \brief The QFeedbackFileInterface class is the base class for plugins providing support for effects stored in files. They can be of any nature (tactile, audio...). As it is possible to load many different file types using different technologies, all the backend plugins exposing this interface will be loaded at the same time. When loading a file all the backend will be tried in order until one can load the file. It is thus very important that the backends return a load status as soon as possible to not take a too long time to load a file. */ /*! \internal \fn QFeedbackFileInterface::setLoaded(QFeedbackFileEffect* effect, bool value) Sets the state of the effect \a effect to be loaded if \a value is true, otherwise unloaded. Loading a file is asynchronous. Once the backend knows if it has loaded or can't load the file, it must call the reportLoadFinished function. */ /*! \internal \fn QFeedbackFileInterface::setEffectState(QFeedbackFileEffect *effect, QFeedbackEffect::State state) Sets the state of \a effect to \a state. */ /*! \internal \fn QFeedbackFileInterface::effectState(const QFeedbackFileEffect *effect) Returns the current state of the effect \a effect. */ /*! \internal \fn QFeedbackFileInterface::effectDuration(const QFeedbackFileEffect *effect) Return the duration of \a effect, in milliseconds. It should return \l QFeedbackEffect::Infinite in case the duration is infinite, or 0 if undefined or unknown. */ /*! \internal \fn QFeedbackFileInterface::supportedMimeTypes() Returns a list of the MIME types supported by this plugin. */ /*! \internal \fn QFeedbackFileInterface::instance() Returns the instance of the object managing theme effects. Even if no backend has been loaded, this will never return a null pointer. */ QFeedbackFileInterface *QFeedbackFileInterface::instance() { return backendManager()->fileBackendInstance(); } /*! \internal \fn QFeedbackFileInterface::reportLoadFinished(QFeedbackFileEffect *effect, bool success) This is the function the backend should call when it has finished trying to load the effect \a effect. As loading a file is asynchronous and multiple plugins are attempted after each other, the backend has to call this function in order for the process to perform smoothly. The success of the operation is indicated by the \a success parameter. */ void QFeedbackFileInterface::reportLoadFinished(QFeedbackFileEffect *effect, bool success) { backendManager()->fileBackendInstance()->reportLoadFinished(effect, success); } QT_END_NAMESPACE src/feedback/qfeedbackplugin_p.h000066400000000000000000000065071215142760100172140ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QFEEDBACKPLUGIN_P_H #define QFEEDBACKPLUGIN_P_H #include "qfeedbackactuator.h" #include "qfeedbackeffect.h" #include "qfeedbackplugininterfaces.h" #include #include QT_BEGIN_NAMESPACE class QDummyBackend : QObject, public QFeedbackHapticsInterface { public: QDummyBackend() : QObject(qApp) { pluginPriority(); } QList actuators() { return QList(); } void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &) { } QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty) { return QVariant(); } bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability) { return false; } void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty) { } void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State) { } QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *) { return QFeedbackEffect::Stopped; } virtual PluginPriority pluginPriority() { return PluginLowPriority; } }; QT_END_NAMESPACE #endif // QFEEDBACKPLUGIN_P_H src/feedback/qfeedbackplugininterfaces.h000066400000000000000000000116161215142760100207360ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKPLUGIN_H #define QFEEDBACKPLUGIN_H #include #include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class Q_FEEDBACK_EXPORT QFeedbackInterface { public: enum PluginPriority { PluginLowPriority, PluginNormalPriority, PluginHighPriority }; protected: static void reportError(const QFeedbackEffect *, QFeedbackEffect::ErrorType); }; class Q_FEEDBACK_EXPORT QFeedbackHapticsInterface : public QFeedbackInterface { public: //going with enums allow more flexibility without breaking BC enum EffectProperty { Duration, Intensity, AttackTime, AttackIntensity, FadeTime, FadeIntensity, Period //optional }; enum ActuatorProperty { Name, State, Enabled }; //static members for actuators management virtual QList actuators() = 0; virtual ~QFeedbackHapticsInterface() {} virtual PluginPriority pluginPriority() = 0; //for actuator handling virtual void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &) = 0; virtual QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty) = 0; virtual bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability) = 0; //effects virtual void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty) = 0; virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State) = 0; virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *) = 0; static QFeedbackHapticsInterface *instance(); protected: //utility function for the backends QFeedbackActuator* createFeedbackActuator(QObject* parent, int id); }; class QFeedbackThemeInterface : public QFeedbackInterface { public: virtual ~QFeedbackThemeInterface() {} virtual PluginPriority pluginPriority() = 0; virtual bool play(QFeedbackEffect::Effect) = 0; static QFeedbackThemeInterface *instance(); }; class Q_FEEDBACK_EXPORT QFeedbackFileInterface : public QFeedbackInterface { public: virtual ~QFeedbackFileInterface() {} virtual void setLoaded(QFeedbackFileEffect*, bool) = 0; virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State) = 0; virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *) = 0; virtual int effectDuration(const QFeedbackFileEffect*) = 0; virtual QStringList supportedMimeTypes() = 0; static QFeedbackFileInterface *instance(); protected: static void reportLoadFinished(QFeedbackFileEffect*, bool success); }; Q_DECLARE_INTERFACE(QFeedbackHapticsInterface, "com.nokia.qt.QFeedbackHapticsInterface/1.0") Q_DECLARE_INTERFACE(QFeedbackThemeInterface, "com.nokia.qt.QFeedbackThemeInterface/1.0") Q_DECLARE_INTERFACE(QFeedbackFileInterface, "com.nokia.qt.QFeedbackFileInterface/1.0") QT_END_NAMESPACE QT_END_HEADER #endif // QFEEDBACKPLUGININTERFACES_H src/feedback/qfeedbackpluginsearch.h000066400000000000000000000101011215142760100200440ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKPLUGINSEARCH_H #define QFEEDBACKPLUGINSEARCH_H #include #include #include #include QT_BEGIN_NAMESPACE #define CHECKDIR(dir) (dir).exists() inline QStringList getPluginPaths(const QString& plugintype) { #if !defined QT_NO_DEBUG const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0; #endif QStringList paths = QCoreApplication::libraryPaths(); #if !defined QT_NO_DEBUG if (showDebug) qDebug() << "Plugin paths:" << paths; #endif // Temp variable to avoid multiple identical paths // (we don't convert the list to set first, because that loses the order) QSet processed; /* The list of discovered plugins */ QStringList plugins; /* Enumerate our plugin paths */ for (int i=0; i < paths.count(); i++) { if (processed.contains(paths.at(i))) continue; processed.insert(paths.at(i)); QDir pluginsDir(paths.at(i)); if (!CHECKDIR(pluginsDir)) continue; #if defined(Q_OS_WIN) if (pluginsDir.dirName().toLower() == QLatin1String("debug") || pluginsDir.dirName().toLower() == QLatin1String("release")) pluginsDir.cdUp(); #elif defined(Q_OS_MAC) if (pluginsDir.dirName() == QLatin1String("MacOS")) { pluginsDir.cdUp(); pluginsDir.cdUp(); pluginsDir.cdUp(); } #endif QString subdir(QLatin1String("plugins/")); subdir += plugintype; if (pluginsDir.path().endsWith(QLatin1String("/plugins")) || pluginsDir.path().endsWith(QLatin1String("/plugins/"))) subdir = plugintype; if (CHECKDIR(QDir(pluginsDir.filePath(subdir)))) { pluginsDir.cd(subdir); QStringList files = pluginsDir.entryList(QDir::Files); #if !defined QT_NO_DEBUG if (showDebug) qDebug() << "Looking for " << plugintype << " plugins in" << pluginsDir.path() << files; #endif for (int j=0; j < files.count(); j++) { plugins << pluginsDir.absoluteFilePath(files.at(j)); } } } return plugins; } QT_END_NAMESPACE #endif src/imports/000077500000000000000000000000001215142760100133415ustar00rootroot00000000000000src/imports/feedback/000077500000000000000000000000001215142760100150655ustar00rootroot00000000000000src/imports/feedback/feedback.pro000066400000000000000000000007531215142760100173400ustar00rootroot00000000000000QT = core qml feedback HEADERS += qdeclarativehapticseffect_p.h \ qdeclarativefileeffect_p.h \ qdeclarativethemeeffect_p.h \ qdeclarativefeedbackactuator_p.h \ qdeclarativefeedbackeffect_p.h SOURCES += qdeclarativehapticseffect.cpp \ qdeclarativefileeffect.cpp \ plugin.cpp \ qdeclarativethemeeffect.cpp \ qdeclarativefeedbackactuator.cpp \ qdeclarativefeedbackeffect.cpp load(qml_plugin) src/imports/feedback/plugin.cpp000066400000000000000000000067121215142760100170750ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "qdeclarativehapticseffect_p.h" #include "qdeclarativefileeffect_p.h" #include "qdeclarativethemeeffect_p.h" #include "qdeclarativefeedbackeffect_p.h" #include "qdeclarativefeedbackactuator_p.h" QT_USE_NAMESPACE static QObject *createDeclarativeThemeEfect(QQmlEngine *engine, QJSEngine *jsengine) { Q_UNUSED(engine) Q_UNUSED(jsengine) return new QDeclarativeThemeEffect; } class QDeclarativeFeedbackPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "plugin.json") public: virtual void registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtFeedback")); int major = 5; int minor = 0; qmlRegisterUncreatableType(uri, major, minor, "Feedback", "this is the feedback namespace"); qmlRegisterUncreatableType(uri, major, minor, "FeedbackEffect", "this is the base feedback effect class"); qmlRegisterType(uri, major, minor, "Actuator"); qmlRegisterType(uri, major, minor, "FileEffect"); qmlRegisterType(uri, major, minor, "HapticsEffect"); qmlRegisterType(uri, major, minor, "ThemeEffect"); qmlRegisterSingletonType("QtFeedback", major, minor, "EffectPlayer", createDeclarativeThemeEfect); } }; #include "plugin.moc" src/imports/feedback/plugin.json000066400000000000000000000000031215142760100172470ustar00rootroot00000000000000{} src/imports/feedback/plugins.qmltypes000066400000000000000000000111361215142760100203500ustar00rootroot00000000000000import QtQuick.tooling 1.1 // This file describes the plugin-supplied types contained in the library. // It is used for QML tooling purposes only. // // This file was auto-generated with the command 'qmlplugindump -notrelocatable QtFeedback 5.0'. Module { Component { name: "QDeclarativeFeedbackActuator" prototype: "QObject" exports: ["QtFeedback/Actuator 5.0"] exportMetaObjectRevisions: [0] Enum { name: "Capability" values: { "Envelope": 0, "Period": 1 } } Enum { name: "State" values: { "Busy": 0, "Ready": 1, "Unknown": 2 } } Property { name: "actuatorId"; type: "int"; isReadonly: true } Property { name: "name"; type: "string"; isReadonly: true } Property { name: "state"; type: "State"; isReadonly: true } Property { name: "valid"; type: "bool"; isReadonly: true } Property { name: "enabled"; type: "bool" } Method { name: "isCapabilitySupported" type: "bool" Parameter { name: "capability"; type: "Capability" } } } Component { name: "QDeclarativeFeedbackEffect" prototype: "QObject" exports: ["QtFeedback/Feedback 5.0", "QtFeedback/FeedbackEffect 5.0"] exportMetaObjectRevisions: [0, 0] Enum { name: "Duration" values: { "Infinite": -1 } } Enum { name: "State" values: { "Stopped": 0, "Paused": 1, "Running": 2, "Loading": 3 } } Enum { name: "ErrorType" values: { "UnknownError": 0, "DeviceBusy": 1 } } Property { name: "running"; type: "bool" } Property { name: "paused"; type: "bool" } Property { name: "duration"; type: "int" } Property { name: "state"; type: "State" } Property { name: "error"; type: "ErrorType"; isReadonly: true } Method { name: "updateState" } Method { name: "start" } Method { name: "stop" } Method { name: "pause" } } Component { name: "QDeclarativeFileEffect" prototype: "QDeclarativeFeedbackEffect" exports: ["QtFeedback/FileEffect 5.0"] exportMetaObjectRevisions: [0] Property { name: "loaded"; type: "bool" } Property { name: "source"; type: "QUrl" } Property { name: "supportedMimeTypes"; type: "QStringList"; isReadonly: true } Method { name: "load" } Method { name: "unload" } } Component { name: "QDeclarativeHapticsEffect" prototype: "QDeclarativeFeedbackEffect" exports: ["QtFeedback/HapticsEffect 5.0"] exportMetaObjectRevisions: [0] Property { name: "availableActuators" type: "QDeclarativeFeedbackActuator" isList: true isReadonly: true } Property { name: "intensity"; type: "double" } Property { name: "attackTime"; type: "int" } Property { name: "attackIntensity"; type: "double" } Property { name: "fadeTime"; type: "int" } Property { name: "fadeIntensity"; type: "double" } Property { name: "period"; type: "int" } Property { name: "actuator"; type: "QDeclarativeFeedbackActuator"; isPointer: true } } Component { name: "QDeclarativeThemeEffect" prototype: "QObject" exports: ["QtFeedback/EffectPlayer 5.0", "QtFeedback/ThemeEffect 5.0"] exportMetaObjectRevisions: [0, 0] Enum { name: "Effect" values: { "Undefined": -1, "Press": 0, "Release": 1, "PressWeak": 2, "ReleaseWeak": 3, "PressStrong": 4, "ReleaseStrong": 5, "DragStart": 6, "DragDropInZone": 7, "DragDropOutOfZone": 8, "DragCrossBoundary": 9, "Appear": 10, "Disappear": 11, "Move": 12, "NumberOfEffects": 13, "UserEffect": 65535 } } Property { name: "supported"; type: "bool"; isReadonly: true } Property { name: "effect"; type: "Effect" } Method { name: "play" } Method { name: "play" Parameter { name: "effect"; type: "Effect" } } } } src/imports/feedback/qdeclarativefeedbackactuator.cpp000066400000000000000000000117571215142760100234600ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qdeclarativefeedbackactuator_p.h" /*! \qmltype Actuator \instantiates QFeedbackActuator \brief The Actuator element represents a feedback actuator. \ingroup qml-feedback-api The Actuator class maps directly to the QFeedbackActuator C++ class, and can be used with HapticsEffect elements. There are several predefined enumerations and constants provided in this object: 1. Capability \list \li Envelope - Value specifying that the device can bound its intensity by an envelope. \li Period - Value specifying that the device can play periodic effects. \endlist 2. State \list \li Busy - The actuator is busy. \li Ready - The actuator is ready to play an effect. \li Unknown - The actuator is in an unknown state. \endlist \sa HapticsEffect, {QFeedbackActuator} */ QDeclarativeFeedbackActuator::QDeclarativeFeedbackActuator(QObject *parent) :QObject(parent) { d = new QFeedbackActuator(this); connect(d, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged())); } QDeclarativeFeedbackActuator::QDeclarativeFeedbackActuator(QObject *parent, QFeedbackActuator* actuator) :QObject(parent) { d = actuator; connect(d, SIGNAL(enabledChanged()), this, SIGNAL(enabledChanged())); } QFeedbackActuator* QDeclarativeFeedbackActuator::feedbackActuator() const { return d; } /*! \qmlproperty int Actuator::actuatorId This property holds the id of the feedback actuator. This property is read only. */ int QDeclarativeFeedbackActuator::actuatorId() const { return d->id(); } /*! \qmlproperty bool Actuator::valid This property is true if the actuator is valid. This property is read only. */ bool QDeclarativeFeedbackActuator::isValid() const { return d->isValid(); } /*! \qmlproperty string Actuator::name This property holds the name of the feedback actuator. This property is read only. */ QString QDeclarativeFeedbackActuator::name() const { return d->name(); } /*! \qmlproperty enumeration Actuator::state This property holds the state of the feedback actuator. This property is read only. */ QDeclarativeFeedbackActuator::State QDeclarativeFeedbackActuator::state() const { return static_cast(d->state()); } /*! \qmlmethod bool Actuator::isCapabilitySupported(enumeration capability) Returns if the actuator supports the supplied \a capability, available capabilities are: \list \li Envelope - Value specifying that the device can bound its intensity by an Envelope. \li Period - Value specifying that the device can play periodic effects. \endlist */ bool QDeclarativeFeedbackActuator::isCapabilitySupported(Capability capability) const { return d->isCapabilitySupported(static_cast(capability)); } /*! \qmlproperty bool Actuator::enabled This property is true if the feedback actuator is enabled. */ bool QDeclarativeFeedbackActuator::isEnabled() const { return d->isEnabled(); } void QDeclarativeFeedbackActuator::setEnabled(bool v) { d->setEnabled(v); } src/imports/feedback/qdeclarativefeedbackactuator_p.h000066400000000000000000000070641215142760100234400ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QDECLARATIVEFEEDBACKACTUATOR_P_H #define QDECLARATIVEFEEDBACKACTUATOR_P_H #include #include "qfeedbackactuator.h" QT_USE_NAMESPACE class QDeclarativeFeedbackActuator : public QObject { Q_OBJECT Q_PROPERTY(int actuatorId READ actuatorId) Q_PROPERTY(QString name READ name) Q_PROPERTY(State state READ state) Q_PROPERTY(bool valid READ isValid) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) Q_ENUMS(Capability) Q_ENUMS(State) public: enum Capability { Envelope = QFeedbackActuator::Envelope, Period = QFeedbackActuator::Period }; enum State { Busy = QFeedbackActuator::Busy, Ready = QFeedbackActuator::Ready, Unknown = QFeedbackActuator::Unknown }; explicit QDeclarativeFeedbackActuator(QObject *parent = 0); explicit QDeclarativeFeedbackActuator(QObject *parent, QFeedbackActuator* actuator); QFeedbackActuator* feedbackActuator() const; int actuatorId() const; bool isValid() const; QString name() const; State state() const; Q_INVOKABLE bool isCapabilitySupported(Capability capability) const; bool isEnabled() const; void setEnabled(bool v); signals: void enabledChanged(); private: QFeedbackActuator* d; }; QML_DECLARE_TYPE(QDeclarativeFeedbackActuator) #endif // QDECLARATIVEFEEDBACKACTUATOR_P_H src/imports/feedback/qdeclarativefeedbackeffect.cpp000066400000000000000000000202211215142760100230540ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qdeclarativefeedbackeffect_p.h" /*! \qmltype FeedbackEffect \instantiates QDeclarativeFeedbackEffect \brief The FeedbackEffect element is the base class for all feedback effects. \ingroup qml-feedback-api You can't create one of these elements directly, but several other elements inherit the methods and properties of these elements. There are several predefined enumerations and constants provided in this class: 1. Duration This enum describes the possible predefined duration types. Generally a specific value in milliseconds can be supplied instead of one of these values. \list \li Feedback.Infinite - Infinite effect duration \endlist 2. State This enum describes the state of the effect. An effect will be in one of these states. \list \li Feedback.Stopped - The effect is not running. This is the initial state. \li Feedback.Paused - The effect is paused. \li Feedback.Running - The effect is running. \li Feedback.Loading - The effect is loading. \endlist 3. ErrorType This enum describes the possible errors happening on the effect. \list \li Feedback.UnknownError - An unknown error occurred. \li Feedback.DeviceBusy - The feedback could not start because the device is busy, the device could be busy if a higher-priority client is using the haptics/actuator device. \endlist \sa FileEffect, ThemeEffect, HapticsEffect, {QFeedbackEffect} */ QDeclarativeFeedbackEffect::QDeclarativeFeedbackEffect(QObject *parent) : QObject(parent), m_running(false), m_paused(false), m_error(UnknownError) { } void QDeclarativeFeedbackEffect::setFeedbackEffect(QFeedbackEffect* effect) { m_effect = effect; QObject::connect(m_effect, SIGNAL(stateChanged()), this, SLOT(updateState())); QObject::connect(m_effect, SIGNAL(error(QFeedbackEffect::ErrorType)), this, SLOT(_error(QFeedbackEffect::ErrorType))); } QFeedbackEffect* QDeclarativeFeedbackEffect::feedbackEffect() { return m_effect; } /*! \qmlproperty bool FeedbackEffect::running This property is true if this feedback effect is running. */ bool QDeclarativeFeedbackEffect::isRunning() const { return m_running; } void QDeclarativeFeedbackEffect::setRunning(bool running) { QDeclarativeFeedbackEffect::State currentState = static_cast(m_effect->state()); if (currentState != QDeclarativeFeedbackEffect::Running && running) { m_running = true; m_effect->start(); emit runningChanged(); } else if (currentState != QDeclarativeFeedbackEffect::Stopped && !running) { m_running = false; m_effect->stop(); emit runningChanged(); } } /*! \qmlproperty bool FeedbackEffect::paused This property is true if this feedback effect is paused. */ bool QDeclarativeFeedbackEffect::isPaused() const { return m_paused; } void QDeclarativeFeedbackEffect::setPaused(bool paused) { QDeclarativeFeedbackEffect::State currentState = static_cast(m_effect->state()); if (currentState == QDeclarativeFeedbackEffect::Paused && !paused) { m_paused = true; m_effect->start(); emit pausedChanged(); } else if (currentState == QDeclarativeFeedbackEffect::Running && paused) { paused = false; m_effect->pause(); emit pausedChanged(); } } /*! \qmlproperty int FeedbackEffect::duration The duration of the effect, in milliseconds. This is 0 for effects of unknown duration, or Feedback.Infinite for effects that don't stop. \sa Feedback */ int QDeclarativeFeedbackEffect::duration() const { return m_effect->duration(); } void QDeclarativeFeedbackEffect::setDuration(int newDuration) { Q_UNUSED(newDuration) //default do nothing } /*! \qmlproperty FeedbackEffect::State FeedbackEffect::state This is the current state of the effect. It is one of: \list \li Feedback.Stopped - the effect is not playing. \li Feedback.Loading - the effect is being loaded. \li Feedback.Running - the effect is playing. \li Feedback.Paused - the effect was being played, but is now paused. \endlist \sa Feedback */ QDeclarativeFeedbackEffect::State QDeclarativeFeedbackEffect::state() const { return static_cast(m_effect->state()); } void QDeclarativeFeedbackEffect::setState(QDeclarativeFeedbackEffect::State newState) { Q_UNUSED(newState) //default do nothing } /*! \qmlproperty Feedback::ErrorType FeedbackEffect::error This property holds the error status of the FeedbackEffect. The error is one of the following values: \list \li Feedback.UnknownError - An unknown error occurred. \li Feedback.DeviceBusy - The device resource is already being used. \endlist \sa Feedback, QFeedbackEffect::ErrorType */ QDeclarativeFeedbackEffect::ErrorType QDeclarativeFeedbackEffect::error() const { return m_error; } /*! \qmlmethod Feedback::updateState() updates the state of the effect. */ void QDeclarativeFeedbackEffect::updateState() { bool running = m_effect->state() == QFeedbackEffect::Running; bool paused = m_effect->state() == QFeedbackEffect::Paused; if (running != m_running) { m_running = running; emit runningChanged(); } if (paused != m_paused) { m_paused = paused; emit pausedChanged(); } emit stateChanged(); } /*! \qmlmethod Feedback::start() makes sure that the effect associated with the feedback object is started. \sa QFeedbackEffect::start() */ void QDeclarativeFeedbackEffect::start() { m_effect->start(); } /*! \qmlmethod Feedback::stop() makes sure that the effect associated with the feedback object is stoped. \sa QFeedbackEffect::stop() */ void QDeclarativeFeedbackEffect::stop() { m_effect->stop(); } /*! \qmlmethod Feedback::pause() makes sure that the effect associated with the feedback object is paused. \sa QFeedbackEffect::pause() */ void QDeclarativeFeedbackEffect::pause() { m_effect->pause(); } void QDeclarativeFeedbackEffect::_error(QFeedbackEffect::ErrorType err) { if (static_cast(err) != m_error) { m_error = static_cast(err); emit errorChanged(); } } src/imports/feedback/qdeclarativefeedbackeffect_p.h000066400000000000000000000102401215142760100230400ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QDECLARATIVEFEEDBACKEFFECT_P_H #define QDECLARATIVEFEEDBACKEFFECT_P_H #include #include QT_USE_NAMESPACE class QDeclarativeFeedbackEffect : public QObject { Q_OBJECT Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) Q_PROPERTY(int duration READ duration WRITE setDuration NOTIFY durationChanged) Q_PROPERTY(State state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(ErrorType error READ error NOTIFY errorChanged) Q_ENUMS(Duration) Q_ENUMS(State) Q_ENUMS(ErrorType) public: enum Duration { Infinite = QFeedbackEffect::Infinite }; enum State { Stopped = QFeedbackEffect::Stopped, Paused = QFeedbackEffect::Paused, Running = QFeedbackEffect::Running, Loading = QFeedbackEffect::Loading }; enum ErrorType { UnknownError = QFeedbackEffect::UnknownError, DeviceBusy = QFeedbackEffect::DeviceBusy }; QDeclarativeFeedbackEffect(QObject *parent = 0); void setFeedbackEffect(QFeedbackEffect* effect); QFeedbackEffect* feedbackEffect(); bool isRunning() const; bool isPaused() const; void setRunning(bool running); void setPaused(bool paused); virtual State state() const; virtual int duration() const; virtual void setState(State newState); virtual void setDuration(int newDuration); ErrorType error() const; signals: void runningChanged(); void pausedChanged(); void durationChanged(); void stateChanged(); void errorChanged(); public slots: void updateState(); void start(); void stop(); void pause(); private slots: void _error(QFeedbackEffect::ErrorType err); private: bool m_running; bool m_paused; QFeedbackEffect* m_effect; ErrorType m_error; }; QML_DECLARE_TYPE(QDeclarativeFeedbackEffect) #endif // QDECLARATIVEFEEDBACKEFFECT_P_H src/imports/feedback/qdeclarativefileeffect.cpp000066400000000000000000000075561215142760100222670ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qdeclarativefileeffect_p.h" /*! \internal \qmltype FileEffect \brief The FileEffect element represents feedback data stored in a file. \ingroup qml-feedback-api \inherits FeedbackEffect \snippet doc/src/snippets/declarative/declarative-feedback.qml File Effect \sa HapticsEffect, {QFeedbackActuator} */ QDeclarativeFileEffect::QDeclarativeFileEffect(QObject *parent) : QDeclarativeFeedbackEffect(parent) { d = new QFeedbackFileEffect(this); setFeedbackEffect(d); } /*! \qmlproperty bool FileEffect::loaded This property is true if this feedback effect is loaded. */ bool QDeclarativeFileEffect::isLoaded() const { return d->isLoaded(); } void QDeclarativeFileEffect::setLoaded(bool v) { if (v != d->isLoaded()) { d->setLoaded(v); emit loadedChanged(); } } /*! \qmlproperty url FileEffect::source This property stores the URL for the feedback data. */ QUrl QDeclarativeFileEffect::source() const { return d->source(); } void QDeclarativeFileEffect::setSource(const QUrl & url) { if (url != d->source()) { d->setSource(url); emit sourceChanged(); } } /*! \qmlproperty list FileEffect::supportedMimeTypes This property holds the MIME types supported for playing effects from a file. */ QStringList QDeclarativeFileEffect::supportedMimeTypes() { return d->supportedMimeTypes(); } /*! \qmlmethod FileEffect::load() Makes sure that the file associated with the feedback object is loaded. \sa QFeedbackFileEffect::load() */ void QDeclarativeFileEffect::load() { if (!isLoaded()) { d->load(); emit loadedChanged(); } } /*! \qmlmethod FileEffect::unload() Makes sure that the file associated with the feedback object is unloaded. \sa QFeedbackFileEffect::unload() */ void QDeclarativeFileEffect::unload() { if (isLoaded()) { d->unload(); emit loadedChanged(); } } src/imports/feedback/qdeclarativefileeffect_p.h000066400000000000000000000060711215142760100222420ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QDECLARATIVEFILEEFFECT_P_H #define QDECLARATIVEFILEEFFECT_P_H #include "qdeclarativefeedbackeffect_p.h" QT_USE_NAMESPACE class QDeclarativeFileEffect : public QDeclarativeFeedbackEffect { Q_OBJECT Q_PROPERTY(bool loaded READ isLoaded WRITE setLoaded NOTIFY loadedChanged) Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QStringList supportedMimeTypes READ supportedMimeTypes) public: explicit QDeclarativeFileEffect(QObject *parent = 0); bool isLoaded() const; void setLoaded(bool v); QUrl source() const; void setSource(const QUrl & url); QStringList supportedMimeTypes(); signals: void loadedChanged(); void sourceChanged(); public slots: void load(); void unload(); private: QFeedbackFileEffect* d; }; QML_DECLARE_TYPE(QDeclarativeFileEffect) #endif // QDECLARATIVEFILEEFFECT_P_H src/imports/feedback/qdeclarativehapticseffect.cpp000066400000000000000000000166361215142760100230020ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qdeclarativehapticseffect_p.h" /*! \qmltype HapticsEffect \brief The HapticsEffect element represents a custom haptic feedback effect. \ingroup qml-feedback-api \inherits FeedbackEffect This class closely corresponds to the C++ \l QFeedbackHapticsEffect class. \snippet doc/src/snippets/declarative/declarative-feedback.qml Haptics Effect \sa Actuator, {QFeedbackHapticsEffect} */ QDeclarativeHapticsEffect::QDeclarativeHapticsEffect(QObject *parent) : QDeclarativeFeedbackEffect(parent), m_actuator(0) { d = new QFeedbackHapticsEffect(this); setFeedbackEffect(d); QFeedbackActuator* fa = d->actuator(); QList actuators = QFeedbackActuator::actuators(); foreach (QFeedbackActuator* actuator, actuators) { QDeclarativeFeedbackActuator* dfa; dfa = new QDeclarativeFeedbackActuator(this, actuator); if (fa && *fa == *actuator) { m_actuator = dfa; } m_actuators.push_back(dfa); } } void QDeclarativeHapticsEffect::setDuration(int msecs) { if (msecs != d->duration()) { d->setDuration(msecs); emit durationChanged(); } } int QDeclarativeHapticsEffect::duration() const { return d->duration(); } /*! \qmlproperty double HapticsEffect::intensity The intensity of the main part of the haptics effect, from 0.0 to 1.0. */ void QDeclarativeHapticsEffect::setIntensity(qreal intensity) { if (!qFuzzyCompare(intensity, d->intensity())) { d->setIntensity(intensity); emit intensityChanged(); } } qreal QDeclarativeHapticsEffect::intensity() const { return d->intensity(); } /*! \qmlproperty int HapticsEffect::attackTime The duration of the attack (fade-in) part of the haptics effect. */ void QDeclarativeHapticsEffect::setAttackTime(int msecs) { if (msecs != d->attackTime()) { d->setAttackTime(msecs); emit attackTimeChanged(); } } int QDeclarativeHapticsEffect::attackTime() const { return d->attackTime(); } /*! \qmlproperty double HapticsEffect::attackIntensity The intensity of the attack (fade-in) part of the haptics effect, from 0.0 to 1.0. */ void QDeclarativeHapticsEffect::setAttackIntensity(qreal intensity) { if (!qFuzzyCompare(intensity, d->attackIntensity())) { d->setAttackIntensity(intensity); emit intensityChanged(); } } qreal QDeclarativeHapticsEffect::attackIntensity() const { return d->attackIntensity(); } /*! \qmlproperty int HapticsEffect::fadeTime The duration of the fade-out part of the haptics effect. */ void QDeclarativeHapticsEffect::setFadeTime(int msecs) { if (msecs != d->fadeTime()) { d->setFadeTime(msecs); emit fadeTimeChanged(); } } int QDeclarativeHapticsEffect::fadeTime() const { return d->fadeTime(); } void QDeclarativeHapticsEffect::setFadeIntensity(qreal intensity) { if (!qFuzzyCompare(intensity, d->fadeIntensity())) { d->setFadeIntensity(intensity); emit fadeIntensityChanged(); } } /*! \qmlproperty double HapticsEffect::fadeIntensity The intensity of the fade-out part of the haptics effect, from 0.0 to 1.0. */ qreal QDeclarativeHapticsEffect::fadeIntensity() const { return d->fadeIntensity(); } /*! \qmlproperty int HapticsEffect::period The period of the haptics effect. If the period is zero, the effect will not repeat. If it is non-zero, the effect will repeat every period milliseconds. */ void QDeclarativeHapticsEffect::setPeriod(int msecs) { if (msecs != d->period()) { d->setPeriod(msecs); emit periodChanged(); } } int QDeclarativeHapticsEffect::period() const { return d->period(); } /*! \qmlproperty Actuator HapticsEffect::actuator The actuator that is used for playing this effect. \sa Actuator */ void QDeclarativeHapticsEffect::setActuator(QDeclarativeFeedbackActuator *actuator) { if (actuator != m_actuator) { if (!actuator || !m_actuator || !(*(actuator->feedbackActuator()) == *(m_actuator->feedbackActuator()))) { m_actuator = actuator; d->setActuator(m_actuator ? m_actuator->feedbackActuator() : 0); emit actuatorChanged(); } } } QDeclarativeFeedbackActuator* QDeclarativeHapticsEffect::actuator() const { return m_actuator; } /*! \qmlproperty list HapticsEffect::availableActuators This property holds a list of available actuators. This property is read only. \sa Actuator */ QQmlListProperty QDeclarativeHapticsEffect::availableActuators() { return QQmlListProperty(this, 0, 0 /*appending actuators are not allowed*/, actuator_count, actuator_at, 0 /*removing actuators are not allowed*/); } int QDeclarativeHapticsEffect::actuator_count(QQmlListProperty *prop) { return static_cast(prop->object)->m_actuators.size(); } QDeclarativeFeedbackActuator* QDeclarativeHapticsEffect::actuator_at(QQmlListProperty *prop, int index) { return static_cast(prop->object)->m_actuators.at(index); } src/imports/feedback/qdeclarativehapticseffect_p.h000066400000000000000000000110751215142760100227560ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QDECLARATIVEHAPTICSEFFECT_P_H #define QDECLARATIVEHAPTICSEFFECT_P_H #include "qdeclarativefeedbackeffect_p.h" #include "qdeclarativefeedbackactuator_p.h" QT_USE_NAMESPACE class QDeclarativeHapticsEffect : public QDeclarativeFeedbackEffect { Q_OBJECT Q_PROPERTY(QQmlListProperty availableActuators READ availableActuators) Q_PROPERTY(qreal intensity READ intensity WRITE setIntensity NOTIFY intensityChanged) Q_PROPERTY(int attackTime READ attackTime WRITE setAttackTime NOTIFY attackTimeChanged) Q_PROPERTY(qreal attackIntensity READ attackIntensity WRITE setAttackIntensity NOTIFY attackIntensityChanged) Q_PROPERTY(int fadeTime READ fadeTime WRITE setFadeTime NOTIFY fadeTimeChanged) Q_PROPERTY(qreal fadeIntensity READ fadeIntensity WRITE setFadeIntensity NOTIFY fadeIntensityChanged) Q_PROPERTY(int period READ period WRITE setPeriod NOTIFY periodChanged) Q_PROPERTY(QDeclarativeFeedbackActuator* actuator READ actuator WRITE setActuator NOTIFY actuatorChanged) public: explicit QDeclarativeHapticsEffect(QObject *parent = 0); void setDuration(int msecs); int duration() const; void setIntensity(qreal intensity); qreal intensity() const; //the envelope void setAttackTime(int msecs); int attackTime() const; void setAttackIntensity(qreal intensity); qreal attackIntensity() const; void setFadeTime(int msecs); int fadeTime() const; void setFadeIntensity(qreal intensity); qreal fadeIntensity() const; void setPeriod(int msecs); int period() const; void setActuator(QDeclarativeFeedbackActuator *actuator); QDeclarativeFeedbackActuator* actuator() const; QQmlListProperty availableActuators(); static int actuator_count(QQmlListProperty *prop); static QDeclarativeFeedbackActuator *actuator_at(QQmlListProperty *prop, int index); signals: void intensityChanged(); void attackTimeChanged(); void attackIntensityChanged(); void fadeTimeChanged(); void fadeIntensityChanged(); void periodChanged(); void actuatorChanged(); private: QFeedbackHapticsEffect* d; QList m_actuators; QDeclarativeFeedbackActuator* m_actuator; }; QML_DECLARE_TYPE(QDeclarativeHapticsEffect) #endif // QDECLARATIVEHAPTICSEFFECT_P_H src/imports/feedback/qdeclarativethemeeffect.cpp000066400000000000000000000110371215142760100224370ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qdeclarativethemeeffect_p.h" /*! \qmltype ThemeEffect \brief The ThemeEffect element represents a themed feedback effect. \ingroup qml-feedback-api This element is used for playing feedback effects that follow the system theme. The actual feedback might be haptic, audio or some other method. \snippet doc/src/snippets/declarative/declarative-feedback.qml Theme */ QDeclarativeThemeEffect::QDeclarativeThemeEffect(QObject *parent) : QObject(parent), m_effect(QDeclarativeThemeEffect::Undefined) { } /*! \qmlproperty bool ThemeEffect::supported This property is true if the system supports themed feedback effects. */ bool QDeclarativeThemeEffect::effectSupported() { return QFeedbackEffect::supportsThemeEffect(); } /*! \qmlproperty ThemeEffect ThemeEffect::effect This property holds the specific themed effect type to play. It is one of: \li Effect.Undefined - Undefined feedback. No feedback is given. \li Effect.Press - Feedback for when the screen is pressed. \li Effect.Release - Feedback for touch release. \li Effect.PressWeak - A weak feedback for press. \li Effect.ReleaseWeak - A weak feedback for release. \li Effect.PressStrong - A strong feedback for press. \li Effect.ReleaseStrong - A strong feedback for release. \li Effect.DragStart - Feedback for when dragging starts. \li Effect.DragDropInZone - Feedback for when dragging ends and touch is released inside a drop zone. \li Effect.DragDropOutOfZone - Feedback for when dragging ends and touch is released outside a drop zone. \li Effect.DragCrossBoundary - Feedback for when crossing a boundary while dragging. \li Effect.Appear - Feedback for when an item is shown. \li Effect.Disappear - Feedback for when an item item is closed. \li Effect.Move - Feedback for dragging on screen. \endlist \sa QFeedbackEffect::Effect */ void QDeclarativeThemeEffect::setEffect(QDeclarativeThemeEffect::Effect effect) { if (m_effect != effect) { m_effect = effect; emit effectChanged(); } } QDeclarativeThemeEffect::Effect QDeclarativeThemeEffect::effect() const { return m_effect; } /*! \qmlmethod ThemeEffect::play() Call this to play the themed effect. */ void QDeclarativeThemeEffect::play() { QFeedbackEffect::playThemeEffect(static_cast(m_effect)); } /*! \qmlmethod ThemeEffect::play(Effect) Call this to play the themed effect passed as parameter. */ void QDeclarativeThemeEffect::play(Effect effect) { QFeedbackEffect::playThemeEffect(static_cast(effect)); } src/imports/feedback/qdeclarativethemeeffect_p.h000066400000000000000000000075141215142760100224300ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QDECLARATIVETHEMEEFFECT_P_H #define QDECLARATIVETHEMEEFFECT_P_H #include #include QT_USE_NAMESPACE // Wrapper for theme effects class QDeclarativeThemeEffect : public QObject { Q_OBJECT Q_PROPERTY(bool supported READ effectSupported) Q_PROPERTY(Effect effect READ effect WRITE setEffect NOTIFY effectChanged) Q_CLASSINFO("DefaultMethod", "play()") Q_CLASSINFO("OverloadedMethod", "play(Effect)") Q_ENUMS(Effect) public: enum Effect { Undefined = QFeedbackEffect::Undefined, Press = QFeedbackEffect::Press, Release = QFeedbackEffect::Release, PressWeak = QFeedbackEffect::PressWeak, ReleaseWeak = QFeedbackEffect::ReleaseWeak, PressStrong = QFeedbackEffect::PressStrong, ReleaseStrong = QFeedbackEffect::ReleaseStrong, DragStart = QFeedbackEffect::DragStart, DragDropInZone = QFeedbackEffect::DragDropInZone, DragDropOutOfZone = QFeedbackEffect::DragDropOutOfZone, DragCrossBoundary = QFeedbackEffect::DragCrossBoundary, Appear = QFeedbackEffect::Appear, Disappear = QFeedbackEffect::Disappear, Move = QFeedbackEffect::Move, NumberOfEffects = QFeedbackEffect::NumberOfEffects, UserEffect = QFeedbackEffect::UserEffect }; QDeclarativeThemeEffect(QObject *parent = 0); bool effectSupported(); void setEffect(Effect effect); Effect effect() const; public slots: void play(); void play(Effect effect); signals: void effectChanged(); public: Effect m_effect; }; QML_DECLARE_TYPE(QDeclarativeThemeEffect) #endif // QDECLARATIVETHEMEEFFECT_P_H src/imports/feedback/qmldir000066400000000000000000000001101215142760100162700ustar00rootroot00000000000000module QtFeedback plugin declarative_feedback typeinfo plugins.qmltypes src/imports/imports.pro000066400000000000000000000000471215142760100155610ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += feedback src/plugins/000077500000000000000000000000001215142760100133255ustar00rootroot00000000000000src/plugins/feedback/000077500000000000000000000000001215142760100150515ustar00rootroot00000000000000src/plugins/feedback/feedback.pro000066400000000000000000000004751215142760100173250ustar00rootroot00000000000000TEMPLATE = subdirs contains(immersion_enabled, yes) { message("Building with Immersion TouchSense support") SUBDIRS += immersion } contains(meegotouchfeedback_enabled, yes) { message("Building with meegotouch theme haptics support") SUBDIRS += meegotouch } qtHaveModule(multimedia): SUBDIRS += mmk src/plugins/feedback/immersion/000077500000000000000000000000001215142760100170535ustar00rootroot00000000000000src/plugins/feedback/immersion/immersion.json000066400000000000000000000001141215142760100217440ustar00rootroot00000000000000{ "Interfaces": [ "QFeedbackHapticsInterface", "QFeedbackFileInterface" ] } src/plugins/feedback/immersion/immersion.pro000066400000000000000000000002351215142760100215770ustar00rootroot00000000000000TARGET = qtfeedback_immersion QT = core feedback PLUGIN_TYPE = feedback load(qt_plugin) HEADERS += qfeedback.h SOURCES += qfeedback.cpp LIBS += -limmvibe src/plugins/feedback/immersion/qfeedback.cpp000066400000000000000000000430151215142760100214670ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "qfeedback.h" #include #include #include #include #include #include #include #include #define MAX_FILE_SIZE (1 << 14) //16KB QFeedbackImmersion::QFeedbackImmersion() : QObject(qApp) { if (VIBE_FAILED(ImmVibeInitialize(VIBE_CURRENT_VERSION_NUMBER))) { //that should be done once //error management qWarning() << "the Immersion library could not be initialized"; } else { const int nbDev = ImmVibeGetDeviceCount(); for (int i = 0; i < nbDev; ++i) { actuatorList << createFeedbackActuator(this, i); } } } QFeedbackImmersion::~QFeedbackImmersion() { //cleanup the devices when terminating for (int i = 0 ; i < actuatorHandles.size(); ++i) ImmVibeCloseDevice(actuatorHandles.at(i)); ImmVibeTerminate(); } QFeedbackInterface::PluginPriority QFeedbackImmersion::pluginPriority() { return PluginNormalPriority; } QList QFeedbackImmersion::actuators() { return actuatorList; } void QFeedbackImmersion::setActuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop, const QVariant &value) { switch (prop) { case Enabled: ImmVibeSetDevicePropertyBool(handleForActuator(actuator), VIBE_DEVPROPTYPE_DISABLE_EFFECTS, !value.toBool()); break; default: break; } } QVariant QFeedbackImmersion::actuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop) { switch (prop) { case Name: { char szDeviceName[VIBE_MAX_DEVICE_NAME_LENGTH] = { 0 }; if (VIBE_FAILED(ImmVibeGetDeviceCapabilityString(actuator.id(), VIBE_DEVCAPTYPE_DEVICE_NAME, VIBE_MAX_CAPABILITY_STRING_LENGTH, szDeviceName))) return QString(); return QString::fromLocal8Bit(szDeviceName); } case State: { QFeedbackActuator::State ret = QFeedbackActuator::Unknown; VibeInt32 s = 0; if (actuator.isValid() && VIBE_SUCCEEDED(ImmVibeGetDeviceState(actuator.id(), &s))) { if (s == VIBE_DEVICESTATE_ATTACHED) ret = QFeedbackActuator::Ready; else if (s == VIBE_DEVICESTATE_BUSY) ret = QFeedbackActuator:: Busy; } return ret; } case Enabled: { VibeBool disabled = true; if (VIBE_FAILED(ImmVibeGetDevicePropertyBool(handleForActuator(actuator), VIBE_DEVPROPTYPE_DISABLE_EFFECTS, &disabled))) return false; return !disabled; } default: return QVariant(); } } bool QFeedbackImmersion::isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability cap) { switch(cap) { case QFeedbackActuator::Envelope: case QFeedbackActuator::Period: return true; default: return false; } } VibeInt32 QFeedbackImmersion::convertedDuration(int duration) { //this allows to manage the infinite durations if (duration == -1) return VIBE_TIME_INFINITE; return duration; } VibeInt32 QFeedbackImmersion::handleForActuator(const QFeedbackActuator &actuator) { return handleForActuator(actuator.id()); } VibeInt32 QFeedbackImmersion::handleForActuator(int actId) { if (actId < 0) return VIBE_INVALID_DEVICE_HANDLE_VALUE; //we avoid locking too much (it will only lock if the device is not yet open if (actuatorHandles.size() <= actId) { QMutexLocker locker(&mutex); while (actuatorHandles.size() <= actId) actuatorHandles.append(VIBE_INVALID_DEVICE_HANDLE_VALUE); } if (VIBE_IS_INVALID_DEVICE_HANDLE(actuatorHandles.at(actId))) { QMutexLocker locker(&mutex); if (VIBE_IS_INVALID_DEVICE_HANDLE(actuatorHandles.at(actId))) { ImmVibeOpenDevice(actId, &actuatorHandles[actId] ); //temporary solution: provide a proto dev license key ImmVibeSetDevicePropertyString(actuatorHandles.at(actId), VIBE_DEVPROPTYPE_LICENSE_KEY, "IMWPROTOSJZF4EH6KWVUK8HAP5WACT6Q"); } } return actuatorHandles.at(actId); } void QFeedbackImmersion::updateEffectProperty(const QFeedbackHapticsEffect *effect, EffectProperty) { VibeInt32 effectHandle = effectHandles.value(effect, VIBE_INVALID_EFFECT_HANDLE_VALUE); if (VIBE_IS_INVALID_EFFECT_HANDLE(effectHandle)) return; // the effect is simply not running VibeStatus status = VIBE_S_SUCCESS; if (effect->period() > 0) { status = ImmVibeModifyPlayingPeriodicEffect(handleForActuator(effect->actuator()), effectHandle, convertedDuration(effect->duration()), effect->intensity() * qreal(VIBE_MAX_MAGNITUDE), effect->period(), VIBE_DEFAULT_STYLE, effect->attackTime(), effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE), effect->fadeTime(), effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE)); } else { status = ImmVibeModifyPlayingMagSweepEffect(handleForActuator(effect->actuator()), effectHandle, convertedDuration(effect->duration()), effect->intensity() * qreal(VIBE_MAX_MAGNITUDE), VIBE_DEFAULT_STYLE, effect->attackTime(), effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE), effect->fadeTime(), effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE)); } // Hmm. Not sure if the duration needs to be updated or not if (VIBE_SUCCEEDED(status)) { startTimerForHandle(effectHandle, effect); // this will kill old one, if necessary } if (VIBE_FAILED(status)) reportError(effect, QFeedbackEffect::UnknownError); } void QFeedbackImmersion::killTimerForHandle(VibeInt32 handle) { QTimer* t = effectTimers.take(handle); if (t) { t->stop(); delete t; } } void QFeedbackImmersion::startTimerForHandle(VibeInt32 handle, const QFeedbackHapticsEffect *effect) { // Make sure we don't have one already killTimerForHandle(handle); // And create a timer for a non infinite, non periodic effect if (effect->period() <= 0 && effect->duration() > 0) { QTimer* t = new QTimer(); t->setSingleShot(true); t->setInterval(effect->duration() + effect->attackTime() + effect->fadeTime()); connect(t, SIGNAL(timeout()), const_cast(effect), SIGNAL(stateChanged())); effectTimers.insert(handle, t); t->start(); } } void QFeedbackImmersion::startTimerForHandle(VibeInt32 handle, QFeedbackFileEffect *effect) { // Make sure we don't have one already killTimerForHandle(handle); // And create a timer for a non infinite effect if (effect->duration() > 0) { QTimer* t = new QTimer(); t->setSingleShot(true); t->setInterval(effect->duration()); connect(t, SIGNAL(timeout()), effect, SIGNAL(stateChanged())); effectTimers.insert(handle, t); t->start(); } } void QFeedbackImmersion::setEffectState(const QFeedbackHapticsEffect *effect, QFeedbackEffect::State state) { VibeStatus status = VIBE_S_SUCCESS; VibeInt32 effectHandle = effectHandles.value(effect, VIBE_INVALID_EFFECT_HANDLE_VALUE); switch (state) { case QFeedbackEffect::Stopped: if (VIBE_IS_VALID_EFFECT_HANDLE(effectHandle)) { status = ImmVibeStopPlayingEffect(handleForActuator(effect->actuator()), effectHandle); effectHandles.remove(effect); killTimerForHandle(effectHandle); } break; case QFeedbackEffect::Paused: Q_ASSERT(VIBE_IS_VALID_EFFECT_HANDLE(effectHandle)); status = ImmVibePausePlayingEffect(handleForActuator(effect->actuator()), effectHandle); killTimerForHandle(effectHandle); break; case QFeedbackEffect::Running: //if the effect handle exists, the feedback must be paused if (VIBE_IS_VALID_EFFECT_HANDLE(effectHandle)) { status = ImmVibeResumePausedEffect(handleForActuator(effect->actuator()), effectHandle); // Restart a timer if needed (only aperiodic ones) if (VIBE_SUCCEEDED(status)) { startTimerForHandle(effectHandle, effect); } } else { //we need to start the effect and create the handle VibeInt32 effectHandle = VIBE_INVALID_EFFECT_HANDLE_VALUE; if (effect->period() > 0) { status = ImmVibePlayPeriodicEffect(handleForActuator(effect->actuator()), convertedDuration(effect->duration()), qRound(effect->intensity() * qreal(VIBE_MAX_MAGNITUDE)), effect->period(), VIBE_DEFAULT_STYLE, effect->attackTime(), effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE), effect->fadeTime(), effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE), &effectHandle); } else { status = ImmVibePlayMagSweepEffect(handleForActuator(effect->actuator()), convertedDuration(effect->duration()), qRound(effect->intensity() * qreal(VIBE_MAX_MAGNITUDE)), VIBE_DEFAULT_STYLE, effect->attackTime(), effect->attackIntensity() * qreal(VIBE_MAX_MAGNITUDE), effect->fadeTime(), effect->fadeIntensity() * qreal(VIBE_MAX_MAGNITUDE), &effectHandle); } if (VIBE_SUCCEEDED(status)) { effectHandles.insert(effect, effectHandle); startTimerForHandle(effectHandle, effect); } } break; default: break; } } QFeedbackEffect::State QFeedbackImmersion::effectState(const QFeedbackHapticsEffect *effect) { VibeInt32 effectHandle = effectHandles.value(effect, VIBE_INVALID_EFFECT_HANDLE_VALUE); if (VIBE_IS_INVALID_EFFECT_HANDLE(effectHandle)) return QFeedbackEffect::Stopped; // the effect is simply not running VibeInt32 effectState = VIBE_EFFECT_STATE_NOT_PLAYING; ImmVibeGetEffectState(handleForActuator(effect->actuator()), effectHandle, &effectState); return updateImmState(effect, effectHandle, effectState); } // ************************** // !!! File based stuff below // ************************** void QFeedbackImmersion::setLoaded(QFeedbackFileEffect *effect, bool load) { const QUrl url = effect->source(); // This doesn't handle qrc urls.. const QString fileName = url.toLocalFile(); if (fileName.isEmpty()) return; if (!load && !fileData.contains(fileName)) return; FileContent &fc = fileData[fileName]; if (load) { bool success = true; if (fc.refCount == 0) { //we need to load the file QFile file(fileName); success = false; if (file.size() < MAX_FILE_SIZE && file.open(QIODevice::ReadOnly)) { fc.ba = file.readAll(); //now let's try to check the file content with immersion if (VIBE_FAILED(ImmVibeGetIVTEffectCount(fc.constData()))) { fileData.remove(fileName); } else { fc.refCount++; success = true; } } } reportLoadFinished(effect, success); } else { //unload if (fc.refCount > 0) fc.refCount--; if (fc.refCount == 0) fileData.remove(fileName); } } void QFeedbackImmersion::setEffectState(QFeedbackFileEffect *effect, QFeedbackEffect::State state) { VibeStatus status = VIBE_S_SUCCESS; VibeInt32 effectHandle = effectHandles.value(effect, VIBE_INVALID_EFFECT_HANDLE_VALUE); VibeInt32 dev = handleForActuator(0); //we always use the default (first) device switch (state) { case QFeedbackEffect::Stopped: if (VIBE_IS_VALID_EFFECT_HANDLE(effectHandle)) { status = ImmVibeStopPlayingEffect(dev, effectHandle); effectHandles.remove(effect); killTimerForHandle(effectHandle); } break; case QFeedbackEffect::Paused: Q_ASSERT(VIBE_IS_VALID_EFFECT_HANDLE(effectHandle)); status = ImmVibePausePlayingEffect(dev, effectHandle); killTimerForHandle(effectHandle); break; case QFeedbackEffect::Running: //if the effect handle exists, the feedback must be paused if (VIBE_IS_VALID_EFFECT_HANDLE(effectHandle)) { status = ImmVibeResumePausedEffect(dev, effectHandle); if (VIBE_SUCCEEDED(status)) { startTimerForHandle(effectHandle, effect); } } else { //we need to start the effect and create the handle QString fileName = effect->source().toLocalFile(); Q_ASSERT(fileData.contains(fileName)); status = ImmVibePlayIVTEffect(dev, fileData[fileName].constData(), 0, &effectHandle); if (VIBE_SUCCEEDED(status)) { effectHandles.insert(effect, effectHandle); startTimerForHandle(effectHandle, effect); } } break; default: break; } if (VIBE_FAILED(status)) reportError(effect, QFeedbackEffect::UnknownError); } QFeedbackEffect::State QFeedbackImmersion::updateImmState(const QFeedbackEffect *effect, VibeInt32 effectHandle, VibeInt32 effectState) { // here we detect changes in the state of the effect // and make sure any timers are updated switch(effectState) { case VIBE_EFFECT_STATE_PAUSED: killTimerForHandle(effectHandle); return QFeedbackEffect::Paused; case VIBE_EFFECT_STATE_PLAYING: { // If the timer existed and is not running, we probably need // to reschedule it so the effect state can be up to date QTimer *t = effectTimers.value(effectHandle); if (t && !t->isActive()) { // Well, perhaps the timer fired early. Trigger it again later t->setInterval(50); // XXX arbitrary choice t->start(); } return QFeedbackEffect::Running; } case VIBE_EFFECT_STATE_NOT_PLAYING: default: killTimerForHandle(effectHandle); if (effectHandles.contains(effect)) { effectHandles.remove(effect); // because we kill the timer before it fires stateChanged, we need to emit stateChanged ourself. QMetaObject::invokeMethod(const_cast(effect), "stateChanged"); } return QFeedbackEffect::Stopped; } } QFeedbackEffect::State QFeedbackImmersion::effectState(const QFeedbackFileEffect *effect) { VibeInt32 effectHandle = effectHandles.value(effect, VIBE_INVALID_EFFECT_HANDLE_VALUE); if (VIBE_IS_INVALID_EFFECT_HANDLE(effectHandle)) return QFeedbackEffect::Stopped; // the effect is simply not running VibeInt32 effectState = VIBE_EFFECT_STATE_NOT_PLAYING; ImmVibeGetEffectState(handleForActuator(0), effectHandle, &effectState); return updateImmState(effect, effectHandle, effectState); } int QFeedbackImmersion::effectDuration(const QFeedbackFileEffect *effect) { VibeInt32 ret = 0; QString fileName = effect->source().toLocalFile(); if (fileData.contains(fileName)) ImmVibeGetIVTEffectDuration(fileData[fileName].constData(), 0, &ret); return ret; } QStringList QFeedbackImmersion::supportedMimeTypes() { return QStringList() << QLatin1String("vibra/ivt"); } src/plugins/feedback/immersion/qfeedback.h000066400000000000000000000116731215142760100211410ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtFeedback module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of Qt Feedback framework. This header file may change from version // to version without notice, or even be removed. // // We mean it. // // #ifndef QFEEDBACK_IMMERSION_H #define QFEEDBACK_IMMERSION_H #include #include #include #include #include #include #include #include QT_BEGIN_HEADER QT_USE_NAMESPACE class QFeedbackImmersion : public QObject, public QFeedbackHapticsInterface, public QFeedbackFileInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "immersion.json") Q_INTERFACES(QTM_NAMESPACE::QFeedbackHapticsInterface) Q_INTERFACES(QTM_NAMESPACE::QFeedbackFileInterface) public: QFeedbackImmersion(); virtual ~QFeedbackImmersion(); virtual PluginPriority pluginPriority(); virtual QList actuators(); //for actuator handling virtual void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &); virtual QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty); virtual bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability); virtual void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty); virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State); virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *); //for loading files virtual void setLoaded(QFeedbackFileEffect*, bool); virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State); virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *); virtual int effectDuration(const QFeedbackFileEffect *); virtual QStringList supportedMimeTypes(); private: VibeInt32 handleForActuator(const QFeedbackActuator &actuator); VibeInt32 handleForActuator(int actId); static VibeInt32 convertedDuration(int duration); QFeedbackEffect::State updateImmState(const QFeedbackEffect *effect, VibeInt32 effectHandle, VibeInt32 state); void killTimerForHandle(VibeInt32 handle); void startTimerForHandle(VibeInt32 handle, const QFeedbackHapticsEffect* effect); void startTimerForHandle(VibeInt32 handle, QFeedbackFileEffect* effect); QMutex mutex; QVector actuatorHandles; QList actuatorList; QHash effectHandles; QHash effectTimers; struct FileContent { FileContent() : refCount(0) { } FileContent(const QByteArray &arr) : ba(arr), refCount(1) { } const VibeUInt8 *constData() const {return reinterpret_cast(ba.constData()); } QByteArray ba; int refCount; }; QHash fileData; }; QT_END_HEADER #endif // QFEEDBACK_IMMERSION_H src/plugins/feedback/meegotouch/000077500000000000000000000000001215142760100172105ustar00rootroot00000000000000src/plugins/feedback/meegotouch/meegotouch.json000066400000000000000000000000601215142760100222360ustar00rootroot00000000000000{ "Interfaces": [ "QFeedbackThemeInterface" ] } src/plugins/feedback/meegotouch/meegotouch.pro000066400000000000000000000002451215142760100220720ustar00rootroot00000000000000TARGET = qtfeedback_meegotouch QT = core feedback PLUGIN_TYPE = feedback load(qt_plugin) HEADERS += qfeedback.h SOURCES += qfeedback.cpp LIBS += -lmeegotouchcore src/plugins/feedback/meegotouch/qfeedback.cpp000066400000000000000000000072261215142760100216300ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qfeedback.h" #include "qfeedbackeffect.h" #include #include #include // TODO Use a style property based enum to play the correct feedback //enum MeegoTouchFeedback //{ // // MWidgetStyle // widgetPressFeedback, // widgetReleaseFeedback, // widgetCancelFeedback, // // MSliderStyle // sliderMoveFeedback, // // MTextEditStyle // textEditPressBoundaryFeedback, // textEditReleaseBoundaryFeedback, // textEditPressWordFeedback, // textEditReleaseWordFeedback, // textEditChangeSelectionFeedback //}; static QString convertToMeegoTouch(QFeedbackEffect::ThemeEffect effect) { switch (effect) { case QFeedbackEffect::Press: case QFeedbackEffect::Release: case QFeedbackEffect::PressWeak: case QFeedbackEffect::ReleaseWeak: case QFeedbackEffect::PressStrong: case QFeedbackEffect::ReleaseStrong: case QFeedbackEffect::DragStart: case QFeedbackEffect::DragDropInZone: case QFeedbackEffect::DragDropOutOfZone: case QFeedbackEffect::DragCrossBoundary: case QFeedbackEffect::Appear: case QFeedbackEffect::Disappear: case QFeedbackEffect::Move: return MFeedback::Press; default: return QString(); } } QFeedbackMeegoTouch::QFeedbackMeegoTouch(QObject *parent) : QObject(parent), QFeedbackThemeInterface() { } bool QFeedbackMeegoTouch::play(QFeedbackEffect::Effect effect) { const QString &feedbackString = convertToMeegoTouch(effect); if (feedbackString.isEmpty()) return false; MFeedback::play(feedbackString); return true; } QFeedbackInterface::PluginPriority QFeedbackMeegoTouch::pluginPriority() { return QFeedbackInterface::PluginLowPriority; } src/plugins/feedback/meegotouch/qfeedback.h000066400000000000000000000047511215142760100212750ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACK_MEEGOTOUCH_H #define QFEEDBACK_MEEGOTOUCH_H #include #include QT_BEGIN_HEADER class QFeedbackMeegoTouch : public QObject, public QFeedbackThemeInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "meegotouch.json") Q_INTERFACES(QFeedbackThemeInterface) public: QFeedbackMeegoTouch(QObject *parent = 0); virtual bool play(QFeedbackEffect::Effect); virtual QFeedbackInterface::PluginPriority pluginPriority(); }; QT_END_HEADER #endif // QFEEDBACK_MEEGOTOUCH_H src/plugins/feedback/mmk/000077500000000000000000000000001215142760100156355ustar00rootroot00000000000000src/plugins/feedback/mmk/mmk.json000066400000000000000000000000571215142760100173160ustar00rootroot00000000000000{ "Interfaces": [ "QFeedbackFileInterface" ] } src/plugins/feedback/mmk/mmk.pro000066400000000000000000000002171215142760100171430ustar00rootroot00000000000000TARGET = qtfeedback_mmk QT = core feedback multimedia PLUGIN_TYPE = feedback load(qt_plugin) HEADERS += qfeedback.h SOURCES += qfeedback.cpp src/plugins/feedback/mmk/qfeedback.cpp000066400000000000000000000173011215142760100202500ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include #include "qfeedback.h" QT_BEGIN_NAMESPACE QFeedbackMMK::QFeedbackMMK() : QObject(qApp) { } QFeedbackMMK::~QFeedbackMMK() { foreach(FeedbackInfo fi, mEffects.values()) { delete fi.soundEffect; } } void QFeedbackMMK::setLoaded(QFeedbackFileEffect *effect, bool load) { if (!effect) return; // See if we have seen this effect before FeedbackInfo fi = mEffects.value(effect); if (load) { // Well.. we might already have an effect, since we don't create them until // we load... if (fi.loaded) { // We've already loaded? return; } else { if (fi.soundEffect) { // We've started a load, they must just be impatient // Pushing this elevator button does nothing.. return; } else { // New sound effect! QUrl url = effect->source(); if (QFile::exists(url.toLocalFile())) { fi.soundEffect = new QSoundEffect(this); mEffects.insert(effect, fi); mEffectMap.insert(fi.soundEffect, effect); connect(fi.soundEffect, SIGNAL(statusChanged()), this, SLOT(soundEffectStatusChanged())); connect(fi.soundEffect, SIGNAL(playingChanged()), this, SLOT(soundEffectPlayingChanged())); fi.soundEffect->setSource(url); // conceptually we're now loading, so we have to do this manually?? QMetaObject::invokeMethod(effect, "stateChanged"); } else { reportLoadFinished(effect, false); } } } } else { // Time to unload. if (fi.soundEffect) { mEffectMap.remove(fi.soundEffect); fi.soundEffect->deleteLater(); } mEffects.remove(effect); } } void QFeedbackMMK::setEffectState(QFeedbackFileEffect *effect, QFeedbackEffect::State state) { FeedbackInfo fi = mEffects.value(effect); switch (state) { case QFeedbackEffect::Stopped: if (fi.playing) { Q_ASSERT(fi.soundEffect); fi.playing = false; mEffects.insert(effect, fi); // overwrite previous version fi.soundEffect->stop(); } break; case QFeedbackEffect::Paused: // Well, we can't pause, really reportError(effect, QFeedbackEffect::UnknownError); break; case QFeedbackEffect::Running: if (fi.playing) { // We're already playing. } else if (fi.soundEffect) { fi.playing = true; mEffects.insert(effect, fi); // overwrite previous version fi.soundEffect->play(); } break; default: break; } } QFeedbackEffect::State QFeedbackMMK::effectState(const QFeedbackFileEffect *effect) { FeedbackInfo fi = mEffects.value(effect); if (fi.soundEffect) { if (fi.playing) // we might not be loaded, however return QFeedbackEffect::Running; if (fi.loaded) return QFeedbackEffect::Stopped; // No idle? return QFeedbackEffect::Loading; } return QFeedbackEffect::Stopped; } int QFeedbackMMK::effectDuration(const QFeedbackFileEffect *effect) { Q_UNUSED(effect); // XXX This isn't supported by MMK currently return 0; } QStringList QFeedbackMMK::supportedMimeTypes() { return QSoundEffect::supportedMimeTypes(); } void QFeedbackMMK::soundEffectStatusChanged() { QSoundEffect* se = qobject_cast(sender()); if (se) { // Hmm, now look up the right sound effect QFeedbackFileEffect* fe = mEffectMap.value(se); if (!fe) return; FeedbackInfo fi = mEffects.value(fe); switch(se->status()) { case QSoundEffect::Error: if (!fi.soundEffect || !fi.loaded) { // Error before we got loaded, so fail the load mEffectMap.remove(se); mEffects.remove(fe); se->deleteLater(); reportLoadFinished(fe, false); // this ends our involvement } else { reportError(fe, QFeedbackEffect::UnknownError); // this doesn't do much } break; case QSoundEffect::Ready: if (fe->state() == QFeedbackEffect::Loading) { reportLoadFinished(fe, true); FeedbackInfo fi = mEffects.value(fe); fi.loaded = true; mEffects.insert(fe, fi); QMetaObject::invokeMethod(fe, "stateChanged"); } break; default: // Nothing to handle here? break; } } } void QFeedbackMMK::soundEffectPlayingChanged() { QSoundEffect* se = qobject_cast(sender()); if (se) { QFeedbackFileEffect* fileEffect = mEffectMap.value(se); FeedbackInfo fi = mEffects.value(fileEffect); if (fi.soundEffect == se) { if (fi.playing != se->isPlaying()) { fi.playing = se->isPlaying(); mEffects.insert(fileEffect, fi); // overwrite previous version QFeedbackFileEffect* fe = mEffectMap.value(se); // Emit the stateChanged() signal if (fe) { QMetaObject::invokeMethod(fe, "stateChanged"); } } else { // Do nothing, internal state is already ok } } } } QT_END_NAMESPACE src/plugins/feedback/mmk/qfeedback.h000066400000000000000000000062301215142760100177140ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACK_MMK_H #define QFEEDBACK_MMK_H #include #include #include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE class QFeedbackMediaObject; class QFeedbackMMK : public QObject, public QFeedbackFileInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackPlugin" FILE "mmk.json") Q_INTERFACES(QFeedbackFileInterface) public: QFeedbackMMK(); virtual ~QFeedbackMMK(); virtual void setLoaded(QFeedbackFileEffect*, bool); virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State); virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *); virtual int effectDuration(const QFeedbackFileEffect*); virtual QStringList supportedMimeTypes(); private Q_SLOTS: void soundEffectStatusChanged(); void soundEffectPlayingChanged(); private: struct FeedbackInfo { FeedbackInfo() : soundEffect(0), loaded(false), playing(false) {} QSoundEffect* soundEffect; bool loaded; bool playing; }; QHash mEffects; QHash mEffectMap; }; QT_END_NAMESPACE QT_END_HEADER #endif // QFEEDBACK_MMK_H src/plugins/plugins.pro000066400000000000000000000000471215142760100155310ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += feedback src/src.pro000066400000000000000000000001111215142760100131460ustar00rootroot00000000000000TEMPLATE = subdirs CONFIG += ordered SUBDIRS = feedback plugins imports sync.profile000066400000000000000000000013311215142760100134110ustar00rootroot00000000000000%modules = ( # path to module name map "QtFeedback" => "$basedir/src/feedback", ); %moduleheaders = ( # restrict the module headers to those found in relative path ); # Module dependencies. # Every module that is required to build this module should have one entry. # Each of the module version specifiers can take one of the following values: # - A specific Git revision. # - any git symbolic ref resolvable from the module's repository (e.g. "refs/heads/master" to track master branch) # %dependencies = ( "qtbase" => "refs/heads/stable", "qtxmlpatterns" => "refs/heads/stable", "qtdeclarative" => "refs/heads/stable", "qtjsbackend" => "refs/heads/stable", "qtmultimedia" => "refs/heads/stable", ); tests/000077500000000000000000000000001215142760100122175ustar00rootroot00000000000000tests/auto/000077500000000000000000000000001215142760100131675ustar00rootroot00000000000000tests/auto/auto.pri000066400000000000000000000001001215142760100146420ustar00rootroot00000000000000TEMPLATE = app CONFIG += console testcase qtAddLibrary(QtTest) tests/auto/auto.pro000066400000000000000000000004351215142760100146630ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += \ qfeedbackactuator \ qfeedbackhapticseffect \ qfeedbackplugin \ qfeedbackmmk \ qdeclarativefeedback \ cmake !qtHaveModule(qml): SUBDIRS -= \ qdeclarativefeedback \ !qtHaveModule(multimedia): SUBDIRS -= \ qfeedbackmmk \ tests/auto/cmake/000077500000000000000000000000001215142760100142475ustar00rootroot00000000000000tests/auto/cmake/CMakeLists.txt000066400000000000000000000002551215142760100170110ustar00rootroot00000000000000 cmake_minimum_required(VERSION 2.8) project(qmake_cmake_files) enable_testing() find_package(Qt5Core REQUIRED) include("${_Qt5CTestMacros}") expect_pass(test_modules) tests/auto/cmake/cmake.pro000066400000000000000000000001121215142760100160430ustar00rootroot00000000000000 # Cause make to do nothing. TEMPLATE = subdirs CONFIG += ctest_testcase tests/auto/cmake/test_modules/000077500000000000000000000000001215142760100167565ustar00rootroot00000000000000tests/auto/cmake/test_modules/CMakeLists.txt000066400000000000000000000006231215142760100215170ustar00rootroot00000000000000 cmake_minimum_required(VERSION 2.8) project(test_modules) find_package(Qt5Core REQUIRED) find_package(Qt5Feedback REQUIRED) include_directories( ${Qt5Feedback_INCLUDE_DIRS} ) add_definitions( ${Qt5Feedback_DEFINITIONS} ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}") add_executable(mainapp main.cpp) target_link_libraries(mainapp ${Qt5Feedback_LIBRARIES} ) tests/auto/cmake/test_modules/main.cpp000066400000000000000000000042011215142760100204030ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include int main(int argc, char **argv) { QFeedbackHapticsEffect feedbackHapticsEffect; return 0; } tests/auto/qdeclarativefeedback/000077500000000000000000000000001215142760100173005ustar00rootroot00000000000000tests/auto/qdeclarativefeedback/data/000077500000000000000000000000001215142760100202115ustar00rootroot00000000000000tests/auto/qdeclarativefeedback/data/actuator.qml000066400000000000000000000000671215142760100225510ustar00rootroot00000000000000import QtFeedback 5.0 Actuator { enabled: false } tests/auto/qdeclarativefeedback/data/fileeffect.qml000066400000000000000000000001411215142760100230140ustar00rootroot00000000000000import QtFeedback 5.0 FileEffect { loaded: false source: "qrc:nonexistingfile.haptic" } tests/auto/qdeclarativefeedback/data/hapticseffect.qml000066400000000000000000000003231215142760100235320ustar00rootroot00000000000000import QtFeedback 5.0 HapticsEffect { id: rumbleEffect attackIntensity: 0.0 attackTime: 250 intensity: 1.0 duration: 100 fadeTime: 250 fadeIntensity: 0.0 actuator: Actuator {} } tests/auto/qdeclarativefeedback/data/themeeffect.qml000066400000000000000000000001061215142760100232000ustar00rootroot00000000000000import QtFeedback 5.0 ThemeEffect { effect: ThemeEffect.Press; } tests/auto/qdeclarativefeedback/data/themeeffect2.qml000066400000000000000000000001111215142760100232560ustar00rootroot00000000000000import QtFeedback 5.0 // Test string enum ThemeEffect {effect: "Press"} tests/auto/qdeclarativefeedback/data/themeeffect3.qml000066400000000000000000000002031215142760100232610ustar00rootroot00000000000000import QtQuick 2.0 import QtFeedback 5.0 // Test default method Item { Component.onCompleted: ThemeEffect {effect: "Press"} } tests/auto/qdeclarativefeedback/qdeclarativefeedback.pro000066400000000000000000000005271215142760100241370ustar00rootroot00000000000000include(../auto.pri) QT += qml feedback network SOURCES += tst_qdeclarativefeedback.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" OTHER_FILES += \ data/hapticseffect.qml \ data/fileeffect.qml \ data/actuator.qml \ data/themeeffect.qml \ data/themeeffect2.qml \ data/themeeffect3.qml DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qdeclarativefeedback/tst_qdeclarativefeedback.cpp000066400000000000000000000206631215142760100250160ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include #include #include #include #include #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir #define SRCDIR "." #endif Q_DECLARE_METATYPE(QFeedbackEffect::Effect); class tst_qdeclarativefeedback : public QObject { Q_OBJECT public: tst_qdeclarativefeedback(); private slots: void hapticsEffect(); void fileEffect(); void actuator(); void themeEffect(); private: QQmlEngine engine; }; tst_qdeclarativefeedback::tst_qdeclarativefeedback() { } void tst_qdeclarativefeedback::hapticsEffect() { QQmlComponent component(&engine); component.loadUrl(QUrl::fromLocalFile(SRCDIR "/data/hapticseffect.qml")); QObject *hapticsEffect = component.create(); QVERIFY(hapticsEffect != 0); QSignalSpy stateSpy(hapticsEffect, SIGNAL(stateChanged())); QVERIFY(stateSpy.isValid()); QCOMPARE(stateSpy.count(), 0); QCOMPARE(hapticsEffect->property("attackIntensity").toReal(), 0.0); QCOMPARE(hapticsEffect->property("attackTime").toInt(), 250); QCOMPARE(hapticsEffect->property("intensity").toReal(), 1.0); QCOMPARE(hapticsEffect->property("duration").toInt(), 100); QCOMPARE(hapticsEffect->property("fadeTime").toInt(), 250); QCOMPARE(hapticsEffect->property("fadeIntensity").toReal(), 0.0); QVERIFY(!hapticsEffect->property("actuator").isNull()); QCOMPARE(hapticsEffect->property("state").toInt(), (int)(QFeedbackEffect::Stopped)); hapticsEffect->setProperty("attackIntensity", 0.2); QCOMPARE(hapticsEffect->property("attackIntensity").toReal(), 0.2); hapticsEffect->setProperty("attackTime", 500); QCOMPARE(hapticsEffect->property("attackTime").toInt(), 500); hapticsEffect->setProperty("intensity", 0.8); QCOMPARE(hapticsEffect->property("intensity").toReal(), 0.8); hapticsEffect->setProperty("duration", 500); QCOMPARE(hapticsEffect->property("duration").toInt(), 500); hapticsEffect->setProperty("fadeTime", 500); QCOMPARE(hapticsEffect->property("fadeTime").toInt(), 500); hapticsEffect->setProperty("fadeIntensity", 0.2); QCOMPARE(hapticsEffect->property("fadeIntensity").toReal(), 0.2); if (!hapticsEffect->property("availableActuators").toList().isEmpty()) { QCOMPARE(hapticsEffect->property("running").toBool(), false); QCOMPARE(hapticsEffect->property("paused").toBool(), false); QCOMPARE(hapticsEffect->property("state").toInt(), (int)(QFeedbackEffect::Stopped)); hapticsEffect->setProperty("running", true); QCOMPARE(hapticsEffect->property("running").toBool(), true); QCOMPARE(hapticsEffect->property("paused").toBool(), false); QCOMPARE(stateSpy.count(), 1); QCOMPARE(hapticsEffect->property("state").toInt(), (int)(QFeedbackEffect::Running)); hapticsEffect->setProperty("paused", true); // XXX make sure we just test dummy backend QCOMPARE(hapticsEffect->property("running").toBool(), false); QCOMPARE(hapticsEffect->property("paused").toBool(), true); QCOMPARE(stateSpy.count(), 2); QCOMPARE(hapticsEffect->property("state").toInt(), (int)(QFeedbackEffect::Paused)); hapticsEffect->setProperty("running", true); QCOMPARE(hapticsEffect->property("running").toBool(), true); QCOMPARE(hapticsEffect->property("paused").toBool(), false); QCOMPARE(stateSpy.count(), 3); QCOMPARE(hapticsEffect->property("state").toInt(), (int)(QFeedbackEffect::Running)); hapticsEffect->setProperty("running", false); QCOMPARE(hapticsEffect->property("running").toBool(), false); QCOMPARE(hapticsEffect->property("paused").toBool(), false); QCOMPARE(stateSpy.count(), 4); QCOMPARE(hapticsEffect->property("state").toInt(), (int)(QFeedbackEffect::Stopped)); } delete hapticsEffect; } void tst_qdeclarativefeedback::fileEffect() { QQmlComponent component(&engine); component.loadUrl(QUrl::fromLocalFile(SRCDIR "/data/fileeffect.qml")); QObject *fileEffect = component.create(); QVERIFY(fileEffect != 0); QCOMPARE(fileEffect->property("source").toUrl(), QUrl("qrc:nonexistingfile.haptic")); QCOMPARE(fileEffect->property("loaded").toBool(), false); QTRY_COMPARE(fileEffect->property("state").toInt(), (int)(QFeedbackEffect::Stopped)); QCOMPARE(fileEffect->property("running").toBool(), false); QCOMPARE(fileEffect->property("paused").toBool(), false); fileEffect->setProperty("running", true); fileEffect->setProperty("paused", true); // dummy backend QTRY_COMPARE(fileEffect->property("running").toBool(), false); QTRY_COMPARE(fileEffect->property("paused").toBool(), false); delete fileEffect; } void tst_qdeclarativefeedback::actuator() { QQmlComponent component(&engine); component.loadUrl(QUrl::fromLocalFile(SRCDIR "/data/actuator.qml")); QObject *actuator = component.create(); QVERIFY(actuator != 0); QCOMPARE(actuator->property("enabled").toBool(), false); delete actuator; } void tst_qdeclarativefeedback::themeEffect() { QQmlComponent component(&engine); component.loadUrl(QUrl::fromLocalFile(SRCDIR "/data/themeeffect.qml")); // We don't export this class, but we're just poking at properties anyway QObject *dte = component.create(); QCOMPARE(component.errorString(), QString()); QVERIFY(dte != 0); // Test the effect property gets assigned QMetaProperty p = dte->metaObject()->property(dte->metaObject()->indexOfProperty("effect")); QCOMPARE(p.read(dte).value(), (int)QFeedbackEffect::Press); p = dte->metaObject()->property(dte->metaObject()->indexOfProperty("supported")); QCOMPARE(p.read(dte).value(), QFeedbackEffect::supportsThemeEffect()); delete dte; component.loadUrl(QUrl::fromLocalFile(SRCDIR "/data/themeeffect2.qml")); dte = component.create(); QCOMPARE(component.errorString(), QString()); QVERIFY(dte != 0); // Effect property as a string p = dte->metaObject()->property(dte->metaObject()->indexOfProperty("effect")); QCOMPARE(p.read(dte).value(), (int)QFeedbackEffect::Press); delete dte; // Now test the default method component.loadUrl(QUrl::fromLocalFile(SRCDIR "/data/themeeffect3.qml")); dte = component.create(); QCOMPARE(component.errorString(), QString()); QVERIFY(dte != 0); // Well, we can only verify that through a dummy plugin (TODO). verified through qdebug atm :) delete dte; } QTEST_MAIN(tst_qdeclarativefeedback) #include "tst_qdeclarativefeedback.moc" tests/auto/qfeedbackactuator/000077500000000000000000000000001215142760100166375ustar00rootroot00000000000000tests/auto/qfeedbackactuator/qfeedbackactuator.pro000066400000000000000000000002401215142760100230250ustar00rootroot00000000000000include(../auto.pri) QT += feedback SOURCES += tst_qfeedbackactuator.cpp linux-g++-maemo:DEFINES += HAVE_ACTUATORS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qfeedbackactuator/tst_qfeedbackactuator.cpp000066400000000000000000000111341215142760100237050ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //TESTED_COMPONENT=src/feedback #include #include QT_USE_NAMESPACE class tst_QFeedbackActuator : public QObject { Q_OBJECT public: tst_QFeedbackActuator(); ~tst_QFeedbackActuator(); public slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); private slots: void enumeration(); void setEnabled(); }; tst_QFeedbackActuator::tst_QFeedbackActuator() { } tst_QFeedbackActuator::~tst_QFeedbackActuator() { } void tst_QFeedbackActuator::initTestCase() { } void tst_QFeedbackActuator::cleanupTestCase() { } void tst_QFeedbackActuator::init() { //the list returned should always be the same with the same order QCOMPARE(QFeedbackActuator::actuators(), QFeedbackActuator::actuators()); } void tst_QFeedbackActuator::cleanup() { } #if defined(HAVE_ACTUATORS) && !defined(Q_OS_SYMBIAN) //we're on meego/maemo #define CAPABILITY true //the capabilities are supported through Immersion #else #define CAPABILITY false #endif void tst_QFeedbackActuator::enumeration() { QList actuators = QFeedbackActuator::actuators(); #ifdef HAVE_ACTUATORS QVERIFY(!actuators.isEmpty()); #endif foreach(QFeedbackActuator* actuator, actuators) { if (actuator->name() == QString("test plugin") || actuator->name() == QString("5555")) continue; QVERIFY(actuator->isValid()); QVERIFY(actuator->id() >= 0); QCOMPARE(actuator->isCapabilitySupported(QFeedbackActuator::Envelope), CAPABILITY); QCOMPARE(actuator->isCapabilitySupported(QFeedbackActuator::Period), CAPABILITY); QVERIFY(!actuator->name().isEmpty()); } // Try comparisons if (actuators.count() > 1) { QFeedbackActuator* a1 = actuators.at(0); QFeedbackActuator* a2 = actuators.at(1); QFeedbackActuator* a1b = actuators.at(0); QFeedbackActuator* a2b = actuators.at(1); QVERIFY(a1->id() != a2->id()); // QVERIFY(*a1 != *a2); // doesn't work, no operator != !! QVERIFY(!(*a1 == *a2)); QVERIFY(*a1 == *a1b); QVERIFY(*a2 == *a2b); } } void tst_QFeedbackActuator::setEnabled() { foreach(QFeedbackActuator* actuator, QFeedbackActuator::actuators()) { if (actuator->name() == QString("test plugin") || actuator->name() == QString("5555")) continue; //this test might not always be true because you ight not be allowed to change the enabled property actuator->setEnabled(false); QVERIFY(!actuator->isEnabled()); actuator->setEnabled(true); QVERIFY(actuator->isEnabled()); } } QTEST_MAIN(tst_QFeedbackActuator) #include "tst_qfeedbackactuator.moc" tests/auto/qfeedbackhapticseffect/000077500000000000000000000000001215142760100176255ustar00rootroot00000000000000tests/auto/qfeedbackhapticseffect/qfeedbackhapticseffect.pro000066400000000000000000000001721215142760100250050ustar00rootroot00000000000000include(../auto.pri) QT += feedback SOURCES += tst_qfeedbackhapticseffect.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qfeedbackhapticseffect/tst_qfeedbackhapticseffect.cpp000066400000000000000000000217201215142760100256630ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //TESTED_COMPONENT=src/feedback #include #include #include QT_USE_NAMESPACE class tst_QFeedbackHapticsEffect : public QObject { Q_OBJECT public: tst_QFeedbackHapticsEffect(); ~tst_QFeedbackHapticsEffect(); public slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); private slots: void initialization(); void envelope_data(); void envelope(); void startStop_data(); void startStop(); void themeSupport(); }; tst_QFeedbackHapticsEffect::tst_QFeedbackHapticsEffect() { } tst_QFeedbackHapticsEffect::~tst_QFeedbackHapticsEffect() { } void tst_QFeedbackHapticsEffect::initTestCase() { } void tst_QFeedbackHapticsEffect::cleanupTestCase() { } void tst_QFeedbackHapticsEffect::init() { #ifdef Q_OS_SYMBIAN //we need that head start for the eventloop to be responsive QTest::qWait(1000); #endif } void tst_QFeedbackHapticsEffect::cleanup() { } void tst_QFeedbackHapticsEffect::initialization() { QFeedbackHapticsEffect effect; if (QFeedbackActuator::actuators().isEmpty()) { QVERIFY(!effect.actuator()->isValid()); } else { QVERIFY(effect.actuator()->isValid()); QCOMPARE(effect.actuator(), QFeedbackActuator::actuators().first()); } // actuators from other plugins need to be verified. //test default values QCOMPARE(effect.duration(), 250); //250ms is the default length for effects QCOMPARE(effect.intensity(), qreal(1)); QCOMPARE(effect.attackTime(), 0); QCOMPARE(effect.attackIntensity(), qreal(0)); QCOMPARE(effect.fadeTime(), 0); QCOMPARE(effect.fadeIntensity(), qreal(0)); QCOMPARE(effect.period(), -1); QCOMPARE(effect.state(), QFeedbackEffect::Stopped); } void tst_QFeedbackHapticsEffect::envelope_data() { QTest::addColumn("duration"); QTest::addColumn("intensity"); QTest::addColumn("attackTime"); QTest::addColumn("attackIntensity"); QTest::addColumn("fadeTime"); QTest::addColumn("fadeIntensity"); QTest::addColumn("period"); QTest::newRow("TEST1") << 300 << qreal(.2) << 1 << qreal(.2) << 2 << qreal(1) << -1; QTest::newRow("TEST2") << 500 << qreal(1) << 100 << qreal(.5) << 0 << qreal(0) << -1; QTest::newRow("TEST3") << 250 << qreal(.8) << 150 << qreal(1) << 150 << qreal(1) << -1; QTest::newRow("TEST period") << 1000 << qreal(1) << 150 << qreal(1) << 150 << qreal(1) << 150; } void tst_QFeedbackHapticsEffect::envelope() { QFETCH(int, duration); QFETCH(qreal, intensity); QFETCH(int, attackTime); QFETCH(qreal, attackIntensity); QFETCH(int, fadeTime); QFETCH(qreal, fadeIntensity); QFETCH(int, period); QFeedbackHapticsEffect effect; // actuators from other plugins need to be verified. effect.setDuration(duration); QCOMPARE(effect.duration(), duration); effect.setIntensity(intensity); QCOMPARE(effect.intensity(), intensity); effect.setAttackTime(attackTime); QCOMPARE(effect.attackTime(), attackTime); effect.setAttackIntensity(attackIntensity); QCOMPARE(effect.attackIntensity(), attackIntensity); effect.setFadeTime(fadeTime); QCOMPARE(effect.fadeTime(), fadeTime); effect.setFadeIntensity(fadeIntensity); QCOMPARE(effect.fadeIntensity(), fadeIntensity); effect.setPeriod(period); QCOMPARE(effect.period(), period); //test all the values at once QCOMPARE(effect.duration(), duration); QCOMPARE(effect.intensity(), intensity); QCOMPARE(effect.attackTime(), attackTime); QCOMPARE(effect.attackIntensity(), attackIntensity); QCOMPARE(effect.fadeTime(), fadeTime); QCOMPARE(effect.fadeIntensity(), fadeIntensity); QCOMPARE(effect.period(), period); } void tst_QFeedbackHapticsEffect::startStop_data() { envelope_data(); } void tst_QFeedbackHapticsEffect::startStop() { qRegisterMetaType("QFeedbackEffect::ErrorType"); if (QFeedbackActuator::actuators().isEmpty()) QSKIP("this test requires to have actuators"); QList actuators = QFeedbackActuator::actuators(); QFETCH(int, duration); QFETCH(qreal, intensity); QFETCH(int, attackTime); QFETCH(qreal, attackIntensity); QFETCH(int, fadeTime); QFETCH(qreal, fadeIntensity); QFETCH(int, period); QFeedbackHapticsEffect effect; QSignalSpy errorspy(&effect, SIGNAL(error(QFeedbackEffect::ErrorType))); QSignalSpy stateSpy(&effect, SIGNAL(stateChanged())); effect.setDuration(duration); effect.setIntensity(intensity); effect.setAttackTime(attackTime); effect.setAttackIntensity(attackIntensity); effect.setFadeTime(fadeTime); effect.setFadeIntensity(fadeIntensity); effect.setPeriod(period); QCOMPARE(effect.state(), QFeedbackHapticsEffect::Stopped); QCOMPARE(effect.actuator(), actuators.at(0)); // Double set a few properties (shouldn't call the backend) effect.setAttackTime(attackTime); QVERIFY(effect.attackTime() == attackTime); effect.setFadeTime(fadeTime); QVERIFY(effect.fadeTime() == fadeTime); // Test setting to a non default actuator and then back again if (actuators.count() > 1) { effect.setActuator(actuators.at(1)); QCOMPARE(effect.actuator(), actuators.at(1)); effect.setActuator(0); QCOMPARE(effect.actuator(), actuators.at(0)); // noop effect.setActuator(actuators.at(0)); QCOMPARE(effect.actuator(), actuators.at(0)); } // Now start QVERIFY(stateSpy.isEmpty()); effect.start(); QVERIFY(errorspy.isEmpty()); // This seems a little risky QTRY_COMPARE(effect.state(), QFeedbackHapticsEffect::Running); QVERIFY(errorspy.isEmpty()); QCOMPARE(stateSpy.count(), 1); // stopped to start effect.pause(); QCOMPARE(effect.state(), QFeedbackHapticsEffect::Paused); QCOMPARE(stateSpy.count(), 2); // Now try to change a few properties (should be refused because of !Stopped) effect.setPeriod(period + 100); QVERIFY(effect.period() == period); QFeedbackActuator* actuator = effect.actuator(); effect.setActuator(0); QVERIFY(effect.actuator() == actuator); effect.start(); QCOMPARE(effect.state(), QFeedbackHapticsEffect::Running); QCOMPARE(stateSpy.count(), 3); QTRY_COMPARE(effect.state(), QFeedbackHapticsEffect::Stopped); QVERIFY(errorspy.isEmpty()); QCOMPARE(stateSpy.count(), 4); } void tst_QFeedbackHapticsEffect::themeSupport() { const bool supportsTheme = QFeedbackEffect::supportsThemeEffect(); if (!supportsTheme) QSKIP("No theme support"); int numberOfSupportedEffects = 0; for (int i = 0; i < QFeedbackEffect::NumberOfEffects; ++i) { if (QFeedbackEffect::playThemeEffect(QFeedbackEffect::Effect(i))) numberOfSupportedEffects++; QTest::qWait(250); //let's make sure the device is ready again } QVERIFY(numberOfSupportedEffects > 0); } QTEST_MAIN(tst_QFeedbackHapticsEffect) #include "tst_qfeedbackhapticseffect.moc" tests/auto/qfeedbackmmk/000077500000000000000000000000001215142760100156015ustar00rootroot00000000000000tests/auto/qfeedbackmmk/qfeedbackmmk.pro000066400000000000000000000007721215142760100207430ustar00rootroot00000000000000include(../auto.pri) QT += feedback SOURCES += tst_qfeedbackmmk.cpp wince* { deploy.files = test.wav DEPLOYMENT = deploy DEFINES += QT_QFEEDBACKMMK_USEAPPLICATIONPATH } else:maemo* { DEFINES += QT_QFEEDBACKMMK_USEAPPLICATIONPATH } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):CONFIG += insignificant_test # QTBUG-25448 win32: CONFIG += insignificant_test # QTBUG-25448 DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qfeedbackmmk/test.wav000066400000000000000000001126541215142760100173100ustar00rootroot00000000000000RIFFWAVEfmt data=r.uU1 us~)"r9rYv2DF5QURE!Y r7aea 5|N'  9 r .R}jd+6Dy "( A `P ~  DMu,K8}N <;KKv_I gHKFL<^[W2t15DO[kM^!@cdaI.  ^,9 =d.^K*> M VPU!0"##$NF%%&N&0 &? & &> 'T &9 & % ,%l $ g"X * x o`L q  #MR3FݷA:/zӺlүѯ6ѣ!D@w ѡ 7 т\mѠ%) B eF r&oѽҗԉ֚qpyYihS|l 3>J` 7~^#*15|89@::O; ;;#<]g<%<`<&%=R=r=x=4= v< A; 9J i7141->(r9#&jNy4%x#47WqخOG۾ֻA " "}Y8ݹc9߸ θB< q.JV.)kjǦVyP͂Xxvw޶&}?bK78 8U }*4H= E3fKkNP P6QQ9Q $RpRzRNSHSSSS TUSCzS RQSO5M@J E'x?7/jq%#] $Q2P{ mΤS ã0""L!"m ٢Ȣ'qCa qͥܦDq6boknѷT{Y`3ĴȮC[ۓ}ޖLf :&~3%? K"TF\?Sa id5f7gTg hPhhVhAi`iii|jMjKzj?j_j i"ih.Lfbe\S8IM=D0*h"zG'|f ˮ;s ұ@+c %VD*P.ݍ01OH1 'ƌ!zFux ir#et nޣ2åп~з-HXKO r(l7ED=SY?_~?io puSUy{FF}! ~7#f~$~$~$3j$w##!8xoO -r~'~}*{ul` ߏR6C3X"y[$ *%+\@0W/jB+߀s&݁-!Ӈ  飑:bޚr 9֐%Ίxd$E.% 7߼ .)<.HrSU] fn9sx| ~&"~$D%''Y((&$!Fv0 d| {~zrg{YJ\;yh+: 3}ۗ5%6|%;+,1}5A;88 y86ʀ34u0 d,q\'L!M`;Y *Д"͕?p襓HǑzՠgҊЯJϫdBP[[ ]EF'Z49?vJI5TO \ndjp-t jx !{B#|v%~t'"):*w*)/';#H~{Xu9kXn_QC_5%|Lh2[ l,%(+yh-5.ہ-,t*J'<#Ɋx,Q 8 sK\,Soޅ ҃^Ն:Ҷp9ʼ./˧҆ ܈ &yV28=G PW ^HeNj7pt)x!{$ ~'>}(('#*,2 ,<~|ullج`ؐS0`EG6@i&n xv)AwZbq!&P*-.//l.+ȌN(ԏv#͒cUk9nWn} z_~"{t?ۃhY#IS=9{y(cDd5J K!w1Ů$X*S/Wl3o6 8P\8 7AT41[0.\+%\ ?,#ǎ Ê@LJ𵀤>e!$w7د:iXZ˘^ݡիttsUՓכQlQbR =t?( V2;DVMUK]\"{e%l2'nsj( y`(|&#o 6Q߫R~9^|G7vwMkߨ\cLX;Q,`+9 a#|K!Α'~-1˺4p6ڲa7կ{654Z0l@,)&~ t" @[ك|򷁦였`1:n/^wdwՃ&VЎ{ӯnl'҇mӒ__&4Mc'@#X- 6?GROzV%"h]@%Kd&Sk&Wro$xT }@3 +^$ bر~ԉ|v]msH`IQ:fAN1W"2!z#o'.37b:;˯;լ(:©7yP4V0#+9&D!Qn/P Ȅ#OfЀi6*4;㢀5ܰؐպӂ)ӘڪDػܫ"ͨhm[cLgW h# (0_7?%F*N-+W._-h*[q%Bxz|Gx\:NY;өT}#w0mUׯ` RsD+5q1'}D  `v% %?+j12ɇ5zU8<9/:> :Pn8o5U1+k%%lp!X,\FAU (^PٙzҖziϕrҷ쬃ٻbOMIFc&l g #=+2 %;:)B,uJ-SL-v]*h&qq!y3}U VowY})yepRMdDBVcGQ\8l)rvvkE  ܊&՘+/3I55E4ȴf2k.%)"g]@S/v 2{܆3m/ I 3ר큫U'v$/tyڎ~#‘3FִVKpM6 %&-B+6-e?.I-T+`'vl"Lv|i /~A~ǜ{Nt{>i̴[Lz='>/!~ xF%;,g1De6оD9 [:쳖9W7.63>B.J(/#Ӌce ۃy^\ l ?ۀboZ!UшNل(r#&ؕػu؊يDhCU$rb 9?$'<*0&.;s0\F1R/^;-j)t#{"TտNO|vϳlfv_QۑBR4&x IY@ Kk(%,?37"Ú:j;¸~:O/84Ϋ 1l,Ң(%G!BLF'Å@わ&'eȂNெZ퍀ƒr?`Gղʶ׷Ԫۈ*aG88Pi$%-*|8-?D /P[.]3,pj(t$I{ ~*_a&پ&v1~yуyыo+b^SGڏEHl7l)  rlu0#+0X46;716J4{1ǩP/,")O'#74EY w'rXgZ:Mv@H3:&fZ7\ JVYs [hΘ8ɻ˵ɯUʩFJP MN u Sa}pUGCvL<칃(E84ޚNۍ؅ Jm&;c:VcQ De"_$$/h)9:S-E0Qy1]^1i/Wt,{(v#d .Dhٰ~v|[vh͘l`t.T1G9:0g-S  %!\ U7ԡ$<KSM:8N  x (*uj]c/3Iۛĭߗ҅>ڠ&j+ ? }t ,'9+,_61A05 NU7RZ8cf7Hq5yW3~ 02,'"qmwEޙ}UylَqfܴZpMe@3&YZ x9YjT ލ&5%ضѪygˠm jk4XZl_eJ0yPMӃ;QDoMBۉ.'k۾NvɊЉ6[EP9@3 D ( )<%4J)\@,`L-KX.c-Gn"-v+|*W'K${y1=|4xwpeۉYTL>1$l) "h9I mT3$>ǝ\GKNemˤ( ˡ+ E6TcT m!}PሊCGTŸgV/ඍޞmB0:iܵPAw\ )6^QV&l!1$D=''IB)T%+X`,vk6.ru.o|.H+.' !8R,"{0G~[{t)Ak9_/R E/787+Wf \!F f (r  BJf) ӭD$ 7ě:&'A 4g%7 5#VyЄ/Fפceyհ;bq/۟JɼO؟}BE  &2"?&dKj*W -;cQ.n-v+|'/"uxGNRVK~zyrgZ[OCa8*z-"D  l$/bՉw g! ?C=&\H 6g:qPu% ;#ZjOۏՍ+dz8ƪ{1naǩWN7~CAP% :M($4{*A/M3Xy6$d7n}7Cw5|2\.(t"D !~{=u*lbWM3B6>+ V w j#"&s'uW'%2w#}1 5{`&O0 9 YLʀb z93ݖ7΁gևϝt/)@8n;^7Ib܎.%$fE+= t #t/ -;%F)Q*,[-e-n,%vG*{&~!, C":`U}-xpgc]bRFM:c-V i!%Z(i*ҡ*)](&$oe" iۥS8ec< Cdydnx?$zݵ2%J΍#J;LذiaEı3̸wA/{*j #it.S8c$'Cj(M?+V,D`,pi}+q(vx$}^q Od.~U|b2w"yoeZN'B!5( %{ m${)(**, .-}֭-ѩ--,JO*(j5% "Wy9gsmt TKkX@mEۂ|Fwԅp_ᖀ̓@<*}̈TЭӶ9sEucmO'2!=7!H$S;'_ (i'r%Xy#}vnXb LD'kCv|rvm#mNa̓' N&$嶢"L ܦvh< ̀d` =7`Ā290ȜՎ6ŃġAv}NڸC‚˼a.7 I 0 i+6/B"N$[Z%e%o<$w!|= KO6\}qFD|OߴuAk{_RDE28z+w  _"a:%&)'R(f(J((&æ'&}%#+ R} >H7x l1˩Q-]J DSEϝ7jB30C^B~  +7CT O#F[%"f&o}&w %|n"<C FnKMy~%?z7s-h`{\e4OA4 (UO -&"@%e'')|*+,-y.>ŝ.B/.-9+ۥ(ᜉ% !&"j 6(j^πػԉdі#˽Kƨhơ*nܷ7[ɡ%ӣ߶'\"O5+7"C'OM+ZO-d-Qn,v*{-'~" L kf+~zBtkJ}`TWIF=&2r(  3e *T!$'(K*+@+*?C*),'ܖ$ǎ!;88 ?] X?mG"р)MLGEӏӿͽTlO {ћHކ<4W _ taK*f5Y"8A'K+, V.`_/h/o3.v+{ (~#CB <s_}0zsj`qkU|Jtw@T`6#,U#a, KGXdhK ^FaXzeL6 &y)V 3kJۀ*eV|geZ%u%ezɘt2ҁJ<-S /\o/eu.Mn?,u({$~u L\~|xqfh^RT J?u6}-=% *\6#e"$ '()>*)ץ,(%a#--BT?lEwtG FV+A(Ԁ+aOԋSi=!a1ﬞg|ŜƽTүږT/]G (A2<#F"O7$OY-%b$fl_#t z0}L,F D! 09}yr\_jJZaXNyEAӼg9o'+ ;Z&n0.;( E "P"l[!e- `ob5wT|~v   _P~}L{$xsme]DUGL"aCVu:18( ;EkrhP>"I$z]'ƛ)g+'-+.~J.0-S*,)d%!3@E] rmSڀVDD{:%o4w]k rveʴ.=.R< n rx "-39D!~O!ZdEmluz~# /9~Cx}-yt nfvd^U# M'D:61'wmJ S8bc6!m%Ǔ(E+i^-?.OC/..-b*fD& ׁh*N H)͔QǦ7¢YƊCÏ.қ[ϩX_\)ߊ5 &G12 =~H(S]&f nbt[x= =|SW~Ti#D}zuohaXO&m-ei\)S_IT9@6-R[%[$=\ 'M4 >%*%/E[47'(::ޣ935}J0q)?Y!rW2{8"pg|=o 5Lpƴi;=Z{HQgƌ;Ѵۅ  r*AB4~v=FBNU]/cci!o s xO {8}F~x =m/A}wysle_\YTK)C:&83+u$m  eGqqY&%|+17BѲ<N@XVBBB¯*A˨=G842+k"%)2ޅ)N+CQn۹Tn3\1yl̉|%޴QN񘖻|~~؎ӑޘ d ~* H c)G2Q;CK+S2Y-`0e nk pX >uTyY|~Ol~}Qytsnvg_-RXPHI%BO;4_-f'  Uf$*(+0ٻ5|99=;;:n&8=G4(/ќ(痢!㐤3Q !dފ[?ӋþJ܏F70;( 3 l*r  S%$*G#/ѳ2B5\5@"5೧2.ި?)"zU2mMW`& ΍ ՍηPЮ]{>F 㜂߽rѰʣ52aZW&'MFZH EX H)#1I:CKSm[ aLg1lCp{su,Xwpw {w0vs q }mi0Le9`v\W0S :NwHU C.6zk. v%G %m*gt/g361Ԙ8ˉ9!9#7"w3L.-&Et |bMmfNܲ ObD: ]S썓Cݴ{P޽gvǂͰ.D1ʭ6'ْdr  > ^v)l2r;D~MsUs]$Sd4j=n{rtLuG%vnum t4r/ p m _kh4*f>c_\LWZaR5L F?b7/' u oRL"D(-397.:;(;\0:<6ʷ2+q#s~2ƚ^qD̜ĸԾ#˶܋WvŴ6ضn"TÈu~`П¦߸VЄ)Ipp \  )w 3A=Gg P}.X,F_`,e ilcmToDqMq q rqpoVwnl#kvh fb_Z̤=w;}71I)# { &f󧗚詓TύAƽ>Raܗ1ŠXz)º^;t:[>ؙ8^?2"b | W *4/>F:OV\`ndgAj km&m0n "nml8k4ifc$`+.\WSWMHB<6>.^'" {a9,~ 'Z.496P>=eAB6ԃB1@;85p.$簑_Ɵ#Ta<яRՍ=>Vl67}[% ~CJɝci֦'KP]jA!N l $-6@E LQ!lVZ5:^Ia1c?e;f<gQ hg gdg.fe\d bn`d]|ZV RM81k)\!_ 6-: 㰙FLKs%3]ڹ$\ )ƻ GgO,?#r֔hto8$ - e" + 3:eAG&MQ7VuY#\L4^_B`a b Lbsb<lbHbEau_]_[u2XsT>PKFkbA;6 0) #?#B* y1q73793v.(t#MA$, 28z=A!CCwBY@?<>͍6e/&Te 7$B^%]o6փK_ҙЙMA/o aRbyJpӭ 5nYcAtZY~mD[x!/ ]) 0# 7 =y B? F FJ 5MM O Q3 Sd U =W |X \YYY6Y"XiV-TXiQ,N8JUF1Bh>F:51m,'"E%,3f9S>BEE3$FkZEBմ>H8@Ǜ1(õw }-T!>ޠ럕Zl9IşEtUX?e<ݹd+.si\^j [ M  "* ) / J5 :n !> AV D G wJ L` ;O0 KQE SmTGUlUC9UUd;p740y- *k&O"!~)\*1>8( b>aBCIFG~GIDEpA.O<+6t:/Dz'µki6ŲK䰌B2̭zۊԎ檔ʧaWϫDLc>nƝȗu QԷ˭ 6g],.6  } X&+ 0 #5 z9h=vA?EB9HKWM 8O P Q RFXSVtSDS4QIGP NpSKLHEA>{; 956\B30Dq,T(#% ~( e07 =+BREtFF EEAD=ӟ8ͩ2Y+ã$xջ Ƶ]'˰ߥƪav.o@?鮾kh%_І֎ɩqQEWJO 9g. #;)K M. 3]7&Z;5>1BEG'JuWLAN Ok PxQsQ P$O_MKVIFeD4Ag`?{B*DE EESCC@Ag;7v3 /*%-")q/ 4 ?8;m;=^> %?*&>;Y8Ը2Q",rʝ$řo]  dc!(6VќQɁWŰ#©qǰɜ̘+ЋS۸Ѫiي] t1x ^1k8T/$:*- H/5 4 8C =I !A DY *Hl J4 MNZOAO3OOd4N!MKmJ>H)&GLETC1A>GDC2A?.a=(: (7F3*$./(/%O"+M27 <?APB/gAvD?+ەEo5Ы;ۭoҋ" }˼ A)IP2iw 3 ]SY#)M/49=>~eB FAIKMOvPPcPAP3_O4NTLpKIFzHFYEC^A >/^;^7X2,-='X$!1+q16E;X}>yh@n AJ{@)>8dHBqFH _Kf4MpNO^'ONK N9MLK'J1I9%HF;ECXj@9=9d p50, !&'p!Y-:2'69i; <7<;':740H9,Zӡ&= +ɠ1 ~,6󲼣W1.P޸ۉ²ֆkՋVڡݲ^Z݃)`j q&M<,e16~o;?CF(IJK1LKKaLK$JCrJIQIdtHNGEC,AE>U;5d8 40t,+"'O$!)b.?2V5'7J_9Q: :9=:85j17-gN' }#! ;É2j¹y秷Wڵko ڻs۽7V! ɡΕӳ!پބ2[fZ&%*/u3U 7 :c=?@@)AXEAfVAjYAuIA+A,@!@?7?=]<.:96_G4cE1 -) 9% ]#dy(K*- k1k579y::1g9%6ߚ3Ic/tn*$о2YV u]¢~\0 O޶6ݵ+[q9Og9ے_ޛ9]=QҵH1mL ?F_Mr!K'Z p,v 1 4 J8( ;9=-> `@tANBBmCyCfCCGCCB A}@ x?=3? @@@3AQATAAA A@?'>aX=?D;8[51 )-X("#p#Q' v*,./W/.+(q$sކ ֹ!Ӕg ?|$"3W{1惶⊵o&a=ݱ޹97 M°\3Sбؒ6~ (V` @'!#(-< 0$ X4LL79;=>?@A{A]A[ BaBABQ~B&2BA @ ?=:73h /L*;%2 [X!\w%V )d+-/1/H.=f,)O&v"?G:6 nŇLJg;ͼ죺jon]ߧ,fႽW¢a`TGֈJyGIT^ #A ( 9, / 357Cy9p:g;B<'h=2 >>B(??j@Z@ad@u@2{?j>Z<:_8q4'1z ,T0(E#,*-!$ '=*+++r5*9/(/%O" 7/ ًմ җuEcdž(mA;`瓻&غ.]Y½[{p\RˤJщطNi.FT\ e] @0dD ; o! o% ( ,.02$44E5X6U7I8Q59:6:;qc<{< =Q<^&(ĜK~4>~Ыӟb׼^)8ge@59: "%#7(J* ,R-./0@123546Y7-i8F9D9 :^9T8U78Q52w/+g, ($li Z&-!P# %T&PD'''&&$B">: 5JuE NIgyΩ:,<(ǓƑS)P ';Ut1Y ʋF Goҿwd3_PSBQI # B!t B   \ ! }#X%L&'m)*,L-GT.%///l/m/M.QW-+n)'%g#.!r  `=:h= } )!7! =g$ P M s"J'ؑԼpN8 I1y$ʧs`͇kѬV3dm, AE&R5 -UB yC!"$B&')1+t,M-FN..-.V.[-,w+_*8(&>.%Z[#w!` lSGp$wu ! !IX!& hM1m 7:ۚf*ט< @͢2n:G=ʌK̒Yt%W׌ 5>wRDA  WFF 4!w#$_A&z'h( )(f)|)IV)T(V(')&!n%1$q"!=!  ; ,(N,!M" " X"c!CcuU#M 52ߏ,ڂCԸ'bf̽G̭B)Ϲ%|_~?A8~TtE_sT[x  CY~u:2pmyy $"l#$Q%&;'z'|'X1'g&%%}$z#" 5g ~bkL K hP#^\o`% Ik2M݃OGg~հѕT$,pΈ1wΤz$PN&`Nhyyk=8?~ C} E 4xyLp !m"#L$$P$B$^$ #4X#""@!q 3 j U*E!Jo k X;'"0VV3T wl4Cpթo?[/ҩjs`Ս۩{ު9y0$o\5A o rEDU2y#4l: !z"M#N#f#T##"Y="d!!" KK] [G|' #F mLjB=|DpSR2=C Q :mMH)M<߭ QG^֟Ӽ!ӕ8ӤGՐ%t{٧+(3b; 3ds`O&@@ ; V4Mm%"b<{K  sJy2 d  2 k:?  (PWtLq .e~  RHl{c,IC1|! ٞBle/׉/('iߣI^xK$p{Qn?M7D* E F_ODV(>(KbpszMlTQqx#w" 3 @_4# 0 Oh6/Oa ^h 9$ t cRX$f~|8.`q9+"kv Yb{KcxDx0l  |fBpGTyuV)abDk:w 5 cHX% $E bZ,uo : Y uWwm U/Hl1Rn ([_۪ۮj 2 :/ug6j}v^cUPh8xP L > aV{Eg_&H D/9d_|Mc2M% P'mj cC  f\; i1 NqH@x c U WyV|i:Ec ` G cl5ja!-' H:C%U4t "4 S l  " B<+  | ^ % k#  '9.lmFMQ/ dSMpTrdWUz2[)jsPvUm\ M  2FH= 1/G Nd&oL_3l#ah2mj  "  7 9    f  k ) U 8 } jO_qis1!UoQ; <=$jOv a93Gw|b6)xq2# t I jpgQ\a=MB]!b {9I  z k " z w _ I 0~ 8  ~N  e h wvN.v&> 5;33{eMEGR'~"8BeQ4d YqbdB q h w p rV /?`+WwOk}@3$a) z  C = _ t z h 4=  [ i-/=0=a~S 7JG4LWu+u={tAys1 U < } 3>N0YAK4I}7K G_7$  ( K o H   dd     N  R *w)qI^0%$;-dF!?GT4/`(=5M6@W)kz s u  d E^,SOl>Q.+  ;   Z  ] Ac^  1 o d _J0U'kWm! |(@qB'onBFeLphLJRVJaeppm} }| ~ AvB=NY)u%w w fZ ^ \) b fC a M - OG9wM @zoU|[bg]OW`Xhz8U/5/9`=v5vZ%-|}`6!( 82 4 # =cuW\ z x g G 2 # d   O @X 9LdCk|` q mYu e=M1u,W]V0 A|p$re ' G } Z7[~,\E7a/' Hyrm5z=^d%^N_@<Gbdf$ xcLjC#Z U>86yt$(XtXv]6( FkMM4$T Xn%pY@Y- *Cu@9u6HIiY{F.+i:(l x{P%2_v\7aNz<tY qj .o7h CR)  +  3o`#%'hQ&svi9(x?C|:Kr+ugAMr>P)tj>ZZ|9Y oH6"p_#hy(OT=\wzS$65&5'*7ZDf-BuM?+V ;})RZ NkE^8J}kJ+Z;Bm-TO^nH45% q9c3ExrW/Ym2Lykd~o\3 kif?zs+nSguoG" pZ)s;k=I()(iX6"$3b5*?0|4P%-)A`LxII8u7Nx9!(#r[XgP%nAez.R^!Ls rZE Ad<u$cqMJsdi/O(r#U7 Io#LN!tQFq:R. h/rg'UEw6'>vr=u~ ](hc` 6_$[ I+zr SzU'1Ritww[oJ_GMP9`)z(>/n64/<Yq}?n)ydKx.FI xya*G';q;a JCJ_E (EIau{Fs@ w%^7LWmZ^WTQOGR<Y4e.x,-18?F%JFHf>.xHxY<vmdhY7N>*RkIn/cf o %5J3\Tot:Ww&,)R*{%)3:;<:9778<@EKO*P?QSMhD{7&}iWG7|)rj e`[WRJBf5G&+ 2AQaotests/auto/qfeedbackmmk/tst_qfeedbackmmk.cpp000066400000000000000000000162741215142760100216230ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //TESTED_COMPONENT=src/feedback #include #include #include #include #include class tst_QFeedbackMMK : public QObject { Q_OBJECT public: tst_QFeedbackMMK(); ~tst_QFeedbackMMK(); public slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); private slots: void goodFile(); void badFile(); private: QUrl url; }; tst_QFeedbackMMK::tst_QFeedbackMMK() { } tst_QFeedbackMMK::~tst_QFeedbackMMK() { } void tst_QFeedbackMMK::initTestCase() { // Only perform tests if audio device exists // have to check specific formats supported as test plugin maybe installed QStringList mimeTypes = QFeedbackFileEffect::supportedMimeTypes(); if (!(mimeTypes.contains("audio/x-wav") || mimeTypes.contains("audio/wav") || mimeTypes.contains("audio/wave") || mimeTypes.contains("audio/x-pn-wav"))) QSKIP("No audio devices available"); // Some of this comes from the qsoundeffect testcase . .. ... #ifdef QT_QFEEDBACKMMK_USEAPPLICATIONPATH url = QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + QString("/test.wav")); #else url = QUrl::fromLocalFile(QString(SRCDIR "test.wav")); #endif } void tst_QFeedbackMMK::cleanupTestCase() { } void tst_QFeedbackMMK::init() { #ifdef Q_OS_SYMBIAN //we need that head start for the eventloop to be responsive QTest::qWait(1000); #endif } void tst_QFeedbackMMK::cleanup() { } Q_DECLARE_METATYPE(QFeedbackEffect::ErrorType); void tst_QFeedbackMMK::goodFile() { QFeedbackFileEffect fe; qRegisterMetaType(); QSignalSpy errorSpy(&fe, SIGNAL(error(QFeedbackEffect::ErrorType))); QSignalSpy stateSpy(&fe, SIGNAL(stateChanged())); QFileInfo fi(url.toLocalFile()); qDebug() << "URL for test data:" << url << url.toLocalFile() << fi.exists(); fe.setSource(url); QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Loading); QCOMPARE(errorSpy.count(), 0); QCOMPARE(stateSpy.count(), 1); // Stopped to Loading // Wait for it to be loaded QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Stopped); QCOMPARE(errorSpy.count(), 0); QCOMPARE(stateSpy.count(), 2); // Stopped to Loading to Stopped // Now play! fe.start(); // Now wait for it to be playing QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Running); QCOMPARE(errorSpy.count(), 0); QCOMPARE(stateSpy.count(), 3); // Stopped to Loading to Stopped to Running QVERIFY(fe.isLoaded()); QVERIFY(fe.duration() == 0); // unsupported :/ // Try pausing - not supported fe.pause(); // XXX this emits stateChanged even when it fails QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Running); QCOMPARE(errorSpy.count(), 1); QCOMPARE(stateSpy.count(), 4); // Stopped to Loading to Stopped to Running // It should run out, eventually QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Stopped); QCOMPARE(errorSpy.count(), 1); QCOMPARE(stateSpy.count(), 5); // Stopped to Loading to Stopped to Running to Stopped // Play it again.. fe.start(); QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Running); QCOMPARE(errorSpy.count(), 1); QCOMPARE(stateSpy.count(), 6); // Stopped to Loading to Stopped to Running to Stopped to Running fe.stop(); QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Stopped); QCOMPARE(errorSpy.count(), 1); QCOMPARE(stateSpy.count(), 7); // Stopped to Loading to Stopped to Running to Stopped to Running to Stopped fe.unload(); QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Stopped); QCOMPARE(stateSpy.count(), 7); // no change QCOMPARE(fe.isLoaded(), false); QCOMPARE(fe.duration(), 0); // now load again fe.load(); #ifdef Q_OS_MAC QEXPECT_FAIL("", "QTBUG-25448", Abort); #endif QTRY_COMPARE((int)fe.state(), (int)QFeedbackFileEffect::Loading); QCOMPARE(errorSpy.count(), 1); QCOMPARE(stateSpy.count(), 8); // Stopped to Loading // Now wait for it to be loaded and playing QTRY_COMPARE((int)fe.state(), (int) QFeedbackFileEffect::Stopped); QCOMPARE(errorSpy.count(), 1); QCOMPARE(stateSpy.count(), 9); // Stopped to Loading to Stopped QVERIFY(fe.isLoaded()); // destroy it while playing } void tst_QFeedbackMMK::badFile() { QFeedbackFileEffect fe; qRegisterMetaType(); QSignalSpy errorSpy(&fe, SIGNAL(error(QFeedbackEffect::ErrorType))); QSignalSpy stateSpy(&fe, SIGNAL(stateChanged())); fe.setSource(QUrl("file:///does/not/exist/ever.wav")); // Depending on event loops we might miss the Loading state. QTRY_VERIFY(stateSpy.count() > 0); // Loading & Stopped QTRY_COMPARE(fe.state(), QFeedbackEffect::Stopped); QVERIFY(errorSpy.count() > 0); QVERIFY(fe.isLoaded() == false); stateSpy.clear(); errorSpy.clear(); fe.start(); // this actually causes a load, so it goes into LOADING, then fails, should go to STOPPED QTRY_VERIFY(stateSpy.count() > 0); // Loading & Stopped QTRY_COMPARE(fe.state(), QFeedbackEffect::Stopped); QVERIFY(errorSpy.count() > 0); QVERIFY(fe.isLoaded() == false); } QTEST_MAIN(tst_QFeedbackMMK) #include "tst_qfeedbackmmk.moc" tests/auto/qfeedbackplugin/000077500000000000000000000000001215142760100163135ustar00rootroot00000000000000tests/auto/qfeedbackplugin/qfeedbackplugin.pro000066400000000000000000000001621215142760100221600ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += testplugin \ # unittest \ testplugin2 \ testplugin3 tests/auto/qfeedbackplugin/testplugin/000077500000000000000000000000001215142760100205115ustar00rootroot00000000000000tests/auto/qfeedbackplugin/testplugin/qfeedbacktestplugin.cpp000066400000000000000000000151531215142760100252460ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "qfeedbacktestplugin.h" #include #include #include #include #include #include #include QFeedbackTestPlugin::QFeedbackTestPlugin() : QObject(qApp), mHapticState(QFeedbackEffect::Stopped), mFileState(QFeedbackEffect::Stopped) { actuators_ << createFeedbackActuator(this, 0) << createFeedbackActuator(this, 1); } QFeedbackTestPlugin::~QFeedbackTestPlugin() { } QFeedbackInterface::PluginPriority QFeedbackTestPlugin::pluginPriority() { return PluginHighPriority; // to make sure we get used } QList QFeedbackTestPlugin::actuators() { return actuators_; } void QFeedbackTestPlugin::setActuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop, const QVariant &value) { Q_UNUSED(actuator) Q_UNUSED(prop) Q_UNUSED(value) } QVariant QFeedbackTestPlugin::actuatorProperty(const QFeedbackActuator &actuator, ActuatorProperty prop) { Q_UNUSED(actuator) switch (prop) { case Name: if (actuator.id() == 0) return QString(QLatin1String("test plugin")); else return QString(QLatin1String("5555")); case State: return static_cast(QFeedbackActuator::Unknown); case Enabled: return false; default: break; } return QVariant(); } bool QFeedbackTestPlugin::isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability cap) { switch (cap) { case QFeedbackActuator::Envelope: case QFeedbackActuator::Period: return true; default: break; } return false; } QTimer* QFeedbackTestPlugin::ensureTimer(const QFeedbackHapticsEffect* effect) { // Yes, this is slow QTimer *t = mHapticEffects.key(effect); if (!t) { t = new QTimer(); t->setSingleShot(true); t->setInterval(effect->duration()); connect(t, SIGNAL(timeout()), this, SLOT(timerExpired())); mHapticEffects.insert(t, effect); } return t; } void QFeedbackTestPlugin::updateEffectProperty(const QFeedbackHapticsEffect *effect, EffectProperty ep) { if (ep == QFeedbackHapticsInterface::Duration) { QTimer* t = ensureTimer(effect); t->setInterval(effect->duration()); } } void QFeedbackTestPlugin::setEffectState(const QFeedbackHapticsEffect *effect, QFeedbackEffect::State state) { Q_UNUSED(effect) if (mHapticState != state) { mHapticState = state; QTimer* t = ensureTimer(effect); if (mHapticState == QFeedbackEffect::Running) { t->start(); } else if (mHapticState == QFeedbackEffect::Stopped) { t->stop(); } else if (mHapticState == QFeedbackEffect::Paused) { // In theory should set the duration to the remainder... t->stop(); } } } QFeedbackEffect::State QFeedbackTestPlugin::effectState(const QFeedbackHapticsEffect *effect) { Q_UNUSED(effect) return mHapticState; } void QFeedbackTestPlugin::timerExpired() { mHapticState = QFeedbackEffect::Stopped; // Emit the stateChanged signal const QFeedbackHapticsEffect* effect = mHapticEffects.value(static_cast(sender())); if (effect) { QMetaObject::invokeMethod(const_cast(effect), "stateChanged"); } } void QFeedbackTestPlugin::setLoaded(QFeedbackFileEffect *effect, bool load) { if (effect->source() == QUrl("load")) { // Succeed the load if (load) { mFileState = QFeedbackEffect::Loading; reportLoadFinished(effect, true); // not strictly true } else mFileState = QFeedbackEffect::Stopped; } else { // Fail the load if (load) reportLoadFinished(effect, false); } } void QFeedbackTestPlugin::setEffectState(QFeedbackFileEffect *effect, QFeedbackEffect::State state) { Q_UNUSED(effect) if (effect->source() == QUrl("load")) // we only change state for good effects mFileState = state; } QFeedbackEffect::State QFeedbackTestPlugin::effectState(const QFeedbackFileEffect *effect) { Q_UNUSED(effect) return mFileState; } int QFeedbackTestPlugin::effectDuration(const QFeedbackFileEffect *effect) { Q_UNUSED(effect) return 5678; } QStringList QFeedbackTestPlugin::supportedMimeTypes() { return QStringList() << "x-test/this is a test"; } bool QFeedbackTestPlugin::play(QFeedbackEffect::Effect effect) { if (effect == QFeedbackEffect::Press) return true; else { reportError(0, QFeedbackEffect::UnknownError); return false; } } tests/auto/qfeedbackplugin/testplugin/qfeedbacktestplugin.h000066400000000000000000000100401215142760100247010ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKTESTPLUGIN_H #define QFEEDBACKTESTPLUGIN_H #include #include #include #include #include #include #include #include QT_BEGIN_HEADER QT_USE_NAMESPACE class QFeedbackTestPlugin : public QObject, public QFeedbackHapticsInterface, public QFeedbackFileInterface, public QFeedbackThemeInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackTestPlugin") Q_INTERFACES(QFeedbackHapticsInterface) Q_INTERFACES(QFeedbackFileInterface) Q_INTERFACES(QFeedbackThemeInterface) public: QFeedbackTestPlugin(); virtual ~QFeedbackTestPlugin(); virtual PluginPriority pluginPriority(); virtual QList actuators(); //for actuator handling virtual void setActuatorProperty(const QFeedbackActuator &, ActuatorProperty, const QVariant &); virtual QVariant actuatorProperty(const QFeedbackActuator &, ActuatorProperty); virtual bool isActuatorCapabilitySupported(const QFeedbackActuator &, QFeedbackActuator::Capability); virtual void updateEffectProperty(const QFeedbackHapticsEffect *, EffectProperty); virtual void setEffectState(const QFeedbackHapticsEffect *, QFeedbackEffect::State); virtual QFeedbackEffect::State effectState(const QFeedbackHapticsEffect *); //for loading files virtual void setLoaded(QFeedbackFileEffect*, bool); virtual void setEffectState(QFeedbackFileEffect *, QFeedbackEffect::State); virtual QFeedbackEffect::State effectState(const QFeedbackFileEffect *); virtual int effectDuration(const QFeedbackFileEffect *); virtual QStringList supportedMimeTypes(); // For themes virtual bool play(QFeedbackEffect::Effect); private slots: void timerExpired(); private: QList actuators_; // Our hacky state QFeedbackEffect::State mHapticState; QFeedbackEffect::State mFileState; QMap mHapticEffects; QTimer* ensureTimer(const QFeedbackHapticsEffect* effect); }; QT_END_HEADER #endif tests/auto/qfeedbackplugin/testplugin/testplugin.pro000066400000000000000000000003121215142760100234250ustar00rootroot00000000000000TARGET = qtfeedback_testplugin QT = core feedback PLUGIN_TYPE = feedback load(qt_plugin) HEADERS += qfeedbacktestplugin.h SOURCES += qfeedbacktestplugin.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qfeedbackplugin/testplugin2/000077500000000000000000000000001215142760100205735ustar00rootroot00000000000000tests/auto/qfeedbackplugin/testplugin2/qfeedbacktestplugin.cpp000066400000000000000000000044271215142760100253320ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "qfeedbacktestplugin.h" #include #include #include #include #include #include #include QFeedbackTestPlugin::QFeedbackTestPlugin() : QObject(qApp) { } QFeedbackTestPlugin::~QFeedbackTestPlugin() { } tests/auto/qfeedbackplugin/testplugin2/qfeedbacktestplugin.h000066400000000000000000000052461215142760100247770ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKTESTPLUGIN_H #define QFEEDBACKTESTPLUGIN_H #include #include #include #include #include #include #include #include QT_BEGIN_HEADER QT_USE_NAMESPACE class QFeedbackTestPlugin : public QObject, public QFeedbackThemeInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackTestPlugin2") Q_INTERFACES(QFeedbackThemeInterface) public: QFeedbackTestPlugin(); virtual ~QFeedbackTestPlugin(); virtual PluginPriority pluginPriority() {return QFeedbackInterface::PluginNormalPriority;} virtual bool play(QFeedbackEffect::Effect) {return false;} }; QT_END_HEADER #endif tests/auto/qfeedbackplugin/testplugin2/testplugin2.pro000066400000000000000000000003411215142760100235730ustar00rootroot00000000000000TARGET = qtfeedback_testplugin2 QT = core feedback PLUGIN_TYPE = feedback load(qt_plugin) CONFIG += testplugin HEADERS += qfeedbacktestplugin.h SOURCES += qfeedbacktestplugin.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qfeedbackplugin/testplugin3/000077500000000000000000000000001215142760100205745ustar00rootroot00000000000000tests/auto/qfeedbackplugin/testplugin3/qfeedbacktestplugin.cpp000066400000000000000000000044271215142760100253330ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #include #include "qfeedbacktestplugin.h" #include #include #include #include #include #include #include QFeedbackTestPlugin::QFeedbackTestPlugin() : QObject(qApp) { } QFeedbackTestPlugin::~QFeedbackTestPlugin() { } tests/auto/qfeedbackplugin/testplugin3/qfeedbacktestplugin.h000066400000000000000000000052421215142760100247740ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the Qt Mobility Components. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QFEEDBACKTESTPLUGIN_H #define QFEEDBACKTESTPLUGIN_H #include #include #include #include #include #include #include #include QT_BEGIN_HEADER QT_USE_NAMESPACE class QFeedbackTestPlugin : public QObject, public QFeedbackThemeInterface { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtFeedbackTestPlugin3") Q_INTERFACES(QFeedbackThemeInterface) public: QFeedbackTestPlugin(); virtual ~QFeedbackTestPlugin(); virtual PluginPriority pluginPriority() {return QFeedbackInterface::PluginLowPriority;} virtual bool play(QFeedbackEffect::Effect) {return false;} }; QT_END_HEADER #endif tests/auto/qfeedbackplugin/testplugin3/testplugin3.pro000066400000000000000000000004101215142760100235720ustar00rootroot00000000000000TARGET = qtfeedback_testplugin3 QT = core feedback PLUGIN_TYPE = feedback load(qt_plugin) INCLUDEPATH += $$QT.feedback.includes CONFIG += testplugin HEADERS += qfeedbacktestplugin.h SOURCES += qfeedbacktestplugin.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/auto/qfeedbackplugin/unittest/000077500000000000000000000000001215142760100201725ustar00rootroot00000000000000tests/auto/qfeedbackplugin/unittest/tst_qfeedbackplugin.cpp000066400000000000000000000161011215142760100247130ustar00rootroot00000000000000/**************************************************************************** ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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, Digia gives you certain additional ** rights. These rights are described in the Digia 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. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //TESTED_COMPONENT=src/feedback #include #include #include QT_USE_NAMESPACE class tst_QFeedbackPlugin : public QObject { Q_OBJECT public: tst_QFeedbackPlugin(); ~tst_QFeedbackPlugin(); public slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); private slots: void testPlugin(); void testFileEffect(); void testThemeEffect(); }; tst_QFeedbackPlugin::tst_QFeedbackPlugin() { } tst_QFeedbackPlugin::~tst_QFeedbackPlugin() { } void tst_QFeedbackPlugin::initTestCase() { } void tst_QFeedbackPlugin::cleanupTestCase() { } void tst_QFeedbackPlugin::init() { } void tst_QFeedbackPlugin::cleanup() { } void tst_QFeedbackPlugin::testThemeEffect() { QVERIFY(QFeedbackEffect::supportsThemeEffect()); QVERIFY(QFeedbackEffect::playThemeEffect(QFeedbackEffect::Press)); QVERIFY(!QFeedbackEffect::playThemeEffect(QFeedbackEffect::Release)); } void tst_QFeedbackPlugin::testFileEffect() { QFeedbackFileEffect fileEffect; QVERIFY(QFeedbackFileEffect::supportedMimeTypes().contains("x-test/this is a test")); QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); fileEffect.setSource(QUrl("load")); // this should call load QVERIFY(fileEffect.state() == QFeedbackEffect::Loading); fileEffect.setSource(QUrl("ignored")); // not stopped, should fail QVERIFY(fileEffect.source() == QUrl("load")); QVERIFY(fileEffect.isLoaded()); fileEffect.setLoaded(true); // should do nothing QVERIFY(fileEffect.isLoaded()); QCOMPARE(fileEffect.duration(), 5678); // from the plugin fileEffect.unload(); // should fail, since we're not STOPPED (HMM!!) QVERIFY(fileEffect.isLoaded()); fileEffect.stop(); QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); // Now we should be able to change things again // Make sure setting the source to the same thing is a noop fileEffect.setSource(fileEffect.source()); QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); // Now unload QVERIFY(fileEffect.isLoaded()); fileEffect.unload(); QVERIFY(!fileEffect.isLoaded()); QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); QCOMPARE(fileEffect.duration(), 0); // unloaded, shouldn't call? // Change the url fileEffect.setSource(QUrl("failload")); QVERIFY(!fileEffect.isLoaded()); // Spinning the event loop is necessary for mmk to fail a load QTRY_COMPARE(fileEffect.state(), QFeedbackEffect::Stopped); QCOMPARE(fileEffect.duration(), 0); // unknown fileEffect.setSource(QUrl("load")); QVERIFY(fileEffect.isLoaded()); QVERIFY(fileEffect.state() == QFeedbackEffect::Loading); fileEffect.start(); QVERIFY(fileEffect.state() == QFeedbackEffect::Running); fileEffect.start(); QVERIFY(fileEffect.state() == QFeedbackEffect::Running); fileEffect.stop(); QVERIFY(fileEffect.state() == QFeedbackEffect::Stopped); fileEffect.pause(); QVERIFY(fileEffect.state() == QFeedbackEffect::Paused); // XXX this is a strange transition } void tst_QFeedbackPlugin::testPlugin() { QFeedbackHapticsEffect testEffect; // first get the actuators. we want to use the test plugin actuator. QFeedbackActuator* testActuator; QList actuators = QFeedbackActuator::actuators(); QCOMPARE(actuators.count(), 2); QCOMPARE(actuators.at(0)->name(), QString("test plugin")); QCOMPARE(actuators.at(0)->id(), 0); QCOMPARE(actuators.at(1)->name(), QString("5555")); QCOMPARE(actuators.at(1)->id(), 1); // make sure we found the test actuator... testActuator = actuators.at(0); QCOMPARE(testActuator->name(), QString("test plugin")); QCOMPARE(testActuator->id(), 0); // test QVERIFY(testActuator->isCapabilitySupported(QFeedbackActuator::Period)); testActuator->setEnabled(true); QVERIFY(!testActuator->isEnabled()); // the test plugin always returns enabled = false. testActuator->setEnabled(false); QVERIFY(!testActuator->isEnabled()); // the test plugin always returns enabled = false. testActuator->setEnabled(true); QVERIFY(!testActuator->isEnabled()); // the test plugin always returns enabled = false. QCOMPARE(testActuator->state(), QFeedbackActuator::Unknown); // and it always returns state = unknown. // XXX TODO: ensure that a "working" plugin returns real values.. // then, ensure that the test effect uses this actuator. testEffect.setActuator(testActuator); // it will do nothing, so stick some values in and play it. testEffect.setAttackIntensity(0.0); testEffect.setAttackTime(250); testEffect.setIntensity(1.0); testEffect.setDuration(100); testEffect.setFadeTime(250); testEffect.setFadeIntensity(0.0); testEffect.start(); QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Running); testEffect.pause(); QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Paused); testEffect.start(); QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Running); testEffect.stop(); QVERIFY(testEffect.state() == QFeedbackHapticsEffect::Stopped); } QTEST_MAIN(tst_QFeedbackPlugin) #include "tst_qfeedbackplugin.moc" tests/auto/qfeedbackplugin/unittest/unittest.pro000066400000000000000000000002411215142760100225700ustar00rootroot00000000000000include(../../auto.pri) QT += feedback SOURCES += tst_qfeedbackplugin.cpp linux-g++-maemo:DEFINES += HAVE_ACTUATORS DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 tests/tests.pro000066400000000000000000000000431215142760100141000ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += auto