diff options
author | Assam Boudjelthia <[email protected]> | 2021-05-11 12:49:40 +0300 |
---|---|---|
committer | Assam Boudjelthia <[email protected]> | 2021-06-29 14:08:24 +0300 |
commit | ae24e41ad4da78b029fd42ea317e4d2be73b015e (patch) | |
tree | 3f2d8c44dbf5a3eb666a7782bb5c1dfd62481c8e | |
parent | ede82024b08842e9599b9bdbd00b7498601a921f (diff) |
The JNI utilities (i.e. QJniObject, QJniEnvironment) are already under
qtbase as public APIs.
Permission handling is now under QCoreApplication::{check,request}Permission
and QPermission namespace.
Some of the QtAndroid namespace functions are now under QNativeInterface's
QAndroidApplication, this includes:
* sdkVersion()
* hideSplashScreen()
* context() and isActivityContext()
* runOnAndroidMainThread()
The remaining APIs are now moved as private APIs under qtbase
ee05af296f65e240f64db6470cdddafbddbf2fa3. That is until we add
new cross-platform APIs to replace their functionalities like
Intents handling, starting activites and working with Services.
Task-number: QTBUG-83251
Task-number: QTBUG-84382
Pick-to: 6.2
Change-Id: Id077f8cbbe223a987916f737fad6088fb58e470d
Reviewed-by: Ville Voutilainen <[email protected]>
218 files changed, 30 insertions, 17885 deletions
diff --git a/.cmake.conf b/.cmake.conf deleted file mode 100644 index 4e73b3d..0000000 --- a/.cmake.conf +++ /dev/null @@ -1 +0,0 @@ -set(QT_REPO_MODULE_VERSION "6.2.0") diff --git a/.qmake.conf b/.qmake.conf deleted file mode 100644 index b044179..0000000 --- a/.qmake.conf +++ /dev/null @@ -1,5 +0,0 @@ -load(qt_build_config) - -DEFINES += QT_NO_FOREACH - -MODULE_VERSION = 6.2.0 diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 4e28914..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Generated from qtandroidextras.pro. - -cmake_minimum_required(VERSION 3.15.0) - -include(.cmake.conf) -project(QtAndroidExtras - VERSION "${QT_REPO_MODULE_VERSION}" - DESCRIPTION "Qt AndroidExtras Libraries" - HOMEPAGE_URL "https://qt.io/" - LANGUAGES CXX C -) - -# Make sure we use the fixed BASE argument of qt_add_resource. -set(QT_USE_FIXED_QT_ADD_RESOURCE_BASE TRUE) - -# special case begin -find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) -find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Gui) - -if (NOT ANDROID) - message(NOTICE "Skipping the build as the condition \"ANDROID\" is not met.") - return() -endif() -# special case end - -if(NOT TARGET Qt::Gui) - message(NOTICE "Skipping the build as the condition \"TARGET Qt::Gui\" is not met.") - return() -endif() - -qt_build_repo() diff --git a/LICENSE.FDL b/LICENSE.FDL deleted file mode 100644 index 938bb8d..0000000 --- a/LICENSE.FDL +++ /dev/null @@ -1,450 +0,0 @@ - GNU Free Documentation License - Version 1.3, 3 November 2008 - - - Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. - <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -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. diff --git a/LICENSE.GPL2 b/LICENSE.GPL2 deleted file mode 100644 index d159169..0000000 --- a/LICENSE.GPL2 +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 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. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) 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 -this service 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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. 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. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -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 Program or any portion -of it, thus forming a work based on the Program, 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) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -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 Program, 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 Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) 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; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, 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 executable. However, as a -special exception, the source code 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. - -If distribution of executable or 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 counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program 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. - - 5. 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 Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program 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 to -this License. - - 7. 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 Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program 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 Program. - -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. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program 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. - - 9. The Free Software Foundation may publish revised and/or new versions -of the 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 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 Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, 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 - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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. - - 12. 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 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. - - 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 -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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 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, 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. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision 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, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This 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. diff --git a/LICENSE.GPL3 b/LICENSE.GPL3 deleted file mode 100644 index 94a9ed0..0000000 --- a/LICENSE.GPL3 +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/LICENSE.GPL3-EXCEPT b/LICENSE.GPL3-EXCEPT deleted file mode 100644 index b1cb1be..0000000 --- a/LICENSE.GPL3-EXCEPT +++ /dev/null @@ -1,704 +0,0 @@ -This is the GNU General Public License version 3, annotated with The -Qt Company GPL Exception 1.0: - -------------------------------------------------------------------------- - -The Qt Company GPL Exception 1.0 - -Exception 1: - -As a special exception you may create a larger work which contains the -output of this application and distribute that work under terms of your -choice, so long as the work is not otherwise derived from or based on -this application and so long as the work does not in itself generate -output that contains the output from this application in its original -or modified form. - -Exception 2: - -As a special exception, you have permission to combine this application -with Plugins licensed under the terms of your choice, to produce an -executable, and to copy and distribute the resulting executable under -the terms of your choice. However, the executable must be accompanied -by a prominent notice offering all users of the executable the entire -source code to this application, excluding the source code of the -independent modules, but including any changes you have made to this -application, under the terms of this license. - - -------------------------------------------------------------------------- - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/LICENSE.LGPL3 b/LICENSE.LGPL3 deleted file mode 100644 index 65c5ca8..0000000 --- a/LICENSE.LGPL3 +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - 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 that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU 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 as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ebe23d5 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# QtAndroidExtras + +**The QtAndroidExtras module has been deprecated and is no longer part of Qt.** + +The functionality of the module has been incorporated into other parts of Qt, or in some cases removed due to being obsolete or better suited as cross platform APIs. + +For more details, see [QTBUG-84382](https://bugreports.qt.io/browse/QTBUG-84382) in the Qt issue tracker. + +## Porting away from QtAndroidExtras + +To learn more about how to port from QtAndroidExtras to alternative APIs please visit the [Qt 6 porting guide](https://doc.qt.io/qt-6/portingguide.html). + +## Working on Qt 5 + +To work on patches for the Qt 5 series, check out a local branch of the relevant Qt version, e.g.: + +```bash +$ git checkout 5.15 +Branch '5.15' set up to track remote branch '5.15' from 'origin' by rebasing. +Switched to a new branch '5.15' +``` + +## Going back in time + +To inspect the code in the `dev` branch prior to its removal, follow these steps: + +```bash +$ git checkout -b my-dev dev~1 +Switched to a new branch 'my-dev' +``` diff --git a/coin/module_config.yaml b/coin/module_config.yaml deleted file mode 100644 index bcdc97c..0000000 --- a/coin/module_config.yaml +++ /dev/null @@ -1,23 +0,0 @@ -version: 2 -accept_configuration: - condition: property - property: features - not_contains_value: Disable - -instructions: - Build: - - !include "{{qt/qtbase}}/coin_module_build_template_v2.yaml" - - Test: - - type: Group - instructions: - - !include "{{qt/qtbase}}/coin_module_test_template_v3.yaml" - enable_if: - condition: and - conditions: - - condition: property - property: target.os - in_values: ["Android"] - - type: EnvironmentVariable - variableName: Dummy - variableValue: dummy diff --git a/dependencies.yaml b/dependencies.yaml deleted file mode 100644 index fb0e532..0000000 --- a/dependencies.yaml +++ /dev/null @@ -1,4 +0,0 @@ -dependencies: - ../qtbase: - ref: 286816e76ef9dd5c656a25e604ea00138da957f5 - required: true diff --git a/dist/changes-5.10.0 b/dist/changes-5.10.0 deleted file mode 100644 index e3cdf73..0000000 --- a/dist/changes-5.10.0 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.10 introduces many new features and improvements as well as bugfixes -over the 5.9.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.10 series is binary compatible with the 5.9.x series. -Applications compiled for 5.9 will continue to run with 5.10. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.10.0 Changes * -**************************************************************************** - - - Added low level APIs for Android Service & Binder. - - [QTBUG-50759] Added API for using Android's new Permission Model. - - [QTBUG-59200] Added timeout argument to the hideSplashScreen function. diff --git a/dist/changes-5.10.1 b/dist/changes-5.10.1 deleted file mode 100644 index 695c4e3..0000000 --- a/dist/changes-5.10.1 +++ /dev/null @@ -1,26 +0,0 @@ -Qt 5.10.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.10.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.10 series is binary compatible with the 5.9.x series. -Applications compiled for 5.9 will continue to run with 5.10. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -This release contains all fixes included in the Qt 5.9.4 release. - -**************************************************************************** -* Qt 5.10.1 Changes * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.11.0 b/dist/changes-5.11.0 deleted file mode 100644 index 8ef66ea..0000000 --- a/dist/changes-5.11.0 +++ /dev/null @@ -1,22 +0,0 @@ -Qt 5.11 introduces many new features and improvements as well as bugfixes -over the 5.10.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.11 series is binary compatible with the 5.10.x series. -Applications compiled for 5.10 will continue to run with 5.11. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.11.0 Changes * -**************************************************************************** - - - Updated QAndroidService to allow the user to easily register a binder creator diff --git a/dist/changes-5.11.1 b/dist/changes-5.11.1 deleted file mode 100644 index 030ea3f..0000000 --- a/dist/changes-5.11.1 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.11.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.11.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.11 series is binary compatible with the 5.10.x series. -Applications compiled for 5.10 will continue to run with 5.11. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.11.1 Changes * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.11.2 b/dist/changes-5.11.2 deleted file mode 100644 index 8efdf5e..0000000 --- a/dist/changes-5.11.2 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.11.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.11.0 through 5.11.1. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.11 series is binary compatible with the 5.10.x series. -Applications compiled for 5.10 will continue to run with 5.11. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.11.2 Changes * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.12.0 b/dist/changes-5.12.0 deleted file mode 100644 index 9d2cc96..0000000 --- a/dist/changes-5.12.0 +++ /dev/null @@ -1,23 +0,0 @@ -Qt 5.12 introduces many new features and improvements as well as bugfixes -over the 5.11.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* QtAndroid * -**************************************************************************** - - - QAndroidJniEnvironment::findClass convenient method to find classes in - all class loaders. diff --git a/dist/changes-5.12.1 b/dist/changes-5.12.1 deleted file mode 100644 index 1cb4dd7..0000000 --- a/dist/changes-5.12.1 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.12.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.12.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.12.10 b/dist/changes-5.12.10 deleted file mode 100644 index c9b97b2..0000000 --- a/dist/changes-5.12.10 +++ /dev/null @@ -1,28 +0,0 @@ -Qt 5.12.10 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.12.9. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - - https://doc.qt.io/qt-5.12/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Important Behavior Changes * -**************************************************************************** - -**************************************************************************** -* Library * -**************************************************************************** - - diff --git a/dist/changes-5.12.2 b/dist/changes-5.12.2 deleted file mode 100644 index 0c8bd85..0000000 --- a/dist/changes-5.12.2 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.12.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.12.0 through 5.12.1. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.12.3 b/dist/changes-5.12.3 deleted file mode 100644 index 8803320..0000000 --- a/dist/changes-5.12.3 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.12.3 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.12.0 through 5.12.2. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.12.4 b/dist/changes-5.12.4 deleted file mode 100644 index a285cd8..0000000 --- a/dist/changes-5.12.4 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.12.4 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.12.0 through 5.12.3. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5 deleted file mode 100644 index e8be931..0000000 --- a/dist/changes-5.12.5 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.12.5 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.12.0 through 5.12.4. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.12 series is binary compatible with the 5.11.x series. -Applications compiled for 5.11 will continue to run with 5.12. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0 deleted file mode 100644 index ebb4be1..0000000 --- a/dist/changes-5.13.0 +++ /dev/null @@ -1,18 +0,0 @@ -Qt 5.13 introduces many new features and improvements as well as bugfixes -over the 5.12.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.13 series is binary compatible with the 5.12.x series. -Applications compiled for 5.12 will continue to run with 5.13. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1 deleted file mode 100644 index 57ebdbe..0000000 --- a/dist/changes-5.13.1 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.13.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.13.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.13 series is binary compatible with the 5.12.x series. -Applications compiled for 5.12 will continue to run with 5.13. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.13.2 b/dist/changes-5.13.2 deleted file mode 100644 index e3bb833..0000000 --- a/dist/changes-5.13.2 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.13.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.13.0 through 5.13.1. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.13 series is binary compatible with the 5.12.x series. -Applications compiled for 5.12 will continue to run with 5.13. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.14.0 b/dist/changes-5.14.0 deleted file mode 100644 index 29a2c83..0000000 --- a/dist/changes-5.14.0 +++ /dev/null @@ -1,18 +0,0 @@ -Qt 5.14 introduces many new features and improvements as well as bugfixes -over the 5.13.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.14 series is binary compatible with the 5.13.x series. -Applications compiled for 5.13 will continue to run with 5.14. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.14.1 b/dist/changes-5.14.1 deleted file mode 100644 index d008638..0000000 --- a/dist/changes-5.14.1 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.14.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.14.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.14 series is binary compatible with the 5.13.x series. -Applications compiled for 5.13 will continue to run with 5.14. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.14.2 b/dist/changes-5.14.2 deleted file mode 100644 index 68a0051..0000000 --- a/dist/changes-5.14.2 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.14.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.14.0 through 5.14.1. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.14 series is binary compatible with the 5.13.x series. -Applications compiled for 5.13 will continue to run with 5.14. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. diff --git a/dist/changes-5.15.0 b/dist/changes-5.15.0 deleted file mode 100644 index 2aad19b..0000000 --- a/dist/changes-5.15.0 +++ /dev/null @@ -1,20 +0,0 @@ -Qt 5.15 introduces many new features and improvements as well as bugfixes -over the 5.14.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.15 series is binary compatible with the 5.14.x series. -Applications compiled for 5.14 will continue to run with 5.15. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains a new example: Qt JNI Messenger. - - - Minor code improvements. diff --git a/dist/changes-5.15.1 b/dist/changes-5.15.1 deleted file mode 100644 index 6e03bb7..0000000 --- a/dist/changes-5.15.1 +++ /dev/null @@ -1,28 +0,0 @@ -Qt 5.15.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.15.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -https://doc.qt.io/qt-5/index.html - -The Qt version 5.15 series is binary compatible with the 5.14.x series. -Applications compiled for 5.14 will continue to run with 5.15. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - - - This release contains only minor code improvements. - - Added examples for: - - Android service in the same process. - - Android Services with BroadcastReceiver. - - Android Service with QAndroidBinder. - - Android Service with Qt Remote Objects. - - Using Activities and handling their result within Qt. - - Using custom Java objects/ArrayList between Java and Qt. - diff --git a/dist/changes-5.15.2 b/dist/changes-5.15.2 deleted file mode 100644 index 3f584ae..0000000 --- a/dist/changes-5.15.2 +++ /dev/null @@ -1,28 +0,0 @@ -Qt 5.15.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.15.1. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - - https://doc.qt.io/qt-5.15/index.html - -The Qt version 5.15 series is binary compatible with the 5.14.x series. -Applications compiled for 5.14 will continue to run with 5.15. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Important Behavior Changes * -**************************************************************************** - -**************************************************************************** -* Library * -**************************************************************************** - - diff --git a/dist/changes-5.4.0 b/dist/changes-5.4.0 deleted file mode 100644 index 09a3482..0000000 --- a/dist/changes-5.4.0 +++ /dev/null @@ -1,26 +0,0 @@ -Qt 5.4 introduces many new features and improvements as well as bugfixes -over the 5.3.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - - http://qt-project.org/doc/qt-5.4 - -The Qt version 5.4 series is binary compatible with the 5.3.x series. -Applications compiled for 5.3 will continue to run with 5.4. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - http://bugreports.qt-project.org/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Library * -**************************************************************************** - -QtAndroidExtras -------------- - - - Notification example icon and documentation updated. - - QAndroidJniObject class documentation fixed. diff --git a/dist/changes-5.5.0 b/dist/changes-5.5.0 deleted file mode 100644 index 133dc93..0000000 --- a/dist/changes-5.5.0 +++ /dev/null @@ -1,26 +0,0 @@ -Qt 5.5 introduces many new features and improvements as well as bugfixes -over the 5.4.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - - http://qt-project.org/doc/qt-5.5 - -The Qt version 5.5 series is binary compatible with the 5.4.x series. -Applications compiled for 5.4 will continue to run with 5.5. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - http://bugreports.qt-project.org/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Library * -**************************************************************************** - -QAndroidJniObject ------------------ - - [QTBUG-43453] Fixed comparison overloads. - - Added convenience functions for jclass, jobject, jobjectArray and jthrowable - - Added the missing jcharArray variant of the callObjectMethod method. diff --git a/dist/changes-5.6.0 b/dist/changes-5.6.0 deleted file mode 100644 index f9e7e75..0000000 --- a/dist/changes-5.6.0 +++ /dev/null @@ -1,22 +0,0 @@ -Qt 5.6 introduces many new features and improvements as well as bugfixes -over the 5.5.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - - http://doc.qt.io/qt-5.6 - -The Qt version 5.6 series is binary compatible with the 5.5.x series. -Applications compiled for 5.5 will continue to run with 5.6. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - http://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* General * -**************************************************************************** - - This release contains only minor improvements. - diff --git a/dist/changes-5.6.1 b/dist/changes-5.6.1 deleted file mode 100644 index f87daec..0000000 --- a/dist/changes-5.6.1 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.6.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.6.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - - http://doc.qt.io/qt-5.6/ - -The Qt version 5.6 series is binary compatible with the 5.5.x series. -Applications compiled for 5.5 will continue to run with 5.6. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - http://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* General * -**************************************************************************** - - This release contains only minor improvements. - diff --git a/dist/changes-5.6.3 b/dist/changes-5.6.3 deleted file mode 100644 index f0feae1..0000000 --- a/dist/changes-5.6.3 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.6.3 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.6.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - - http://doc.qt.io/qt-5/index.html - -The Qt version 5.6 series is binary compatible with the 5.5.x series. -Applications compiled for 5.5 will continue to run with 5.6. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Library * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.7.0 b/dist/changes-5.7.0 deleted file mode 100644 index 79edb2d..0000000 --- a/dist/changes-5.7.0 +++ /dev/null @@ -1,45 +0,0 @@ -Qt 5.7 introduces many new features and improvements as well as bugfixes -over the 5.6.x series. Also, there is a change in the licensing terms. -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - - https://doc.qt.io - -The Qt version 5.7 series is binary compatible with the 5.6.x series. -Applications compiled for 5.6 will continue to run with 5.7. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - https://bugreports.qt.io - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Important License Changes * -**************************************************************************** - - This module is no longer available under LGPLv2.1. The libraries are - now available under the following licenses: - * Commercial License - * GNU General Public License v2.0 (LICENSE.GPL2) and later - * GNU Lesser General Public License v3.0 (LICENSE.LGPL3) - - The tools are now available under the following licenses: - * Commercial License - * GNU General Public License 3.0 (LICENSE.GPL3) with exceptions - described in The Qt Company GPL Exception 1.0 (LICENSE.GPL3-EXCEPT) - -**************************************************************************** -* Library * -**************************************************************************** - -- Added function QtAndroid::hideSplashScreen() to hide the splash screen. - -- Added function QtAndroid::androidService() to get the main Android service. - -- Added helper functions to run Runnables on the Android UI thread. - -- Added function QAndroidJniObject::fromLocalRef() to take ownership of a local - JNI reference. diff --git a/dist/changes-5.8.0 b/dist/changes-5.8.0 deleted file mode 100644 index 2a11f18..0000000 --- a/dist/changes-5.8.0 +++ /dev/null @@ -1,22 +0,0 @@ -Qt 5.8 introduces many new features and improvements as well as bugfixes -over the 5.7.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - - http://doc.qt.io/qt-5/index.html - -The Qt version 5.8 series is binary compatible with the 5.7.x series. -Applications compiled for 5.7 will continue to run with 5.8. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - - https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -QtAndroidExtras ---------------- - - - QtAndroid: - * [QTBUG-55102] Added QtAndroid::androidContext() diff --git a/dist/changes-5.9.0 b/dist/changes-5.9.0 deleted file mode 100644 index c8d075f..0000000 --- a/dist/changes-5.9.0 +++ /dev/null @@ -1,21 +0,0 @@ -Qt 5.9 introduces many new features and improvements as well as bugfixes -over the 5.8.x series. For more details, refer to the online documentation -included in this distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* General * -**************************************************************************** - - This release contains no new changes. diff --git a/dist/changes-5.9.1 b/dist/changes-5.9.1 deleted file mode 100644 index e0a6a4b..0000000 --- a/dist/changes-5.9.1 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.9.1 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.9.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Library * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.9.2 b/dist/changes-5.9.2 deleted file mode 100644 index 25aba57..0000000 --- a/dist/changes-5.9.2 +++ /dev/null @@ -1,23 +0,0 @@ -Qt 5.9.2 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.9.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.9.2 Changes * -**************************************************************************** - - This release contains only minor code improvements. diff --git a/dist/changes-5.9.3 b/dist/changes-5.9.3 deleted file mode 100644 index bb5db63..0000000 --- a/dist/changes-5.9.3 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.9.3 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.9.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.9.3 Changes * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.9.4 b/dist/changes-5.9.4 deleted file mode 100644 index d49a42f..0000000 --- a/dist/changes-5.9.4 +++ /dev/null @@ -1,25 +0,0 @@ -Qt 5.9.4 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.9.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.9.4 Changes * -**************************************************************************** - - - This release contains only minor code improvements. - diff --git a/dist/changes-5.9.5 b/dist/changes-5.9.5 deleted file mode 100644 index 876af5f..0000000 --- a/dist/changes-5.9.5 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.9.5 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.9.0. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.9.5 Changes * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/dist/changes-5.9.6 b/dist/changes-5.9.6 deleted file mode 100644 index f0179a5..0000000 --- a/dist/changes-5.9.6 +++ /dev/null @@ -1,24 +0,0 @@ -Qt 5.9.6 is a bug-fix release. It maintains both forward and backward -compatibility (source and binary) with Qt 5.9.0 through 5.9.5. - -For more details, refer to the online documentation included in this -distribution. The documentation is also available online: - -http://doc.qt.io/qt-5/index.html - -The Qt version 5.9 series is binary compatible with the 5.8.x series. -Applications compiled for 5.8 will continue to run with 5.9. - -Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Qt Bug Tracker: - -https://bugreports.qt.io/ - -Each of these identifiers can be entered in the bug tracker to obtain more -information about a particular change. - -**************************************************************************** -* Qt 5.9.6 Changes * -**************************************************************************** - - - This release contains only minor code improvements. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt deleted file mode 100644 index b6c43ae..0000000 --- a/examples/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Generated from examples.pro. - -qt_examples_build_begin() - -if(ANDROID) - add_subdirectory(androidextras) -endif() - -qt_examples_build_end() diff --git a/examples/androidextras/androidextras.pro b/examples/androidextras/androidextras.pro deleted file mode 100644 index 169797a..0000000 --- a/examples/androidextras/androidextras.pro +++ /dev/null @@ -1,19 +0,0 @@ -TEMPLATE = subdirs - -android { - qtHaveModule(quick) { - SUBDIRS += \ - notification \ - jnimessenger \ - services \ - customactivity \ - musiclist - - EXAMPLE_FILES += \ - notification \ - jnimessenger \ - services \ - customactivity \ - musiclist - } -} diff --git a/examples/androidextras/customactivity/activityhandler.cpp b/examples/androidextras/customactivity/activityhandler.cpp deleted file mode 100644 index 2d7b172..0000000 --- a/examples/androidextras/customactivity/activityhandler.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "activityhandler.h" - -#include <QAndroidIntent> - -const int REQUEST_CODE = 123; -const jint RESULT_OK = QAndroidJniObject::getStaticField<jint>("android/app/Activity", "RESULT_OK"); -ActivityHandler *ActivityHandler::m_instance = nullptr; - -ActivityHandler::ActivityHandler(QObject *parent) : QObject(parent) -{ - m_instance = this; -} - -void ActivityHandler::showSecondActivity() -{ - QAndroidIntent activityIntent(QtAndroid::androidActivity().object(), - "org/qtproject/example/activityhandler/CustomActivity"); - - QtAndroid::startActivity( - activityIntent.handle(), REQUEST_CODE, - [this](int requestCode, int resultCode, const QAndroidJniObject &data) { - activityReceiver(requestCode, resultCode, data); - }); -} - -void ActivityHandler::activityReceiver(int requestCode, int resultCode, const QAndroidJniObject &data) -{ - if (requestCode == REQUEST_CODE) { - if (resultCode == RESULT_OK) { - const QAndroidJniObject key = QAndroidJniObject::fromString("message"); - const QAndroidJniObject message = data.callObjectMethod( - "getStringExtra", "(Ljava/lang/String;)Ljava/lang/String;", key.object()); - if (message.isValid()) - emit ActivityHandler::instance()->receiveFromActivityResult(message.toString()); - } else { - emit ActivityHandler::instance()->receiveFromActivityResult("Rejected!"); - } - } -} diff --git a/examples/androidextras/customactivity/activityhandler.h b/examples/androidextras/customactivity/activityhandler.h deleted file mode 100644 index 3dba71e..0000000 --- a/examples/androidextras/customactivity/activityhandler.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ -#ifndef MULTIACTIVITY_H -#define MULTIACTIVITY_H - -#include <QtAndroid> - -class ActivityHandler : public QObject -{ - Q_OBJECT - -public: - ActivityHandler(QObject *parent = nullptr); - static ActivityHandler *instance() { return m_instance; } - - Q_INVOKABLE void showSecondActivity(); - void activityReceiver(int requestCode, int resultCode, const QAndroidJniObject &data); - -signals: - void receiveFromActivityResult(const QString &message); - -private: - static ActivityHandler *m_instance; -}; - -#endif // MULTIACTIVITY_H diff --git a/examples/androidextras/customactivity/android/AndroidManifest.xml b/examples/androidextras/customactivity/android/AndroidManifest.xml deleted file mode 100644 index 88e910d..0000000 --- a/examples/androidextras/customactivity/android/AndroidManifest.xml +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.activityhandler" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="minimal"/> - <!-- extract android style --> - </activity> - - <activity android:process=":custom_activity" android:name=".CustomActivity" android:label="-- %%INSERT_APP_NAME%% --"> - <!-- android:process=":qt" is needed to force the service to run on a separate process than the Activity --> - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - </activity> - - <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices --> - - </application> - -</manifest> diff --git a/examples/androidextras/customactivity/android/res/layout/second_activity.xml b/examples/androidextras/customactivity/android/res/layout/second_activity.xml deleted file mode 100644 index 0c07790..0000000 --- a/examples/androidextras/customactivity/android/res/layout/second_activity.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/relativeLayout" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:padding="20dp"> - - <TextView - android:id="@+id/blackboard_text" - android:layout_width="match_parent" - android:layout_height="350dp" - android:layout_gravity="center" - android:gravity="center" - android:singleLine="false" - android:text="@string/hello_second_activity" - android:textAlignment="center" - android:textSize="60sp" /> - - <Button - android:id="@+id/backButton" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/go_back" - android:layout_gravity="center_vertical|center_horizontal" /> -</LinearLayout> diff --git a/examples/androidextras/customactivity/android/res/values/strings.xml b/examples/androidextras/customactivity/android/res/values/strings.xml deleted file mode 100644 index 0b65e8f..0000000 --- a/examples/androidextras/customactivity/android/res/values/strings.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <string name="app_name">Qt Android Multi-Activity</string> - <string name="hello_second_activity">Hello Second Activity</string> - <string name="go_back">Go back</string> -</resources> diff --git a/examples/androidextras/customactivity/android/src/org/qtproject/example/activityhandler/CustomActivity.java b/examples/androidextras/customactivity/android/src/org/qtproject/example/activityhandler/CustomActivity.java deleted file mode 100644 index b2502e9..0000000 --- a/examples/androidextras/customactivity/android/src/org/qtproject/example/activityhandler/CustomActivity.java +++ /dev/null @@ -1,78 +0,0 @@ - /**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.activityhandler; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.Button; - - public class CustomActivity extends Activity { - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.second_activity); - - Button backButton = (Button) findViewById(R.id.backButton); - backButton.setOnClickListener(new View.OnClickListener() { - - @Override - public void onClick(View view) { - Intent resultIntent = new Intent(); - resultIntent.putExtra("message", "Back button clicked."); - setResult(Activity.RESULT_OK, resultIntent); - finish(); - } - }); - } -} diff --git a/examples/androidextras/customactivity/customactivity.pro b/examples/androidextras/customactivity/customactivity.pro deleted file mode 100644 index 5c5b1e8..0000000 --- a/examples/androidextras/customactivity/customactivity.pro +++ /dev/null @@ -1,27 +0,0 @@ -QT += quick androidextras - -DEFINES += QT_DEPRECATED_WARNINGS - -CONFIG += c++11 - -HEADERS += \ - activityhandler.h - -SOURCES += \ - activityhandler.cpp \ - main.cpp - -RESOURCES += qml.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/customactivity -INSTALLS += target - -android { - DISTFILES += \ - android/AndroidManifest.xml \ - android/src/org/qtproject/example/activityhandler/CustomActivity.java \ - android/res/layout/second_activity.xml \ - android/res/values/strings.xml - - ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android -} diff --git a/examples/androidextras/customactivity/doc/src/qtandroidextras-example-customactivity.qdoc b/examples/androidextras/customactivity/doc/src/qtandroidextras-example-customactivity.qdoc deleted file mode 100644 index ad075e6..0000000 --- a/examples/androidextras/customactivity/doc/src/qtandroidextras-example-customactivity.qdoc +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Android Custom Activity - \ingroup examples-qtandroidextras - \example customactivity - \brief Demonstrates working with custom Android activities. - - \image customactivity.png - - This example demonstrates how to create an Android Activity and run it from - your Qt application. The activity is composed of a Java class and an Android - XML layout which is started from the main app. The activity can send back data - after finishing which can be used in QML. - - When you click the \uicontrol{"Start custom Android activity"} button, the - activity is started, and the activity has a text view and a button to exit. - The activity can either use the button or the back gesture to go back. - - \include examples-run.qdocinc - - \section1 Create Activity Class - - Define an Android class called \c CustomActivity in the CustomActivity.java - file as follows: - - \quotefromfile customactivity/android/src/org/qtproject/example/activityhandler/CustomActivity.java - \skipto package - \printuntil /^\}/ - - The Activity's layout is defined at \e {customactivity/android/res/layout/second_activity.xml}. - - To use this Activity, it must be defined in the \e AndroidManifest.xml file - as follows: - - \quotefromfile customactivity/android/AndroidManifest.xml - \skipto :custom_activity - \printuntil </activity> - - \note To use any native JNI calls, you must extend \c QtActivity instead of - \c Activity. - - \section1 Start the Activity - - To start an Activity from Qt, you need to create an intent using \l{QAndroidIntent}, - then call \l{QtAndroid::startActivity} providing the intent, a custom request - code, and a callback function. The latter is called after the activity has - finished. You can start the activity as follows: - - \quotefromfile customactivity/activityhandler.cpp - \skipto showSecondActivity - \printuntil }); - \printline } - - Then, define the callback function that is called directly after the activity - is done: - - \quotefromfile customactivity/activityhandler.cpp - \skipto ActivityHandler::activityReceiver - \printuntil } - - \note You can first check that the \c requestCode and \c resultCode are correct. - - To connect C++ with QML, add an instance of the C++ class that is handling - the JNI logic as a QML property in the \e main.cpp file: - - \quotefromfile customactivity/main.cpp - \skipto ActivityHandler - \printuntil setContextProperty - - Then, add a \l Connections element to watch for messages from C++ in the - \e main.qml file: - - \quotefromfile customactivity/main.qml - \skipto Connections - \printuntil /^\ {4}\}/ - - And set the \c onClicked for the \uicontrol{"Start custom Android activity"} - button to: - - \quotefromfile services/common/main.qml - \skipto onClicked - \printline onClicked - - \sa {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/customactivity/main.cpp b/examples/androidextras/customactivity/main.cpp deleted file mode 100644 index 4c1ab3d..0000000 --- a/examples/androidextras/customactivity/main.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "activityhandler.h" - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - const QUrl url(http://code.qt.io/QStringLiteral(%22qrc:/main.qml")); - - ActivityHandler *activityHandler = new ActivityHandler(&app); - engine.rootContext()->setContextProperty(QLatin1String("activityHandler"), activityHandler); - - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, Qt::QueuedConnection); - engine.load(url); - - return app.exec(); -} diff --git a/examples/androidextras/customactivity/main.qml b/examples/androidextras/customactivity/main.qml deleted file mode 100644 index 75f8ff3..0000000 --- a/examples/androidextras/customactivity/main.qml +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.14 -import QtQuick.Window 2.14 -import QtQuick.Controls 2.14 - -Window { - id: window - visible: true - width: 640 - height: 480 - title: qsTr("Qt Activity handler") - - property string status: "Return status: " - Text { - id: resultText - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - font.pointSize: 20 - text: status + "not started" - } - - Button { - text: "Start custom Android activity" - anchors.verticalCenterOffset: 100 - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - onClicked: activityHandler.showSecondActivity() - } - - Connections { - target: activityHandler - function onReceiveFromActivityResult(message) { - resultText.text = status + message - } - } -} diff --git a/examples/androidextras/customactivity/qml.qrc b/examples/androidextras/customactivity/qml.qrc deleted file mode 100644 index 5f6483a..0000000 --- a/examples/androidextras/customactivity/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/androidextras/jnimessenger/android/AndroidManifest.xml b/examples/androidextras/jnimessenger/android/AndroidManifest.xml deleted file mode 100644 index 75b5369..0000000 --- a/examples/androidextras/jnimessenger/android/AndroidManifest.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.jnimessenger" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="Qt JNI Messenger" android:extractNativeLibs="true" android:icon="@drawable/icon"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - - <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices --> - - </application> - -</manifest> diff --git a/examples/androidextras/jnimessenger/android/res/drawable-hdpi/icon.png b/examples/androidextras/jnimessenger/android/res/drawable-hdpi/icon.png Binary files differdeleted file mode 100644 index d3ccebe..0000000 --- a/examples/androidextras/jnimessenger/android/res/drawable-hdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/jnimessenger/android/res/drawable-ldpi/icon.png b/examples/androidextras/jnimessenger/android/res/drawable-ldpi/icon.png Binary files differdeleted file mode 100644 index 2194be1..0000000 --- a/examples/androidextras/jnimessenger/android/res/drawable-ldpi/icon.png +++ /dev/null diff --git a/examples/androidextras/jnimessenger/android/res/drawable-mdpi/icon.png b/examples/androidextras/jnimessenger/android/res/drawable-mdpi/icon.png Binary files differdeleted file mode 100644 index 31812cc..0000000 --- a/examples/androidextras/jnimessenger/android/res/drawable-mdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/jnimessenger/android/res/drawable-xhdpi/icon.png b/examples/androidextras/jnimessenger/android/res/drawable-xhdpi/icon.png Binary files differdeleted file mode 100644 index 3aeae64..0000000 --- a/examples/androidextras/jnimessenger/android/res/drawable-xhdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/jnimessenger/android/res/drawable-xxhdpi/icon.png b/examples/androidextras/jnimessenger/android/res/drawable-xxhdpi/icon.png Binary files differdeleted file mode 100644 index f754fd1..0000000 --- a/examples/androidextras/jnimessenger/android/res/drawable-xxhdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/jnimessenger/android/res/drawable-xxxhdpi/icon.png b/examples/androidextras/jnimessenger/android/res/drawable-xxxhdpi/icon.png Binary files differdeleted file mode 100644 index d0d043b..0000000 --- a/examples/androidextras/jnimessenger/android/res/drawable-xxxhdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/jnimessenger/android/src/org/qtproject/example/jnimessenger/JniMessenger.java b/examples/androidextras/jnimessenger/android/src/org/qtproject/example/jnimessenger/JniMessenger.java deleted file mode 100644 index e3b7408..0000000 --- a/examples/androidextras/jnimessenger/android/src/org/qtproject/example/jnimessenger/JniMessenger.java +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.jnimessenger; - -public class JniMessenger -{ - private static native void callFromJava(String message); - - public JniMessenger() {} - - public static void printFromJava(String message) - { - System.out.println("This is printed from JAVA, message is: " + message); - callFromJava("Hello from JAVA!"); - } -} diff --git a/examples/androidextras/jnimessenger/doc/src/qtandroidextras-example-jnimessenger.qdoc b/examples/androidextras/jnimessenger/doc/src/qtandroidextras-example-jnimessenger.qdoc deleted file mode 100644 index 6b5838b..0000000 --- a/examples/androidextras/jnimessenger/doc/src/qtandroidextras-example-jnimessenger.qdoc +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Qt JNI Messenger - \ingroup examples-qtandroidextras - \example jnimessenger - \brief Demonstrates communication between Java code and QML or C++ using NJI calls. - - \image jnimessenger.png - - This example demonstrates how to add a custom Java class to an Android application, and - how to both call it from C++ and call C++ functions from Java using the JNI convenience - APIs in the Qt Android Extras module. The application UI is created by using Qt Quick. - - When clicking the send button, a message will be sent from QML to Java class though - the C++ class and a log of that is shown in the screen view. Logs also can be seen - from the Android logcat of the messages being exchanged, which would be similar to: - - \badcode - I System.out: This is printed from JAVA, message is: QML sending to Java: Hello from QML - D libjnimessenger_armeabi-v7a.so: qml: QML received a message: Hello from JAVA! - \endcode - - \include examples-run.qdocinc - - \section1 Calling Java Methods from C++ Code - - We define a custom Java class called \c JniMessenger in the JniMessenger.java file: - - \quotefromfile jnimessenger/android/src/org/qtproject/example/jnimessenger/JniMessenger.java - \skipto org.qtproject.example.jnimessenger - \printuntil /^\}/ - - \note The custom Java class can extend other classes like QtActivity, Activity or any - other Java class. - - In the jnimessenger.cpp file, we call the function \c printFromJava(String message) - by first creating a \c QAndroidJniObject for the Java String that we want to send - and then invoking a JNI call with \c callStaticMethod<>() while providing the method - signature: - - \quotefromfile jnimessenger/jnimessenger.cpp - \skipto void JniMessenger::printFromJava - \printuntil } - - That call will then execute the following from Java side, which would print the - message to the \c System.output. - - \quotefromfile jnimessenger/android/src/org/qtproject/example/jnimessenger/JniMessenger.java - \skipto public static void printFromJava - \printuntil ); - - \section1 Calling QML/C++ Functions from Java Code - - Directly after that, our native function \c callFromJava(String message) will be - called, which would be then handled from C++ side. Note, that this method has - to be defined as \c native at the top of the Java class as: - - \code - private static native void callFromJava(String message); - \endcode - - To be able to call C++ functions from Java, in our C++ class JniMessenger.cpp, - we need to define those functions using \c RegisterNatives() as follows: - - \quotefromfile jnimessenger/jnimessenger.cpp - \skipto JNINativeMethod - \printuntil } - - (See \l{Java Native Methods} for more details). - - We would need to register the functions' signatures in \c methods[], which have - the name in Java class, then its parameters and return types, then the function - pointer in the C++ code. - - \code - JNINativeMethod methods[] {{"callFromJava", "(Ljava/lang/String;)V", reinterpret_cast<void *>(callFromJava)}}; - \endcode - - This would insure that our C++ function is available from within the Java call. - Now, that function could simply print the message it received from Java to - the debug log, but we want to forward the received message to the QML components - so that it gets displayed in our text view, so we get: - - \quotefromfile jnimessenger/jnimessenger.cpp - \skipto static void callFromJava - \printuntil } - - Now, we need to implement the necessary \c Connections in the QML code to receive - the message from C++, which we would print into the \c Text view with the id \c messengerLog: - - \quotefromfile jnimessenger/main.qml - \skipto Connections - \printuntil /^\ {4}\}/ - - \sa {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/jnimessenger/jnimessenger.cpp b/examples/androidextras/jnimessenger/jnimessenger.cpp deleted file mode 100644 index 3c309ba..0000000 --- a/examples/androidextras/jnimessenger/jnimessenger.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "jnimessenger.h" - -#include <QAndroidJniObject> -#include <QAndroidJniEnvironment> -#include <QtAndroid> - -JniMessenger *JniMessenger::m_instance = nullptr; - -static void callFromJava(JNIEnv *env, jobject /*thiz*/, jstring value) -{ - emit JniMessenger::instance()->messageFromJava(env->GetStringUTFChars(value, nullptr)); -} - -JniMessenger::JniMessenger(QObject *parent) : QObject(parent) -{ - m_instance = this; - - JNINativeMethod methods[] {{"callFromJava", "(Ljava/lang/String;)V", reinterpret_cast<void *>(callFromJava)}}; - QAndroidJniObject javaClass("org/qtproject/example/jnimessenger/JniMessenger"); - - QAndroidJniEnvironment env; - jclass objectClass = env->GetObjectClass(javaClass.object<jobject>()); - env->RegisterNatives(objectClass, - methods, - sizeof(methods) / sizeof(methods[0])); - env->DeleteLocalRef(objectClass); -} - -void JniMessenger::printFromJava(const QString &message) -{ - QAndroidJniObject javaMessage = QAndroidJniObject::fromString(message); - QAndroidJniObject::callStaticMethod<void>("org/qtproject/example/jnimessenger/JniMessenger", - "printFromJava", - "(Ljava/lang/String;)V", - javaMessage.object<jstring>()); -} diff --git a/examples/androidextras/jnimessenger/jnimessenger.h b/examples/androidextras/jnimessenger/jnimessenger.h deleted file mode 100644 index 441e476..0000000 --- a/examples/androidextras/jnimessenger/jnimessenger.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -#ifndef MYCLASS_H -#define MYCLASS_H - -#include <QObject> - -class JniMessenger : public QObject -{ - Q_OBJECT - -public: - explicit JniMessenger(QObject *parent = nullptr); - static JniMessenger *instance() { return m_instance; } - Q_INVOKABLE void printFromJava(const QString &message); - -signals: - void messageFromJava(const QString &message); - -public slots: - -private: - static JniMessenger *m_instance; -}; - -#endif // MYCLASS_H diff --git a/examples/androidextras/jnimessenger/jnimessenger.pro b/examples/androidextras/jnimessenger/jnimessenger.pro deleted file mode 100644 index b1a6326..0000000 --- a/examples/androidextras/jnimessenger/jnimessenger.pro +++ /dev/null @@ -1,21 +0,0 @@ -QT += quick androidextras - -DEFINES += QT_DEPRECATED_WARNINGS - -SOURCES += \ - jnimessenger.cpp \ - main.cpp - -HEADERS += \ - jnimessenger.h - -RESOURCES += qml.qrc - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android -DISTFILES += \ - android/src/org/qtproject/example/jnimessenger/JniMessenger.java \ - android/AndroidManifest.xml - - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/jnimessenger -INSTALLS += target diff --git a/examples/androidextras/jnimessenger/main.cpp b/examples/androidextras/jnimessenger/main.cpp deleted file mode 100644 index 45e914a..0000000 --- a/examples/androidextras/jnimessenger/main.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "jnimessenger.h" - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - const QUrl url(http://code.qt.io/QStringLiteral(%22qrc:/main.qml")); - - JniMessenger *jniMessenger = new JniMessenger(&app); - - engine.rootContext()->setContextProperty(QLatin1String("JniMessenger"), jniMessenger); - - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, Qt::QueuedConnection); - engine.load(url); - - return app.exec(); -} diff --git a/examples/androidextras/jnimessenger/main.qml b/examples/androidextras/jnimessenger/main.qml deleted file mode 100644 index 57c90ec..0000000 --- a/examples/androidextras/jnimessenger/main.qml +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.13 -import QtQuick.Window 2.13 -import QtQuick.Controls 2.13 -import QtQuick.Layouts 1.13 - -ApplicationWindow { - id: window - visible: true - - ColumnLayout { - anchors.fill: parent - Text { - id: messengerLog - text: qsTr("") - clip: true - Layout.fillHeight: true - Layout.fillWidth: true - transformOrigin: Item.Center - Layout.alignment: Qt.AlignHCenter | Qt.AlignTop - } - - RowLayout { - id: rowlayout - Layout.bottomMargin: 10 - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - anchors.bottom: window.bottom - spacing: 10 - - Button { - text: qsTr("Send to Java via JNI") - onClicked: { - var message = qsTr("QML sending to Java: Hello from QML") - messengerLog.text += "\n" + message - JniMessenger.printFromJava(message) - } - } - - Button { - text: "Clear" - onClicked: messengerLog.text = "" - } - } - } - - Connections { - target: JniMessenger - function onMessageFromJava(message) { - var output = qsTr("QML received a message: %1").arg(message) - print(output) - messengerLog.text += "\n" + output - } - } -} diff --git a/examples/androidextras/jnimessenger/qml.qrc b/examples/androidextras/jnimessenger/qml.qrc deleted file mode 100644 index 5f6483a..0000000 --- a/examples/androidextras/jnimessenger/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/androidextras/musiclist/android/AndroidManifest.xml b/examples/androidextras/musiclist/android/AndroidManifest.xml deleted file mode 100644 index eea974e..0000000 --- a/examples/androidextras/musiclist/android/AndroidManifest.xml +++ /dev/null @@ -1,84 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.musiclist" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="minimal"/> - <!-- extract android style --> - </activity> - </application> - -</manifest> diff --git a/examples/androidextras/musiclist/android/src/org/qtproject/example/musiclist/MusicList.java b/examples/androidextras/musiclist/android/src/org/qtproject/example/musiclist/MusicList.java deleted file mode 100644 index d4dc840..0000000 --- a/examples/androidextras/musiclist/android/src/org/qtproject/example/musiclist/MusicList.java +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.musiclist; - -import android.content.ContentResolver; -import android.content.Context; -import android.database.Cursor; -import android.net.Uri; -import android.provider.MediaStore; -import java.util.ArrayList; - -public class MusicList { - - static ArrayList<MusicTrack> fetchMusicList(Context context) { - ArrayList<MusicTrack> musicList = new ArrayList<MusicTrack>(); - Cursor songCursor; - - try { - ContentResolver contentResolver = context.getContentResolver(); - Uri songUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; - songCursor = contentResolver.query(songUri, null, null, null, null); - } catch (SecurityException e) { - e.printStackTrace(); - return musicList; - } - - if (songCursor != null && songCursor.moveToFirst()) - { - int title = songCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE); - int artist = songCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST); - int duration = duration = songCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION); - - do { - String currentTitle = songCursor.getString(title); - String currentArtist = songCursor.getString(artist); - long currentDuration = songCursor.getLong(duration); - musicList.add(new MusicTrack(currentTitle, currentArtist, currentDuration)); - } while (songCursor.moveToNext()); - } - - if (songCursor != null) - songCursor.close(); - - return musicList; - } -} - -class MusicTrack { - - private String title; - private String artist; - private long duration; - - MusicTrack (String title, String artist, long duration) { - this.title = title; - this.artist = artist; - this.duration = duration; - } - - public String getTitle() { return title; } - - public String getArtist() { return artist; } - - public long getDuration() { return duration; } -} diff --git a/examples/androidextras/musiclist/doc/src/qtandroidextras-example-musiclist.qdoc b/examples/androidextras/musiclist/doc/src/qtandroidextras-example-musiclist.qdoc deleted file mode 100644 index 39efb6a..0000000 --- a/examples/androidextras/musiclist/doc/src/qtandroidextras-example-musiclist.qdoc +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! -\title Qt JNI Music List - \ingroup examples-qtandroidextras - \example musiclist - \brief Demonstrates how to exchange data from complex Java objects. - - \image musiclist.png - - This example demonstrates how to move around data from a Java ArrayList of - objects over to Qt. The example uses Android APIs to retrieve a list of music - tracks, and displays some information about them with QML. - - When the application starts, it displays a list of music tracks, showing the - track name, artist, and duration. - - \include examples-run.qdocinc - - \section1 Create the Music Classes - - Let's create a Java class, \c MusicTrack, that defines some of the basic - information about a track. In the Java side, create the following: - - \quotefromfile musiclist/android/src/org/qtproject/example/musiclist/MusicList.java - \skipto class MusicTrack - \printuntil /^\}/ - - Create another class with the same variables or information on the C++ side. - The definition for \c MusicTrack class is the following: - - \quotefromfile musiclist/musiclist.h - \skipto class MusicTrack - \printuntil }; - - \note The \c MusicTrack class must be a \l{QObject}-derived class to be used - with as a QML context property. For more information, see - \l{Overview - QML and C++ Integration}{QML and C++ Integration}. - - \section1 Fetch the Music List - - To retrieve the music list, the Android APIs are used. Add the following method - to find music tracks that are available on the system. This method returns - an ArrayList of \c MusicTrack. - - \quotefromfile musiclist/android/src/org/qtproject/example/musiclist/MusicList.java - \skipto package - \printuntil /^\ {4}\}/ - \printline } - - Using the JNI helpers provided with Qt, call the previous method to - first get an \l{QAndroidJniObject} containing an ArrayList of objects. In the - C++ code, you need to go through the Java ArrayList and create a parallel list - on C++. Add the following lines to do that: - - \quotefromfile musiclist/musiclist.cpp - \skipto QAndroidJniObject - \printuntil /^\ {4}\}/ - - Then, add a function to return the resulted \l{QList}: - - \quotefromfile musiclist/musiclist.cpp - \skipto MusicList::assembledMusicList - \printuntil } - - To display the music list, create a \l{ListView} that uses the \l{QList} - as a property. Register the property as follows: - - \quotefromfile musiclist/main.cpp - \skipto MusicList - \printuntil assembledMusicList - - In the QML code, define the model of the \l{ListView} as follows: - - \quotefromfile musiclist/main.qml - \skipto model - \printline model - - \sa {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/musiclist/main.cpp b/examples/androidextras/musiclist/main.cpp deleted file mode 100644 index 0c76cc2..0000000 --- a/examples/androidextras/musiclist/main.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "musiclist.h" - -#include <QtAndroid> - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -bool requestStoragePermission() { - using namespace QtAndroid; - - QString permission = QStringLiteral("android.permission.WRITE_EXTERNAL_STORAGE"); - const QHash<QString, PermissionResult> results = requestPermissionsSync(QStringList({permission})); - if (!results.contains(permission) || results[permission] == PermissionResult::Denied) { - qWarning() << "Couldn't get permission: " << permission; - return false; - } - - return true; -} - -int main(int argc, char *argv[]) -{ - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - const QUrl url(http://code.qt.io/QStringLiteral(%22qrc:/main.qml")); - - if (!requestStoragePermission()) - qDebug() << "Storage permissions denied. This example might not work as intended"; - - MusicList *musicList = new MusicList(&app); - engine.rootContext()->setContextProperty(QLatin1String("musiclist"), - QVariant::fromValue(musicList->assembledMusicList())); - - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, Qt::QueuedConnection); - engine.load(url); - - return app.exec(); -} diff --git a/examples/androidextras/musiclist/main.qml b/examples/androidextras/musiclist/main.qml deleted file mode 100644 index 6a04bef..0000000 --- a/examples/androidextras/musiclist/main.qml +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.14 -import QtQuick.Window 2.14 -import QtQuick.Controls 2.14 - -Window { - id: window - visible: true - width: 640 - height: 480 - title: qsTr("Qt Android Music List") - - Text { - id: resultText - height: 40 - text: "Music library list:" - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: parent.top - anchors.topMargin: 10 - font.pointSize: 20 - verticalAlignment: Text.AlignTop - } - - ToolSeparator { - id: toolSeparator - width: parent.width - anchors.bottom: listView.top - anchors.bottomMargin: 10 - anchors.top: resultText.bottom - anchors.topMargin: 6 - anchors.horizontalCenter: parent.horizontalCenter - orientation: Qt.Horizontal - } - - ListView { - id: listView - width: parent.width - clip: true - flickableDirection: Flickable.HorizontalAndVerticalFlick - anchors.bottomMargin: 10 - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: resultText.bottom - anchors.topMargin: 30 - anchors.bottom: parent.bottom - - model: musiclist - delegate: Rectangle { - height: 25 - width: ListView.view.width - color: index % 2 == 0 ? "#EDEDED" : "#FFFFFF" - - function toTimeFormat(sec_num) { - sec_num = Math.floor(sec_num / 1000); - var hours = Math.floor(sec_num / 3600); - var minutes = Math.floor((sec_num - (hours * 3600)) / 60); - var seconds = sec_num - (hours * 3600) - (minutes * 60); - - if (hours < 10) { hours = "0" + hours; } - if (minutes < 10) { minutes = "0" + minutes; } - if (seconds < 10) { seconds = "0" + seconds; } - - return hours+':'+minutes+':'+seconds; - } - - Text { text: model.modelData.title + " | " + model.modelData.artist + " | " + toTimeFormat(model.modelData.duration) } - } - } -} diff --git a/examples/androidextras/musiclist/musiclist.cpp b/examples/androidextras/musiclist/musiclist.cpp deleted file mode 100644 index 97d5cdb..0000000 --- a/examples/androidextras/musiclist/musiclist.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "musiclist.h" - -#include <QAndroidIntent> -#include <QAndroidJniEnvironment> - -MusicList::MusicList(QObject *parent) : QObject(parent) -{ - QAndroidJniObject musicList = QAndroidJniObject::callStaticObjectMethod( - "org/qtproject/example/musiclist/MusicList", - "fetchMusicList", - "(Landroid/content/Context;)Ljava/util/ArrayList;", - QtAndroid::androidContext().object()); - - for (int i = 0; i < musicList.callMethod<jint>("size"); ++i) { - QAndroidJniObject track = musicList.callObjectMethod("get", "(I)Ljava/lang/Object;", i); - const QString title = track.callObjectMethod("getTitle", "()Ljava/lang/String;").toString(); - const QString artist = track.callObjectMethod("getArtist", "()Ljava/lang/String;").toString(); - const long duration = track.callMethod<jlong>("getDuration"); - m_assembledMusicList.append(new MusicTrack(title, artist, duration, this)); - } -} - -QList<MusicTrack *> MusicList::assembledMusicList() const -{ - return m_assembledMusicList; -} diff --git a/examples/androidextras/musiclist/musiclist.h b/examples/androidextras/musiclist/musiclist.h deleted file mode 100644 index 14d487f..0000000 --- a/examples/androidextras/musiclist/musiclist.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ -#ifndef MUSICLIST_H -#define MUSICLIST_H - -#include <QtAndroid> - -class MusicTrack : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString title READ title CONSTANT) - Q_PROPERTY(QString artist READ artist CONSTANT) - Q_PROPERTY(long duration READ duration CONSTANT) - -public: - MusicTrack(const QString title, const QString artist, const long duration, QObject *parent = nullptr) - : QObject(parent), m_title(title), m_artist(artist), m_duration(duration) {} - - QString title() const { return m_title; } - QString artist() const { return m_artist; } - long duration() const { return m_duration; } - -private: - QString m_title; - QString m_artist; - long m_duration; -}; - -class MusicList : public QObject -{ - Q_OBJECT - -public: - MusicList(QObject *parent = nullptr); - QList<MusicTrack *> assembledMusicList() const; - -private: - QList<MusicTrack *> m_assembledMusicList; -}; - -#endif diff --git a/examples/androidextras/musiclist/musiclist.pro b/examples/androidextras/musiclist/musiclist.pro deleted file mode 100644 index 0d20de8..0000000 --- a/examples/androidextras/musiclist/musiclist.pro +++ /dev/null @@ -1,23 +0,0 @@ -QT += quick androidextras - -CONFIG += c++11 - -DEFINES += QT_DEPRECATED_WARNINGS - -HEADERS += \ - musiclist.h - -SOURCES += \ - main.cpp \ - musiclist.cpp - -RESOURCES += qml.qrc - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/musiclist -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/AndroidManifest.xml \ - android/src/org/qtproject/example/musiclist/MusicList.java diff --git a/examples/androidextras/musiclist/qml.qrc b/examples/androidextras/musiclist/qml.qrc deleted file mode 100644 index 5f6483a..0000000 --- a/examples/androidextras/musiclist/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/androidextras/notification/android/AndroidManifest.xml b/examples/androidextras/notification/android/AndroidManifest.xml deleted file mode 100644 index d3b87bd..0000000 --- a/examples/androidextras/notification/android/AndroidManifest.xml +++ /dev/null @@ -1,87 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.notification" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="Qt Notifier" android:extractNativeLibs="true" android:icon="@drawable/icon"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - - <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices --> - - </application> - -</manifest> diff --git a/examples/androidextras/notification/android/res/drawable-hdpi/icon.png b/examples/androidextras/notification/android/res/drawable-hdpi/icon.png Binary files differdeleted file mode 100644 index d3ccebe..0000000 --- a/examples/androidextras/notification/android/res/drawable-hdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/notification/android/res/drawable-ldpi/icon.png b/examples/androidextras/notification/android/res/drawable-ldpi/icon.png Binary files differdeleted file mode 100644 index 2194be1..0000000 --- a/examples/androidextras/notification/android/res/drawable-ldpi/icon.png +++ /dev/null diff --git a/examples/androidextras/notification/android/res/drawable-mdpi/icon.png b/examples/androidextras/notification/android/res/drawable-mdpi/icon.png Binary files differdeleted file mode 100644 index 31812cc..0000000 --- a/examples/androidextras/notification/android/res/drawable-mdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/notification/android/res/drawable-xhdpi/icon.png b/examples/androidextras/notification/android/res/drawable-xhdpi/icon.png Binary files differdeleted file mode 100644 index 3aeae64..0000000 --- a/examples/androidextras/notification/android/res/drawable-xhdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/notification/android/res/drawable-xxhdpi/icon.png b/examples/androidextras/notification/android/res/drawable-xxhdpi/icon.png Binary files differdeleted file mode 100644 index f754fd1..0000000 --- a/examples/androidextras/notification/android/res/drawable-xxhdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/notification/android/res/drawable-xxxhdpi/icon.png b/examples/androidextras/notification/android/res/drawable-xxxhdpi/icon.png Binary files differdeleted file mode 100644 index d0d043b..0000000 --- a/examples/androidextras/notification/android/res/drawable-xxxhdpi/icon.png +++ /dev/null diff --git a/examples/androidextras/notification/android/src/org/qtproject/example/notification/NotificationClient.java b/examples/androidextras/notification/android/src/org/qtproject/example/notification/NotificationClient.java deleted file mode 100644 index 16789d1..0000000 --- a/examples/androidextras/notification/android/src/org/qtproject/example/notification/NotificationClient.java +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.notification; - -import android.app.Notification; -import android.app.NotificationManager; -import android.content.Context; -import android.content.Intent; -import android.app.PendingIntent; -import android.graphics.Color; -import android.graphics.BitmapFactory; -import android.app.NotificationChannel; - -public class NotificationClient -{ - private static NotificationManager m_notificationManager; - private static Notification.Builder m_builder; - - public NotificationClient() {} - - public static void notify(Context context, String message) { - try { - m_notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); - - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - int importance = NotificationManager.IMPORTANCE_DEFAULT; - NotificationChannel notificationChannel = new NotificationChannel("Qt", "Qt Notifier", importance); - m_notificationManager.createNotificationChannel(notificationChannel); - m_builder = new Notification.Builder(context, notificationChannel.getId()); - } else { - m_builder = new Notification.Builder(context); - } - - m_builder.setSmallIcon(R.drawable.icon) - .setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.drawable.icon)) - .setContentTitle("A message from Qt!") - .setContentText(message) - .setDefaults(Notification.DEFAULT_SOUND) - .setColor(Color.GREEN) - .setAutoCancel(true); - - m_notificationManager.notify(0, m_builder.build()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc b/examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc deleted file mode 100644 index a042af5..0000000 --- a/examples/androidextras/notification/doc/src/qtandroidextras-example-notification.qdoc +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \title Qt Notifier - \ingroup examples-qtandroidextras - \example notification - \brief Demonstrates calling Java code from an Android application. - - \image notification.png - - This example demonstrates how to add a custom Java class to an Android application, and - how to call into this using the JNI convenience APIs in the Qt Android Extras module. - The application UI is created by using Qt Quick. - - Click on either of the smiley faces to put a notification in the status area of the Android - device. - - \include examples-run.qdocinc - - \section1 Calling Java Methods from C++ Code - - We define a custom Java class called \c NotificationClient in the - NotificationClient.java file: - - \quotefromfile notification/android/src/org/qtproject/example/notification/NotificationClient.java - \skipto org.qtproject.example.notification - \printuntil /^\}/ - - In the NotificationClient C++ class header file, notificationclient.h, we - declare a simple C++ API to display notifications on an Android device. It - consists of a single string property, \c notification, and a slot, - \c updateAndroidNotification(), that calls the Java code: - - \quotefromfile notification/notificationclient.h - \skipto Q_PROPERTY - \printuntil ) - \dots - \skipto private slots - \printuntil updateAndroidNotification() - - A NotificationClient object is exposed to the QML in the main source file, - main.cpp: - - \quotefromfile notification/main.cpp - \skipto QQuickView view; - \printuntil notificationClient); - - In the NotificationClient C++ class source file, notificationclient.cpp, we - import the QtAndroid class: - - \quotefromfile notification/notificationclient.cpp - \skipto <QtAndroid - \printuntil > - - This will allow us to use \c QAndroidJniObject for JNI calls, and also allow - us to pass our application's context to the Java methods as in: - - \code - QtAndroid::androidContext().object() - \endcode - - We connect the \c notificationChanged() signal to the - \c updateAndroidNotification() slot to update the notification text when the - \c notification property changes: - - \printuntil } - - The \c NotificationClient::updateAndroidNotification() function calls the - Java method. We construct a Java string from the \c notification string - property: - - \skipto updateAndroidNotification() - \printuntil fromString - - And pass the string object as a parameter to the Java \c notify() method. - Note that we must supply the signature ourselves: - - \printuntil } - - \sa {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/notification/images/happy.png b/examples/androidextras/notification/images/happy.png Binary files differdeleted file mode 100644 index fd31f8d..0000000 --- a/examples/androidextras/notification/images/happy.png +++ /dev/null diff --git a/examples/androidextras/notification/images/sad.png b/examples/androidextras/notification/images/sad.png Binary files differdeleted file mode 100644 index 74e8f8f..0000000 --- a/examples/androidextras/notification/images/sad.png +++ /dev/null diff --git a/examples/androidextras/notification/main.cpp b/examples/androidextras/notification/main.cpp deleted file mode 100644 index d6c352c..0000000 --- a/examples/androidextras/notification/main.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 <QtGui> -#include <QtQuick> - -#include "notificationclient.h" - -int main(int argc, char **argv) -{ - QGuiApplication app(argc, argv); - - QQuickView view; - - NotificationClient *notificationClient = new NotificationClient(&view); - view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"), - notificationClient); - view.setResizeMode(QQuickView::SizeRootObjectToView); - view.setSource(QUrl(QStringLiteral("qrc:/qml/main.qml"))); - view.show(); - - return app.exec(); -} diff --git a/examples/androidextras/notification/main.qrc b/examples/androidextras/notification/main.qrc deleted file mode 100644 index 10190c9..0000000 --- a/examples/androidextras/notification/main.qrc +++ /dev/null @@ -1,7 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>qml/main.qml</file> - <file>images/happy.png</file> - <file>images/sad.png</file> - </qresource> -</RCC> diff --git a/examples/androidextras/notification/notification.pro b/examples/androidextras/notification/notification.pro deleted file mode 100644 index b2fdec8..0000000 --- a/examples/androidextras/notification/notification.pro +++ /dev/null @@ -1,19 +0,0 @@ -QT += quick androidextras - -SOURCES += \ - main.cpp \ - notificationclient.cpp - -RESOURCES += \ - main.qrc - -HEADERS += \ - notificationclient.h - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/notification -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android -OTHER_FILES += \ - android/src/org/qtproject/example/notification/NotificationClient.java \ - android/AndroidManifest.xml diff --git a/examples/androidextras/notification/notificationclient.cpp b/examples/androidextras/notification/notificationclient.cpp deleted file mode 100644 index 871d889..0000000 --- a/examples/androidextras/notification/notificationclient.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "notificationclient.h" - -#include <QtAndroid> - -NotificationClient::NotificationClient(QObject *parent) - : QObject(parent) -{ - connect(this, SIGNAL(notificationChanged()), this, SLOT(updateAndroidNotification())); -} - -void NotificationClient::setNotification(const QString ¬ification) -{ - if (m_notification == notification) - return; - - m_notification = notification; - emit notificationChanged(); -} - -QString NotificationClient::notification() const -{ - return m_notification; -} - -void NotificationClient::updateAndroidNotification() -{ - QAndroidJniObject javaNotification = QAndroidJniObject::fromString(m_notification); - QAndroidJniObject::callStaticMethod<void>( - "org/qtproject/example/notification/NotificationClient", - "notify", - "(Landroid/content/Context;Ljava/lang/String;)V", - QtAndroid::androidContext().object(), - javaNotification.object<jstring>()); -} diff --git a/examples/androidextras/notification/notificationclient.h b/examples/androidextras/notification/notificationclient.h deleted file mode 100644 index 6540421..0000000 --- a/examples/androidextras/notification/notificationclient.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -#ifndef NOTIFICATIONCLIENT_H -#define NOTIFICATIONCLIENT_H - -#include <QObject> - -class NotificationClient : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString notification READ notification WRITE setNotification NOTIFY notificationChanged) -public: - explicit NotificationClient(QObject *parent = 0); - - void setNotification(const QString ¬ification); - QString notification() const; - -signals: - void notificationChanged(); - -private slots: - void updateAndroidNotification(); - -private: - QString m_notification; -}; - -#endif // NOTIFICATIONCLIENT_H diff --git a/examples/androidextras/notification/qml/main.qml b/examples/androidextras/notification/qml/main.qml deleted file mode 100644 index 97c8cad..0000000 --- a/examples/androidextras/notification/qml/main.qml +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 { - width: 500 - height: 500 - color: "white" - - Column { - anchors.fill: parent - spacing: (height - happyButton.height - sadButton.height - title.height) / 3 - - Text { - id: title - color: "black" - font.pixelSize: parent.width / 20 - text: "How are you feeling?" - width: parent.width - horizontalAlignment: Text.AlignHCenter - } - - Image { - id: happyButton - height: parent.height / 5 - fillMode: Image.PreserveAspectFit - source: "../images/happy.png" - anchors.horizontalCenter: parent.horizontalCenter - smooth: true - - Behavior on scale { - PropertyAnimation { - duration: 100 - } - } - - MouseArea { - anchors.fill: parent - onClicked: notificationClient.notification = "User is happy!" - onPressed: happyButton.scale = 0.9 - onReleased: happyButton.scale = 1.0 - } - } - - Image { - id: sadButton - height: parent.height / 5 - fillMode: Image.PreserveAspectFit - source: "../images/sad.png" - anchors.horizontalCenter: parent.horizontalCenter - smooth: true - - Behavior on scale { - PropertyAnimation { - duration: 100 - } - } - - MouseArea { - anchors.fill: parent - onClicked: notificationClient.notification = "User is sad :(" - onPressed: sadButton.scale = 0.9 - onReleased: sadButton.scale = 1.0 - } - } - } -} diff --git a/examples/androidextras/services/common/common.pri b/examples/androidextras/services/common/common.pri deleted file mode 100644 index 1225f32..0000000 --- a/examples/androidextras/services/common/common.pri +++ /dev/null @@ -1 +0,0 @@ -RESOURCES += $$PWD/qml.qrc diff --git a/examples/androidextras/services/common/common_broadcast.pri b/examples/androidextras/services/common/common_broadcast.pri deleted file mode 100644 index 117f362..0000000 --- a/examples/androidextras/services/common/common_broadcast.pri +++ /dev/null @@ -1,5 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += $$PWD/qtandroidservice.h - -SOURCES += $$PWD/qtandroidservice.cpp diff --git a/examples/androidextras/services/common/common_ro.pri b/examples/androidextras/services/common/common_ro.pri deleted file mode 100644 index eacfc6d..0000000 --- a/examples/androidextras/services/common/common_ro.pri +++ /dev/null @@ -1,3 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += $$PWD/qtandroidservice_ro.h diff --git a/examples/androidextras/services/common/main.qml b/examples/androidextras/services/common/main.qml deleted file mode 100644 index 528212b..0000000 --- a/examples/androidextras/services/common/main.qml +++ /dev/null @@ -1,112 +0,0 @@ - -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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.14 -import QtQuick.Window 2.14 -import QtQuick.Controls 2.14 - -Window { - id: window - visible: true - width: 640 - height: 480 - title: qsTr("Hello World") - - Text { - id: pingLabel - y: 100 - text: qsTr("Enter a name:") - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 20 - } - - TextInput { - id: pingText - y: 130 - text: "Qt" - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - font.pointSize: 24 - } - - Button { - id: sendButton - y: 220 - text: "Send name to Service" - anchors.horizontalCenter: parent.horizontalCenter - onClicked: qtAndroidService.sendToService(pingText.text) - } - - Text { - id: pongLabel - y: 300 - text: qsTr("Android Service replied:") - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 20 - } - - Text { - id: pongText - y: 330 - text: qsTr("") - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - font.pixelSize: 24 - } - - Connections { - target: qtAndroidService - function onMessageFromService(message) { - pongText.text = message - } - } -} diff --git a/examples/androidextras/services/common/qml.qrc b/examples/androidextras/services/common/qml.qrc deleted file mode 100644 index 5f6483a..0000000 --- a/examples/androidextras/services/common/qml.qrc +++ /dev/null @@ -1,5 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>main.qml</file> - </qresource> -</RCC> diff --git a/examples/androidextras/services/common/qtandroidservice.cpp b/examples/androidextras/services/common/qtandroidservice.cpp deleted file mode 100644 index 0296892..0000000 --- a/examples/androidextras/services/common/qtandroidservice.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QAndroidJniEnvironment> -#include <QAndroidIntent> -#include <QtDebug> - -QtAndroidService *QtAndroidService::m_instance = nullptr; - -static void receivedFromAndroidService(JNIEnv *env, jobject /*thiz*/, jstring value) -{ - emit QtAndroidService::instance()->messageFromService( - env->GetStringUTFChars(value, nullptr)); -} - -QtAndroidService::QtAndroidService(QObject *parent) : QObject(parent) -{ - m_instance = this; - - registerNatives(); - registerBroadcastReceiver(); -} - -void QtAndroidService::sendToService(const QString &name) -{ - QAndroidIntent serviceIntent(QtAndroid::androidActivity().object(), - "org/qtproject/example/qtandroidservice/QtAndroidService"); - serviceIntent.putExtra("name", name.toUtf8()); - QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod( - "startService", - "(Landroid/content/Intent;)Landroid/content/ComponentName;", - serviceIntent.handle().object()); -} - -void QtAndroidService::registerNatives() -{ - JNINativeMethod methods[] { - {"sendToQt", "(Ljava/lang/String;)V", reinterpret_cast<void *>(receivedFromAndroidService)}}; - QAndroidJniObject javaClass("org/qtproject/example/qtandroidservice/ActivityUtils"); - - QAndroidJniEnvironment env; - jclass objectClass = env->GetObjectClass(javaClass.object<jobject>()); - env->RegisterNatives(objectClass, - methods, - sizeof(methods) / sizeof(methods[0])); - env->DeleteLocalRef(objectClass); -} - -void QtAndroidService::registerBroadcastReceiver() -{ - QAndroidJniEnvironment env; - jclass javaClass = env.findClass("org/qtproject/example/qtandroidservice/ActivityUtils"); - QAndroidJniObject classObject(javaClass); - - classObject.callMethod<void>("registerServiceBroadcastReceiver", - "(Landroid/content/Context;)V", - QtAndroid::androidContext().object()); -} diff --git a/examples/androidextras/services/common/qtandroidservice.h b/examples/androidextras/services/common/qtandroidservice.h deleted file mode 100644 index bee1fd3..0000000 --- a/examples/androidextras/services/common/qtandroidservice.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -#ifndef QTANDROIDSERVICE_H -#define QTANDROIDSERVICE_H - -#include <QObject> -#include <QtAndroid> -#include <QAndroidIntent> - -class QtAndroidService : public QObject -{ - Q_OBJECT - -public: - QtAndroidService(QObject *parent = nullptr); - - static QtAndroidService *instance() { return m_instance; } - Q_INVOKABLE void sendToService(const QString &name); - -signals: - void messageFromService(const QString &message); - -private: - void registerNatives(); - void registerBroadcastReceiver(); - - static QtAndroidService *m_instance; -}; - -#endif // QTANDROIDSERVICE_H diff --git a/examples/androidextras/services/common/qtandroidservice.rep b/examples/androidextras/services/common/qtandroidservice.rep deleted file mode 100644 index 6b9d676..0000000 --- a/examples/androidextras/services/common/qtandroidservice.rep +++ /dev/null @@ -1,4 +0,0 @@ -class QtAndroidService { - SLOT(void sendToService(const QString &name)); - SIGNAL(messageFromService(const QString &message)); -} diff --git a/examples/androidextras/services/common/qtandroidservice_ro.h b/examples/androidextras/services/common/qtandroidservice_ro.h deleted file mode 100644 index 8e53fb1..0000000 --- a/examples/androidextras/services/common/qtandroidservice_ro.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "rep_qtandroidservice_source.h" - -class QtAndroidService : public QtAndroidServiceSource -{ -public slots: - void sendToService(const QString &name) override { - emit messageFromService("Hello " + name); - }; -}; diff --git a/examples/androidextras/services/servicebinder/android/AndroidManifest.xml b/examples/androidextras/services/servicebinder/android/AndroidManifest.xml deleted file mode 100644 index 1f63179..0000000 --- a/examples/androidextras/services/servicebinder/android/AndroidManifest.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.qtandroidservice" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="minimal"/> - <!-- extract android style --> - </activity> - -<service android:process=":qt_service" android:name=".QtAndroidService"> - - <meta-data android:name="android.app.lib_name" android:value="service"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Run with local libs --> - - <!-- Background running --> - <meta-data android:name="android.app.background_running" android:value="true"/> - <!-- Background running --> - </service> - </application> -</manifest> diff --git a/examples/androidextras/services/servicebinder/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java b/examples/androidextras/services/servicebinder/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java deleted file mode 100644 index fdbd559..0000000 --- a/examples/androidextras/services/servicebinder/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import org.qtproject.qt.android.bindings.QtService; -import android.util.Log; - -public class QtAndroidService extends QtService { - - private static final String TAG = "QtAndroidService"; - - @Override - public void onCreate() { - super.onCreate(); - Log.i(TAG, "Creating Service"); - } - - @Override - public void onDestroy() { - super.onDestroy(); - Log.i(TAG, "Destroying Service"); - } -} diff --git a/examples/androidextras/services/servicebinder/androidbinder.cpp b/examples/androidextras/services/servicebinder/androidbinder.cpp deleted file mode 100644 index 87f98b1..0000000 --- a/examples/androidextras/services/servicebinder/androidbinder.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "androidbinder.h" - -#include <QDebug> - -const static char TAG[] = "Service process"; - -bool AndroidBinder::onTransact(int code, - const QAndroidParcel &data, - const QAndroidParcel &reply, - QAndroidBinder::CallType flags) -{ - qDebug() << TAG << ": onTransact(), code " << code << ", flags " << int(flags); - - switch (code) { - case 1: { - QAndroidBinder binder = data.readBinder(); - - const QString name(data.readData()); - qDebug() << TAG << ": onTransact() received name " << name; - - reply.writeVariant("Hello " + name); - } break; - default: - QAndroidBinder binder = data.readBinder(); - - qDebug() << TAG << ": onTransact() received non-name data" << data.readVariant(); - reply.writeVariant(QVariant("Cannot process this!")); - - // send back message - QAndroidParcel sendData, replyData; - sendData.writeVariant(QVariant("Send me only names!")); - binder.transact(0, sendData, &replyData); - qDebug() << TAG << ": onTransact() received " << replyData.readData(); - - break; - } - return true; -} diff --git a/examples/androidextras/services/servicebinder/androidbinder.h b/examples/androidextras/services/servicebinder/androidbinder.h deleted file mode 100644 index d53249b..0000000 --- a/examples/androidextras/services/servicebinder/androidbinder.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 <QAndroidBinder> -#include <QAndroidParcel> - -class AndroidBinder : public QAndroidBinder -{ -public: - bool onTransact(int code, - const QAndroidParcel &data, - const QAndroidParcel &reply, - QAndroidBinder::CallType flags) override; -}; diff --git a/examples/androidextras/services/servicebinder/doc/src/qtandroidextras-example-service-binder.qdoc b/examples/androidextras/services/servicebinder/doc/src/qtandroidextras-example-service-binder.qdoc deleted file mode 100644 index fb503d6..0000000 --- a/examples/androidextras/services/servicebinder/doc/src/qtandroidextras-example-service-binder.qdoc +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Android Service with QAndroidBinder - \ingroup examples-qtandroidextras - \example services/servicebinder - \brief Demonstrates how to run an Android service in a separate process, - and how to communicate between the service process and the main process - using QAndroidBinder. - - \image androidservices.png - - This example demonstrates how to create and run an Android service in - a separate process and using a separate \c .so lib file, and then exchange - data between the two processes using \l{QAndroidBinder}. - - When clicking the \uicontrol {Send to Service} button, the name entered in the QML - view, Qt, in this case, is sent to the Android service. Then, the service - replies back with the message \c {Hello Qt} which is printed in the QML view. - - \include examples-run.qdocinc - - \section1 Create the Service - - To start a service in its own process, extend the \c QtService class for - your service. Extending \c QtService allows the service to load the necessary - Qt libraries used for Qt. - - Start by creating the Java service class. The following class extends \c QtService - and acts as your service entry point: - - \quotefromfile services/servicebinder/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - \skipto package - \printuntil /^\}/ - - This class can have any logic you want using Java code. However, you don't need - any logic to communicate with Qt as that will be done using \l{QAndroidBinder}. - - \section1 Manage the AndroidManifest.xml File - - To use the service, it must be declared in the \c AndroidManifest.xml - file as follows: - - \quotefromfile services/servicebinder/android/AndroidManifest.xml - \skipto <service - \printuntil </service> - - The important part of this service declaration is the \c lib_name part. - It will ensure that the service is run by the service's own lib file: - - \quotefromfile services/servicebinder/android/AndroidManifest.xml - \skipto android:value="service" - \printuntil android:value="service" - - \section1 Handle the Service Start - - Create a sub-project for the service, as follows: - - \quotefromfile services/servicebinder/service.pro - \printuntil androidbinder.cpp - - In \c androidbinder.cpp, implement a class that inherits \l{QAndroidBinder}. - This is the binder that the main application will use to connect to the service - by binding to it. \l{QAndroidBinder::onTransact()} uses a \c code integer to - differentiate between actions. Use a \c switch case or \c if conditions to - handle all expected actions that the binder could expect: - - \quotefromfile services/servicebinder/androidbinder.cpp - \skipto onTransact - \printuntil /^\}/ - - In the service's \c main(), start the \l{QAndroidBinder} along with - \l{QAndroidService}: - - \quotefromfile services/servicebinder/service_main.cpp - \skipto main - \printuntil /^\}/ - - - \section1 Handle the Application Start - - In the main application side, a \l{QAndroidServiceConnection} implementation - is required to bind to the service and exchange data with it. Implement - the functions \l{QAndroidServiceConnection::onServiceConnected()} and - \l{QAndroidServiceConnection::onServiceDisconnected()}: - - \quotefromfile services/servicebinder/qtandroidservice.cpp - \skipto onServiceConnected - \printuntil } - \printuntil } - - Then, create a function to explicitly send messages to the service: - - \quotefromfile services/servicebinder/qtandroidservice.cpp - \skipto sendToService - \printuntil } - - Once you have all that ready, it's time to start the service and bind to it - as follows: - - \quotefromfile services/servicebinder/qtandroidservice.cpp - \skipto :QtAndroidService - \printuntil } - - The \l{QtAndroid::bindService()} is called using \l{QtAndroid::AutoCreate} - which starts the service if it's not already running. - - \note To receive data explicitly sent from the service (i.e. not just a reply), - implement \l{QAndroidBinder} in the main application the same way - it's done on the service. Once you have that, the service could initially - send a message. - - Then, create an instance for the custom \l{QAndroidServiceConnection} class - and connect it to QML. Add the following in \c main.cpp: - - \quotefromfile services/servicebinder/main.cpp - \skipto QtAndroidService - \printuntil setContextProperty - - Then, add a \l Connections element to watch for the incoming messages from - the service in \c main.qml: - - \quotefromfile services/common/main.qml - \skipto Connections - \printuntil /^\ {4}\}/ - - And set the \c onClicked for the sending button to: - - \quotefromfile services/common/main.qml - \skipto onClicked - \printline onClicked - - \sa {Android Services}, {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/services/servicebinder/main.cpp b/examples/androidextras/services/servicebinder/main.cpp deleted file mode 100644 index 82066df..0000000 --- a/examples/androidextras/services/servicebinder/main.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - - QtAndroidService *qtAndroidService = new QtAndroidService(&app); - engine.rootContext()->setContextProperty(QLatin1String("qtAndroidService"), qtAndroidService); - - engine.load(QUrl(QLatin1String("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/examples/androidextras/services/servicebinder/qtandroidservice.cpp b/examples/androidextras/services/servicebinder/qtandroidservice.cpp deleted file mode 100644 index c984746..0000000 --- a/examples/androidextras/services/servicebinder/qtandroidservice.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QAndroidIntent> -#include <QAndroidParcel> -#include <QDebug> - -const static char TAG[] = "Service app"; -QtAndroidService *QtAndroidService::m_instance = nullptr; - -void AndroidServiceConnection::onServiceConnected(const QString &name, - const QAndroidBinder &serviceBinder) -{ - qDebug() << TAG << ": onServiceConnected() " << name; - m_servieBinder = serviceBinder; -} - -void AndroidServiceConnection::onServiceDisconnected(const QString &name) -{ - qDebug() << TAG << ": onServiceDisconnected() " << name; -} - -void AndroidServiceConnection::sendToService(const QString &name) -{ - // send name - QAndroidParcel sendData, replyData; - sendData.writeBinder(m_servieBinder); - sendData.writeData(name.toUtf8()); - m_servieBinder.transact(1, sendData, &replyData); - const QVariant received(replyData.readVariant()); - qDebug() << received; - emit QtAndroidService::instance()->messageFromService(received.toString()); -} - -QtAndroidService::QtAndroidService(QObject *parent) : QObject(parent) -{ - m_instance = this; - - QAndroidIntent serviceIntent(QtAndroid::androidActivity(), - "org.qtproject.example.qtandroidservice.QtAndroidService"); - - const bool bindResult = QtAndroid::bindService(serviceIntent, - m_serviceConnection, - QtAndroid::BindFlag::AutoCreate); - qDebug() << "Binding to the service..." << bindResult; -} - -void QtAndroidService::sendToService(const QString &name) -{ - m_serviceConnection.sendToService(name); -} diff --git a/examples/androidextras/services/servicebinder/qtandroidservice.h b/examples/androidextras/services/servicebinder/qtandroidservice.h deleted file mode 100644 index 352f6d1..0000000 --- a/examples/androidextras/services/servicebinder/qtandroidservice.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 <QAndroidBinder> -#include <QAndroidServiceConnection> -#include <QtAndroid> - -class AndroidServiceConnection : public QAndroidServiceConnection -{ -public: - void onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder) override; - - void onServiceDisconnected(const QString &name) override; - - void sendToService(const QString &name); - -private: - QAndroidBinder m_servieBinder; -}; - -class QtAndroidService : public QObject -{ - Q_OBJECT - -public: - explicit QtAndroidService(QObject *parent = nullptr); - static QtAndroidService *instance() { return m_instance; } - Q_INVOKABLE void sendToService(const QString &name); - -signals: - void messageFromService(const QString &message); - -private: - static QtAndroidService *m_instance; - AndroidServiceConnection m_serviceConnection; -}; diff --git a/examples/androidextras/services/servicebinder/service.pro b/examples/androidextras/services/servicebinder/service.pro deleted file mode 100644 index 12853ff..0000000 --- a/examples/androidextras/services/servicebinder/service.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -TARGET = service -CONFIG += dll -QT += core androidextras - -HEADERS += androidbinder.h - -SOURCES += \ - service_main.cpp \ - androidbinder.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/servicebinder -INSTALLS += target diff --git a/examples/androidextras/services/servicebinder/service_main.cpp b/examples/androidextras/services/servicebinder/service_main.cpp deleted file mode 100644 index 5fefa18..0000000 --- a/examples/androidextras/services/servicebinder/service_main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "androidbinder.h" - -#include <QAndroidService> -#include <QDebug> - -int main(int argc, char *argv[]) -{ - qDebug() << "Starting service process from C++"; - QAndroidService app(argc, argv, [](const QAndroidIntent &) { - qDebug() << "Android service onBind()"; - return new AndroidBinder{}; - }); - - return app.exec(); -} diff --git a/examples/androidextras/services/servicebinder/servicebinder.pro b/examples/androidextras/services/servicebinder/servicebinder.pro deleted file mode 100644 index f2eeb3c..0000000 --- a/examples/androidextras/services/servicebinder/servicebinder.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - servicebinderclient.pro \ - service.pro diff --git a/examples/androidextras/services/servicebinder/servicebinderclient.pro b/examples/androidextras/services/servicebinder/servicebinderclient.pro deleted file mode 100644 index 653e546..0000000 --- a/examples/androidextras/services/servicebinder/servicebinderclient.pro +++ /dev/null @@ -1,25 +0,0 @@ -QT += qml quick androidextras - -CONFIG += c++11 - -HEADERS += \ - qtandroidservice.h - -SOURCES += \ - main.cpp \ - qtandroidservice.cpp - -include(../common/common.pri) - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/servicebinder -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/AndroidManifest.xml \ - android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - diff --git a/examples/androidextras/services/servicebroadcast/android/AndroidManifest.xml b/examples/androidextras/services/servicebroadcast/android/AndroidManifest.xml deleted file mode 100644 index ef94a7f..0000000 --- a/examples/androidextras/services/servicebroadcast/android/AndroidManifest.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.qtandroidservice" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - -<service android:process=":qt_service" android:name=".QtAndroidService"> - - <meta-data android:name="android.app.lib_name" android:value="service"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Run with local libs --> - - <!-- Background running --> - <meta-data android:name="android.app.background_running" android:value="true"/> - <!-- Background running --> - </service> - </application> -</manifest> diff --git a/examples/androidextras/services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java b/examples/androidextras/services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java deleted file mode 100644 index d2802d7..0000000 --- a/examples/androidextras/services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import android.content.BroadcastReceiver; -import android.content.IntentFilter; - -public class ActivityUtils { - - private static native void sendToQt(String message); - - private static final String TAG = "ActivityUtils"; - public static final String BROADCAST_NAME_ACTION = "org.qtproject.example.qtandroidservice.broadcast.name"; - - public void registerServiceBroadcastReceiver(Context context) { - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(BROADCAST_NAME_ACTION); - context.registerReceiver(serviceMessageReceiver, intentFilter); - Log.i(TAG, "Registered broadcast receiver"); - } - - private BroadcastReceiver serviceMessageReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - Log.i(TAG, "In OnReceive broadcast receiver"); - if (BROADCAST_NAME_ACTION.equals(intent.getAction())) { - String name = intent.getStringExtra("name"); - Log.i(TAG, "Service received name: " + name); - String message = "Hello " + name; - sendToQt(message); - Log.i(TAG, "Service sent back message: " + message); - } - } - }; -} diff --git a/examples/androidextras/services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java b/examples/androidextras/services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java deleted file mode 100644 index 75c01be..0000000 --- a/examples/androidextras/services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import android.os.IBinder; -import org.qtproject.qt.android.bindings.QtService; -import android.content.IntentFilter; - -public class QtAndroidService extends QtService -{ - private static final String TAG = "QtAndroidService"; - - @Override - public void onCreate() { - super.onCreate(); - Log.i(TAG, "Creating Service"); - } - - @Override - public void onDestroy() { - super.onDestroy(); - Log.i(TAG, "Destroying Service"); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - int ret = super.onStartCommand(intent, flags, startId); - - String name = new String(intent.getByteArrayExtra("name")); - Intent sendToUiIntent = new Intent(); - sendToUiIntent.setAction(ActivityUtils.BROADCAST_NAME_ACTION); - sendToUiIntent.putExtra("name", name); - Log.i(TAG, "Service sending broadcast"); - sendBroadcast(sendToUiIntent); - - return ret; - } - - @Override - public IBinder onBind(Intent intent) { - return super.onBind(intent); - } -} diff --git a/examples/androidextras/services/servicebroadcast/doc/src/qtandroidextras-example-service-broadcastreceiver.qdoc b/examples/androidextras/services/servicebroadcast/doc/src/qtandroidextras-example-service-broadcastreceiver.qdoc deleted file mode 100644 index 781f95a..0000000 --- a/examples/androidextras/services/servicebroadcast/doc/src/qtandroidextras-example-service-broadcastreceiver.qdoc +++ /dev/null @@ -1,152 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Android Service with BroadcastReceiver - \ingroup examples-qtandroidextras - \example services/servicebroadcast - \brief Demonstrates how to run an Android service in a separate process using - a separate .so lib file, and how to communicate with Qt using a BroadcastReceiver. - - \image androidservices.png - - This example demonstrates how to create and run an Android service in a - separate process that uses a separate \c .so lib file, and then exchange data - between QML/C++ and the Java service using a - \l{Android: BroadcastReceiver}{BroadcastReceiver}. - - When clicking the \uicontrol {Send to Service} button, the name entered in the QML - view, Qt, in this case, is sent to the Android service. Then, the service - replies back with a message \c {Hello Qt} which is printed in the QML view. - - \include examples-run.qdocinc - - \section1 Create the Service - - When running the app's process, you can extend either \c QtService or \c Service. - Extending \c QtService allows Qt to load all the necessary libraries to load - Qt components correctly and call native methods on Android. However, here - the service is running in the same process, and with the BroadcastReceiver - you don't need native calls to exchange messages with Qt, so extending either - class works. - - Start by creating the Java service class. This is a normal Android \c Service - that receives a name from QML and replies back with \c {Hello <name>}: - - \quotefromfile services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - \skipto package - \printuntil /^\}/ - - In the owerwritten method - \l{Android: Service onStartCommand}{onStartCommand()}, the service receives - a name from the calling intent, then sends a broadcast to the BroadcastReceiver, - which in turn will call the native method \c {sendToQt(String message)}. For - more information on managing native calls in Qt, see - \l{Calling QML/C++ Functions from Java Code}. - - Since the service is run on a separate \c .so lib file, you must create a - sub-project for the service process which uses \l{QAndroidService}. Start - with a \c .pro file as follows: - - \quotefromfile services/servicebroadcast/service.pro - \printuntil service_main - - Then, create the file \c service_main.cpp: - - \quotefromfile services/servicebroadcast/service_main.cpp - \skipto include - \printuntil /^\}/ - - \section1 Manage the AndroidManifest.xml File - - To use the service, it must be declared in the \c AndroidManifest.xml - file: - - \quotefromfile services/servicebroadcast/android/AndroidManifest.xml - \skipto <service - \printuntil </service> - - \section1 Start the Service - - Take the following steps to set up and start the service: - - \list 1 - \li Register the native method - - \li Create the BroadcastReceiver in a custom Java class: - - \quotefromfile services/servicebroadcast/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java - \skipto package - \printuntil /^\}/ - - \li Register the BroadcastReceiver: - - \quotefromfile services/common/qtandroidservice.cpp - \skipto :registerBroadcastReceiver - \printuntil /^\}/ - - \li Call the \l{Android: Service startService}{startService()} - method, as follows: - - \quotefromfile services/common/qtandroidservice.cpp - \skipto sendToService - \printuntil /^\}/ - - This function is used to start the Service. If the service is already running, - it will only send the names without starting a new service instance. - - \li Then, you have to add the necessary \l Connections, as described in - \l{Qt JNI Messenger}{Qt JNI Messenger Example}. - - \endlist - - \sa {Android Service with BroadcastReceiver - Same Lib File}, - {Android Services}, {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/services/servicebroadcast/main.cpp b/examples/androidextras/services/servicebroadcast/main.cpp deleted file mode 100644 index da53bb8..0000000 --- a/examples/androidextras/services/servicebroadcast/main.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QAndroidService> -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - - QtAndroidService *qtAndroidService = new QtAndroidService(&app); - engine.rootContext()->setContextProperty(QLatin1String("qtAndroidService"), qtAndroidService); - - const QUrl url(http://code.qt.io/QStringLiteral(%22qrc:/main.qml")); - QObject::connect( - &engine, - &QQmlApplicationEngine::objectCreated, - &app, - [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, - Qt::QueuedConnection); - engine.load(url); - - qtAndroidService->sendToService("Qt"); - - return app.exec(); -} diff --git a/examples/androidextras/services/servicebroadcast/service.pro b/examples/androidextras/services/servicebroadcast/service.pro deleted file mode 100644 index 62b2c9f..0000000 --- a/examples/androidextras/services/servicebroadcast/service.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = lib -TARGET = service -CONFIG += dll -QT += core androidextras - -SOURCES += \ - service_main.cpp - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/servicebroadcast -INSTALLS += target diff --git a/examples/androidextras/services/servicebroadcast/service_main.cpp b/examples/androidextras/services/servicebroadcast/service_main.cpp deleted file mode 100644 index a7e2e24..0000000 --- a/examples/androidextras/services/servicebroadcast/service_main.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 <QDebug> -#include <QAndroidService> - -int main(int argc, char *argv[]) -{ - qWarning() << "Service starting with BroadcastReceiver from separate .so file"; - QAndroidService app(argc, argv); - - return app.exec(); -} diff --git a/examples/androidextras/services/servicebroadcast/servicebroadcast.pro b/examples/androidextras/services/servicebroadcast/servicebroadcast.pro deleted file mode 100644 index 4ab511b..0000000 --- a/examples/androidextras/services/servicebroadcast/servicebroadcast.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - servicebroadcastclient.pro \ - service.pro diff --git a/examples/androidextras/services/servicebroadcast/servicebroadcastclient.pro b/examples/androidextras/services/servicebroadcast/servicebroadcastclient.pro deleted file mode 100644 index 72ceab6..0000000 --- a/examples/androidextras/services/servicebroadcast/servicebroadcastclient.pro +++ /dev/null @@ -1,21 +0,0 @@ -QT += qml quick androidextras - -CONFIG += c++11 - -SOURCES += main.cpp - -include(../common/common_broadcast.pri) -include(../common/common.pri) - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/servicebroadcast -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java \ - android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java \ - android/AndroidManifest.xml diff --git a/examples/androidextras/services/servicebroadcastsamelib/android/AndroidManifest.xml b/examples/androidextras/services/servicebroadcastsamelib/android/AndroidManifest.xml deleted file mode 100644 index 9f9647f..0000000 --- a/examples/androidextras/services/servicebroadcastsamelib/android/AndroidManifest.xml +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.qtandroidservice" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - -<service android:process=":qt_service" android:name=".QtAndroidService"> - - <!-- Application arguments --> - <meta-data android:name="android.app.arguments" android:value="-service"/> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Run with local libs --> - - <!-- Background running --> - <meta-data android:name="android.app.background_running" android:value="true"/> - <!-- Background running --> - </service> - </application> -</manifest> diff --git a/examples/androidextras/services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java b/examples/androidextras/services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java deleted file mode 100644 index d2802d7..0000000 --- a/examples/androidextras/services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import android.content.BroadcastReceiver; -import android.content.IntentFilter; - -public class ActivityUtils { - - private static native void sendToQt(String message); - - private static final String TAG = "ActivityUtils"; - public static final String BROADCAST_NAME_ACTION = "org.qtproject.example.qtandroidservice.broadcast.name"; - - public void registerServiceBroadcastReceiver(Context context) { - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(BROADCAST_NAME_ACTION); - context.registerReceiver(serviceMessageReceiver, intentFilter); - Log.i(TAG, "Registered broadcast receiver"); - } - - private BroadcastReceiver serviceMessageReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - Log.i(TAG, "In OnReceive broadcast receiver"); - if (BROADCAST_NAME_ACTION.equals(intent.getAction())) { - String name = intent.getStringExtra("name"); - Log.i(TAG, "Service received name: " + name); - String message = "Hello " + name; - sendToQt(message); - Log.i(TAG, "Service sent back message: " + message); - } - } - }; -} diff --git a/examples/androidextras/services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java b/examples/androidextras/services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java deleted file mode 100644 index 69ae5a6..0000000 --- a/examples/androidextras/services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import android.os.IBinder; -import org.qtproject.qt.android.bindings.QtService; -import android.content.IntentFilter; - - -public class QtAndroidService extends QtService -{ - private static final String TAG = "QtAndroidService"; - - @Override - public void onCreate() { - super.onCreate(); - Log.i(TAG, "Creating Service"); - } - - @Override - public void onDestroy() { - super.onDestroy(); - Log.i(TAG, "Destroying Service"); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - int ret = super.onStartCommand(intent, flags, startId); - - String name = new String(intent.getByteArrayExtra("name")); - Intent sendToUiIntent = new Intent(); - sendToUiIntent.setAction(ActivityUtils.BROADCAST_NAME_ACTION); - sendToUiIntent.putExtra("name", name); - Log.i(TAG, "Service sending broadcast"); - sendBroadcast(sendToUiIntent); - - return ret; - } - - @Override - public IBinder onBind(Intent intent) { - return super.onBind(intent); - } -} diff --git a/examples/androidextras/services/servicebroadcastsamelib/doc/src/qtandroidextras-example-service-broadcastreceiver-samelib.qdoc b/examples/androidextras/services/servicebroadcastsamelib/doc/src/qtandroidextras-example-service-broadcastreceiver-samelib.qdoc deleted file mode 100644 index 7f1d6b0..0000000 --- a/examples/androidextras/services/servicebroadcastsamelib/doc/src/qtandroidextras-example-service-broadcastreceiver-samelib.qdoc +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Android Service with BroadcastReceiver - Same Lib File - \ingroup examples-qtandroidextras - \example services/servicebroadcastsamelib - \brief Demonstrates how to run an Android service in a separate process, - and how to communicate with Qt using a BroadcastReceiver. - - \image androidservices.png - - This example demonstrates how to create and run an Android service in its - own process using the same main \c .so lib file, and then exchange data - between QML/C++ and the Java service using a - \l{Android: BroadcastReceiver}{BroadcastReceiver}. - - When clicking the \uicontrol {Send to Service} button, the name entered in - the QML view, Qt, in this case, is sent to the Android service. Then, the - service replies back with a message \c {Hello Qt} which is printed in the - QML view. - - \include examples-run.qdocinc - - \section1 Create the Service - - When running the app's process, you can extend either \c QtService or \c Service. - Extending \c QtService allows Qt to load all the necessary libraries to load - Qt components correctly and call native methods on Android. However, here - the service is running in the same process, and with the BroadcastReceiver you - don't need native calls to exchange messages with Qt, so extending either - class works. - - Start by creating the Java service class. This is a normal Android \c Service - that receives a name from QML and replies back with \c {Hello <name>}: - - \quotefromfile services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - \skipto package - \printuntil /^\}/ - - In the overwritten method - \l{Android: Service onStartCommand}{onStartCommand()}, - the service receives a name from the calling intent, then sends a broadcast - to the BroadcastReceiver, which in turn will call the native method - \c {sendToQt(String message)}. For more information on managing native - calls in Qt, see \l{Calling QML/C++ Functions from Java Code}. - - \section1 Manage the AndroidManifest.xml File - - To use the service, it must be declared in the \c AndroidManifest.xml - file: - - \quotefromfile services/servicebroadcastsamelib/android/AndroidManifest.xml - \skipto <service - \printuntil </service> - - \section1 Start the Service - - Since the service is run using the same \c .so lib file with different arguments - for the service, you must handle the arguments. For the main application use: - - \quotefromfile services/servicebroadcastsamelib/main.cpp - \skipto (argc - \printline (argc - - Then take the following steps: - - \list 1 - \li Register the native method - - \li Create the BroadcastReceiver in a custom Java class: - - \quotefromfile services/servicebroadcastsamelib/android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java - \skipto package - \printuntil /^\}/ - - \li Register the BroadcastReceiver: - - \quotefromfile services/common/qtandroidservice.cpp - \skipto :registerBroadcastReceiver - \printuntil /^\}/ - - \li Call the \l{Android: Service startService}{startService()} - method, as follows: - - \quotefromfile services/common/qtandroidservice.cpp - \skipto sendToService - \printuntil /^\}/ - - This function is used to start the Service. If the service is already running, - it will only send the names without starting a new service instance. - - \li Then, you have to add the necessary \l Connections, as described in - \l{Qt JNI Messenger}{Qt JNI Messenger Example}. - - \endlist - - Handle the service argument as follows: - - \quotefromfile services/servicebroadcastsamelib/main.cpp - \skipto else if - \printuntil app.exec(); - - \sa {Android Service with BroadcastReceiver}, {Android Services}, - {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/services/servicebroadcastsamelib/main.cpp b/examples/androidextras/services/servicebroadcastsamelib/main.cpp deleted file mode 100644 index 15dfa93..0000000 --- a/examples/androidextras/services/servicebroadcastsamelib/main.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QAndroidService> -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - if (argc <= 1) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - - QtAndroidService *qtAndroidService = new QtAndroidService(&app); - engine.rootContext()->setContextProperty(QLatin1String("qtAndroidService"), qtAndroidService); - - const QUrl url(http://code.qt.io/QStringLiteral(%22qrc:/main.qml")); - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, Qt::QueuedConnection); - engine.load(url); - - qtAndroidService->sendToService("Qt"); - - return app.exec(); - - } else if (argc > 1 && strcmp(argv[1], "-service") == 0) { - qWarning() << "Service starting with BroadcastReceiver from same .so file"; - QAndroidService app(argc, argv); - - return app.exec(); - - } else { - qWarning() << "Unrecognized command line argument"; - return -1; - } -} diff --git a/examples/androidextras/services/servicebroadcastsamelib/servicebroadcastsamelib.pro b/examples/androidextras/services/servicebroadcastsamelib/servicebroadcastsamelib.pro deleted file mode 100644 index dce9afe..0000000 --- a/examples/androidextras/services/servicebroadcastsamelib/servicebroadcastsamelib.pro +++ /dev/null @@ -1,21 +0,0 @@ -QT += qml quick androidextras - -CONFIG += c++11 - -SOURCES += main.cpp - -include(../common/common_broadcast.pri) -include(../common/common.pri) - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/servicebroadcastsamelib -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java \ - android/src/org/qtproject/example/qtandroidservice/ActivityUtils.java \ - android/AndroidManifest.xml diff --git a/examples/androidextras/services/serviceremoteobjects/android/AndroidManifest.xml b/examples/androidextras/services/serviceremoteobjects/android/AndroidManifest.xml deleted file mode 100644 index 5ed4f31..0000000 --- a/examples/androidextras/services/serviceremoteobjects/android/AndroidManifest.xml +++ /dev/null @@ -1,106 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.qtandroidservice" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - - <service android:process=":qt_service" android:name=".QtAndroidService"> - - <meta-data android:name="android.app.lib_name" android:value="service"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Run with local libs --> - - <!-- Background running --> - <meta-data android:name="android.app.background_running" android:value="true"/> - <!-- Background running --> - </service> - </application> -</manifest> diff --git a/examples/androidextras/services/serviceremoteobjects/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java b/examples/androidextras/services/serviceremoteobjects/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java deleted file mode 100644 index 791b319..0000000 --- a/examples/androidextras/services/serviceremoteobjects/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import org.qtproject.qt.android.bindings.QtService; -import android.util.Log; - -public class QtAndroidService extends QtService { - - private static final String TAG = "QtAndroidService"; - - @Override - public void onCreate() { - super.onCreate(); - Log.i(TAG, "Creating Service"); - } - - @Override - public void onDestroy() { - super.onDestroy(); - Log.i(TAG, "Destroying Service"); - } -} diff --git a/examples/androidextras/services/serviceremoteobjects/doc/src/qtandroidextras-example-service-remoteobjects.qdoc b/examples/androidextras/services/serviceremoteobjects/doc/src/qtandroidextras-example-service-remoteobjects.qdoc deleted file mode 100644 index 667f31b..0000000 --- a/examples/androidextras/services/serviceremoteobjects/doc/src/qtandroidextras-example-service-remoteobjects.qdoc +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Android Service with Qt Remote Objects - \ingroup examples-qtandroidextras - \example services/serviceremoteobjects - \brief Demonstrates how to run an Android service in a separate process, - and how to communicate between the service process and the main process - using Qt Remote Objects. - - \image androidservices.png - - This example demonstrates how to create and run an Android service in - a separate process from the main application process, and then exchange data - between QML/C++ and the Java service using \l{Qt Remote Objects}. - - When clicking the \uicontrol {Send to Service} button, the name entered in the QML - view, Qt, in this case, is sent to the Android service. Then, the service - replies back with a message \c {Hello Qt} which is printed in the QML view. - - \include examples-run.qdocinc - - \section1 Create the Service - - To start a service in its own process, extend the \c QtService class for - your service. Extending \c QtService allows the service to load the necessary - Qt libraries used for Qt, like \l{Qt Remote Objects} libraries. - - Start by creating the Java service class. The following class extends \c QtService - and acts as your service entry point: - - \quotefromfile services/serviceremoteobjects/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - \skipto package - \printuntil /^\}/ - - This class can have any logic you want using Java code. However, you don't need - any logic to communicate with Qt as that will be done using Qt Remote Objects. - - \section1 Manage the AndroidManifest.xml File - - To use the service, it must be declared in the \c AndroidManifest.xml - file as follows: - - \quotefromfile services/serviceremoteobjects/android/AndroidManifest.xml - \skipto <service - \printuntil </service> - - The important part of this service declaration is the \c lib_name part. - It will ensure that the service is run by the service's own lib file: - - \quotefromfile services/serviceremoteobjects/android/AndroidManifest.xml - \skipto android:value="service" - \printuntil android:value="service" - - \section1 Handle the Application Start - - To start the service, call the following function from the application's - \c main(): - - \quotefromfile services/serviceremoteobjects/main.cpp - \skipto startService - \printuntil /^\}/ - - \section1 Handle the Service Start - - \l{QAndroidService} is used to create the service process. For the service - to start from its own \c .so lib file, create a sub-project with the following - \c .pro file: - - \quotefromfile services/serviceremoteobjects/service.pro - \printuntil CONFIG - - \section1 Communication with Qt Remote Objects - - To use \l{Qt Remote Objects}, define a \c .rep file: - - \quotefromfile services/common/qtandroidservice.rep - \skipto class - \printuntil /^\}/ - - Define the \c .rep source file in the service project \c .pro: - - \quotefromfile services/serviceremoteobjects/service.pro - \skipto REPC_SOURCE - \printline REPC_SOURCE - - And in the application's \c .pro file: - - \quotefromfile services/serviceremoteobjects/serviceremoteobjectsclient.pro - \skipto REPC_REPLICA - \printline REPC_REPLICA - - Then define the class used by Qt Remote Objects, which has a - \c sendToService() slot and a \c messageFromService() signal: - - \quotefromfile services/common/qtandroidservice_ro.h - \skipto include - \printuntil /^\};/ - - Include the class in the previous snippet in \c main.cpp: - - \quotefromfile services/serviceremoteobjects/main.cpp - \skipto _replica.h - \printline _replica.h - - Now, in the service's \c service_main.cpp, create the \l{QRemoteObjectHost} - node and start \l{QAndroidService}: - - \quotefromfile services/serviceremoteobjects/service_main.cpp - \skipto include - \printuntil /^\}/ - - In the application's \c main.cpp, create the client node and connect it - to the source node created in the service and connect it to the QML view: - - \quotefromfile services/serviceremoteobjects/main.cpp - \skipto QRemoteObjectNode - \printuntil sendToService - - Then, add a \l Connections element to watch for the incoming messages from - the service: - - \quotefromfile services/common/main.qml - \skipto Connections - \printuntil /^\ {4}\}/ - - And set the \c onClicked for the sending button to: - - \quotefromfile services/common/main.qml - \skipto onClicked - \printline onClicked - - \sa {Android Service with Qt Remote Objects - Same Lib File}, - {Android Services}, {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/services/serviceremoteobjects/main.cpp b/examples/androidextras/services/serviceremoteobjects/main.cpp deleted file mode 100644 index b54460a..0000000 --- a/examples/androidextras/services/serviceremoteobjects/main.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "rep_qtandroidservice_replica.h" - -#include <QAndroidIntent> -#include <QtAndroid> - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -void startService() -{ - QAndroidIntent serviceIntent(QtAndroid::androidActivity().object(), - "org/qtproject/example/qtandroidservice/QtAndroidService"); - QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod( - "startService", - "(Landroid/content/Intent;)Landroid/content/ComponentName;", - serviceIntent.handle().object()); -} - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - - startService(); - - QRemoteObjectNode repNode; - repNode.connectToNode(QUrl(QStringLiteral("local:replica"))); - QSharedPointer<QtAndroidServiceReplica> rep(repNode.acquire<QtAndroidServiceReplica>()); - engine.rootContext()->setContextProperty("qtAndroidService", rep.data()); - bool res = rep->waitForSource(); - Q_ASSERT(res); - rep->sendToService("Qt"); - - QObject::connect(rep.data(), &QtAndroidServiceReplica::messageFromService, [](const QString &message){ - qDebug() << "Service sent: " << message; - }); - engine.load(QUrl(QLatin1String("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/examples/androidextras/services/serviceremoteobjects/service.pro b/examples/androidextras/services/serviceremoteobjects/service.pro deleted file mode 100644 index 09a0aaa..0000000 --- a/examples/androidextras/services/serviceremoteobjects/service.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = lib -TARGET = service -CONFIG += dll -QT += core androidextras remoteobjects - -SOURCES += service_main.cpp - -include(../common/common_ro.pri) - -REPC_SOURCE += ../common/qtandroidservice.rep - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/serviceremoteobjects -INSTALLS += target diff --git a/examples/androidextras/services/serviceremoteobjects/service_main.cpp b/examples/androidextras/services/serviceremoteobjects/service_main.cpp deleted file mode 100644 index dc1ec35..0000000 --- a/examples/androidextras/services/serviceremoteobjects/service_main.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice_ro.h" - -#include <QDebug> -#include <QAndroidService> - -int main(int argc, char *argv[]) -{ - qWarning() << "QtAndroidService starting from separate .so"; - QAndroidService app(argc, argv); - - QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:replica"))); - QtAndroidService qtAndroidService; - srcNode.enableRemoting(&qtAndroidService); - - return app.exec(); -} diff --git a/examples/androidextras/services/serviceremoteobjects/serviceremoteobjects.pro b/examples/androidextras/services/serviceremoteobjects/serviceremoteobjects.pro deleted file mode 100644 index 8b8b6e0..0000000 --- a/examples/androidextras/services/serviceremoteobjects/serviceremoteobjects.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - serviceremoteobjectsclient.pro \ - service.pro diff --git a/examples/androidextras/services/serviceremoteobjects/serviceremoteobjectsclient.pro b/examples/androidextras/services/serviceremoteobjects/serviceremoteobjectsclient.pro deleted file mode 100644 index 75f5a2f..0000000 --- a/examples/androidextras/services/serviceremoteobjects/serviceremoteobjectsclient.pro +++ /dev/null @@ -1,21 +0,0 @@ -QT += qml quick androidextras remoteobjects - -CONFIG += c++11 - -SOURCES += main.cpp - -include(../common/common.pri) - -REPC_REPLICA += ../common/qtandroidservice.rep - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/serviceremoteobjects -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/AndroidManifest.xml \ - android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java diff --git a/examples/androidextras/services/serviceremoteobjectssamelib/android/AndroidManifest.xml b/examples/androidextras/services/serviceremoteobjectssamelib/android/AndroidManifest.xml deleted file mode 100644 index 190891f..0000000 --- a/examples/androidextras/services/serviceremoteobjectssamelib/android/AndroidManifest.xml +++ /dev/null @@ -1,110 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.qtandroidservice" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - - <service android:process=":qt_service" android:name=".QtAndroidService"> - - <!-- Application arguments --> - <meta-data android:name="android.app.arguments" android:value="-service"/> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Run with local libs --> - - <!-- Background running --> - <meta-data android:name="android.app.background_running" android:value="true"/> - <!-- Background running --> - </service> - </application> -</manifest> diff --git a/examples/androidextras/services/serviceremoteobjectssamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java b/examples/androidextras/services/serviceremoteobjectssamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java deleted file mode 100644 index fd3bd82..0000000 --- a/examples/androidextras/services/serviceremoteobjectssamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import org.qtproject.qt.android.bindings.QtService; -import android.util.Log; - -public class QtAndroidService extends QtService -{ - private static final String TAG = "QtAndroidService"; - - @Override - public void onCreate() { - Log.i(TAG, "Creating Service"); - super.onCreate(); - } - - @Override - public void onDestroy() { - Log.i(TAG, "Destroying Service"); - super.onDestroy(); - } -} diff --git a/examples/androidextras/services/serviceremoteobjectssamelib/doc/src/qtandroidextras-example-service-remoteobjects-samelib.qdoc b/examples/androidextras/services/serviceremoteobjectssamelib/doc/src/qtandroidextras-example-service-remoteobjects-samelib.qdoc deleted file mode 100644 index 91feaeb..0000000 --- a/examples/androidextras/services/serviceremoteobjectssamelib/doc/src/qtandroidextras-example-service-remoteobjects-samelib.qdoc +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \target android service with remote object in same lib - \title Android Service with Qt Remote Objects - Same Lib File - \ingroup examples-qtandroidextras - \example services/serviceremoteobjectssamelib - \brief Demonstrates how to run an Android service in a separate process using - the same lib file, and how to communicate between the service process - and the main process using Qt Remote Objects. - - \image androidservices.png - - This example demonstrates how to create and run an Android service in - a separate process from the main application process, and then exchange data - between QML/C++ and the Java service using \l{Qt Remote Objects}. - - When clicking the \uicontrol {Send to Service} button, the name entered in the QML - view, Qt, in this case, is sent to the Android service. Then, the service - replies back with a message \c {Hello Qt} which is printed in the QML view. - - \include examples-run.qdocinc - - \section1 Create the Service - - To start a service in its own process, you can extend the \c QtService class - for your service. Extending \c QtService allows the service to load the - necessary Qt libraries used for Qt, like \l{Qt Remote Objects} libraries. - - Start by creating the Java service class. The following class extends \c QtService - and acts as your service entry point: - - \quotefromfile services/serviceremoteobjectssamelib/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - \skipto package - \printuntil /^\}/ - - This class can have any logic you want using Java code. However, you don't need - any logic to communicate with Qt as that will be done using Qt Remote Objects. - - \section1 Manage the AndroidManifest.xml File - - To be able to use the service, it must be declared in the \c AndroidManifest.xml - file as follows: - - \quotefromfile services/serviceremoteobjectssamelib/android/AndroidManifest.xml - \skipto <service - \printuntil </service> - - The important parts of this service declaration are the \c arguments and \c lib_name - parts. Those will ensure that the service is run by executing the lib file - of the main activity with the argument \c -service: - - \quotefromfile services/serviceremoteobjectssamelib/android/AndroidManifest.xml - \skipto <service - \skipto <!-- Application arguments --> - \printuntil lib_name - - \section1 Handle the Application Start - - Since the same \c .so lib file is being used for the application and the - service, you need to handle both scenarios in the \c main() function. No - arguments are provided to start the main application, and therefore you must - add the following in the \c main() function: - - \quotefromfile services/serviceremoteobjectssamelib/main.cpp - \skipto (argc - \printline (argc - - Then calling the following function starts the service: - - \quotefromfile services/serviceremoteobjectssamelib/main.cpp - \skipto startService - \printuntil /^\}/ - - \section1 Handle the Service Start - - \l{QAndroidService} is used to create the service process. The main .so lib - file will be called with an argument to start the service if you add the - following code: - - \quotefromfile services/serviceremoteobjectssamelib/main.cpp - \skipto else if - \printline else if - - \section1 Communication with Qt Remote Objects - - To use \l{Qt Remote Objects}, define a \c .rep file: - - \quotefromfile services/common/qtandroidservice.rep - \skipto class - \printuntil /^\}/ - - Define the \c .rep source and replica file in your project \c .pro file as follows: - - \quotefromfile services/serviceremoteobjectssamelib/serviceremoteobjectssamelib.pro - \skipto REPC_SOURCE - \printuntil REPC_REPLICA - - Then define the class used by Qt Remote Objects, which has a - \c sendToService() slot and a \c messageFromService() signal: - - \quotefromfile services/common/qtandroidservice_ro.h - \skipto include - \printuntil /^\};/ - - Include the class in the previous snippet in \c main.cpp: - - \quotefromfile services/serviceremoteobjectssamelib/main.cpp - \skipto _replica.h - \printline _replica.h - - Now, inside the service handling part, create the \l{QRemoteObjectHost} - node: - - \quotefromfile services/serviceremoteobjectssamelib/main.cpp - \skipto QRemoteObjectHost - \printuntil enableRemoting - - Then, in the application handling part, create the client node and connect it - to the source node created in the service and connect it to the QML view: - - \quotefromfile services/serviceremoteobjectssamelib/main.cpp - \skipto QRemoteObjectNode - \printuntil sendToService - - Then, add a \l Connections element to watch for the incoming messages from - the service: - - \quotefromfile services/common/main.qml - \skipto Connections - \printuntil /^\ {4}\}/ - - And set the \c onClicked for the sending button to: - - \quotefromfile services/common/main.qml - \skipto onClicked - \printline onClicked - - \sa {Android Service with Qt Remote Objects}, {Android Services}, - {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/services/serviceremoteobjectssamelib/main.cpp b/examples/androidextras/services/serviceremoteobjectssamelib/main.cpp deleted file mode 100644 index 8f85cbd..0000000 --- a/examples/androidextras/services/serviceremoteobjectssamelib/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "rep_qtandroidservice_replica.h" -#include "qtandroidservice_ro.h" - -#include <QAndroidIntent> -#include <QtAndroid> -#include <QAndroidService> - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -void startService() -{ - QAndroidIntent serviceIntent(QtAndroid::androidActivity().object(), - "org/qtproject/example/qtandroidservice/QtAndroidService"); - QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod( - "startService", - "(Landroid/content/Intent;)Landroid/content/ComponentName;", - serviceIntent.handle().object()); -} - -int main(int argc, char *argv[]) -{ - if (argc <= 1) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - - startService(); - - QRemoteObjectNode repNode; - repNode.connectToNode(QUrl(QStringLiteral("local:replica"))); - QSharedPointer<QtAndroidServiceReplica> rep(repNode.acquire<QtAndroidServiceReplica>()); - engine.rootContext()->setContextProperty("qtAndroidService", rep.data()); - bool res = rep->waitForSource(); - Q_ASSERT(res); - rep->sendToService("Qt"); - - engine.load(QUrl(QLatin1String("qrc:/main.qml"))); - - return app.exec(); - - } else if (argc > 1 && strcmp(argv[1], "-service") == 0) { - qWarning() << "QtAndroidService starting from same .so"; - QAndroidService app(argc, argv); - - QRemoteObjectHost srcNode(QUrl(QStringLiteral("local:replica"))); - QtAndroidService qtAndroidService; - srcNode.enableRemoting(&qtAndroidService); - - return app.exec(); - - } else { - qWarning() << "Unrecognized command line argument"; - return -1; - } -} diff --git a/examples/androidextras/services/serviceremoteobjectssamelib/serviceremoteobjectssamelib.pro b/examples/androidextras/services/serviceremoteobjectssamelib/serviceremoteobjectssamelib.pro deleted file mode 100644 index 3975a19..0000000 --- a/examples/androidextras/services/serviceremoteobjectssamelib/serviceremoteobjectssamelib.pro +++ /dev/null @@ -1,23 +0,0 @@ -QT += qml quick androidextras remoteobjects - -CONFIG += c++11 - -SOURCES += main.cpp - -include(../common/common_ro.pri) -include(../common/common.pri) - -REPC_SOURCE += ../common/qtandroidservice.rep -REPC_REPLICA += ../common/qtandroidservice.rep - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/serviceremoteobjectssamelib -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/AndroidManifest.xml \ - android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java diff --git a/examples/androidextras/services/services.pro b/examples/androidextras/services/services.pro deleted file mode 100644 index 0d567d6..0000000 --- a/examples/androidextras/services/services.pro +++ /dev/null @@ -1,13 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += \ - servicesameprocess \ - servicebinder \ - servicebroadcast \ - servicebroadcastsamelib - -qtHaveModule(remoteobjects) { - SUBDIRS += \ - serviceremoteobjects \ - serviceremoteobjectssamelib -} diff --git a/examples/androidextras/services/servicesameprocess/android/AndroidManifest.xml b/examples/androidextras/services/servicesameprocess/android/AndroidManifest.xml deleted file mode 100644 index ed72c2d..0000000 --- a/examples/androidextras/services/servicesameprocess/android/AndroidManifest.xml +++ /dev/null @@ -1,89 +0,0 @@ -<?xml version="1.0"?> -<manifest package="org.qtproject.example.qtandroidservice" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="-- %%INSERT_VERSION_CODE%% --" android:installLocation="auto"> - <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/> - - <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application. - Remove the comment if you do not require these default permissions. --> - <!-- %%INSERT_PERMISSIONS --> - - <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application. - Remove the comment if you do not require these default features. --> - <!-- %%INSERT_FEATURES --> - - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> - - <application android:hardwareAccelerated="true" android:name="org.qtproject.qt.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --" android:extractNativeLibs="true"> - <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:name="org.qtproject.qt.android.bindings.QtActivity" android:label="-- %%INSERT_APP_NAME%% --" android:screenOrientation="unspecified" android:launchMode="singleTop"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - - <!-- Application arguments --> - <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ --> - <!-- Application arguments --> - - <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> - <meta-data android:name="android.app.repository" android:value="default"/> - <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> - <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> - <!-- Deploy Qt libs as part of package --> - <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/> - - <!-- Run with local libs --> - <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/> - <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> - <meta-data android:name="android.app.load_local_libs_resource_id" android:resource="@array/load_local_libs"/> - <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/> - <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/> - <!-- Used to specify custom system library path to run with local system libs --> - <!-- <meta-data android:name="android.app.system_libs_prefix" android:value="/system/lib/"/> --> - <!-- Messages maps --> - <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/> - <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/> - <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/> - <meta-data android:value="@string/unsupported_android_version" android:name="android.app.unsupported_android_version"/> - <!-- Messages maps --> - - <!-- Splash screen --> - <!-- Orientation-specific (portrait/landscape) data is checked first. If not available for current orientation, - then android.app.splash_screen_drawable. For best results, use together with splash_screen_sticky and - use hideSplashScreen() with a fade-out animation from Qt Android Extras to hide the splash screen when you - are done populating your window with content. --> - <!-- meta-data android:name="android.app.splash_screen_drawable_portrait" android:resource="@drawable/logo_portrait" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable_landscape" android:resource="@drawable/logo_landscape" / --> - <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ --> - <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ --> - <!-- Splash screen --> - - <!-- Background running --> - <!-- Warning: changing this value to true may cause unexpected crashes if the - application still try to draw after - "applicationStateChanged(Qt::ApplicationSuspended)" - signal is sent! --> - <meta-data android:name="android.app.background_running" android:value="false"/> - <!-- Background running --> - - <!-- auto screen scale factor --> - <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/> - <!-- auto screen scale factor --> - - <!-- extract android style --> - <!-- available android:values : - * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons - * full - useful QWidget & Quick Controls 1 apps - * minimal - useful for Quick Controls 2 apps, it is much faster than "full" - * none - useful for apps that don't use any of the above Qt modules - --> - <meta-data android:name="android.app.extract_android_style" android:value="default"/> - <!-- extract android style --> - </activity> - - <service android:name=".QtAndroidService"> - <!-- Background running --> - <meta-data android:name="android.app.background_running" android:value="true"/> - <!-- Background running --> - </service> - </application> -</manifest> diff --git a/examples/androidextras/services/servicesameprocess/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java b/examples/androidextras/services/servicesameprocess/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java deleted file mode 100644 index 1a5f5e5..0000000 --- a/examples/androidextras/services/servicesameprocess/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -package org.qtproject.example.qtandroidservice; - -import android.content.Context; -import android.content.Intent; -import android.util.Log; -import android.app.Service; -import android.os.IBinder; - -public class QtAndroidService extends Service -{ - private static native void sendToQt(String message); - private static final String TAG = "QtAndroidService"; - - @Override - public void onCreate() { - super.onCreate(); - Log.i(TAG, "Creating Service"); - } - - @Override - public void onDestroy() { - super.onDestroy(); - Log.i(TAG, "Destroying Service"); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - int ret = super.onStartCommand(intent, flags, startId); - String name = new String(intent.getByteArrayExtra("name")); - Log.i(TAG, "Service received name: " + name); - String message = "Hello " + name; - sendToQt(message); - Log.i(TAG, "Service sent back message: " + message); - - return ret; - } - - @Override - public IBinder onBind(Intent intent) { - return null; - } -} diff --git a/examples/androidextras/services/servicesameprocess/doc/src/qtandroidextras-example-service-same-process.qdoc b/examples/androidextras/services/servicesameprocess/doc/src/qtandroidextras-example-service-same-process.qdoc deleted file mode 100644 index 7aeef0a..0000000 --- a/examples/androidextras/services/servicesameprocess/doc/src/qtandroidextras-example-service-same-process.qdoc +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \title Native Android Service in Same Process - \ingroup examples-qtandroidextras - \example services/servicesameprocess - \brief Demonstrates how to run an Android service in the main process, - and how to communicate between QML/C++ and a Java service. - - \image androidservices.png - - This example demonstrates how to create and run a simple Android service in - the same process as the main activity \c QtActivity, and then exchange data - between QML/C++ and the Java service. This service is a pure Java - implementation. - - When clicking the \uicontrol {Send to Service} button, the name entered in - the QML view, Qt, in this case, is sent to the Android service. Then, the service - replies back with a message \c {Hello Qt} which is printed in the QML view. - - \include examples-run.qdocinc - - \section1 Create the Service - - When running the app's process, you can extend either \c QtService or \c Service. - Extending \c QtService allows Qt to load all the necessary libraries to load - Qt components correctly and call native methods on Android. However, here - the service is running in the same process, so extending either class works. - - Start by creating the Java service class. This is a normal Android \c Service - that receives a name from QML and replies back with \c {Hello <name>}: - - \quotefromfile services/servicesameprocess/android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java - \skipto package - \printuntil /^\}/ - - In the overwritten method - \l{Android: Service onStartCommand}{onStartCommand()}, the service receives a - name from the calling intent, then calls the native method - \c {sendToQt(String message)}. For more information on managing native - calls in Qt, see \l{Calling QML/C++ Functions from Java Code}. - - \section1 Manage the AndroidManifest.xml File - - To use the service, it must be declared in the \c AndroidManifest.xml - file. When using pure Android Service in the main app process, use the following: - - \quotefromfile services/servicesameprocess/android/AndroidManifest.xml - \skipto <service - \printuntil </service> - - \section1 Start the Service - - Before starting the service, register the native methods, then call the - \l{Android: Service startService}{startService()} method, as follows: - - \quotefromfile services/servicesameprocess/qtandroidservice.cpp - \skipto sendToService - \printuntil /^\}/ - - This function is used to start the Service. If the service is already running, - it will only send the names without starting a new service instance. - - Then, you have to add the necessary \l Connections, as described in - \l{Qt JNI Messenger}{Qt JNI Messenger Example}. - - \sa {Android Services}, {Qt for Android}, {Qt Android Extras} -*/ diff --git a/examples/androidextras/services/servicesameprocess/main.cpp b/examples/androidextras/services/servicesameprocess/main.cpp deleted file mode 100644 index 1d06566..0000000 --- a/examples/androidextras/services/servicesameprocess/main.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QGuiApplication> -#include <QQmlApplicationEngine> -#include <QQmlContext> - -int main(int argc, char *argv[]) -{ - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); - QQmlApplicationEngine engine; - - QtAndroidService *qtAndroidService = new QtAndroidService(&app); - engine.rootContext()->setContextProperty(QLatin1String("qtAndroidService"), qtAndroidService); - - const QUrl url(http://code.qt.io/QStringLiteral(%22qrc:/main.qml")); - QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, - &app, [url](QObject *obj, const QUrl &objUrl) { - if (!obj && url == objUrl) - QCoreApplication::exit(-1); - }, Qt::QueuedConnection); - engine.load(url); - - qtAndroidService->sendToService("Qt"); - - return app.exec(); -} diff --git a/examples/androidextras/services/servicesameprocess/qtandroidservice.cpp b/examples/androidextras/services/servicesameprocess/qtandroidservice.cpp deleted file mode 100644 index 70db380..0000000 --- a/examples/androidextras/services/servicesameprocess/qtandroidservice.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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 "qtandroidservice.h" - -#include <QAndroidJniEnvironment> -#include <QAndroidIntent> -#include <QtDebug> - -QtAndroidService *QtAndroidService::m_instance = nullptr; - -static void receivedFromAndroidService(JNIEnv *env, jobject /*thiz*/, jstring value) -{ - emit QtAndroidService::instance()->messageFromService(env->GetStringUTFChars(value, nullptr)); -} - -QtAndroidService::QtAndroidService(QObject *parent) : QObject(parent) -{ - m_instance = this; - - JNINativeMethod methods[] {{"sendToQt", "(Ljava/lang/String;)V", reinterpret_cast<void *>(receivedFromAndroidService)}}; - QAndroidJniObject javaClass("org/qtproject/example/qtandroidservice/QtAndroidService"); - - QAndroidJniEnvironment env; - jclass objectClass = env->GetObjectClass(javaClass.object<jobject>()); - env->RegisterNatives(objectClass, - methods, - sizeof(methods) / sizeof(methods[0])); - env->DeleteLocalRef(objectClass); -} - -void QtAndroidService::sendToService(const QString &name) -{ - QAndroidIntent serviceIntent(QtAndroid::androidActivity().object(), - "org/qtproject/example/qtandroidservice/QtAndroidService"); - serviceIntent.putExtra("name", name.toUtf8()); - QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod( - "startService", - "(Landroid/content/Intent;)Landroid/content/ComponentName;", - serviceIntent.handle().object()); -} diff --git a/examples/androidextras/services/servicesameprocess/qtandroidservice.h b/examples/androidextras/services/servicesameprocess/qtandroidservice.h deleted file mode 100644 index 2bed43c..0000000 --- a/examples/androidextras/services/servicesameprocess/qtandroidservice.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -#ifndef QTANDROIDSERVICE_H -#define QTANDROIDSERVICE_H - -#include <QObject> -#include <QtAndroid> -#include <QAndroidIntent> - -class QtAndroidService : public QObject -{ - Q_OBJECT - -public: - QtAndroidService(QObject *parent = nullptr); - - static QtAndroidService *instance() { return m_instance; } - Q_INVOKABLE void sendToService(const QString &name); - -signals: - void messageFromService(const QString &message); - -private: - static QtAndroidService *m_instance; -}; - -#endif // QTANDROIDSERVICE_H diff --git a/examples/androidextras/services/servicesameprocess/servicesameprocess.pro b/examples/androidextras/services/servicesameprocess/servicesameprocess.pro deleted file mode 100644 index 643094f..0000000 --- a/examples/androidextras/services/servicesameprocess/servicesameprocess.pro +++ /dev/null @@ -1,24 +0,0 @@ -QT += qml quick androidextras - -CONFIG += c++11 - -HEADERS += \ - qtandroidservice.h - -SOURCES += \ - main.cpp \ - qtandroidservice.cpp - -include(../common/common.pri) - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -target.path = $$[QT_INSTALL_EXAMPLES]/androidextras/services/servicesameprocess -INSTALLS += target - -ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android - -DISTFILES += \ - android/src/org/qtproject/example/qtandroidservice/QtAndroidService.java \ - android/AndroidManifest.xml diff --git a/examples/examples.pro b/examples/examples.pro deleted file mode 100644 index 467ccc4..0000000 --- a/examples/examples.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -android:SUBDIRS += androidextras diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index e510208..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -# Generated from src.pro. - -# special case skip regeneration -# special case begin -# android -if (ANDROID) - add_subdirectory(androidextras) - add_subdirectory(jar) -endif() -# special case end - diff --git a/src/androidextras/CMakeLists.txt b/src/androidextras/CMakeLists.txt deleted file mode 100644 index 45e7cde..0000000 --- a/src/androidextras/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# Generated from androidextras.pro. - -##################################################################### -## AndroidExtras Module: -##################################################################### - -qt_internal_add_module(AndroidExtras - SOURCES - android/qandroidactivitycallbackresultreceiver.cpp - android/qandroidactivityresultreceiver.cpp android/qandroidactivityresultreceiver.h android/qandroidactivityresultreceiver_p.h - android/qandroidbinder.cpp android/qandroidbinder.h android/qandroidbinder_p.h - android/qandroidfunctions.cpp android/qandroidfunctions.h - android/qandroidintent.cpp android/qandroidintent.h - android/qandroidparcel.cpp android/qandroidparcel.h android/qandroidparcel_p.h - android/qandroidservice.cpp android/qandroidservice.h - android/qandroidserviceconnection.cpp android/qandroidserviceconnection.h - android/qjnionload.cpp - jni/qandroidjnienvironment.cpp jni/qandroidjnienvironment.h - jni/qandroidjniobject.cpp jni/qandroidjniobject.h - DEFINES - QT_NO_USING_NAMESPACE - LIBRARIES - Qt::CorePrivate - PUBLIC_LIBRARIES - Qt::Core - PRIVATE_MODULE_INTERFACE - Qt::CorePrivate -) - -if(ANDROID) - set_property(TARGET AndroidExtras APPEND PROPERTY QT_ANDROID_BUNDLED_JAR_DEPENDENCIES - jar/Qt${QtAndroidExtras_VERSION_MAJOR}AndroidExtras.jar # special case - ) -endif() -qt_internal_add_docs(AndroidExtras - doc/qtandroidextras.qdocconf -) - diff --git a/src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp b/src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp deleted file mode 100644 index e32916f..0000000 --- a/src/androidextras/android/qandroidactivitycallbackresultreceiver.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidactivitycallbackresultreceiver_p.h" - -QAndroidActivityCallbackResultReceiver * QAndroidActivityCallbackResultReceiver::s_instance = nullptr; - -QAndroidActivityCallbackResultReceiver::QAndroidActivityCallbackResultReceiver() - : QAndroidActivityResultReceiver() - , callbackMap() -{ -} - -void QAndroidActivityCallbackResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &intent) -{ - callbackMap[receiverRequestCode](receiverRequestCode, resultCode, intent); - callbackMap.remove(receiverRequestCode); -} - -QAndroidActivityCallbackResultReceiver * QAndroidActivityCallbackResultReceiver::instance() { - if (!s_instance) { - s_instance = new QAndroidActivityCallbackResultReceiver(); - } - return s_instance; -} - -void QAndroidActivityCallbackResultReceiver::registerCallback(int receiverRequestCode, std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc) -{ - callbackMap.insert(receiverRequestCode, callbackFunc); -} diff --git a/src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h b/src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h deleted file mode 100644 index 8232b53..0000000 --- a/src/androidextras/android/qandroidactivitycallbackresultreceiver_p.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDACTIVITYCALLBACKRESULTRECEIVER_P_H -#define QANDROIDACTIVITYCALLBACKRESULTRECEIVER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QMap> - -#include "qandroidactivityresultreceiver.h" - -class QAndroidActivityCallbackResultReceiver: public QAndroidActivityResultReceiver -{ -public: - QAndroidActivityCallbackResultReceiver(); - void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &intent) override; - void registerCallback(int receiverRequestCode, std::function<void(int, int, const QAndroidJniObject &)> callbackFunc); - - static QAndroidActivityCallbackResultReceiver *instance(); -private: - QMap<int, std::function<void(int, int, const QAndroidJniObject &data)>> callbackMap; - - static QAndroidActivityCallbackResultReceiver *s_instance; -}; - -#endif diff --git a/src/androidextras/android/qandroidactivityresultreceiver.cpp b/src/androidextras/android/qandroidactivityresultreceiver.cpp deleted file mode 100644 index 2dfe509..0000000 --- a/src/androidextras/android/qandroidactivityresultreceiver.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidactivityresultreceiver.h" -#include "qandroidactivityresultreceiver_p.h" -#include "qandroidfunctions.h" -#include <QtCore/private/qjnihelpers_p.h> -#include <QtCore/qmutex.h> - -QT_BEGIN_NAMESPACE - -// Get a unique activity request code. -static int uniqueActivityRequestCode() -{ - static QMutex mutex; - static int requestCode = 0x1000; // Reserve all request codes under 0x1000 for Qt. - - QMutexLocker locker(&mutex); - if (requestCode == 0xf3ee) // Special case for MINISTRO_INSTALL_REQUEST_CODE - requestCode++; - - if (requestCode == INT_MAX) - qWarning("Unique activity request code has wrapped. Unexpected behavior may occur."); - - return requestCode++; -} - -int QAndroidActivityResultReceiverPrivate::globalRequestCode(int localRequestCode) const -{ - if (!localToGlobalRequestCode.contains(localRequestCode)) { - int globalRequestCode = uniqueActivityRequestCode(); - localToGlobalRequestCode[localRequestCode] = globalRequestCode; - globalToLocalRequestCode[globalRequestCode] = localRequestCode; - } - return localToGlobalRequestCode.value(localRequestCode); -} - -bool QAndroidActivityResultReceiverPrivate::handleActivityResult(jint requestCode, jint resultCode, jobject data) -{ - if (globalToLocalRequestCode.contains(requestCode)) { - q->handleActivityResult(globalToLocalRequestCode.value(requestCode), resultCode, QAndroidJniObject(data)); - return true; - } - - return false; -} - -/*! - \class QAndroidActivityResultReceiver - \inmodule QtAndroidExtras - \since 5.3 - \brief Interface used for callbacks from onActivityResult() in the main Android activity. - - Create a subclass of this class to be notified of the results when using the - \c QtAndroid::startActivity() and \c QtAndroid::startIntentSender() APIs. - */ - -/*! - \internal -*/ -QAndroidActivityResultReceiver::QAndroidActivityResultReceiver() - : d(new QAndroidActivityResultReceiverPrivate) -{ - d->q = this; - QtAndroidPrivate::registerActivityResultListener(d.data()); -} - -/*! - \internal -*/ -QAndroidActivityResultReceiver::~QAndroidActivityResultReceiver() -{ - QtAndroidPrivate::unregisterActivityResultListener(d.data()); -} - -/*! - \fn void QAndroidActivityResultReceiver::handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) - - Reimplement this function to get activity results after starting an activity using either QtAndroid::startActivity() or - QtAndroid::startIntentSender(). The \a receiverRequestCode is the request code unique to this receiver which was originally - passed to the startActivity() or startIntentSender() functions. The \a resultCode is the result returned by the activity, - and \a data is either null or a Java object of the class android.content.Intent. Both the last to arguments are identical to the - arguments passed to onActivityResult(). -*/ - -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidactivityresultreceiver.h b/src/androidextras/android/qandroidactivityresultreceiver.h deleted file mode 100644 index b71f876..0000000 --- a/src/androidextras/android/qandroidactivityresultreceiver.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDACTIVITYRESULTRECEIVER_H -#define QANDROIDACTIVITYRESULTRECEIVER_H - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QtAndroidExtras/qandroidjniobject.h> - -QT_BEGIN_NAMESPACE - -class QAndroidActivityResultReceiverPrivate; -class Q_ANDROIDEXTRAS_EXPORT QAndroidActivityResultReceiver -{ -public: - QAndroidActivityResultReceiver(); - virtual ~QAndroidActivityResultReceiver(); - virtual void handleActivityResult(int receiverRequestCode, int resultCode, const QAndroidJniObject &data) = 0; - -private: - friend class QAndroidActivityResultReceiverPrivate; - Q_DISABLE_COPY(QAndroidActivityResultReceiver) - - QScopedPointer<QAndroidActivityResultReceiverPrivate> d; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDACTIVITYRESULTRECEIVER_H diff --git a/src/androidextras/android/qandroidactivityresultreceiver_p.h b/src/androidextras/android/qandroidactivityresultreceiver_p.h deleted file mode 100644 index 21553d3..0000000 --- a/src/androidextras/android/qandroidactivityresultreceiver_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDACTIVITYRESULTRECEIVER_P_H -#define QANDROIDACTIVITYRESULTRECEIVER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qhash.h> -#include <QtCore/private/qjnihelpers_p.h> -#include "qandroidactivityresultreceiver.h" - -QT_BEGIN_NAMESPACE - -class QAndroidActivityResultReceiverPrivate: public QtAndroidPrivate::ActivityResultListener -{ -public: - QAndroidActivityResultReceiver *q; - mutable QHash<int, int> localToGlobalRequestCode; - mutable QHash<int, int> globalToLocalRequestCode; - - int globalRequestCode(int localRequestCode) const; - bool handleActivityResult(jint requestCode, jint resultCode, jobject data); - - static QAndroidActivityResultReceiverPrivate *get(QAndroidActivityResultReceiver *publicObject) - { - return publicObject->d.data(); - } -}; - -QT_END_NAMESPACE - -#endif // QANDROIDACTIVITYRESULTRECEIVER_P_H diff --git a/src/androidextras/android/qandroidbinder.cpp b/src/androidextras/android/qandroidbinder.cpp deleted file mode 100644 index e6df77c..0000000 --- a/src/androidextras/android/qandroidbinder.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidbinder.h" - -#include "qandroidbinder_p.h" -#include "qandroidparcel.h" -#include "qandroidparcel_p.h" - -#include <jni/qandroidjnienvironment.h> - -QT_BEGIN_NAMESPACE -QAndroidBinderPrivate::QAndroidBinderPrivate(QAndroidBinder *binder) - : handle("org/qtproject/qt/android/extras/QtAndroidBinder", "(J)V", jlong(binder)) - , m_isQtAndroidBinder(true) -{ - QAndroidJniExceptionCleaner cleaner; -} - -QAndroidBinderPrivate::QAndroidBinderPrivate(const QAndroidJniObject &binder) - : handle(binder) - , m_isQtAndroidBinder(false) -{ -} - -QAndroidBinderPrivate::~QAndroidBinderPrivate() -{ - if (m_isQtAndroidBinder) { - QAndroidJniExceptionCleaner cleaner; - handle.callMethod<void>("setId", "(J)V", jlong(0)); - if (m_deleteListener) - m_deleteListener(); - } -} - -/*! - \class QAndroidBinder - \inmodule QtAndroidExtras - \brief Wraps the most important methods of Android Binder class. - - The QAndroidBinder is a convenience class that wraps the most important - \l {https://developer.android.com/reference/android/os/Binder.html}{Android Binder} - methods. - - \since 5.10 -*/ - - -/*! - \enum QAndroidBinder::CallType - - This enum is used with \l QAndroidBinder::transact() to describe the mode in which the - IPC call is performed. - - \value Normal normal IPC, meaning that the caller waits the result from the callee - \value OneWay one-way IPC, meaning that the caller returns immediately, without waiting for a result from the callee -*/ - -/*! - Creates a new object which can be used to perform IPC. - - \sa onTransact, transact - */ -QAndroidBinder::QAndroidBinder() - : d(new QAndroidBinderPrivate(this)) -{ -} - -/*! - Creates a new object from the \a binder Java object. - - \sa transact - */ -QAndroidBinder::QAndroidBinder(const QAndroidJniObject &binder) - : d(new QAndroidBinderPrivate(binder)) -{ -} - -QAndroidBinder::~QAndroidBinder() -{ -} - -/*! - Default implementation is a stub that returns false. - The user should override this method to get the transact data from the caller. - - The \a code is the action to perform. - The \a data is the marshaled data sent by the caller.\br - The \a reply is the marshaled data to be sent to the caller.\br - The \a flags are the additional operation flags.\br - - \warning This method is called from Binder's thread which is different - from the thread that this object was created. - - \sa transact - */ -bool QAndroidBinder::onTransact(int /*code*/, const QAndroidParcel &/*data*/, const QAndroidParcel &/*reply*/, CallType /*flags*/) -{ - return false; -} - -/*! - Performs an IPC call - - The \a code is the action to perform. Should be between - \l {https://developer.android.com/reference/android/os/IBinder.html#FIRST_CALL_TRANSACTION} - {FIRST_CALL_TRANSACTION} and - \l {https://developer.android.com/reference/android/os/IBinder.html#LAST_CALL_TRANSACTION} - {LAST_CALL_TRANSACTION}.\br - The \a data is the marshaled data to send to the target.\br - The \a reply (if specified) is the marshaled data to be received from the target. - May be \b nullptr if you are not interested in the return value.\br - The \a flags are the additional operation flags.\br - - \return true on success - */ -bool QAndroidBinder::transact(int code, const QAndroidParcel &data, QAndroidParcel *reply, CallType flags) const -{ - QAndroidJniExceptionCleaner cleaner; - return d->handle.callMethod<jboolean>("transact", "(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z", - jint(code), data.d->handle.object(), reply ? reply->d->handle.object() : nullptr, jint(flags)); -} - -/*! - The return value is useful to call other Java API which are not covered by this wrapper - */ -QAndroidJniObject QAndroidBinder::handle() const -{ - return d->handle; -} - -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidbinder.h b/src/androidextras/android/qandroidbinder.h deleted file mode 100644 index 1e73e7d..0000000 --- a/src/androidextras/android/qandroidbinder.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDBINDER_H -#define QANDROIDBINDER_H - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QSharedPointer> - -#include <jni.h> - -QT_BEGIN_NAMESPACE -class QAndroidBinderPrivate; -class QAndroidParcel; -class QAndroidJniObject; - -class Q_ANDROIDEXTRAS_EXPORT QAndroidBinder -{ -public: - enum class CallType { - Normal = 0, - OneWay = 1 - }; - -public: - explicit QAndroidBinder(); - QAndroidBinder(const QAndroidJniObject &binder); - - virtual ~QAndroidBinder(); - - virtual bool onTransact(int code, const QAndroidParcel &data, const QAndroidParcel &reply, CallType flags); - bool transact(int code, const QAndroidParcel &data, QAndroidParcel *reply = nullptr, CallType flags = CallType::Normal) const; - - QAndroidJniObject handle() const; - -private: - friend class QAndroidBinderPrivate; - friend class QAndroidParcelPrivate; - friend class QAndroidServicePrivate; - QSharedPointer<QAndroidBinderPrivate> d; -}; -QT_END_NAMESPACE - -#endif // QANDROIDBINDER_H diff --git a/src/androidextras/android/qandroidbinder_p.h b/src/androidextras/android/qandroidbinder_p.h deleted file mode 100644 index b132b33..0000000 --- a/src/androidextras/android/qandroidbinder_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDBINDER_P_H -#define QANDROIDBINDER_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include "qandroidjniobject.h" - -#include <functional> -#include <jni.h> - -QT_BEGIN_NAMESPACE -class QAndroidBinder; -class QAndroidBinderPrivate -{ -public: - explicit QAndroidBinderPrivate(QAndroidBinder *binder); - explicit QAndroidBinderPrivate(const QAndroidJniObject &binder); - void setDeleteListener(const std::function<void()> &func) { m_deleteListener = func; } - ~QAndroidBinderPrivate(); - -private: - QAndroidJniObject handle; - std::function<void()> m_deleteListener; - bool m_isQtAndroidBinder; - friend class QAndroidBinder; -}; -QT_END_NAMESPACE - -#endif // QANDROIDBINDER_P_H diff --git a/src/androidextras/android/qandroidfunctions.cpp b/src/androidextras/android/qandroidfunctions.cpp deleted file mode 100644 index 8d049fc..0000000 --- a/src/androidextras/android/qandroidfunctions.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidfunctions.h" -#include "qandroidactivityresultreceiver.h" -#include "qandroidactivityresultreceiver_p.h" -#include "qandroidintent.h" -#include "qandroidserviceconnection.h" -#include "qandroidactivitycallbackresultreceiver_p.h" - -#include <QtCore/private/qjni_p.h> -#include <QtCore/private/qjnihelpers_p.h> - -#include <jni/qandroidjnienvironment.h> - -QT_BEGIN_NAMESPACE - -/*! - \namespace QtAndroid - \inmodule QtAndroidExtras - \since 5.3 - \brief The QtAndroid namespace provides miscellaneous functions to aid Android development. - \inheaderfile QtAndroid -*/ - -/*! - \since 5.10 - \enum QtAndroid::BindFlag - - This enum is used with QtAndroid::bindService to describe the mode in which the - binding is performed. - - \value None No options. - \value AutoCreate Automatically creates the service as long as the binding exist. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_AUTO_CREATE} - {BIND_AUTO_CREATE} documentation for more details. - \value DebugUnbind Include debugging help for mismatched calls to unbind. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_DEBUG_UNBIND} - {BIND_DEBUG_UNBIND} documentation for more details. - \value NotForeground Don't allow this binding to raise the target service's process to the foreground scheduling priority. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_NOT_FOREGROUND} - {BIND_NOT_FOREGROUND} documentation for more details. - \value AboveClient Indicates that the client application binding to this service considers the service to be more important than the app itself. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ABOVE_CLIENT} - {BIND_ABOVE_CLIENT} documentation for more details. - \value AllowOomManagement Allow the process hosting the bound service to go through its normal memory management. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ALLOW_OOM_MANAGEMENT} - {BIND_ALLOW_OOM_MANAGEMENT} documentation for more details. - \value WaivePriority Don't impact the scheduling or memory management priority of the target service's hosting process. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_WAIVE_PRIORITY} - {BIND_WAIVE_PRIORITY} documentation for more details. - \value Important This service is assigned a higher priority so that it is available to the client when needed. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_IMPORTANT} - {BIND_IMPORTANT} documentation for more details. - \value AdjustWithActivity If binding from an activity, allow the target service's process importance to be raised based on whether the activity is visible to the user. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_ADJUST_WITH_ACTIVITY} - {BIND_ADJUST_WITH_ACTIVITY} documentation for more details. - \value ExternalService The service being bound is an isolated, external service. - See \l {https://developer.android.com/reference/android/content/Context.html#BIND_EXTERNAL_SERVICE} - {BIND_EXTERNAL_SERVICE} documentation for more details. -*/ - -/*! - \since 5.3 - \fn QAndroidJniObject QtAndroid::androidActivity() - - Returns a handle to this application's main Activity - - \sa QAndroidJniObject, androidService(), androidContext() -*/ -QAndroidJniObject QtAndroid::androidActivity() -{ - return QtAndroidPrivate::activity(); -} - -/*! - \since 5.7 - \fn QAndroidJniObject QtAndroid::androidService() - - Returns a handle to this application's main Service - - \sa QAndroidJniObject, androidActivity(), androidContext() -*/ -QAndroidJniObject QtAndroid::androidService() -{ - return QtAndroidPrivate::service(); -} - -/*! - \since 5.8 - \fn QAndroidJniObject QtAndroid::androidContext() - - Returns a handle to this application's main Context. Depending on the nature of - the application the Context object is either the main Service or Activity - object. - - \sa QAndroidJniObject, androidActivity(), androidService() -*/ -QAndroidJniObject QtAndroid::androidContext() -{ - return QtAndroidPrivate::context(); -} - -/*! - \since 5.3 - \fn int QtAndroid::androidSdkVersion() - - Returns the Android SDK version. This is also known as the API level. -*/ -int QtAndroid::androidSdkVersion() -{ - return QtAndroidPrivate::androidSdkVersion(); -} - -/*! - \since 5.3 - - Starts the activity given by \a intent and provides the result asynchronously through the - \a resultReceiver if this is non-null. - - If \a resultReceiver is null, then the \c startActivity() method in the \c androidActivity() - will be called. Otherwise \c startActivityForResult() will be called. - - The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be - returned along with the result, making it possible to use the same receiver for more than - one intent. - - */ -void QtAndroid::startActivity(const QAndroidJniObject &intent, - int receiverRequestCode, - QAndroidActivityResultReceiver *resultReceiver) -{ - QAndroidJniObject activity = androidActivity(); - if (resultReceiver != 0) { - QAndroidActivityResultReceiverPrivate *resultReceiverD = QAndroidActivityResultReceiverPrivate::get(resultReceiver); - activity.callMethod<void>("startActivityForResult", - "(Landroid/content/Intent;I)V", - intent.object<jobject>(), - resultReceiverD->globalRequestCode(receiverRequestCode)); - } else { - activity.callMethod<void>("startActivity", - "(Landroid/content/Intent;)V", - intent.object<jobject>()); - } -} - -/*! - \since 5.13 - - Starts the activity given by \a intent and provides the result asynchronously through the - \a resultReceiver if this is non-null. - - If \a resultReceiver is null, then the \c startActivity() method in the \c androidActivity() - will be called. Otherwise \c startActivityForResult() will be called. - - The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be - returned along with the result, making it possible to use the same receiver for more than - one intent. - - */ -void QtAndroid::startActivity(const QAndroidIntent &intent, - int receiverRequestCode, - QAndroidActivityResultReceiver *resultReceiver) -{ - startActivity(intent.handle(), receiverRequestCode, resultReceiver); -} - -/*! - \since 5.13 - - Starts the activity given by \a intent, using the request code \a receiverRequestCode, - and provides the result by calling \a callbackFunc. -*/ -void QtAndroid::startActivity(const QAndroidJniObject &intent, - int receiverRequestCode, - std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc) -{ - QAndroidJniObject activity = androidActivity(); - QAndroidActivityCallbackResultReceiver::instance()->registerCallback(receiverRequestCode, callbackFunc); - startActivity(intent, receiverRequestCode, QAndroidActivityCallbackResultReceiver::instance()); -} - -/*! - \since 5.3 - - Starts the activity given by \a intentSender and provides the result asynchronously through the - \a resultReceiver if this is non-null. - - If \a resultReceiver is null, then the \c startIntentSender() method in the \c androidActivity() - will be called. Otherwise \c startIntentSenderForResult() will be called. - - The \a receiverRequestCode is a request code unique to the \a resultReceiver, and will be - returned along with the result, making it possible to use the same receiver for more than - one intent. - -*/ -void QtAndroid::startIntentSender(const QAndroidJniObject &intentSender, - int receiverRequestCode, - QAndroidActivityResultReceiver *resultReceiver) -{ - QAndroidJniObject activity = androidActivity(); - if (resultReceiver != 0) { - QAndroidActivityResultReceiverPrivate *resultReceiverD = QAndroidActivityResultReceiverPrivate::get(resultReceiver); - activity.callMethod<void>("startIntentSenderForResult", - "(Landroid/content/IntentSender;ILandroid/content/Intent;III)V", - intentSender.object<jobject>(), - resultReceiverD->globalRequestCode(receiverRequestCode), - 0, // fillInIntent - 0, // flagsMask - 0, // flagsValues - 0); // extraFlags - } else { - activity.callMethod<void>("startIntentSender", - "(Landroid/content/IntentSender;Landroid/content/Intent;III)V", - intentSender.object<jobject>(), - 0, // fillInIntent - 0, // flagsMask - 0, // flagsValues - 0); // extraFlags - - } - -} - -/*! - \typedef QtAndroid::Runnable - - Synonym for std::function<void()>. -*/ - -/*! - \since 5.7 - \fn void QtAndroid::runOnAndroidThread(const Runnable &runnable) - - Posts the given \a runnable on the android thread. - The \a runnable will be queued and executed on the Android UI thread, unless it called on the - Android UI thread, in which case the runnable will be executed immediately. - - This function is useful to set asynchronously properties of objects that must be set on on Android UI thread. -*/ -void QtAndroid::runOnAndroidThread(const QtAndroid::Runnable &runnable) -{ - QtAndroidPrivate::runOnAndroidThread(runnable, QJNIEnvironmentPrivate()); -} - -/*! - \since 5.7 - \fn void QtAndroid::runOnAndroidThreadSync(const Runnable &runnable, int timeoutMs) - - Posts the \a runnable on the Android UI thread and waits until the runnable is executed, - or until \a timeoutMs has passed - - This function is useful to create objects, or get properties on Android UI thread: - - \code - QAndroidJniObject javaControl; - QtAndroid::runOnAndroidThreadSync([&javaControl](){ - - // create our Java control on Android UI thread. - javaControl = QAndroidJniObject("android/webkit/WebView", - "(Landroid/content/Context;)V", - QtAndroid::androidActivity().object<jobject>()); - javaControl.callMethod<void>("setWebViewClient", - "(Landroid/webkit/WebViewClient;)V", - QAndroidJniObject("android/webkit/WebViewClient").object()); - }); - - // Continue the execution normally - qDebug() << javaControl.isValid(); - \endcode -*/ -void QtAndroid::runOnAndroidThreadSync(const QtAndroid::Runnable &runnable, int timeoutMs) -{ - QtAndroidPrivate::runOnAndroidThreadSync(runnable, QJNIEnvironmentPrivate(), timeoutMs); -} - - -/*! - \since 5.7 - \fn void QtAndroid::hideSplashScreen() - - Hides the splash screen immediately. -*/ -void QtAndroid::hideSplashScreen() -{ - hideSplashScreen(0); -} - -/*! - \since 5.10 - \fn void QtAndroid::hideSplashScreen(int duration) - - Hides the splash screen, fading it for \a duration milliseconds. -*/ -void QtAndroid::hideSplashScreen(int duration) -{ - QtAndroidPrivate::hideSplashScreen(QJNIEnvironmentPrivate(), duration); -} - - -/*! - \since 5.10 - \fn bool QtAndroid::bindService(const QAndroidIntent &serviceIntent, const QAndroidServiceConnection &serviceConnection, BindFlags flags = BindFlag::None) - - Binds the service given by \a serviceIntent, \a serviceConnection and \a flags. - The \a serviceIntent object identifies the service to connect to. - The \a serviceConnection is a listener that receives the information as the service is started and stopped. - - \return true on success - - See \l {https://developer.android.com/reference/android/content/Context.html#bindService%28android.content.Intent,%20android.content.ServiceConnection,%20int%29} - {Android documentation} documentation for more details. - - \sa QAndroidIntent, QAndroidServiceConnection, BindFlag -*/ -bool QtAndroid::bindService(const QAndroidIntent &serviceIntent, - const QAndroidServiceConnection &serviceConnection, BindFlags flags) -{ - QAndroidJniExceptionCleaner cleaner; - return androidContext().callMethod<jboolean>("bindService", "(Landroid/content/Intent;Landroid/content/ServiceConnection;I)Z", - serviceIntent.handle().object(), serviceConnection.handle().object(), jint(flags)); -} - -static QtAndroid::PermissionResultMap privateToPublicPermissionsHash(const QtAndroidPrivate::PermissionsHash &privateHash) -{ - QtAndroid::PermissionResultMap hash; - for (auto it = privateHash.constBegin(); it != privateHash.constEnd(); ++it) - hash[it.key()] = QtAndroid::PermissionResult(it.value()); - return hash; -} - -/*! - \since 5.10 - \enum QtAndroid::PermissionResult - - This enum is used to describe the permission status. - - \value Granted The permission was granted. - \value Denied The permission was denied. -*/ - -/*! - \typedef QtAndroid::PermissionResultMap - - Synonym for QHash<QString, PermissionResult>. -*/ - -/*! - \typedef QtAndroid::PermissionResultCallback - - Synonym for std::function<void(const PermissionResultMap &)>. -*/ - -/*! - \since 5.10 - \fn void QtAndroid::requestPermissions(const QStringList &permissions, const PermissionResultCallback &callbackFunc) - - Asynchronously requests \a permissions to be granted to this application, \a callbackFunc will be called with the results. -*/ -void QtAndroid::requestPermissions(const QStringList &permissions, const QtAndroid::PermissionResultCallback &callbackFunc) -{ - QtAndroidPrivate::requestPermissions(QJNIEnvironmentPrivate(), permissions, - [callbackFunc](const QtAndroidPrivate::PermissionsHash &privatePerms){ - callbackFunc(privateToPublicPermissionsHash(privatePerms)); - }, false); -} - -/*! - \since 5.10 - \fn QtAndroid::PermissionResultMap QtAndroid::requestPermissionsSync(const QStringList &permissions, int timeoutMs) - - Synchronously requests \a permissions to be granted to this application, waits \a timeoutMs to complete. - */ -QtAndroid::PermissionResultMap QtAndroid::requestPermissionsSync(const QStringList &permissions, int timeoutMs) -{ - return privateToPublicPermissionsHash(QtAndroidPrivate::requestPermissionsSync(QJNIEnvironmentPrivate(), permissions, timeoutMs)); -} - -/*! - \since 5.10 - \fn QtAndroid::PermissionResult QtAndroid::checkPermission(const QString &permission) - - Checks if the \a permission was granted or not. This function should be called every time when - the application starts for needed permissions, as the users might disable them from Android Settings. - */ -QtAndroid::PermissionResult QtAndroid::checkPermission(const QString &permission) -{ - return QtAndroid::PermissionResult(QtAndroidPrivate::checkPermission(permission)); -} - -/*! - \since 5.10 - \fn bool QtAndroid::shouldShowRequestPermissionRationale(const QString &permission) - - Returns \c true if you should show UI with a rationale for requesting a \a permission. -*/ -bool QtAndroid::shouldShowRequestPermissionRationale(const QString &permission) -{ - return QtAndroidPrivate::shouldShowRequestPermissionRationale(permission); -} -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidfunctions.h b/src/androidextras/android/qandroidfunctions.h deleted file mode 100644 index 0433d21..0000000 --- a/src/androidextras/android/qandroidfunctions.h +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDFUNCTIONS_H -#define QANDROIDFUNCTIONS_H - -#if 0 -#pragma qt_class(QtAndroid) -#endif - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QtAndroidExtras/qandroidjniobject.h> - -#include <functional> - -QT_BEGIN_NAMESPACE - -class QAndroidActivityResultReceiver; -class QAndroidServiceConnection; -class QAndroidIntent; - -namespace QtAndroid -{ - Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidActivity(); - Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidService(); - Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject androidContext(); - Q_ANDROIDEXTRAS_EXPORT int androidSdkVersion(); - - Q_ANDROIDEXTRAS_EXPORT void startIntentSender(const QAndroidJniObject &intentSender, - int receiverRequestCode, - QAndroidActivityResultReceiver *resultReceiver = nullptr); - Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidJniObject &intent, - int receiverRequestCode, - QAndroidActivityResultReceiver *resultReceiver = nullptr); - Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidIntent &intent, - int receiverRequestCode, - QAndroidActivityResultReceiver *resultReceiver = nullptr); - Q_ANDROIDEXTRAS_EXPORT void startActivity(const QAndroidJniObject &intent, - int receiverRequestCode, - std::function<void(int, int, const QAndroidJniObject &data)> callbackFunc); - - enum class BindFlag { - None = 0x00000000, - AutoCreate = 0x00000001, - DebugUnbind = 0x00000002, - NotForeground = 0x00000004, - AboveClient = 0x00000008, - AllowOomManagement = 0x00000010, - WaivePriority = 0x00000020, - Important = 0x00000040, - AdjustWithActivity = 0x00000080, - ExternalService = -2147483648 // 0x80000000 - - }; - Q_DECLARE_FLAGS(BindFlags, BindFlag) - - Q_ANDROIDEXTRAS_EXPORT bool bindService(const QAndroidIntent &serviceIntent, - const QAndroidServiceConnection &serviceConnection, - BindFlags flags = BindFlag::None); - - typedef std::function<void()> Runnable; - Q_ANDROIDEXTRAS_EXPORT void runOnAndroidThread(const Runnable &runnable); - Q_ANDROIDEXTRAS_EXPORT void runOnAndroidThreadSync(const Runnable &runnable, int timeoutMs = INT_MAX); - - Q_ANDROIDEXTRAS_EXPORT void hideSplashScreen(); // ### Qt6: merge with next overload - Q_ANDROIDEXTRAS_EXPORT void hideSplashScreen(int duration); - - enum class PermissionResult { - Denied = -1, - Granted = 0 - }; - typedef QHash<QString, PermissionResult> PermissionResultMap; - typedef std::function<void(const PermissionResultMap &)> PermissionResultCallback; - Q_ANDROIDEXTRAS_EXPORT void requestPermissions(const QStringList &permissions, const PermissionResultCallback &callbackFunc); - Q_ANDROIDEXTRAS_EXPORT PermissionResultMap requestPermissionsSync(const QStringList &permissions, int timeoutMs = INT_MAX); - Q_ANDROIDEXTRAS_EXPORT PermissionResult checkPermission(const QString &permission); - Q_ANDROIDEXTRAS_EXPORT bool shouldShowRequestPermissionRationale(const QString &permission); -} - -QT_END_NAMESPACE - -#endif // QANDROIDFUNCTIONS_H diff --git a/src/androidextras/android/qandroidintent.cpp b/src/androidextras/android/qandroidintent.cpp deleted file mode 100644 index 9c0fecb..0000000 --- a/src/androidextras/android/qandroidintent.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidintent.h" - -#include <jni/qandroidjnienvironment.h> -#include <QtCore/private/qjni_p.h> -#include <QBuffer> -#include <QDataStream> -#include <QVariant> - -QT_BEGIN_NAMESPACE - -/*! - \class QAndroidIntent - \inmodule QtAndroidExtras - \brief Wraps the most important methods of Android Intent class. - - The QAndroidIntent is a convenience class that wraps the most important - \l {https://developer.android.com/reference/android/content/Intent.html}{Android Intent} - methods. - - \since 5.10 -*/ - -/*! - Create a new intent - */ -QAndroidIntent::QAndroidIntent() - : m_handle("android.content.Intent", "()V") -{ - -} - -QAndroidIntent::~QAndroidIntent() -{} - -/*! - Wraps the provided \a intent java object. - */ -QAndroidIntent::QAndroidIntent(const QAndroidJniObject &intent) - : m_handle(intent) -{ -} - -/*! - Creates a new intent and sets the provided \a action. - */ -QAndroidIntent::QAndroidIntent(const QString &action) - : m_handle("android.content.Intent", "(Ljava/lang/String;)V", - QAndroidJniObject::fromString(action).object()) -{ - QAndroidJniExceptionCleaner cleaner; -} - -/*! - Creates a new intent and sets the provided \a packageContext and the service \a className. - Example: - \code - auto serviceIntent = QAndroidIntent(QtAndroid::androidActivity().object(), "com.example.MyService"); - \endcode - - \sa QtAndroid::androidActivity, QtAndroid::bindService - */ -QAndroidIntent::QAndroidIntent(const QAndroidJniObject &packageContext, const char *className) - : m_handle("android/content/Intent", "(Landroid/content/Context;Ljava/lang/Class;)V", - packageContext.object(), QJNIEnvironmentPrivate::findClass(className)) -{ - QAndroidJniExceptionCleaner cleaner; -} - -/*! - Sets the \a key with the \a data in the Intent extras - */ -void QAndroidIntent::putExtra(const QString &key, const QByteArray &data) -{ - QAndroidJniExceptionCleaner cleaner; - QAndroidJniEnvironment env; - jbyteArray array = env->NewByteArray(data.size()); - env->SetByteArrayRegion(array, 0, data.length(), reinterpret_cast<const jbyte*>(data.constData())); - m_handle.callObjectMethod("putExtra", "(Ljava/lang/String;[B)Landroid/content/Intent;", - QAndroidJniObject::fromString(key).object(), array); - env->DeleteLocalRef(array); -} - -/*! - Returns the extra \a key data from the Intent extras - */ -QByteArray QAndroidIntent::extraBytes(const QString &key) -{ - QAndroidJniExceptionCleaner cleaner; - auto array = m_handle.callObjectMethod("getByteArrayExtra", "(Ljava/lang/String;)[B", - QAndroidJniObject::fromString(key).object()); - if (!array.isValid() || !array.object()) - return QByteArray(); - QAndroidJniEnvironment env; - auto sz = env->GetArrayLength(jarray(array.object())); - QByteArray res(sz, Qt::Initialization::Uninitialized); - env->GetByteArrayRegion(jbyteArray(array.object()), 0, sz, reinterpret_cast<jbyte *>(res.data())); - return res; -} - -/*! - Sets the \a key with the \a value in the Intent extras. - */ -void QAndroidIntent::putExtra(const QString &key, const QVariant &value) -{ - QByteArray buff; - QDataStream stream(&buff, QIODevice::WriteOnly); - stream << value; - putExtra(key, buff); -} - -/*! - Returns the extra \a key data from the Intent extras as a QVariant - */ -QVariant QAndroidIntent::extraVariant(const QString &key) -{ - QDataStream stream(extraBytes(key)); - QVariant res; - stream >> res; - return res; -} - -/*! - The return value is useful to call other Java API which are not covered by this wrapper - */ -QAndroidJniObject QAndroidIntent::handle() const -{ - return m_handle; -} -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidintent.h b/src/androidextras/android/qandroidintent.h deleted file mode 100644 index 3da5692..0000000 --- a/src/androidextras/android/qandroidintent.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDINTENT_H -#define QANDROIDINTENT_H - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QtAndroidExtras/qandroidjniobject.h> - -QT_BEGIN_NAMESPACE -class QAndroidJniObject; -class Q_ANDROIDEXTRAS_EXPORT QAndroidIntent -{ -public: - QAndroidIntent(); - virtual ~QAndroidIntent(); - explicit QAndroidIntent(const QAndroidJniObject &intent); - explicit QAndroidIntent(const QString &action); - explicit QAndroidIntent(const QAndroidJniObject &packageContext, const char *className); - - void putExtra(const QString &key, const QByteArray &data); - QByteArray extraBytes(const QString &key); - - void putExtra(const QString &key, const QVariant &value); - QVariant extraVariant(const QString &key); - - QAndroidJniObject handle() const; - -private: - QAndroidJniObject m_handle; -}; -QT_END_NAMESPACE - -#endif // QANDROIDINTENT_H diff --git a/src/androidextras/android/qandroidparcel.cpp b/src/androidextras/android/qandroidparcel.cpp deleted file mode 100644 index 6923f87..0000000 --- a/src/androidextras/android/qandroidparcel.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidparcel.h" - -#include "qandroidbinder.h" -#include "qandroidbinder_p.h" -#include "qandroidparcel_p.h" - -#include <QAndroidJniObject> -#include <QAndroidJniEnvironment> -#include <QBuffer> -#include <QDataStream> -#include <QVariant> - -QT_BEGIN_NAMESPACE - -struct FileDescriptor -{ - explicit FileDescriptor(int fd = -1) - : handle("java/io/FileDescriptor") - { - QAndroidJniExceptionCleaner cleaner; - setFileDescriptor(fd); - } - - inline void setFileDescriptor(int fd) - { - QAndroidJniExceptionCleaner cleaner; - handle.setField("descriptor", fd); - } - - QAndroidJniObject handle; -}; - -QAndroidParcelPrivate::QAndroidParcelPrivate() - : handle(QAndroidJniObject::callStaticObjectMethod("android/os/Parcel","obtain", "()Landroid/os/Parcel;").object()) -{} - -QAndroidParcelPrivate::QAndroidParcelPrivate(const QAndroidJniObject &parcel) - : handle(parcel) -{} - -void QAndroidParcelPrivate::writeData(const QByteArray &data) const -{ - if (data.isEmpty()) - return; - - QAndroidJniExceptionCleaner cleaner; - QAndroidJniEnvironment env; - jbyteArray array = env->NewByteArray(data.size()); - env->SetByteArrayRegion(array, 0, data.length(), reinterpret_cast<const jbyte*>(data.constData())); - handle.callMethod<void>("writeByteArray", "([B)V", array); - env->DeleteLocalRef(array); -} - -void QAndroidParcelPrivate::writeBinder(const QAndroidBinder &binder) const -{ - QAndroidJniExceptionCleaner cleaner; - handle.callMethod<void>("writeStrongBinder", "(Landroid/os/IBinder;)V", binder.handle().object()); -} - -void QAndroidParcelPrivate::writeFileDescriptor(int fd) const -{ - QAndroidJniExceptionCleaner cleaner; - handle.callMethod<void>("writeFileDescriptor", "(Ljava/io/FileDescriptor;)V", FileDescriptor(fd).handle.object()); -} - -QByteArray QAndroidParcelPrivate::readData() const -{ - QAndroidJniExceptionCleaner cleaner; - auto array = handle.callObjectMethod("createByteArray", "()[B"); - QAndroidJniEnvironment env; - auto sz = env->GetArrayLength(jbyteArray(array.object())); - QByteArray res(sz, Qt::Initialization::Uninitialized); - env->GetByteArrayRegion(jbyteArray(array.object()), 0, sz, reinterpret_cast<jbyte *>(res.data())); - return res; -} - -int QAndroidParcelPrivate::readFileDescriptor() const -{ - QAndroidJniExceptionCleaner cleaner; - auto parcelFD = handle.callObjectMethod("readFileDescriptor", "()Landroid/os/ParcelFileDescriptor;"); - if (parcelFD.isValid()) - return parcelFD.callMethod<jint>("getFd", "()I"); - return -1; -} - -QAndroidBinder QAndroidParcelPrivate::readBinder() const -{ - QAndroidJniExceptionCleaner cleaner; - auto strongBinder = handle.callObjectMethod("readStrongBinder", "()Landroid/os/IBinder;"); - return QAndroidBinder(strongBinder.object()); -} - -/*! - \class QAndroidParcel - \inmodule QtAndroidExtras - \brief Wraps the most important methods of Android Parcel class. - - The QAndroidParcel is a convenience class that wraps the most important - \l {https://developer.android.com/reference/android/os/Parcel.html}{Android Parcel} - methods. - - \since 5.10 -*/ - -/*! - Creates a new object. - */ -QAndroidParcel::QAndroidParcel() - : d(new QAndroidParcelPrivate()) -{ -} - -/*! - Wraps the \a parcel object. - */ -QAndroidParcel::QAndroidParcel(const QAndroidJniObject& parcel) - : d(new QAndroidParcelPrivate(parcel)) -{ - -} - -QAndroidParcel::~QAndroidParcel() -{ -} - -/*! - Writes the provided \a data as a byte array - */ -void QAndroidParcel::writeData(const QByteArray &data) const -{ - d->writeData(data); -} - -/*! - Writes the provided \a value. The value is converted into a - QByteArray before is written. - */ -void QAndroidParcel::writeVariant(const QVariant &value) const -{ - QByteArray buff; - QDataStream stream(&buff, QIODevice::WriteOnly); - stream << value; - d->writeData(buff); -} - -/*! - Writes a \a binder object. This is useful for a client to - send to a server a binder which can be used by the server callback the client. - */ -void QAndroidParcel::writeBinder(const QAndroidBinder &binder) const -{ - d->writeBinder(binder); -} - -/*! - Writes the provided \a fd. - */ -void QAndroidParcel::writeFileDescriptor(int fd) const -{ - d->writeFileDescriptor(fd); -} - -/*! - Returns the data as a QByteArray - */ -QByteArray QAndroidParcel::readData() const -{ - return d->readData(); -} - -/*! - Returns the data as a QVariant - */ -QVariant QAndroidParcel::readVariant() const -{ - QDataStream stream(d->readData()); - QVariant res; - stream >> res; - return res; -} - -/*! - Returns the binder as a QAndroidBinder - */ -QAndroidBinder QAndroidParcel::readBinder() const -{ - return d->readBinder(); -} - -/*! - Returns the file descriptor - */ -int QAndroidParcel::readFileDescriptor() const -{ - return d->readFileDescriptor(); -} - -/*! - The return value is useful to call other Java API which are not covered by this wrapper - */ -QAndroidJniObject QAndroidParcel::handle() const -{ - return d->handle; -} - -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidparcel.h b/src/androidextras/android/qandroidparcel.h deleted file mode 100644 index 23d1edc..0000000 --- a/src/androidextras/android/qandroidparcel.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDPARCEL_H -#define QANDROIDPARCEL_H - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QSharedPointer> -#include <QVariant> - -QT_BEGIN_NAMESPACE -class QAndroidBinder; -class QAndroidJniObject; -class QAndroidParcelPrivate; -class Q_ANDROIDEXTRAS_EXPORT QAndroidParcel -{ -public: - QAndroidParcel(); - explicit QAndroidParcel(const QAndroidJniObject& parcel); - virtual ~QAndroidParcel(); - - void writeData(const QByteArray &data) const; - void writeVariant(const QVariant &value) const; - void writeBinder(const QAndroidBinder &binder) const; - void writeFileDescriptor(int fd) const; - - QByteArray readData() const; - QVariant readVariant() const; - QAndroidBinder readBinder() const; - int readFileDescriptor() const; - - QAndroidJniObject handle() const; - -private: - friend class QAndroidParcelPrivate; - friend class QAndroidBinder; - QSharedPointer<QAndroidParcelPrivate> d; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDPARCEL_H diff --git a/src/androidextras/android/qandroidparcel_p.h b/src/androidextras/android/qandroidparcel_p.h deleted file mode 100644 index 0be55f8..0000000 --- a/src/androidextras/android/qandroidparcel_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDPARCEL_P_H -#define QANDROIDPARCEL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QAndroidJniObject> -QT_BEGIN_NAMESPACE -class QAndroidBinder; -class QAndroidParcelPrivate -{ -public: - QAndroidParcelPrivate(); - explicit QAndroidParcelPrivate(const QAndroidJniObject& parcel); - - void writeData(const QByteArray &data) const; - void writeBinder(const QAndroidBinder &binder) const; - void writeFileDescriptor(int fd) const; - - QByteArray readData() const; - int readFileDescriptor() const; - QAndroidBinder readBinder() const; - -private: - friend class QAndroidBinder; - friend class QAndroidParcel; - QAndroidJniObject handle; -}; -QT_END_NAMESPACE - -#endif // QANDROIDPARCEL_P_H diff --git a/src/androidextras/android/qandroidservice.cpp b/src/androidextras/android/qandroidservice.cpp deleted file mode 100644 index 331f04a..0000000 --- a/src/androidextras/android/qandroidservice.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidservice.h" - -#include "qandroidintent.h" -#include "qandroidbinder.h" -#include "qandroidbinder_p.h" - -#include <private/qjnihelpers_p.h> - -#include <QMutex> -#include <QTimer> -#include <QSet> - -QT_BEGIN_NAMESPACE - -class QAndroidServicePrivate : public QObject, public QtAndroidPrivate::OnBindListener -{ -public: - QAndroidServicePrivate(QAndroidService *service, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder = {}) - : m_service(service) - , m_binder(binder) - { - QTimer::singleShot(0,this, [this]{ QtAndroidPrivate::setOnBindListener(this);}); - } - - ~QAndroidServicePrivate() - { - QMutexLocker lock(&m_bindersMutex); - while (!m_binders.empty()) { - auto it = m_binders.begin(); - lock.unlock(); - delete (*it); - lock.relock(); - } - } - - // OnBindListener interface - jobject onBind(jobject intent) override - { - auto qai = QAndroidIntent(intent); - auto binder = m_binder ? m_binder(qai) : m_service->onBind(qai); - if (binder) { - { - QMutexLocker lock(&m_bindersMutex); - binder->d->setDeleteListener([this, binder]{binderDestroied(binder);}); - m_binders.insert(binder); - } - return binder->handle().object(); - } - return nullptr; - } - -private: - void binderDestroied(QAndroidBinder* obj) - { - QMutexLocker lock(&m_bindersMutex); - m_binders.remove(obj); - } - -public: - QAndroidService *m_service = nullptr; - std::function<QAndroidBinder *(const QAndroidIntent &)> m_binder; - QMutex m_bindersMutex; - QSet<QAndroidBinder*> m_binders; -}; - -/*! - \class QAndroidService - \inmodule QtAndroidExtras - \brief Wraps the most important methods of Android Service class. - - The QAndroidService is a convenience class that wraps the most important - \l {https://developer.android.com/reference/android/app/Service.html}{Android Service} - methods. - - \since 5.10 -*/ - - -/*! - \fn QAndroidService::QAndroidService(int &argc, char **argv) - - Creates a new Android service, passing \a argc and \a argv as parameters. - - //! Parameter \a flags is omitted in the documentation. - - \sa QCoreApplication - */ -QAndroidService::QAndroidService(int &argc, char **argv, int flags) - : QCoreApplication (argc, argv, QtAndroidPrivate::acuqireServiceSetup(flags)) - , d(new QAndroidServicePrivate{this}) -{ -} - -/*! - \fn QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder) - - Creates a new Android service, passing \a argc and \a argv as parameters. - - \a binder is used to create a \l {QAndroidBinder}{binder} when needed. - - //! Parameter \a flags is omitted in the documentation. - - \sa QCoreApplication - */ -QAndroidService::QAndroidService(int &argc, char **argv, const std::function<QAndroidBinder *(const QAndroidIntent &)> &binder, int flags) - : QCoreApplication (argc, argv, QtAndroidPrivate::acuqireServiceSetup(flags)) - , d(new QAndroidServicePrivate{this, binder}) -{ -} - -QAndroidService::~QAndroidService() -{} - -/*! - The user must override this method and to return a binder. - - The \a intent parameter contains all the caller information. - - The returned binder is used by the caller to perform IPC calls. - - \warning This method is called from Binder's thread which is different - from the thread that this object was created. - - \sa QAndroidBinder::onTransact, QAndroidBinder::transact - */ -QAndroidBinder* QAndroidService::onBind(const QAndroidIntent &/*intent*/) -{ - return nullptr; -} - -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidservice.h b/src/androidextras/android/qandroidservice.h deleted file mode 100644 index b9acd18..0000000 --- a/src/androidextras/android/qandroidservice.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDSERVICE_H -#define QANDROIDSERVICE_H - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QCoreApplication> -#include <QSharedPointer> -#include <functional> - -QT_BEGIN_NAMESPACE -class QAndroidServicePrivate; -class QAndroidIntent; -class QAndroidBinder; -class Q_ANDROIDEXTRAS_EXPORT QAndroidService : public QCoreApplication -{ - Q_OBJECT - -public: - QAndroidService(int &argc, char **argv -#ifndef Q_QDOC - , int flags = ApplicationFlags -#endif - ); - QAndroidService(int &argc, char **argv, - const std::function<QAndroidBinder*(const QAndroidIntent &intent)> & binder -#ifndef Q_QDOC - , int flags = ApplicationFlags -#endif - ); - virtual ~QAndroidService(); - - virtual QAndroidBinder* onBind(const QAndroidIntent &intent); - -private: - friend class QAndroidServicePrivate; - Q_DISABLE_COPY(QAndroidService) - - QScopedPointer<QAndroidServicePrivate> d; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDSERVICE_H diff --git a/src/androidextras/android/qandroidserviceconnection.cpp b/src/androidextras/android/qandroidserviceconnection.cpp deleted file mode 100644 index 3daf1cc..0000000 --- a/src/androidextras/android/qandroidserviceconnection.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidserviceconnection.h" -#include "qandroidjniobject.h" - -#include <QAndroidJniEnvironment> - -QT_BEGIN_NAMESPACE -/*! - \class QAndroidServiceConnection - \inmodule QtAndroidExtras - \brief Wraps the most important methods of Android ServiceConnection class. - - The QAndroidServiceConnection is a convenience abstract class which wraps the - \l {https://developer.android.com/reference/android/content/ServiceConnection.html}{Android ServiceConnection} - interface. - - It is useful when you perform a QtAndroid::bindService operation. - - \since 5.10 -*/ - - -/*! - Creates a new object - */ -QAndroidServiceConnection::QAndroidServiceConnection() - : m_handle("org/qtproject/qt/android/extras/QtAndroidServiceConnection", "(J)V", jlong(this)) -{ -} - -/*! - Creates a new object from an existing \a serviceConnection. - - It's useful when you have your own Java implementation. - Of course onServiceConnected()/onServiceDisconnected() - will not be called anymore. - */ -QAndroidServiceConnection::QAndroidServiceConnection(const QAndroidJniObject &serviceConnection) - : m_handle(serviceConnection) -{ -} - -QAndroidServiceConnection::~QAndroidServiceConnection() -{ - m_handle.callMethod<void>("setId", "(J)V", jlong(this)); -} - -/*! - returns the underline QAndroidJniObject - */ -QAndroidJniObject QAndroidServiceConnection::handle() const -{ - return m_handle; -} - -/*! - \fn void QAndroidServiceConnection::onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder) - - This notification is called when the client managed to connect to the service. - The \a name contains the server name, the \a serviceBinder is the binder that the client - uses to perform IPC operations. - - \warning This method is called from Binder's thread which is different - from the thread that this object was created. - - returns the underline QAndroidJniObject - */ - -/*! - \fn void QAndroidServiceConnection::onServiceDisconnected(const QString &name) - - Called when a connection to the Service has been lost. - The \a name parameter specifies which connectioen was lost. - - \warning This method is called from Binder's thread which is different - from the thread that this object was created. - - returns the underline QAndroidJniObject - */ - -QT_END_NAMESPACE diff --git a/src/androidextras/android/qandroidserviceconnection.h b/src/androidextras/android/qandroidserviceconnection.h deleted file mode 100644 index a46c7bb..0000000 --- a/src/androidextras/android/qandroidserviceconnection.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTANDROIDSERVICECONNECTION_H -#define QTANDROIDSERVICECONNECTION_H - -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QtAndroidExtras/QAndroidJniObject> - -QT_BEGIN_NAMESPACE -class QAndroidBinder; -class Q_ANDROIDEXTRAS_EXPORT QAndroidServiceConnection -{ -public: - QAndroidServiceConnection(); - explicit QAndroidServiceConnection(const QAndroidJniObject &serviceConnection); - virtual ~QAndroidServiceConnection(); - - virtual void onServiceConnected(const QString &name, const QAndroidBinder &serviceBinder) = 0; - virtual void onServiceDisconnected(const QString &name) = 0; - - QAndroidJniObject handle() const; -private: - Q_DISABLE_COPY(QAndroidServiceConnection) - QAndroidJniObject m_handle; -}; - -QT_END_NAMESPACE - -#endif // QTANDROIDSERVICECONNECTION_H diff --git a/src/androidextras/android/qjnionload.cpp b/src/androidextras/android/qjnionload.cpp deleted file mode 100644 index 3a7ccc2..0000000 --- a/src/androidextras/android/qjnionload.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidbinder.h" -#include "qandroidparcel.h" -#include "qandroidserviceconnection.h" - -#include <android/log.h> -#include <QAndroidJniObject> -#include <jni.h> - -static jboolean onTransact(JNIEnv */*env*/, jclass /*cls*/, jlong id, jint code, jobject data, jobject reply, jint flags) -{ - if (!id) - return false; - return reinterpret_cast<QAndroidBinder*>(id)->onTransact(code, QAndroidParcel(data), QAndroidParcel(reply), QAndroidBinder::CallType(flags)); -} - -static void onServiceConnected(JNIEnv */*env*/, jclass /*cls*/, jlong id, jstring name, jobject service) -{ - if (!id) - return; - return reinterpret_cast<QAndroidServiceConnection *>(id)->onServiceConnected(QAndroidJniObject(name).toString(), - QAndroidBinder(service)); -} - -static void onServiceDisconnected(JNIEnv */*env*/, jclass /*cls*/, jlong id, jstring name) -{ - if (!id) - return; - return reinterpret_cast<QAndroidServiceConnection *>(id)->onServiceDisconnected(QAndroidJniObject(name).toString()); -} - -static JNINativeMethod methods[] = { - {"onTransact", "(JILandroid/os/Parcel;Landroid/os/Parcel;I)Z", (void *)onTransact}, - {"onServiceConnected", "(JLjava/lang/String;Landroid/os/IBinder;)V", (void *)onServiceConnected}, - {"onServiceDisconnected", "(JLjava/lang/String;)V", (void *)onServiceDisconnected} -}; - - -JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* /*reserved*/) -{ - static bool initialized = false; - if (initialized) - return JNI_VERSION_1_6; - initialized = true; - - typedef union { - JNIEnv *nativeEnvironment; - void *venv; - } UnionJNIEnvToVoid; - - UnionJNIEnvToVoid uenv; - uenv.venv = nullptr; - - if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) { - __android_log_print(ANDROID_LOG_FATAL, "Qt", "GetEnv failed"); - return -1; - } - - JNIEnv *env = uenv.nativeEnvironment; - jclass clazz; - clazz = env->FindClass("org/qtproject/qt/android/extras/QtNative"); - if (!clazz) { - __android_log_print(ANDROID_LOG_FATAL,"Qt", "Can't find \"org/qtproject/qt/android/extras/QtNative\" class"); - return -1; - } - - if (env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])) < 0) { - __android_log_print(ANDROID_LOG_FATAL,"Qt", "RegisterNatives failed"); - return -1; - } - - return JNI_VERSION_1_6; -} diff --git a/src/androidextras/doc/QtAndroidExtras/QAndroidJniObject b/src/androidextras/doc/QtAndroidExtras/QAndroidJniObject deleted file mode 100644 index b96916d..0000000 --- a/src/androidextras/doc/QtAndroidExtras/QAndroidJniObject +++ /dev/null @@ -1 +0,0 @@ -#include "qandroidjniobject.h" diff --git a/src/androidextras/doc/QtAndroidExtras/jni.h b/src/androidextras/doc/QtAndroidExtras/jni.h deleted file mode 100644 index 9013345..0000000 --- a/src/androidextras/doc/QtAndroidExtras/jni.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2018 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* Dummy declarations passed to clang when generating the docs */ - -#ifndef JNI_H -#define JNI_H - -struct JNIEnv_; -struct JavaVM_; -typedef JNIEnv_ JNIEnv; -typedef JavaVM_ JavaVM; -typedef int jclass; -typedef char jobject; - -#endif diff --git a/src/androidextras/doc/QtAndroidExtras/qandroidextrasglobal.h b/src/androidextras/doc/QtAndroidExtras/qandroidextrasglobal.h deleted file mode 100644 index 9000f4e..0000000 --- a/src/androidextras/doc/QtAndroidExtras/qandroidextrasglobal.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "../../qandroidextrasglobal.h" -#include "QtCore/qvariant.h" diff --git a/src/androidextras/doc/QtAndroidExtras/qandroidjniobject.h b/src/androidextras/doc/QtAndroidExtras/qandroidjniobject.h deleted file mode 100644 index 7f58978..0000000 --- a/src/androidextras/doc/QtAndroidExtras/qandroidjniobject.h +++ /dev/null @@ -1 +0,0 @@ -#include "../../jni/qandroidjniobject.h" diff --git a/src/androidextras/doc/QtAndroidExtrasDoc b/src/androidextras/doc/QtAndroidExtrasDoc deleted file mode 100644 index 2294259..0000000 --- a/src/androidextras/doc/QtAndroidExtrasDoc +++ /dev/null @@ -1,10 +0,0 @@ -#include "qandroidextrasglobal.h" -#include "qandroidactivityresultreceiver.h" -#include "qandroidbinder.h" -#include "qandroidfunctions.h" -#include "qandroidintent.h" -#include "qandroidjnienvironment.h" -#include "qandroidjniobject.h" -#include "qandroidparcel.h" -#include "qandroidserviceconnection.h" -#include "qandroidservice.h" diff --git a/src/androidextras/doc/images/androidservices.png b/src/androidextras/doc/images/androidservices.png Binary files differdeleted file mode 100644 index 5c837f6..0000000 --- a/src/androidextras/doc/images/androidservices.png +++ /dev/null diff --git a/src/androidextras/doc/images/customactivity.png b/src/androidextras/doc/images/customactivity.png Binary files differdeleted file mode 100644 index 4b01a0a..0000000 --- a/src/androidextras/doc/images/customactivity.png +++ /dev/null diff --git a/src/androidextras/doc/images/jnimessenger.png b/src/androidextras/doc/images/jnimessenger.png Binary files differdeleted file mode 100644 index 1cb4efd..0000000 --- a/src/androidextras/doc/images/jnimessenger.png +++ /dev/null diff --git a/src/androidextras/doc/images/musiclist.png b/src/androidextras/doc/images/musiclist.png Binary files differdeleted file mode 100644 index cc37613..0000000 --- a/src/androidextras/doc/images/musiclist.png +++ /dev/null diff --git a/src/androidextras/doc/images/notification.png b/src/androidextras/doc/images/notification.png Binary files differdeleted file mode 100644 index 6d7dba6..0000000 --- a/src/androidextras/doc/images/notification.png +++ /dev/null diff --git a/src/androidextras/doc/qtandroidextras.qdocconf b/src/androidextras/doc/qtandroidextras.qdocconf deleted file mode 100644 index 4b9c77a..0000000 --- a/src/androidextras/doc/qtandroidextras.qdocconf +++ /dev/null @@ -1,52 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) -include($QT_INSTALL_DOCS/config/exampleurl-qtandroidextras.qdocconf) - -Cpp.ignoretokens += Q_ANDROIDEXTRAS_EXPORT -# dummy module header for clang, found under doc/ -moduleheader = QtAndroidExtrasDoc - -# pass include paths to clang -includepaths += -I . \ - -I .. \ - -I ../android \ - -I ../jni \ - -I ./QtAndroidExtras - -project = QtAndroidExtras -description = Qt Android Extras Reference Documentation -version = $QT_VERSION - -qhp.projects = QtAndroidExtras - -qhp.QtAndroidExtras.file = qtandroidextras.qhp -qhp.QtAndroidExtras.namespace = org.qt-project.qtandroidextras.$QT_VERSION_TAG -qhp.QtAndroidExtras.virtualFolder = qtandroidextras -qhp.QtAndroidExtras.indexTitle = Qt Android Extras -qhp.QtAndroidExtras.indexRoot = - -qhp.QtAndroidExtras.filterAttributes = qtandroidextras $QT_VERSION qtrefdoc -qhp.QtAndroidExtras.customFilters.Qt.name = QtAndroidExtras $QT_VERSION -qhp.QtAndroidExtras.customFilters.Qt.filterAttributes = qtandroidextras $QT_VERSION - -qhp.QtAndroidExtras.subprojects = classes examples -qhp.QtAndroidExtras.subprojects.classes.title = C++ Classes and Namespaces -qhp.QtAndroidExtras.subprojects.classes.indexTitle = Qt Android Extras C++ Classes -qhp.QtAndroidExtras.subprojects.classes.selectors = class function namespace fake:headerfile -qhp.QtAndroidExtras.subprojects.classes.sortPages = true -qhp.QtAndroidExtras.subprojects.examples.title = Examples -qhp.QtAndroidExtras.subprojects.examples.indexTitle = Qt Android Extras Examples -qhp.QtAndroidExtras.subprojects.examples.selectors = fake:example - -depends += qtcore qtdoc qtqml qtquick qtremoteobjects -headerdirs += .. -sourcedirs += .. -exampledirs += ../../../examples/androidextras \ - snippets -examples.fileextensions += *.java - -# Specify example install dir under QT_INSTALL_EXAMPLES -examplesinstallpath = androidextras - -imagedirs += images -navigation.landingpage = "Qt Android Extras" -navigation.cppclassespage = "Qt Android Extras C++ Classes" diff --git a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjnienvironment.cpp b/src/androidextras/doc/snippets/code/src_androidextras_qandroidjnienvironment.cpp deleted file mode 100644 index 1b404d5..0000000 --- a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjnienvironment.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2015 The Qt Company Ltd. - ** Contact: http://www.qt.io/licensing/ - ** - ** This file is part of the documentation of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** 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 The Qt Company. For licensing terms - ** and conditions see https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** BSD License Usage - ** Alternatively, 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 The Qt Company Ltd 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$ - ** - ****************************************************************************/ - -//! [Create QAndroidJniEnvironment] - -bool exceptionCheck() -{ - /* - The QAndroidJniEnvironment attaches the current thread to the JavaVM on - creation and detach when it goes out of scope. - */ - QAndroidJniEnvironment qjniEnv; - return qjniEnv->ExceptionCheck(); -} -//! [Create QAndroidJniEnvironment] diff --git a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp b/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp deleted file mode 100644 index 96ae1a9..0000000 --- a/src/androidextras/doc/snippets/code/src_androidextras_qandroidjniobject.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************** - ** - ** Copyright (C) 2015 The Qt Company Ltd. - ** Contact: http://www.qt.io/licensing/ - ** - ** This file is part of the documentation of the Qt Toolkit. - ** - ** $QT_BEGIN_LICENSE:BSD$ - ** 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 The Qt Company. For licensing terms - ** and conditions see https://www.qt.io/terms-conditions. For further - ** information use the contact form at https://www.qt.io/contact-us. - ** - ** BSD License Usage - ** Alternatively, 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 The Qt Company Ltd 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$ - ** - ****************************************************************************/ - -//! [Working with lists] -QStringList getTrackTitles(const QAndroidJniObject &album) { - QStringList stringList; - QAndroidJniObject list = album.callObjectMethod("getTitles", - "()Ljava/util/List;"); - - if (list.isValid()) { - const int size = list.callMethod<jint>("size"); - for (int i = 0; i < size; ++i) { - QAndroidJniObject title = list.callObjectMethod("get", "(I)Ljava/lang/Object;", i); - stringList.append(title.toString()); - } - } - return stringList; -} -//! [Working with lists] - -//! [QAndroidJniObject scope] -void functionScope() -{ - QString helloString("Hello"); - jstring myJString = 0; - { - QAndroidJniObject string = QAndroidJniObject::fromString(helloString); - myJString = string.object<jstring>(); - } - - // Ops! myJString is no longer valid. -} -//! [QAndroidJniObject scope] - -//! [Check for exceptions] -void functionException() -{ - QAndroidJniObject myString = QAndroidJniObject::fromString("Hello"); - jchar c = myString.callMethod<jchar>("charAt", "(I)C", 1000); - QAndroidJniEnvironment env; - if (env->ExceptionCheck()) { - // Handle exception here. - env->ExceptionClear(); - } -} -//! [Check for exceptions] - -//! [Registering native methods] -static void fromJavaOne(JNIEnv *env, jobject thiz, jint x) -{ - Q_UNUSED(env); - Q_UNUSED(thiz); - qDebug() << x << "< 100"; -} - -static void fromJavaTwo(JNIEnv *env, jobject thiz, jint x) -{ - Q_UNUSED(env); - Q_UNUSED(thiz); - qDebug() << x << ">= 100"; -} - -void registerNativeMethods() { - JNINativeMethod methods[] {{"callNativeOne", "(I)V", reinterpret_cast<void *>(fromJavaOne)}, - {"callNativeTwo", "(I)V", reinterpret_cast<void *>(fromJavaTwo)}}; - - QAndroidJniObject javaClass("my/java/project/FooJavaClass"); - QAndroidJniEnvironment env; - jclass objectClass = env->GetObjectClass(javaClass.object<jobject>()); - env->RegisterNatives(objectClass, - methods, - sizeof(methods) / sizeof(methods[0])); - env->DeleteLocalRef(objectClass); -} - -void foo() -{ - QAndroidJniObject::callStaticMethod<void>("my/java/project/FooJavaClass", "foo", "(I)V", 10); // Output: 10 < 100 - QAndroidJniObject::callStaticMethod<void>("my/java/project/FooJavaClass", "foo", "(I)V", 100); // Output: 100 >= 100 -} - -//! [Registering native methods] - -//! [Java native methods] -class FooJavaClass -{ - public static void foo(int x) - { - if (x < 100) - callNativeOne(x); - else - callNativeTwo(x); - } - -private static native void callNativeOne(int x); -private static native void callNativeTwo(int x); - -} -//! [Java native methods] diff --git a/src/androidextras/doc/src/external-resources.qdoc b/src/androidextras/doc/src/external-resources.qdoc deleted file mode 100644 index b27f97b..0000000 --- a/src/androidextras/doc/src/external-resources.qdoc +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2020 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtAndroidExtras module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** BSD License Usage -** Alternatively, 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 The Qt Company Ltd 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$ -** -****************************************************************************/ - -/*! - \externalpage https://developer.android.com/reference/android/app/Service#onStartCommand(android.content.Intent,%20int,%20int) - \title Android: Service onStartCommand -*/ - -/*! - \externalpage https://developer.android.com/reference/android/content/Context#startService(android.content.Intent) - \title Android: Service startService -*/ - -/*! - \externalpage https://developer.android.com/reference/android/content/BroadcastReceiver - \title Android: BroadcastReceiver -*/ diff --git a/src/androidextras/doc/src/qtandroidextras-examples.qdoc b/src/androidextras/doc/src/qtandroidextras-examples.qdoc deleted file mode 100644 index 3daf5c9..0000000 --- a/src/androidextras/doc/src/qtandroidextras-examples.qdoc +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ -/*! - \group examples-qtandroidextras - \title Qt Android Extras Examples - \brief Examples in the Qt Android Extras module. - \ingroup all-examples - - These are the examples available in the \l{Qt Android Extras} module. - - \note These examples will only work on Android. -*/ diff --git a/src/androidextras/doc/src/qtandroidextras-index.qdoc b/src/androidextras/doc/src/qtandroidextras-index.qdoc deleted file mode 100644 index 708df6d..0000000 --- a/src/androidextras/doc/src/qtandroidextras-index.qdoc +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \page qtandroidextras-index.html - \title Qt Android Extras - - \brief The Qt Android Extras module contains adittional functionality to aid development on Android. - - \section1 Getting Started - - To include the definitions of the module's classes, use the - following directive: - - \code - #include <QtAndroidExtras> - \endcode - - To link against the Qt Android Extras module, add this line to your project file: - - \code - QT += androidextras - \endcode - - \section1 API Reference - - Links to the API reference materials: - \list - \li \l{Qt Android Extras C++ Classes}{C++ Classes and Namespaces} - \endlist - - \section1 Examples - - \list - \li \l{Qt Android Extras Examples} - \endlist -*/ diff --git a/src/androidextras/doc/src/qtandroidextras-module.qdoc b/src/androidextras/doc/src/qtandroidextras-module.qdoc deleted file mode 100644 index 335d39d..0000000 --- a/src/androidextras/doc/src/qtandroidextras-module.qdoc +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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: https://www.gnu.org/licenses/fdl-1.3.html. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/*! - \module QtAndroidExtras - \title Qt Android Extras C++ Classes - \brief The Qt Android Extras module contains additional functionality for development on Android. - - \ingroup modules - \qtcmakepackage AndroidExtras - \qtvariable androidextras - - To include the definitions of the module's classes, use the - following directive: - - \code - #include <QtAndroidExtras> - \endcode - - To link against the Qt Android Extras module, add this line to your project file: - - \code - QT += androidextras - \endcode -*/ diff --git a/src/androidextras/jni/qandroidjnienvironment.cpp b/src/androidextras/jni/qandroidjnienvironment.cpp deleted file mode 100644 index 70fd3e0..0000000 --- a/src/androidextras/jni/qandroidjnienvironment.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidjnienvironment.h" -#include <QtCore/private/qjni_p.h> -#include <QtCore/private/qjnihelpers_p.h> -#include <QtCore/qthreadstorage.h> - -QT_BEGIN_NAMESPACE - -/*! - \class QAndroidJniEnvironment - \inmodule QtAndroidExtras - \brief The QAndroidJniEnvironment provides access to the JNI Environment. - \since 5.2 -*/ - -/*! - \fn QAndroidJniEnvironment::QAndroidJniEnvironment() - - Constructs a new QAndroidJniEnvironment object and attach the current thread to the Java VM. - - \snippet code/src_androidextras_qandroidjnienvironment.cpp Create QAndroidJniEnvironment -*/ - -/*! - \fn QAndroidJniEnvironment::~QAndroidJniEnvironment() - - Detaches the current thread from the Java VM and destroys the QAndroidJniEnvironment object. -*/ - -/*! - \fn JavaVM *QAndroidJniEnvironment::javaVM() - - Returns the Java VM interface. -*/ - -/*! - \fn JNIEnv *QAndroidJniEnvironment::operator->() - - Provides access to the QAndroidJniEnvironment's JNIEnv pointer. -*/ - -/*! - \fn QAndroidJniEnvironment::operator JNIEnv *() const - - Returns the JNI Environment pointer. - */ - -/*! - \fn jclass QAndroidJniEnvironment::findClass(const char *className) - - Searches for \a className using all available class loaders. Qt on Android - uses a custom class loader to load all the .jar files and it must be used - to find any classes that are created by that class loader because these - classes are not visible in the default class loader. - - Returns the class pointer or null if is not found. - - A use case for this function is searching for a custom class then calling - its memeber method. The following code snippet create an instance of the - class \c CustomClass and then calls \c printFromJava() method: - - \code - QAndroidJniEnvironment env; - jclass javaClass = env.findClass("org/qtproject/example/qtandroidextras/CustomClass"); - QAndroidJniObject classObject(javaClass); - - QAndroidJniObject javaMessage = QAndroidJniObject::fromString("findClass example"); - classObject.callMethod<void>("printFromJava", - "(Ljava/lang/String;)V", - javaMessage.object<jstring>()); - \endcode - - \since Qt 5.12 - */ - - -QAndroidJniEnvironment::QAndroidJniEnvironment() - : d(new QJNIEnvironmentPrivate) -{ -} - -QAndroidJniEnvironment::~QAndroidJniEnvironment() -{ -} - -JavaVM *QAndroidJniEnvironment::javaVM() -{ - return QtAndroidPrivate::javaVM(); -} - -JNIEnv *QAndroidJniEnvironment::operator->() -{ - return d->jniEnv; -} - -QAndroidJniEnvironment::operator JNIEnv*() const -{ - return d->jniEnv; -} - -jclass QAndroidJniEnvironment::findClass(const char *className) -{ - return QJNIEnvironmentPrivate::findClass(className, d->jniEnv); -} - -static void clearException(bool silent) -{ - QAndroidJniEnvironment env; - if (Q_UNLIKELY(env->ExceptionCheck())) { - if (!silent) - env->ExceptionDescribe(); - env->ExceptionClear(); - } -} - -/*! - \class QAndroidJniExceptionCleaner - \inmodule QtAndroidExtras - \brief Cleans pending JNI exceptions. - - The QAndroidJniExceptionCleaner is a convenience class useful to clean - the pending JNI exceptions from the current scope. - - \since 5.10 -*/ - -/*! - \enum QAndroidJniExceptionCleaner::OutputMode - - \value Silent the exceptions are cleaned silently - \value Verbose discribes the exceptions before cleaning them -*/ - -/*! - \fn QAndroidJniExceptionCleaner::QAndroidJniExceptionCleaner(OutputMode outputMode = OutputMode::Silent) - - Cleans any pending exceptions either silently or with descriptions, depending on the \a outputMode. - */ -QAndroidJniExceptionCleaner::QAndroidJniExceptionCleaner(QAndroidJniExceptionCleaner::OutputMode outputMode) - : m_outputMode(outputMode) -{ - clearException(outputMode == OutputMode::Silent); -} - -/*! - \fn QAndroidJniExceptionCleaner::~QAndroidJniExceptionCleaner() - - Clean any pending exceptions. - */ -QAndroidJniExceptionCleaner::~QAndroidJniExceptionCleaner() -{ - clearException(m_outputMode == OutputMode::Silent); -} - -/*! - \fn void QAndroidJniExceptionCleaner::clean() - - Manually cleans any pending exceptions - */ -void QAndroidJniExceptionCleaner::clean() -{ - clearException(m_outputMode == OutputMode::Silent); -} - -QT_END_NAMESPACE diff --git a/src/androidextras/jni/qandroidjnienvironment.h b/src/androidextras/jni/qandroidjnienvironment.h deleted file mode 100644 index 46d443d..0000000 --- a/src/androidextras/jni/qandroidjnienvironment.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDJNIENVIRONMENT_H -#define QANDROIDJNIENVIRONMENT_H - -#include <jni.h> -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QtCore/qglobal.h> -#include <QtCore/qscopedpointer.h> - -QT_BEGIN_NAMESPACE - -class QJNIEnvironmentPrivate; - -class Q_ANDROIDEXTRAS_EXPORT QAndroidJniEnvironment -{ -public: - QAndroidJniEnvironment(); - ~QAndroidJniEnvironment(); - static JavaVM *javaVM(); - JNIEnv *operator->(); - operator JNIEnv*() const; - jclass findClass(const char *className); - -private: - Q_DISABLE_COPY(QAndroidJniEnvironment) - QScopedPointer<QJNIEnvironmentPrivate> d; -}; - -class Q_ANDROIDEXTRAS_EXPORT QAndroidJniExceptionCleaner -{ -public: - enum class OutputMode { - Silent, - Verbose - }; - -public: - explicit QAndroidJniExceptionCleaner(OutputMode outputMode = OutputMode::Silent); - ~QAndroidJniExceptionCleaner(); - - void clean(); -private: - OutputMode m_outputMode; -}; - -QT_END_NAMESPACE - -#endif // QANDROIDJNIENVIRONMENT_H diff --git a/src/androidextras/jni/qandroidjniobject.cpp b/src/androidextras/jni/qandroidjniobject.cpp deleted file mode 100644 index 4f00494..0000000 --- a/src/androidextras/jni/qandroidjniobject.cpp +++ /dev/null @@ -1,2507 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qandroidjniobject.h" -#include <QtCore/private/qjni_p.h> -#include <QtCore/qhash.h> - -QT_BEGIN_NAMESPACE - -/*! - \class QAndroidJniObject - \inmodule QtAndroidExtras - \brief Provides APIs to call Java code from C++. - \since 5.2 - - \sa QAndroidJniEnvironment - - \section1 General Notes - - \list - \li Class names needs to contain the fully-qualified class name, for example: \b"java/lang/String". - \li Method signatures are written as \b"(Arguments)ReturnType" - \li All object types are returned as a QAndroidJniObject. - \endlist - - \section1 Method Signatures - - For functions that take no arguments, QAndroidJniObject provides convenience functions that will use - the correct signature based on the provided template type. For example: - - \code - jint x = QAndroidJniObject::callMethod<jint>("getSize"); - QAndroidJniObject::callMethod<void>("touch"); - \endcode - - In other cases you will need to supply the signature yourself, and it is important that the - signature matches the function you want to call. The signature structure is \b \(A\)R, where \b A - is the type of the argument\(s\) and \b R is the return type. Array types in the signature must - have the \b\[ suffix and the fully-qualified type names must have the \b L prefix and \b ; suffix. - - The example below demonstrates how to call two different static functions. - \code - // Java class - package org.qtproject.qt; - class TestClass - { - static String fromNumber(int x) { ... } - static String[] stringArray(String s1, String s2) { ... } - } - \endcode - - The signature for the first function is \b"\(I\)Ljava/lang/String;" - - \code - // C++ code - QAndroidJniObject stringNumber = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt/TestClass", - "fromNumber" - "(I)Ljava/lang/String;", - 10); - \endcode - - and the signature for the second function is \b"\(Ljava/lang/String;Ljava/lang/String;\)\[Ljava/lang/String;" - - \code - // C++ code - QAndroidJniObject string1 = QAndroidJniObject::fromString("String1"); - QAndroidJniObject string2 = QAndroidJniObject::fromString("String2"); - QAndroidJniObject stringArray = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt/TestClass", - "stringArray" - "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;" - string1.object<jstring>(), - string2.object<jstring>()); - \endcode - - - \section1 Handling Java Exception - - When calling Java functions that might throw an exception, it is important that you check, handle - and clear out the exception before continuing. - - \note It is unsafe to make a JNI call when there are exceptions pending. - - \snippet code/src_androidextras_qandroidjniobject.cpp Check for exceptions - - \section1 Java Native Methods - - Java native methods makes it possible to call native code from Java, this is done by creating a - function declaration in Java and prefixing it with the \b native keyword. - Before a native function can be called from Java, you need to map the Java native function to a - native function in your code. Mapping functions can be done by calling the RegisterNatives() function - through the \l{QAndroidJniEnvironment}{JNI environment pointer}. - - The example below demonstrates how this could be done. - - Java implementation: - \snippet code/src_androidextras_qandroidjniobject.cpp Java native methods - - C++ Implementation: - \snippet code/src_androidextras_qandroidjniobject.cpp Registering native methods - - \section1 The Lifetime of a Java Object - - Most \l{Object types}{objects} received from Java will be local references and will only stay valid - in the scope you received them. After that, the object becomes eligible for garbage collection. If you - want to keep a Java object alive you need to either create a new global reference to the object and - release it when you are done, or construct a new QAndroidJniObject and let it manage the lifetime of the Java object. - \sa object() - - \note The QAndroidJniObject does only manage its own references, if you construct a QAndroidJniObject from a - global or local reference that reference will not be released by the QAndroidJniObject. - - \section1 JNI Types - - \section2 Object Types - \table - \header - \li Type - \li Signature - \row - \li jobject - \li Ljava/lang/Object; - \row - \li jclass - \li Ljava/lang/Class; - \row - \li jstring - \li Ljava/lang/String; - \row - \li jthrowable - \li Ljava/lang/Throwable; - \row - \li jobjectArray - \li [Ljava/lang/Object; - \row - \li jarray - \li [\e<type> - \row - \li jbooleanArray - \li [Z - \row - \li jbyteArray - \li [B - \row - \li jcharArray - \li [C - \row - \li jshortArray - \li [S - \row - \li jintArray - \li [I - \row - \li jlongArray - \li [J - \row - \li jfloatArray - \li [F - \row - \li jdoubleArray - \li [D - \endtable - - - \section2 Primitive Types - \table - \header - \li Type - \li Signature - \row - \li jboolean - \li Z - \row - \li jbyte - \li B - \row - \li jchar - \li C - \row - \li jshort - \li S - \row - \li jint - \li I - \row - \li jlong - \li J - \row - \li jfloat - \li F - \row - \li jdouble - \li D - \endtable - - \section3 Other - \table - \header - \li Type - \li Signature - \row - \li void - \li V - \row - \li \e{Custom type} - \li L\e<fully-qualified-name>; - \endtable - - For more information about JNI see: \l http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/jniTOC.html -*/ - -/*! - \fn QAndroidJniObject::QAndroidJniObject() - - Constructs an invalid QAndroidJniObject. - - \sa isValid() -*/ - -/*! - \fn QAndroidJniObject::QAndroidJniObject(const char *className) - - Constructs a new QAndroidJniObject by calling the default constructor of \a className. - - \code - - ... - QAndroidJniObject myJavaString("java/lang/String"); - ... - - \endcode -*/ - -/*! - \fn QAndroidJniObject::QAndroidJniObject(const char *className, const char *signature, ...) - - Constructs a new QAndroidJniObject by calling the constructor of \a className with \a signature - and arguments. - - \code - - ... - jstring myJStringArg = ...; - QAndroidJniObject myNewJavaString("java/lang/String", "(Ljava/lang/String;)V", myJStringArg); - ... - - \endcode -*/ - -/*! - \fn QAndroidJniObject::QAndroidJniObject(jclass clazz) - - Constructs a new QAndroidJniObject by calling the default constructor of \a clazz. - - Note: The QAndroidJniObject will create a new reference to the class \a clazz - and releases it again when it is destroyed. References to the class created - outside the QAndroidJniObject needs to be managed by the caller. - -*/ - -/*! - \fn QAndroidJniObject::QAndroidJniObject(jclass clazz, const char *signature, ...) - - Constructs a new QAndroidJniObject from \a clazz by calling the constructor with \a signature - and arguments. - - \code - jclass myClazz = ...; - QAndroidJniObject::QAndroidJniObject(myClazz, "(I)V", 3); - \endcode -*/ - -/*! - \fn QAndroidJniObject::QAndroidJniObject(jobject object) - - Constructs a new QAndroidJniObject around the Java object \a object. - - Note: The QAndroidJniObject will hold a reference to the Java object \a object - and release it when destroyed. Any references to the Java object \a object - outside QAndroidJniObject needs to be managed by the caller. - - \sa fromLocalRef() -*/ - -/*! - Destroys the QAndroidJniObject and releases any references held by the QAndroidJniObject. -*/ -QAndroidJniObject::~QAndroidJniObject() -{ - // must be empty until ### Qt 6 -} - -/*! - \fn template <typename T> T QAndroidJniObject::callMethod(const char *methodName, const char *sig, ...) const - - Calls the method \a methodName with a signature \a sig and returns the value. - - \code - QAndroidJniObject myJavaString = ...; - jint index = myJavaString.callMethod<jint>("indexOf", "(I)I", 0x0051); - \endcode - -*/ - -/*! - \fn template <typename T> T QAndroidJniObject::callMethod(const char *methodName) const - - Calls the method \a methodName and returns the value. - - \code - QAndroidJniObject myJavaString = ...; - jint size = myJavaString.callMethod<jint>("length"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::callObjectMethod(const char *methodName) const - - Calls the Java objects method \a methodName and returns a new QAndroidJniObject for - the returned Java object. - - \code - ... - QAndroidJniObject myJavaString1 = ...; - QAndroidJniObject myJavaString2 = myJavaString1.callObjectMethod<jstring>("toString"); - ... - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::callObjectMethod(const char *methodName, const char *signature, ...) const - - Calls the Java object's method \a methodName with the signature \a signature and arguments - - \code - QAndroidJniObject myJavaString; ==> "Hello, Java" - QAndroidJniObject mySubstring = myJavaString.callObjectMethod("substring", "(II)Ljava/lang/String;", 7, 10); - \endcode -*/ - -/*! - \fn template <typename T> T QAndroidJniObject::callStaticMethod(jclass clazz, const char *methodName) - - Calls the static method \a methodName on \a clazz and returns the value. - - \code - ... - jclass javaMathClass = ...; // ("java/lang/Math") - jdouble randNr = QAndroidJniObject::callStaticMethod<jdouble>(javaMathClass, "random"); - ... - \endcode -*/ - -/*! - \fn template <typename T> T QAndroidJniObject::callStaticMethod(const char *className, const char *methodName) - - Calls the static method \a methodName on class \a className and returns the value. - - \code - jint value = QAndroidJniObject::callStaticMethod<jint>("MyClass", "staticMethod"); - \endcode -*/ - -/*! - \fn template <typename T> T QAndroidJniObject::callStaticMethod(const char *className, const char *methodName, const char *signature, ...) - - Calls the static method with \a methodName with \a signature on class \a className with optional arguments. - - \code - ... - jint a = 2; - jint b = 4; - jint max = QAndroidJniObject::callStaticMethod<jint>("java/lang/Math", "max", "(II)I", a, b); - ... - \endcode -*/ - -/*! - \fn template <typename T> T QAndroidJniObject::callStaticMethod(jclass clazz, const char *methodName, const char *signature, ...) - - Calls the static method \a methodName with \a signature on \a clazz and returns the value. - - \code - ... - jclass javaMathClass = ...; // ("java/lang/Math") - jint a = 2; - jint b = 4; - jint max = QAndroidJniObject::callStaticMethod<jint>(javaMathClass, "max", "(II)I", a, b); - ... - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(const char *className, const char *methodName) - - Calls the static method with \a methodName on the class \a className. - - \code - QAndroidJniObject string = QAndroidJniObject::callStaticObjectMethod<jstring>("CustomClass", "getClassName"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(const char *className, const char *methodName, const char *signature, ...) - - Calls the static method with \a methodName and \a signature on the class \a className. - - \code - QAndroidJniObject thread = QAndroidJniObject::callStaticObjectMethod("java/lang/Thread", "currentThread", "()Ljava/lang/Thread;"); - QAndroidJniObject string = QAndroidJniObject::callStaticObjectMethod("java/lang/String", "valueOf", "(I)Ljava/lang/String;", 10); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(jclass clazz, const char *methodName) - - Calls the static method with \a methodName on \a clazz. - -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(jclass clazz, const char *methodName, const char *signature, ...) - - Calls the static method with \a methodName and \a signature on class \a clazz. -*/ - -/*! - \fn T QAndroidJniObject::getField(const char *fieldName) const - - Retrieves the value of the field \a fieldName. - - \code - QAndroidJniObject volumeControl = ...; - jint fieldValue = volumeControl.getField<jint>("MAX_VOLUME"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::getObjectField(const char *fieldName) const - - Retrieves the object of field \a fieldName. - - \code - QAndroidJniObject field = jniObject.getObjectField<jstring>("FIELD_NAME"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::getObjectField(const char *fieldName, const char *signature) const - - Retrieves the object from the field with \a signature and \a fieldName. - - \note Since \b{Qt 5.3} this function can be used without a template type. - - \code - QAndroidJniObject field = jniObject.getObjectField("FIELD_NAME", "Ljava/lang/String;"); - \endcode -*/ - -/*! - \fn T QAndroidJniObject::getStaticField(const char *className, const char *fieldName) - - Retrieves the value from the static field \a fieldName on the class \a className. -*/ - -/*! - \fn T QAndroidJniObject::getStaticField(jclass clazz, const char *fieldName) - - Retrieves the value from the static field \a fieldName on \a clazz. -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::getStaticObjectField(const char *className, const char *fieldName) - - Retrieves the object from the field \a fieldName on the class \a className. - - \code - QAndroidJniObject jobj = QAndroidJniObject::getStaticObjectField<jstring>("class/with/Fields", "FIELD_NAME"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::getStaticObjectField(const char *className, const char *fieldName, const char *signature) - Retrieves the object from the field with \a signature and \a fieldName on class \a className. - - \note Since \b{Qt 5.3} this function can be used without a template type. - - \code - QAndroidJniObject jobj = QAndroidJniObject::getStaticObjectField("class/with/Fields", "FIELD_NAME", "Ljava/lang/String;"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::getStaticObjectField(jclass clazz, const char *fieldName) - - Retrieves the object from the field \a fieldName on \a clazz. - - \code - QAndroidJniObject jobj = QAndroidJniObject::getStaticObjectField<jstring>(clazz, "FIELD_NAME"); - \endcode -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::getStaticObjectField(jclass clazz, const char *fieldName, const char *signature) - Retrieves the object from the field with \a signature and \a fieldName on \a clazz. - - \note Since \b{Qt 5.3} this function can be used without a template type. - - \code - QAndroidJniObject jobj = QAndroidJniObject::getStaticObjectField(clazz, "FIELD_NAME", "Ljava/lang/String;"); - \endcode -*/ - -/*! - \fn template <typename T> void QAndroidJniObject::setField(const char *fieldName, T value) - - Sets the value of \a fieldName to \a value. - - \code - ... - QAndroidJniObject obj; - obj.setField<jint>("AN_INT_FIELD", 10); - jstring myString = ... - obj.setField<jstring>("A_STRING_FIELD", myString); - ... - \endcode -*/ - -/*! - \fn template <typename T> void QAndroidJniObject::setField(const char *fieldName, const char *signature, T value) - - Sets the value of \a fieldName with \a signature to \a value. - - \code - QAndroidJniObject stringArray = ...; - QAndroidJniObject obj = ...; - obj.setField<jobjectArray>("KEY_VALUES", "([Ljava/lang/String;)V", stringArray.object<jobjectArray>()) - \endcode -*/ - -/*! - \fn template <typename T> void QAndroidJniObject::setStaticField(const char *className, const char *fieldName, T value) - - Sets the value of the static field \a fieldName in class \a className to \a value. -*/ - -/*! - \fn template <typename T> void QAndroidJniObject::setStaticField(const char *className, const char *fieldName, const char *signature, T value); - - Sets the static field with \a fieldName and \a signature to \a value on class \a className. -*/ - -/*! - \fn template <typename T> void QAndroidJniObject::setStaticField(jclass clazz, const char *fieldName, T value) - - Sets the static field \a fieldName of the class \a clazz to \a value. -*/ - -/*! - \fn template <typename T> void QAndroidJniObject::setStaticField(jclass clazz, const char *fieldName, const char *signature, T value); - - Sets the static field with \a fieldName and \a signature to \a value on class \a clazz. -*/ - -/*! - \fn bool QAndroidJniObject::isClassAvailable(const char *className) - - Returns true if the Java class \a className is available. - - \code - ... - if (QAndroidJniObject::isClassAvailable("java/lang/String")) { - ... - } - ... - \endcode -*/ - -/*! - \fn bool QAndroidJniObject::isValid() const - - Returns true if this instance holds a valid Java object. - - \code - ... - QAndroidJniObject qjniObject; ==> isValid() == false - QAndroidJniObject qjniObject(0) ==> isValid() == false - QAndroidJniObject qjniObject("could/not/find/Class") ==> isValid() == false - ... - \endcode -*/ - -/*! - \fn template <typename T> T QAndroidJniObject::object() const - - Returns the object held by the QAndroidJniObject as type T. - - \code - QAndroidJniObject string = QAndroidJniObject::fromString("Hello, JNI"); - jstring jstring = string.object<jstring>(); - \endcode - - \note The returned object is still owned by the QAndroidJniObject. If you want to keep the object valid - you should create a new QAndroidJniObject or make a new global reference to the object and - free it yourself. - - \snippet code/src_androidextras_qandroidjniobject.cpp QAndroidJniObject scope - - \note Since \b{Qt 5.3} this function can be used without a template type, if the returned type - is a \c jobject. - - \code - jobject object = jniObject.object(); - \endcode -*/ - -/*! - \fn template <typename T> QAndroidJniObject &QAndroidJniObject::operator=(T object) - - Replace the current object with \a object. The old Java object will be released. -*/ - -/*! - \fn QString QAndroidJniObject::toString() const - - Returns a QString with a string representation of the java object. - Calling this function on a Java String object is a convenient way of getting the actual string - data. - - \code - QAndroidJniObject string = ...; // "Hello Java" - QString qstring = string.toString(); // "Hello Java" - \endcode - - \sa fromString() -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::fromString(const QString &string) - - Creates a Java string from the QString \a string and returns a QAndroidJniObject holding that string. - - \code - ... - QString myQString = "QString"; - QAndroidJniObject myJavaString = QAndroidJniObject::fromString(myQString); - ... - \endcode - - \sa toString() -*/ - -/*! - \fn QAndroidJniObject QAndroidJniObject::fromLocalRef(jobject localRef) - \since 5.7 - - Creates a QAndroidJniObject from the local JNI reference \a localRef. - This function takes ownership of \a localRef and frees it before returning. - - \note Only call this function with a local JNI reference. For example, most raw JNI calls, through - the JNI environment, returns local references to a java object. - - \code - jobject localRef = env->GetObjectArrayElement(array, index); - QAndroidJniObject element = QAndroidJniObject::fromLocalRef(localRef); - \endcode -*/ - -/*! - \fn bool operator==(const QAndroidJniObject &o1, const QAndroidJniObject &o2) - \relates QAndroidJniObject - - Returns true if both objects, \a o1 and \a o2, are referencing the same Java object, or if both - are NULL. In any other cases false will be returned. -*/ - -/*! - \fn bool operator!=(const QAndroidJniObject &o1, const QAndroidJniObject &o2) - \relates QAndroidJniObject - - Returns true if \a o1 holds a reference to a different object then \a o2. -*/ - - -QAndroidJniObject::QAndroidJniObject(const char *className, const char *sig, ...) -{ - va_list args; - QJNIObjectPrivate::QVaListPrivate vargs = { args }; - va_start(args, sig); - d = QSharedPointer<QJNIObjectPrivate>(new QJNIObjectPrivate(className, sig, vargs)); - va_end(args); -} - -QAndroidJniObject::QAndroidJniObject(jclass clazz, const char *sig, ...) -{ - va_list args; - QJNIObjectPrivate::QVaListPrivate vargs = { args }; - va_start(args, sig); - d = QSharedPointer<QJNIObjectPrivate>(new QJNIObjectPrivate(clazz, sig, vargs)); - va_end(args); -} - - -QAndroidJniObject::QAndroidJniObject() : d(new QJNIObjectPrivate) -{ - -} - -QAndroidJniObject::QAndroidJniObject(const char *className) : d(new QJNIObjectPrivate(className)) -{ -} - -QAndroidJniObject::QAndroidJniObject(jclass clazz) : d(new QJNIObjectPrivate(clazz)) -{ -} - -QAndroidJniObject::QAndroidJniObject(jobject obj) : d(new QJNIObjectPrivate(obj)) -{ -} - -QAndroidJniObject::QAndroidJniObject(const QJNIObjectPrivate &o) : d(new QJNIObjectPrivate(o)) -{ - -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::callMethod<void>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - d->callMethodV<void>(methodName, sig, args); - va_end(args); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::callMethod<jboolean>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jboolean res = d->callMethodV<jboolean>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::callMethod<jbyte>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jbyte res = d->callMethodV<jbyte>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::callMethod<jchar>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jchar res = d->callMethodV<jchar>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::callMethod<jshort>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jshort res = d->callMethodV<jshort>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::callMethod<jint>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jint res = d->callMethodV<jint>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::callMethod<jlong>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jlong res = d->callMethodV<jlong>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::callMethod<jfloat>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jfloat res = d->callMethodV<jfloat>(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::callMethod<jdouble>(const char *methodName, const char *sig, ...) const -{ - va_list args; - va_start(args, sig); - jdouble res = d->callMethodV<jdouble>(methodName, sig, args); - va_end(args); - return res; -} - -QAndroidJniObject QAndroidJniObject::callObjectMethod(const char *methodName, - const char *sig, - ...) const -{ - va_list args; - va_start(args, sig); - QJNIObjectPrivate res = d->callObjectMethodV(methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::callMethod<void>(const char *methodName) const -{ - callMethod<void>(methodName, "()V"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::callMethod<jboolean>(const char *methodName) const -{ - return callMethod<jboolean>(methodName, "()Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::callMethod<jbyte>(const char *methodName) const -{ - return callMethod<jbyte>(methodName, "()B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::callMethod<jchar>(const char *methodName) const -{ - return callMethod<jchar>(methodName, "()C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::callMethod<jshort>(const char *methodName) const -{ - return callMethod<jshort>(methodName, "()S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::callMethod<jint>(const char *methodName) const -{ - return callMethod<jint>(methodName, "()I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::callMethod<jlong>(const char *methodName) const -{ - return callMethod<jlong>(methodName, "()J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::callMethod<jfloat>(const char *methodName) const -{ - return callMethod<jfloat>(methodName, "()F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::callMethod<jdouble>(const char *methodName) const -{ - return callMethod<jdouble>(methodName, "()D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jobject>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jclass>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()Ljava/lang/Class;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jstring>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()Ljava/lang/String;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jobjectArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jbooleanArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jbyteArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jcharArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jshortArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jintArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jlongArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jfloatArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jdoubleArray>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()[D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callObjectMethod<jthrowable>(const char *methodName) const -{ - return d->callObjectMethod(methodName, "()Ljava/lang/Throwable;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::callStaticMethod<void>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - QJNIObjectPrivate::callStaticMethodV<void>(className, methodName, sig, args); - va_end(args); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::callStaticMethod<void>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - QJNIObjectPrivate::callStaticMethodV<void>(clazz, methodName, sig, args); - va_end(args); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::callStaticMethod<jboolean>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jboolean res = QJNIObjectPrivate::callStaticMethodV<jboolean>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::callStaticMethod<jboolean>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jboolean res = QJNIObjectPrivate::callStaticMethodV<jboolean>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::callStaticMethod<jbyte>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jbyte res = QJNIObjectPrivate::callStaticMethodV<jbyte>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::callStaticMethod<jbyte>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jbyte res = QJNIObjectPrivate::callStaticMethodV<jbyte>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::callStaticMethod<jchar>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jchar res = QJNIObjectPrivate::callStaticMethodV<jchar>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::callStaticMethod<jchar>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jchar res = QJNIObjectPrivate::callStaticMethodV<jchar>(clazz, methodName, sig, args); - va_end(args); - return res; -} - - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::callStaticMethod<jshort>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jshort res = QJNIObjectPrivate::callStaticMethodV<jshort>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::callStaticMethod<jshort>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jshort res = QJNIObjectPrivate::callStaticMethodV<jshort>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::callStaticMethod<jint>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jint res = QJNIObjectPrivate::callStaticMethodV<jint>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::callStaticMethod<jint>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jint res = QJNIObjectPrivate::callStaticMethodV<jint>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::callStaticMethod<jlong>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jlong res = QJNIObjectPrivate::callStaticMethodV<jlong>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::callStaticMethod<jlong>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jlong res = QJNIObjectPrivate::callStaticMethodV<jlong>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::callStaticMethod<jfloat>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jfloat res = QJNIObjectPrivate::callStaticMethodV<jfloat>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::callStaticMethod<jfloat>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jfloat res = QJNIObjectPrivate::callStaticMethodV<jfloat>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::callStaticMethod<jdouble>(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jdouble res = QJNIObjectPrivate::callStaticMethodV<jdouble>(className, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::callStaticMethod<jdouble>(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - jdouble res = QJNIObjectPrivate::callStaticMethodV<jdouble>(clazz, methodName, sig, args); - va_end(args); - return res; -} - -QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(const char *className, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - QJNIObjectPrivate res = QJNIObjectPrivate::callStaticObjectMethodV(className, - methodName, - sig, - args); - va_end(args); - return res; -} - -QAndroidJniObject QAndroidJniObject::callStaticObjectMethod(jclass clazz, - const char *methodName, - const char *sig, - ...) -{ - va_list args; - va_start(args, sig); - QJNIObjectPrivate res = QJNIObjectPrivate::callStaticObjectMethodV(clazz, methodName, sig, args); - va_end(args); - return res; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::callStaticMethod<void>(const char *className, const char *methodName) -{ - callStaticMethod<void>(className, methodName, "()V"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::callStaticMethod<void>(jclass clazz, const char *methodName) -{ - callStaticMethod<void>(clazz, methodName, "()V"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::callStaticMethod<jboolean>(const char *className, const char *methodName) -{ - return callStaticMethod<jboolean>(className, methodName, "()Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::callStaticMethod<jboolean>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jboolean>(clazz, methodName, "()Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::callStaticMethod<jbyte>(const char *className, const char *methodName) -{ - return callStaticMethod<jbyte>(className, methodName, "()B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::callStaticMethod<jbyte>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jbyte>(clazz, methodName, "()B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::callStaticMethod<jchar>(const char *className, const char *methodName) -{ - return callStaticMethod<jchar>(className, methodName, "()C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::callStaticMethod<jchar>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jchar>(clazz, methodName, "()C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::callStaticMethod<jshort>(const char *className, const char *methodName) -{ - return callStaticMethod<jshort>(className, methodName, "()S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::callStaticMethod<jshort>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jshort>(clazz, methodName, "()S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::callStaticMethod<jint>(const char *className, const char *methodName) -{ - return callStaticMethod<jint>(className, methodName, "()I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::callStaticMethod<jint>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jint>(clazz, methodName, "()I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::callStaticMethod<jlong>(const char *className, const char *methodName) -{ - return callStaticMethod<jlong>(className, methodName, "()J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::callStaticMethod<jlong>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jlong>(clazz, methodName, "()J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::callStaticMethod<jfloat>(const char *className, const char *methodName) -{ - return callStaticMethod<jfloat>(className, methodName, "()F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::callStaticMethod<jfloat>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jfloat>(clazz, methodName, "()F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::callStaticMethod<jdouble>(const char *className, const char *methodName) -{ - return callStaticMethod<jdouble>(className, methodName, "()D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::callStaticMethod<jdouble>(jclass clazz, const char *methodName) -{ - return callStaticMethod<jdouble>(clazz, methodName, "()D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jobject>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jobject>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jclass>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()Ljava/lang/Class;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jclass>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()Ljava/lang/Class;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jstring>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()Ljava/lang/String;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jstring>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()Ljava/lang/String;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jobjectArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jobjectArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jbooleanArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jbooleanArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jbyteArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jbyteArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jcharArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jcharArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jshortArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jshortArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jintArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jintArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jlongArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jlongArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jfloatArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jfloatArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jdoubleArray>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()[D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jdoubleArray>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()[D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jthrowable>(const char *className, - const char *methodName) -{ - return callStaticObjectMethod(className, methodName, "()Ljava/lang/Throwable;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::callStaticObjectMethod<jthrowable>(jclass clazz, - const char *methodName) -{ - return callStaticObjectMethod(clazz, methodName, "()Ljava/lang/Throwable;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::getField<jboolean>(const char *fieldName) const -{ - return d->getField<jboolean>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::getField<jbyte>(const char *fieldName) const -{ - return d->getField<jbyte>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::getField<jchar>(const char *fieldName) const -{ - return d->getField<jchar>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::getField<jshort>(const char *fieldName) const -{ - return d->getField<jshort>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::getField<jint>(const char *fieldName) const -{ - return d->getField<jint>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::getField<jlong>(const char *fieldName) const -{ - return d->getField<jlong>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::getField<jfloat>(const char *fieldName) const -{ - return d->getField<jfloat>(fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::getField<jdouble>(const char *fieldName) const -{ - return d->getField<jdouble>(fieldName); -} - -QAndroidJniObject QAndroidJniObject::getObjectField(const char *fieldName, const char *sig) const -{ - return d->getObjectField(fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jobject>(const char *fieldName, const char *sig) const -{ - return d->getObjectField(fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jobject>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jclass>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "Ljava/lang/Class;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jbooleanArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jbyteArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jcharArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jshortArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jintArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jlongArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jfloatArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jdoubleArray>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "[D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jstring>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "Ljava/lang/String;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jthrowable>(const char *fieldName) const -{ - return d->getObjectField(fieldName, "Ljava/lang/Throwable;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getObjectField<jobjectArray>(const char *fieldName, - const char *sig) const -{ - return d->getObjectField(fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jboolean>(const char *fieldName, jboolean value) -{ - d->setField<jboolean>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jbyte>(const char *fieldName, jbyte value) -{ - d->setField<jbyte>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jchar>(const char *fieldName, jchar value) -{ - d->setField<jchar>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jshort>(const char *fieldName, jshort value) -{ - d->setField<jshort>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jint>(const char *fieldName, jint value) -{ - d->setField<jint>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jlong>(const char *fieldName, jlong value) -{ - d->setField<jlong>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jfloat>(const char *fieldName, jfloat value) -{ - d->setField<jfloat>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jdouble>(const char *fieldName, jdouble value) -{ - d->setField<jdouble>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jobject>(const char *fieldName, - const char *sig, - jobject value) -{ - d->setField<jobject>(fieldName, sig, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jobjectArray>(const char *fieldName, - const char *sig, - jobjectArray value) -{ - d->setField<jobjectArray>(fieldName, sig, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jobject>(const char *fieldName, - jobject value) -{ - setField<jobject>(fieldName, "Ljava/lang/Object;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jclass>(const char *fieldName, - jclass value) -{ - setField<jobject>(fieldName, "Ljava/lang/Class;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jstring>(const char *fieldName, jstring value) -{ - d->setField<jstring>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jbooleanArray>(const char *fieldName, jbooleanArray value) -{ - d->setField<jbooleanArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jbyteArray>(const char *fieldName, jbyteArray value) -{ - d->setField<jbyteArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jcharArray>(const char *fieldName, jcharArray value) -{ - d->setField<jcharArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jshortArray>(const char *fieldName, jshortArray value) -{ - d->setField<jshortArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jintArray>(const char *fieldName, jintArray value) -{ - d->setField<jintArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jlongArray>(const char *fieldName, jlongArray value) -{ - d->setField<jlongArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jfloatArray>(const char *fieldName, jfloatArray value) -{ - d->setField<jfloatArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jdoubleArray>(const char *fieldName, jdoubleArray value) -{ - d->setField<jdoubleArray>(fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setField<jthrowable>(const char *fieldName, jthrowable value) -{ - d->setField<jobject>(fieldName, "Ljava/lang/Throwable;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::getStaticField<jboolean>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jboolean>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jboolean QAndroidJniObject::getStaticField<jboolean>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jboolean>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::getStaticField<jbyte>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jbyte>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jbyte QAndroidJniObject::getStaticField<jbyte>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jbyte>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::getStaticField<jchar>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jchar>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jchar QAndroidJniObject::getStaticField<jchar>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jchar>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::getStaticField<jshort>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jshort>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jshort QAndroidJniObject::getStaticField<jshort>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jshort>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::getStaticField<jint>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jint>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jint QAndroidJniObject::getStaticField<jint>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jint>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::getStaticField<jlong>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jlong>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jlong QAndroidJniObject::getStaticField<jlong>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jlong>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::getStaticField<jfloat>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jfloat>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jfloat QAndroidJniObject::getStaticField<jfloat>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jfloat>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::getStaticField<jdouble>(jclass clazz, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jdouble>(clazz, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT jdouble QAndroidJniObject::getStaticField<jdouble>(const char *className, const char *fieldName) -{ - return QJNIObjectPrivate::getStaticField<jdouble>(className, fieldName); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobject>(jclass clazz, - const char *fieldName, - const char *sig) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, sig); -} - -QAndroidJniObject QAndroidJniObject::getStaticObjectField(jclass clazz, - const char *fieldName, - const char *sig) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, sig); -} - -QAndroidJniObject QAndroidJniObject::getStaticObjectField(const char *className, - const char *fieldName, - const char *sig) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobject>(const char *className, - const char *fieldName, - const char *sig) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobjectArray>(jclass clazz, - const char *fieldName, - const char *sig) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobjectArray>(const char *className, - const char *fieldName, - const char *sig) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, sig); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobject>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobject>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jclass>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "Ljava/lang/Class;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jclass>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "Ljava/lang/Class;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jstring>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "Ljava/lang/String;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jstring>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "Ljava/lang/String;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobjectArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jobjectArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[Ljava/lang/Object;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jbooleanArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jbooleanArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[Z"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jbyteArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[B"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jbyteArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[B");; -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jcharArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jcharArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[C"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jshortArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jshortArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[S"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jintArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jintArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[I"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jlongArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jlongArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[J"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jfloatArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jfloatArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[F"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jdoubleArray>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "[D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jdoubleArray>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "[D"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jthrowable>(jclass clazz, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(clazz, fieldName, "Ljava/lang/Throwable;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject QAndroidJniObject::getStaticObjectField<jthrowable>(const char *className, - const char *fieldName) -{ - return QJNIObjectPrivate::getStaticObjectField(className, fieldName, "Ljava/lang/Throwable;"); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jboolean>(jclass clazz, const char *fieldName, jboolean value) -{ - QJNIObjectPrivate::setStaticField<jboolean>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jboolean>(const char *className, - const char *fieldName, - jboolean value) -{ - QJNIObjectPrivate::setStaticField<jboolean>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jbyte>(jclass clazz, const char *fieldName, jbyte value) -{ - QJNIObjectPrivate::setStaticField<jbyte>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jbyte>(const char *className, - const char *fieldName, - jbyte value) -{ - QJNIObjectPrivate::setStaticField<jbyte>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jchar>(jclass clazz, const char *fieldName, jchar value) -{ - QJNIObjectPrivate::setStaticField<jchar>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jchar>(const char *className, - const char *fieldName, - jchar value) -{ - QJNIObjectPrivate::setStaticField<jchar>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jshort>(jclass clazz, const char *fieldName, jshort value) -{ - QJNIObjectPrivate::setStaticField<jshort>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jshort>(const char *className, - const char *fieldName, - jshort value) -{ - QJNIObjectPrivate::setStaticField<jshort>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jint>(jclass clazz, const char *fieldName, jint value) -{ - QJNIObjectPrivate::setStaticField<jint>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jint>(const char *className, const char *fieldName, jint value) -{ - QJNIObjectPrivate::setStaticField<jint>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jlong>(jclass clazz, const char *fieldName, jlong value) -{ - QJNIObjectPrivate::setStaticField<jlong>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jlong>(const char *className, - const char *fieldName, - jlong value) -{ - QJNIObjectPrivate::setStaticField<jlong>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jfloat>(jclass clazz, const char *fieldName, jfloat value) -{ - QJNIObjectPrivate::setStaticField<jfloat>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jfloat>(const char *className, - const char *fieldName, - jfloat value) -{ - QJNIObjectPrivate::setStaticField<jfloat>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jdouble>(jclass clazz, const char *fieldName, jdouble value) -{ - QJNIObjectPrivate::setStaticField<jdouble>(clazz, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jdouble>(const char *className, - const char *fieldName, - jdouble value) -{ - QJNIObjectPrivate::setStaticField<jdouble>(className, fieldName, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jobject>(jclass clazz, - const char *fieldName, - const char *sig, - jobject value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, sig, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jobject>(const char *className, - const char *fieldName, - const char *sig, - jobject value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, sig, value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jclass>(const char *className, - const char *fieldName, - jclass value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "Ljava/lang/Class;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jclass>(jclass clazz, const char *fieldName, jclass value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "Ljava/lang/Class;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jstring>(const char *className, - const char *fieldName, - jstring value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "Ljava/lang/String;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jstring>(jclass clazz, const char *fieldName, jstring value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "Ljava/lang/String;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jobjectArray>(const char *className, - const char *fieldName, - jobjectArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[Ljava/lang/Object;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jobjectArray>(jclass clazz, - const char *fieldName, - jobjectArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[Ljava/lang/Object;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jbooleanArray>(const char *className, - const char *fieldName, - jbooleanArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[Z", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jbooleanArray>(jclass clazz, - const char *fieldName, - jbooleanArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[Z", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jbyteArray>(const char *className, - const char *fieldName, - jbyteArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[B", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jbyteArray>(jclass clazz, - const char *fieldName, - jbyteArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[B", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jcharArray>(const char *className, - const char *fieldName, - jcharArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[C", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jcharArray>(jclass clazz, - const char *fieldName, - jcharArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[C", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jshortArray>(const char *className, - const char *fieldName, - jshortArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[S", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jshortArray>(jclass clazz, - const char *fieldName, - jshortArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[S", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jintArray>(const char *className, - const char *fieldName, - jintArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[I", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jintArray>(jclass clazz, - const char *fieldName, - jintArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[I", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jlongArray>(const char *className, - const char *fieldName, - jlongArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[J", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jlongArray>(jclass clazz, - const char *fieldName, - jlongArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[J", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jfloatArray>(const char *className, - const char *fieldName, - jfloatArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[F", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jfloatArray>(jclass clazz, - const char *fieldName, - jfloatArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[F", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jdoubleArray>(const char *className, - const char *fieldName, - jdoubleArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "[D", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jdoubleArray>(jclass clazz, - const char *fieldName, - jdoubleArray value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "[D", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jthrowable>(const char *className, - const char *fieldName, - jthrowable value) -{ - QJNIObjectPrivate::setStaticField<jobject>(className, fieldName, "Ljava/lang/Throwable;", value); -} - -template <> -Q_ANDROIDEXTRAS_EXPORT void QAndroidJniObject::setStaticField<jthrowable>(jclass clazz, - const char *fieldName, - jthrowable value) -{ - QJNIObjectPrivate::setStaticField<jobject>(clazz, fieldName, "Ljava/lang/Throwable;", value); -} - -QAndroidJniObject QAndroidJniObject::fromString(const QString &string) -{ - return QJNIObjectPrivate::fromString(string); -} - -QString QAndroidJniObject::toString() const -{ - return d->toString(); -} - -bool QAndroidJniObject::isClassAvailable(const char *className) -{ - return QJNIObjectPrivate::isClassAvailable(className); -} - -bool QAndroidJniObject::isValid() const -{ - return d->isValid(); -} - -QAndroidJniObject QAndroidJniObject::fromLocalRef(jobject obj) -{ - return QJNIObjectPrivate::fromLocalRef(obj); -} - -jobject QAndroidJniObject::javaObject() const -{ - return d->object(); -} - -bool QAndroidJniObject::isSameObject(jobject obj) const -{ - return d->isSameObject(obj); -} - -bool QAndroidJniObject::isSameObject(const QAndroidJniObject &obj) const -{ - return d->isSameObject(*obj.d); -} - -void QAndroidJniObject::assign(jobject o) -{ - if (d->isSameObject(o)) - return; - - d = QSharedPointer<QJNIObjectPrivate>(new QJNIObjectPrivate(o)); -} - -QT_END_NAMESPACE diff --git a/src/androidextras/jni/qandroidjniobject.h b/src/androidextras/jni/qandroidjniobject.h deleted file mode 100644 index 94bd901..0000000 --- a/src/androidextras/jni/qandroidjniobject.h +++ /dev/null @@ -1,215 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QANDROIDJNIOBJECT_H -#define QANDROIDJNIOBJECT_H - -#include <jni.h> -#include <QtAndroidExtras/qandroidextrasglobal.h> -#include <QtCore/qglobal.h> -#include <QtCore/qsharedpointer.h> - -QT_BEGIN_NAMESPACE - -class QJNIObjectPrivate; - -class Q_ANDROIDEXTRAS_EXPORT QAndroidJniObject -{ -public: - QAndroidJniObject(); - explicit QAndroidJniObject(const char *className); - explicit QAndroidJniObject(const char *className, const char *sig, ...); - explicit QAndroidJniObject(jclass clazz); - explicit QAndroidJniObject(jclass clazz, const char *sig, ...); - QAndroidJniObject(jobject obj); - ~QAndroidJniObject(); - - template <typename T> - inline T object() const { return static_cast<T>(javaObject()); } -#ifndef Q_QDOC - inline jobject object() const { return javaObject(); } -#endif // Q_QDOC - - template <typename T> - T callMethod(const char *methodName) const; - template <typename T> - T callMethod(const char *methodName, const char *sig, ...) const; - template <typename T> - QAndroidJniObject callObjectMethod(const char *methodName) const; - QAndroidJniObject callObjectMethod(const char *methodName, - const char *sig, - ...) const; - - template <typename T> - static T callStaticMethod(const char *className, const char *methodName); - template <typename T> - static T callStaticMethod(const char *className, const char *methodName, const char *sig, ...); - template <typename T> - static QAndroidJniObject callStaticObjectMethod(const char *className, const char *methodName); - static QAndroidJniObject callStaticObjectMethod(const char *className, - const char *methodName, - const char *sig, ...); - template <typename T> - static T callStaticMethod(jclass clazz, const char *methodName); - template <typename T> - static T callStaticMethod(jclass clazz, const char *methodName, const char *sig, ...); - template <typename T> - static QAndroidJniObject callStaticObjectMethod(jclass clazz, const char *methodName); - static QAndroidJniObject callStaticObjectMethod(jclass clazz, - const char *methodName, - const char *sig, ...); - template <typename T> - T getField(const char *fieldName) const; - template <typename T> - QAndroidJniObject getObjectField(const char *fieldName) const; -#if QT_DEPRECATED_SINCE(5, 5) -# ifndef Q_QDOC - template <typename T> - QT_DEPRECATED_X("Use the non-template version instead") - QAndroidJniObject getObjectField(const char *fieldName, const char *sig) const; -# endif // Q_QDOC -#endif // QT_DEPRECATED_SINCE - QAndroidJniObject getObjectField(const char *fieldName, const char *sig) const; - template <typename T> - void setField(const char *fieldName, T value); - template <typename T> - void setField(const char *fieldName, const char *sig, T value); - template <typename T> - static QAndroidJniObject getStaticObjectField(const char *className, const char *fieldName); -#if QT_DEPRECATED_SINCE(5, 5) -# ifndef Q_QDOC - template <typename T> - QT_DEPRECATED_X("Use the non-template version instead") - static QAndroidJniObject getStaticObjectField(const char *className, - const char *fieldName, - const char *sig); -# endif // Q_QDOC -#endif // QT_DEPRECATED_SINCE - static QAndroidJniObject getStaticObjectField(const char *className, - const char *fieldName, - const char *sig); - template <typename T> - static T getStaticField(const char *className, const char *fieldName); - template <typename T> - static QAndroidJniObject getStaticObjectField(jclass clazz, const char *fieldName); -#if QT_DEPRECATED_SINCE(5, 5) -# ifndef Q_QDOC - template <typename T> - QT_DEPRECATED_X("Use the non-template version instead") - static QAndroidJniObject getStaticObjectField(jclass clazz, - const char *fieldName, - const char *sig); -# endif // Q_QDOC -#endif // QT_DEPRECATED_SINCE - static QAndroidJniObject getStaticObjectField(jclass clazz, - const char *fieldName, - const char *sig); - template <typename T> - static T getStaticField(jclass clazz, const char *fieldName); - - template <typename T> - static void setStaticField(const char *className, - const char *fieldName, - const char *sig, - T value); - template <typename T> - static void setStaticField(const char *className, const char *fieldName, T value); - template <typename T> - static void setStaticField(jclass clazz, const char *fieldName, const char *sig, T value); - template <typename T> - static void setStaticField(jclass clazz, const char *fieldName, T value); - - static QAndroidJniObject fromString(const QString &string); - QString toString() const; - - static bool isClassAvailable(const char *className); - bool isValid() const; - - static QAndroidJniObject fromLocalRef(jobject obj); - - template <typename T> - inline QAndroidJniObject &operator=(T o) - { - assign(static_cast<jobject>(o)); - return *this; - } - -private: - friend bool operator==(const QAndroidJniObject &, const QAndroidJniObject &); - friend bool operator!=(const QAndroidJniObject &, const QAndroidJniObject &); - template <typename T> friend bool operator!=(const QAndroidJniObject &, const QAndroidJniObject &); - template <typename T> friend bool operator==(const QAndroidJniObject &, const QAndroidJniObject &); - - QAndroidJniObject(const QJNIObjectPrivate &o); - - void assign(jobject o); - jobject javaObject() const; - bool isSameObject(jobject obj) const; - bool isSameObject(const QAndroidJniObject &obj) const; - - QSharedPointer<QJNIObjectPrivate> d; -}; - -inline bool operator==(const QAndroidJniObject &obj1, const QAndroidJniObject &obj2) -{ - return obj1.isSameObject(obj2); -} - -inline bool operator!=(const QAndroidJniObject &obj1, const QAndroidJniObject &obj2) -{ - return !obj1.isSameObject(obj2); -} - -#if QT_DEPRECATED_SINCE(5, 5) -template<typename T> -QT_DEPRECATED inline bool operator==(const QAndroidJniObject &obj1, const QAndroidJniObject &obj2) -{ - return obj1.isSameObject(obj2.object()); -} - -template <typename T> -QT_DEPRECATED inline bool operator!=(const QAndroidJniObject &obj1, const QAndroidJniObject &obj2) -{ - return !obj1.isSameObject(obj2.object()); -} -#endif // QT_DEPRECATED_SINCE - -QT_END_NAMESPACE - -#endif // QANDROIDJNIOBJECT_H diff --git a/src/androidextras/qandroidextrasglobal.h b/src/androidextras/qandroidextrasglobal.h deleted file mode 100644 index 90a78ad..0000000 --- a/src/androidextras/qandroidextrasglobal.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTANDROIDEXTRASGLOBAL_H -#define QTANDROIDEXTRASGLOBAL_H - -#include <QtCore/qglobal.h> - -QT_BEGIN_NAMESPACE - -#ifndef QT_STATIC -# if defined(QT_BUILD_ANDROIDEXTRAS_LIB) -# define Q_ANDROIDEXTRAS_EXPORT Q_DECL_EXPORT -# else -# define Q_ANDROIDEXTRAS_EXPORT Q_DECL_IMPORT -# endif -#else -# define Q_ANDROIDEXTRAS_EXPORT -#endif - -QT_END_NAMESPACE - -#endif // QTANDROIDEXTRASGLOBAL_H diff --git a/src/jar/AndroidManifest.xml b/src/jar/AndroidManifest.xml deleted file mode 100644 index 17019fb..0000000 --- a/src/jar/AndroidManifest.xml +++ /dev/null @@ -1,6 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="org.qtproject.qt.android.multimedia" - android:versionCode="1" - android:versionName="1.0" > - <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> -</manifest> diff --git a/src/jar/CMakeLists.txt b/src/jar/CMakeLists.txt deleted file mode 100644 index 0aab31a..0000000 --- a/src/jar/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -# Generated from jar.pro. - -set(java_sources - src/org/qtproject/qt/android/extras/QtAndroidBinder.java - src/org/qtproject/qt/android/extras/QtAndroidServiceConnection.java - src/org/qtproject/qt/android/extras/QtNative.java -) - -qt_internal_add_jar(Qt${QtAndroidExtras_VERSION_MAJOR}AndroidExtras # special case - INCLUDE_JARS ${QT_ANDROID_JAR} - SOURCES ${java_sources} - OUTPUT_DIR "${QT_BUILD_DIR}/jar" -) - -install_jar(Qt${QtAndroidExtras_VERSION_MAJOR}AndroidExtras # special case - DESTINATION jar - COMPONENT Devel -) - diff --git a/src/jar/src/org/qtproject/qt/android/extras/QtAndroidBinder.java b/src/jar/src/org/qtproject/qt/android/extras/QtAndroidBinder.java deleted file mode 100644 index 4e34955..0000000 --- a/src/jar/src/org/qtproject/qt/android/extras/QtAndroidBinder.java +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Android port 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -package org.qtproject.qt.android.extras; - -import android.os.Binder; -import android.os.Parcel; - -public class QtAndroidBinder extends Binder -{ - public QtAndroidBinder(long id) - { - m_id = id; - } - - public void setId(long id) - { - synchronized(this) - { - m_id = id; - } - } - @Override - protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) - { - synchronized(this) - { - return QtNative.onTransact(m_id, code, data, reply, flags); - } - } - - private long m_id; -} diff --git a/src/jar/src/org/qtproject/qt/android/extras/QtAndroidServiceConnection.java b/src/jar/src/org/qtproject/qt/android/extras/QtAndroidServiceConnection.java deleted file mode 100644 index bab4d3f..0000000 --- a/src/jar/src/org/qtproject/qt/android/extras/QtAndroidServiceConnection.java +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Android port 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -package org.qtproject.qt.android.extras; - -import android.content.ComponentName; -import android.content.ServiceConnection; -import android.os.IBinder; - -public class QtAndroidServiceConnection implements ServiceConnection -{ - public QtAndroidServiceConnection(long id) - { - m_id = id; - } - - public void setId(long id) - { - synchronized(this) - { - m_id = id; - } - } - - @Override - public void onServiceConnected(ComponentName name, IBinder service) - { - synchronized(this) { - QtNative.onServiceConnected(m_id, name.flattenToString(), service); - } - } - - @Override - public void onServiceDisconnected(ComponentName name) - { - synchronized(this) { - QtNative.onServiceDisconnected(m_id, name.flattenToString()); - } - } - - private long m_id; -} diff --git a/src/jar/src/org/qtproject/qt/android/extras/QtNative.java b/src/jar/src/org/qtproject/qt/android/extras/QtNative.java deleted file mode 100644 index 86a9151..0000000 --- a/src/jar/src/org/qtproject/qt/android/extras/QtNative.java +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 BogDan Vatra <[email protected]> -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Android port 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -package org.qtproject.qt.android.extras; - -import android.content.ComponentName; -import android.content.ServiceConnection; -import android.os.IBinder; -import android.os.Parcel; - -public class QtNative { - // Binder - public static native boolean onTransact(long id, int code, Parcel data, Parcel reply, int flags); - - - // ServiceConnection - public static native void onServiceConnected(long id, String name, IBinder service); - public static native void onServiceDisconnected(long id, String name); -} diff --git a/sync.profile b/sync.profile deleted file mode 100644 index 1912e5b..0000000 --- a/sync.profile +++ /dev/null @@ -1,5 +0,0 @@ -%modules = ( # path to module name map - "QtAndroidExtras" => "$basedir/src/androidextras", -); -%moduleheaders = ( # restrict the module headers to those found in relative path -); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index 2214137..0000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Generated from tests.pro. - -if(QT_BUILD_STANDALONE_TESTS) - # Add qt_find_package calls for extra dependencies that need to be found when building - # the standalone tests here. -endif() -qt_build_tests() diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt deleted file mode 100644 index b9cb400..0000000 --- a/tests/auto/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Generated from auto.pro. - -#add_subdirectory(cmake) # special case -add_subdirectory(qandroidjnienvironment) -add_subdirectory(qandroidjniobject) -add_subdirectory(qandroidfunctions) diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt deleted file mode 100644 index a786745..0000000 --- a/tests/auto/cmake/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ - -cmake_minimum_required(VERSION 2.8) - -project(qmake_cmake_files) - -enable_testing() - -find_package(Qt5Core REQUIRED) - -include("${_Qt5CTestMacros}") - -test_module_includes( - AndroidExtras QAndroidJniObject -) diff --git a/tests/auto/qandroidfunctions/CMakeLists.txt b/tests/auto/qandroidfunctions/CMakeLists.txt deleted file mode 100644 index ae983db..0000000 --- a/tests/auto/qandroidfunctions/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Generated from qandroidfunctions.pro. - -##################################################################### -## tst_qandroidfunctions Test: -##################################################################### - -qt_internal_add_test(tst_qandroidfunctions - SOURCES - tst_qandroidfunctions.cpp - PUBLIC_LIBRARIES - Qt::AndroidExtras - Qt::Gui -) diff --git a/tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp b/tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp deleted file mode 100644 index f6bfc2b..0000000 --- a/tests/auto/qandroidfunctions/tst_qandroidfunctions.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtAndroidExtras/QtAndroid> - -class tst_QAndroidFunctions : public QObject -{ - Q_OBJECT -private slots: - void testAndroidSdkVersion(); - void testAndroidActivity(); - void testRunOnAndroidThread(); -}; - -void tst_QAndroidFunctions::testAndroidSdkVersion() -{ - QVERIFY(QtAndroid::androidSdkVersion() > 0); -} - -void tst_QAndroidFunctions::testAndroidActivity() -{ - QAndroidJniObject activity = QtAndroid::androidActivity(); - QVERIFY(activity.isValid()); - QVERIFY(activity.callMethod<jboolean>("isTaskRoot")); -} - -void tst_QAndroidFunctions::testRunOnAndroidThread() -{ - int a = 0; - - // test async operation - QtAndroid::runOnAndroidThread([&a]{ - a = 1; - }); - QTRY_COMPARE(a, 1); // wait for async op. to finish - - // test sync operation - QtAndroid::runOnAndroidThreadSync([&a]{ - a = 2; - }); - QCOMPARE(a, 2); - - // test async/async lock - QtAndroid::runOnAndroidThread([&a]{ - QtAndroid::runOnAndroidThread([&a]{ - a = 3; - }); - }); - QTRY_COMPARE(a, 3); // wait for async op. to finish - - // test async/sync lock - QtAndroid::runOnAndroidThread([&a]{ - QtAndroid::runOnAndroidThreadSync([&a]{ - a = 5; - }); - }); - QTRY_COMPARE(a, 5); - - // test sync/sync lock - QtAndroid::runOnAndroidThreadSync([&a]{ - QtAndroid::runOnAndroidThreadSync([&a]{ - a = 4; - }); - }); - QCOMPARE(a, 4); - - - // test sync/async lock - QtAndroid::runOnAndroidThreadSync([&a]{ - QtAndroid::runOnAndroidThread([&a]{ - a = 6; - }); - }); - QCOMPARE(a, 6); -} - -QTEST_APPLESS_MAIN(tst_QAndroidFunctions) - -#include "tst_qandroidfunctions.moc" diff --git a/tests/auto/qandroidjnienvironment/CMakeLists.txt b/tests/auto/qandroidjnienvironment/CMakeLists.txt deleted file mode 100644 index 56dd64f..0000000 --- a/tests/auto/qandroidjnienvironment/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -# Generated from qandroidjnienvironment.pro. - -##################################################################### -## tst_qandroidjnienvironment Test: -##################################################################### - -qt_internal_add_test(tst_qandroidjnienvironment - SOURCES - tst_qandroidjnienvironment.cpp - PUBLIC_LIBRARIES - Qt::AndroidExtras - Qt::CorePrivate - Qt::Gui -) diff --git a/tests/auto/qandroidjnienvironment/tst_qandroidjnienvironment.cpp b/tests/auto/qandroidjnienvironment/tst_qandroidjnienvironment.cpp deleted file mode 100644 index 3aa2033..0000000 --- a/tests/auto/qandroidjnienvironment/tst_qandroidjnienvironment.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtTest/QtTest> -#include <QtAndroidExtras/QAndroidJniEnvironment> -#include <QtCore/private/qjnihelpers_p.h> - -class tst_QAndroidJniEnvironment : public QObject -{ - Q_OBJECT - -private slots: - void jniEnv(); - void javaVM(); -}; - -void tst_QAndroidJniEnvironment::jniEnv() -{ - JavaVM *javaVM = QtAndroidPrivate::javaVM(); - QVERIFY(javaVM); - - { - QAndroidJniEnvironment env; - - // JNI environment should now be attached to the current thread - JNIEnv *jni = 0; - QCOMPARE(javaVM->GetEnv((void**)&jni, JNI_VERSION_1_6), JNI_OK); - - JNIEnv *e = env; - QVERIFY(e); - - QCOMPARE(env->GetVersion(), JNI_VERSION_1_6); - - // try to find an existing class - QVERIFY(env->FindClass("java/lang/Object")); - QVERIFY(!env->ExceptionCheck()); - - // try to find a nonexistent class - QVERIFY(!env->FindClass("this/doesnt/Exist")); - QVERIFY(env->ExceptionCheck()); - env->ExceptionClear(); - } - - // The env does not detach automatically, even if it goes out of scope. The only way it can - // be detached is if it's done explicitly, or if the thread we attached to gets killed (TLS clean-up). - JNIEnv *jni = nullptr; - QCOMPARE(javaVM->GetEnv((void**)&jni, JNI_VERSION_1_6), JNI_OK); -} - -void tst_QAndroidJniEnvironment::javaVM() -{ - JavaVM *javaVM = QtAndroidPrivate::javaVM(); - QVERIFY(javaVM); - - QAndroidJniEnvironment env; - QCOMPARE(env.javaVM(), javaVM); - - JavaVM *vm = 0; - QCOMPARE(env->GetJavaVM(&vm), JNI_OK); - QCOMPARE(env.javaVM(), vm); -} - -QTEST_APPLESS_MAIN(tst_QAndroidJniEnvironment) - -#include "tst_qandroidjnienvironment.moc" diff --git a/tests/auto/qandroidjniobject/CMakeLists.txt b/tests/auto/qandroidjniobject/CMakeLists.txt deleted file mode 100644 index e1dd052..0000000 --- a/tests/auto/qandroidjniobject/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Generated from qandroidjniobject.pro. - -##################################################################### -## tst_qandroidjniobject Test: -##################################################################### - -qt_internal_add_test(tst_qandroidjniobject - SOURCES - tst_qandroidjniobject.cpp - PUBLIC_LIBRARIES - Qt::AndroidExtras - Qt::Gui -) - -if(ANDROID) - set_property(TARGET tst_qandroidjniobject APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR - ${CMAKE_CURRENT_SOURCE_DIR}/testdata - ) -endif() - -#### Keys ignored in scope 1:.:.:qandroidjniobject.pro:<TRUE>: -# OTHER_FILES = "testdata/src/org/qtproject/qt/android/testdata/QtAndroidJniObjectTestClass.java" diff --git a/tests/auto/qandroidjniobject/testdata/src/org/qtproject/qt/android/testdata/QtAndroidJniObjectTestClass.java b/tests/auto/qandroidjniobject/testdata/src/org/qtproject/qt/android/testdata/QtAndroidJniObjectTestClass.java deleted file mode 100644 index d2799b0..0000000 --- a/tests/auto/qandroidjniobject/testdata/src/org/qtproject/qt/android/testdata/QtAndroidJniObjectTestClass.java +++ /dev/null @@ -1,177 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -package org.qtproject.qt.android.testdatapackage; - -public class QtAndroidJniObjectTestClass -{ - static final byte A_BYTE_VALUE = 127; - static final short A_SHORT_VALUE = 32767; - static final int A_INT_VALUE = 060701; - static final long A_LONG_VALUE = 060701; - static final float A_FLOAT_VALUE = 1.0f; - static final double A_DOUBLE_VALUE = 1.0; - static final boolean A_BOOLEAN_VALUE = true; - static final char A_CHAR_VALUE = 'Q'; - static final String A_STRING_OBJECT = "TEST_DATA_STRING"; - static final Class A_CLASS_OBJECT = QtAndroidJniObjectTestClass.class; - static final Object A_OBJECT_OBJECT = new QtAndroidJniObjectTestClass(); - static final Throwable A_THROWABLE_OBJECT = new Throwable(A_STRING_OBJECT); - - // -------------------------------------------------------------------------------------------- - public static void staticVoidMethod() { return; } - public static void staticVoidMethodWithArgs(int a, boolean b, char c) { return; } - - public void voidMethod() { return; } - public void voidMethodWithArgs(int a, boolean b, char c) { return; } - - // -------------------------------------------------------------------------------------------- - public static boolean staticBooleanMethod() { return A_BOOLEAN_VALUE; } - public static boolean staticBooleanMethodWithArgs(boolean a, boolean b, boolean c) - { return staticBooleanMethod(); } - - public boolean booleanMethod() { return staticBooleanMethod(); } - public boolean booleanMethodWithArgs(boolean a, boolean b, boolean c) - { return staticBooleanMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static byte staticByteMethod() { return A_BYTE_VALUE; } - public static byte staticByteMethodWithArgs(byte a, byte b, byte c) { return staticByteMethod(); } - - public byte byteMethod() { return staticByteMethod(); } - public byte byteMethodWithArgs(byte a, byte b, byte c) - { return staticByteMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static char staticCharMethod() { return A_CHAR_VALUE; } - public static char staticCharMethodWithArgs(char a, char b, char c) { return staticCharMethod(); } - - public char charMethod() { return staticCharMethod(); } - public char charMethodWithArgs(char a, char b, char c) - { return staticCharMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static short staticShortMethod() { return A_SHORT_VALUE; } - public static short staticShortMethodWithArgs(short a, short b, short c) { return staticShortMethod(); } - - public short shortMethod() { return staticShortMethod(); } - public short shortMethodWithArgs(short a, short b, short c) - { return staticShortMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static int staticIntMethod() { return A_INT_VALUE; } - public static int staticIntMethodWithArgs(int a, int b, int c) { return staticIntMethod(); } - - public int intMethod() { return staticIntMethod(); } - public int intMethodWithArgs(int a, int b, int c) { return staticIntMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static long staticLongMethod() { return A_LONG_VALUE; } - public static long staticLongMethodWithArgs(long a, long b, long c) { return staticLongMethod(); } - - public long longMethod() { return staticLongMethod(); } - public long longMethodWithArgs(long a, long b, long c) - { return staticLongMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static float staticFloatMethod() { return A_FLOAT_VALUE; } - public static float staticFloatMethodWithArgs(float a, float b, float c) { return staticFloatMethod(); } - - public float floatMethod() { return staticFloatMethod(); } - public float floatMethodWithArgs(float a, float b, float c) - { return staticFloatMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static double staticDoubleMethod() { return A_DOUBLE_VALUE; } - public static double staticDoubleMethodWithArgs(double a, double b, double c) - { return staticDoubleMethod(); } - - public double doubleMethod() { return staticDoubleMethod(); } - public double doubleMethodWithArgs(double a, double b, double c) - { return staticDoubleMethodWithArgs(a, b, c); } - - // -------------------------------------------------------------------------------------------- - public static Object staticObjectMethod() { return A_OBJECT_OBJECT; } - public Object objectMethod() { return staticObjectMethod(); } - - // -------------------------------------------------------------------------------------------- - public static Class staticClassMethod() { return A_CLASS_OBJECT; } - public Class classMethod() { return staticClassMethod(); } - - // -------------------------------------------------------------------------------------------- - public static String staticStringMethod() { return A_STRING_OBJECT; } - public String stringMethod() { return staticStringMethod(); } - - // -------------------------------------------------------------------------------------------- - public static Throwable staticThrowableMethod() { return A_THROWABLE_OBJECT; } - public Throwable throwableMethod() { return staticThrowableMethod(); } - - // -------------------------------------------------------------------------------------------- - public static Object[] staticObjectArrayMethod() - { Object[] array = { new Object(), new Object(), new Object() }; return array; } - public Object[] objectArrayMethod() { return staticObjectArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static boolean[] staticBooleanArrayMethod() - { boolean[] array = { true, true, true }; return array; } - public boolean[] booleanArrayMethod() { return staticBooleanArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static byte[] staticByteArrayMethod() - { byte[] array = { 'a', 'b', 'c' }; return array; } - public byte[] byteArrayMethod() { return staticByteArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static char[] staticCharArrayMethod() - { char[] array = { 'a', 'b', 'c' }; return array; } - public char[] charArrayMethod() { return staticCharArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static short[] staticShortArrayMethod() { short[] array = { 3, 2, 1 }; return array; } - public short[] shortArrayMethod() { return staticShortArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static int[] staticIntArrayMethod() { int[] array = { 3, 2, 1 }; return array; } - public int[] intArrayMethod() { return staticIntArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static long[] staticLongArrayMethod() - { long[] array = { 3, 2, 1 }; return array; } - public long[] longArrayMethod() { return staticLongArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static float[] staticFloatArrayMethod() - { float[] array = { 1.0f, 2.0f, 3.0f }; return array; } - public float[] floatArrayMethod() { return staticFloatArrayMethod(); } - - // -------------------------------------------------------------------------------------------- - public static double[] staticDoubleArrayMethod() - { double[] array = { 3.0, 2.0, 1.0 }; return array; } - public double[] doubleArrayMethod() { return staticDoubleArrayMethod(); } -} - diff --git a/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp b/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp deleted file mode 100644 index 5de8537..0000000 --- a/tests/auto/qandroidjniobject/tst_qandroidjniobject.cpp +++ /dev/null @@ -1,1055 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QString> -#include <QtTest> -#include <QtAndroidExtras/QAndroidJniObject> -#include <QtAndroidExtras/QAndroidJniEnvironment> - -static const char testClassName[] = "org/qtproject/qt/android/testdatapackage/QtAndroidJniObjectTestClass"; - -static const jbyte A_BYTE_VALUE = 127; -static const jshort A_SHORT_VALUE = 32767; -static const jint A_INT_VALUE = 060701; -static const jlong A_LONG_VALUE = 060701; -static const jfloat A_FLOAT_VALUE = 1.0; -static const jdouble A_DOUBLE_VALUE = 1.0; -static const jboolean A_BOOLEAN_VALUE = true; -static const jchar A_CHAR_VALUE = 'Q'; - -static QString A_STRING_OBJECT() -{ - return QStringLiteral("TEST_DATA_STRING"); -} - -class tst_QAndroidJniObject : public QObject -{ - Q_OBJECT - -public: - tst_QAndroidJniObject(); - -private slots: - void initTestCase(); - - void ctor(); - void callMethodTest(); - void callObjectMethodTest(); - void stringConvertionTest(); - void compareOperatorTests(); - void callStaticObjectMethodClassName(); - void callStaticObjectMethod(); - void callStaticBooleanMethodClassName(); - void callStaticBooleanMethod(); - void callStaticCharMethodClassName(); - void callStaticCharMethod(); - void callStaticIntMethodClassName(); - void callStaticIntMethod(); - void callStaticByteMethodClassName(); - void callStaticByteMethod(); - void callStaticDoubleMethodClassName(); - void callStaticDoubleMethod(); - void callStaticFloatMethodClassName(); - void callStaticFloatMethod(); - void callStaticLongMethodClassName(); - void callStaticLongMethod(); - void callStaticShortMethodClassName(); - void callStaticShortMethod(); - void getStaticObjectFieldClassName(); - void getStaticObjectField(); - void getStaticIntFieldClassName(); - void getStaticIntField(); - void getStaticByteFieldClassName(); - void getStaticByteField(); - void getStaticLongFieldClassName(); - void getStaticLongField(); - void getStaticDoubleFieldClassName(); - void getStaticDoubleField(); - void getStaticFloatFieldClassName(); - void getStaticFloatField(); - void getStaticShortFieldClassName(); - void getStaticShortField(); - void getStaticCharFieldClassName(); - void getStaticCharField(); - void getBooleanField(); - void getIntField(); - void templateApiCheck(); - void isClassAvailable(); - void fromLocalRef(); - - void cleanupTestCase(); -}; - -tst_QAndroidJniObject::tst_QAndroidJniObject() -{ -} - -void tst_QAndroidJniObject::initTestCase() -{ -} - -void tst_QAndroidJniObject::cleanupTestCase() -{ -} - -void tst_QAndroidJniObject::ctor() -{ - { - QAndroidJniObject object; - QVERIFY(!object.isValid()); - } - - { - QAndroidJniObject object("java/lang/String"); - QVERIFY(object.isValid()); - } - - { - QAndroidJniObject string = QAndroidJniObject::fromString(QLatin1String("Hello, Java")); - QAndroidJniObject object("java/lang/String", "(Ljava/lang/String;)V", string.object<jstring>()); - QVERIFY(object.isValid()); - QCOMPARE(string.toString(), object.toString()); - } - - { - QAndroidJniEnvironment env; - jclass javaStringClass = env->FindClass("java/lang/String"); - QAndroidJniObject string(javaStringClass); - QVERIFY(string.isValid()); - } - - { - QAndroidJniEnvironment env; - const QString qString = QLatin1String("Hello, Java"); - jclass javaStringClass = env->FindClass("java/lang/String"); - QAndroidJniObject string = QAndroidJniObject::fromString(qString); - QAndroidJniObject stringCpy(javaStringClass, "(Ljava/lang/String;)V", string.object<jstring>()); - QVERIFY(stringCpy.isValid()); - QCOMPARE(qString, stringCpy.toString()); - } -} - -void tst_QAndroidJniObject::callMethodTest() -{ - { - QAndroidJniObject jString1 = QAndroidJniObject::fromString(QLatin1String("Hello, Java")); - QAndroidJniObject jString2 = QAndroidJniObject::fromString(QLatin1String("hELLO, jAVA")); - QVERIFY(jString1 != jString2); - - const jboolean isEmpty = jString1.callMethod<jboolean>("isEmpty"); - QVERIFY(!isEmpty); - - const jint ret = jString1.callMethod<jint>("compareToIgnoreCase", - "(Ljava/lang/String;)I", - jString2.object<jstring>()); - QVERIFY(0 == ret); - } - - { - jlong jLong = 100; - QAndroidJniObject longObject("java/lang/Long", "(J)V", jLong); - jlong ret = longObject.callMethod<jlong>("longValue"); - QCOMPARE(ret, jLong); - } -} - -void tst_QAndroidJniObject::callObjectMethodTest() -{ - const QString qString = QLatin1String("Hello, Java"); - QAndroidJniObject jString = QAndroidJniObject::fromString(qString); - const QString qStringRet = jString.callObjectMethod<jstring>("toUpperCase").toString(); - QCOMPARE(qString.toUpper(), qStringRet); - - QAndroidJniObject subString = jString.callObjectMethod("substring", - "(II)Ljava/lang/String;", - 0, 4); - QCOMPARE(subString.toString(), qString.mid(0, 4)); -} - -void tst_QAndroidJniObject::stringConvertionTest() -{ - const QString qString(QLatin1String("Hello, Java")); - QAndroidJniObject jString = QAndroidJniObject::fromString(qString); - QVERIFY(jString.isValid()); - QString qStringRet = jString.toString(); - QCOMPARE(qString, qStringRet); -} - -void tst_QAndroidJniObject::compareOperatorTests() -{ - QString str("hello!"); - QAndroidJniObject stringObject = QAndroidJniObject::fromString(str); - - jobject obj = stringObject.object(); - jobject jobj = stringObject.object<jobject>(); - jstring jsobj = stringObject.object<jstring>(); - - QVERIFY(obj == stringObject); - QVERIFY(jobj == stringObject); - QVERIFY(stringObject == jobj); - QVERIFY(jsobj == stringObject); - QVERIFY(stringObject == jsobj); - - QAndroidJniObject stringObject3 = stringObject.object<jstring>(); - QVERIFY(stringObject3 == stringObject); - - QAndroidJniObject stringObject2 = QAndroidJniObject::fromString(str); - QVERIFY(stringObject != stringObject2); - - jstring jstrobj = 0; - QAndroidJniObject invalidStringObject; - QVERIFY(invalidStringObject == jstrobj); - - QVERIFY(jstrobj != stringObject); - QVERIFY(stringObject != jstrobj); - QVERIFY(!invalidStringObject.isValid()); -} - -void tst_QAndroidJniObject::callStaticObjectMethodClassName() -{ - QAndroidJniObject formatString = QAndroidJniObject::fromString(QLatin1String("test format")); - QVERIFY(formatString.isValid()); - - QVERIFY(QAndroidJniObject::isClassAvailable("java/lang/String")); - QAndroidJniObject returnValue = QAndroidJniObject::callStaticObjectMethod("java/lang/String", - "format", - "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - formatString.object<jstring>(), - jobjectArray(0)); - QVERIFY(returnValue.isValid()); - - QString returnedString = returnValue.toString(); - - QCOMPARE(returnedString, QString::fromLatin1("test format")); -} - -void tst_QAndroidJniObject::callStaticObjectMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/String"); - QVERIFY(cls != 0); - - QAndroidJniObject formatString = QAndroidJniObject::fromString(QLatin1String("test format")); - QVERIFY(formatString.isValid()); - - QAndroidJniObject returnValue = QAndroidJniObject::callStaticObjectMethod(cls, - "format", - "(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;", - formatString.object<jstring>(), - jobjectArray(0)); - QVERIFY(returnValue.isValid()); - - QString returnedString = returnValue.toString(); - - QCOMPARE(returnedString, QString::fromLatin1("test format")); -} - -void tst_QAndroidJniObject::callStaticBooleanMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Boolean"); - QVERIFY(cls != 0); - - { - QAndroidJniObject parameter = QAndroidJniObject::fromString("true"); - QVERIFY(parameter.isValid()); - - jboolean b = QAndroidJniObject::callStaticMethod<jboolean>(cls, - "parseBoolean", - "(Ljava/lang/String;)Z", - parameter.object<jstring>()); - QVERIFY(b); - } - - { - QAndroidJniObject parameter = QAndroidJniObject::fromString("false"); - QVERIFY(parameter.isValid()); - - jboolean b = QAndroidJniObject::callStaticMethod<jboolean>(cls, - "parseBoolean", - "(Ljava/lang/String;)Z", - parameter.object<jstring>()); - QVERIFY(!b); - } -} - -void tst_QAndroidJniObject::callStaticBooleanMethodClassName() -{ - { - QAndroidJniObject parameter = QAndroidJniObject::fromString("true"); - QVERIFY(parameter.isValid()); - - jboolean b = QAndroidJniObject::callStaticMethod<jboolean>("java/lang/Boolean", - "parseBoolean", - "(Ljava/lang/String;)Z", - parameter.object<jstring>()); - QVERIFY(b); - } - - { - QAndroidJniObject parameter = QAndroidJniObject::fromString("false"); - QVERIFY(parameter.isValid()); - - jboolean b = QAndroidJniObject::callStaticMethod<jboolean>("java/lang/Boolean", - "parseBoolean", - "(Ljava/lang/String;)Z", - parameter.object<jstring>()); - QVERIFY(!b); - } -} - -void tst_QAndroidJniObject::callStaticByteMethodClassName() -{ - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jbyte returnValue = QAndroidJniObject::callStaticMethod<jbyte>("java/lang/Byte", - "parseByte", - "(Ljava/lang/String;)B", - parameter.object<jstring>()); - QCOMPARE(returnValue, jbyte(number.toInt())); -} - -void tst_QAndroidJniObject::callStaticByteMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Byte"); - QVERIFY(cls != 0); - - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jbyte returnValue = QAndroidJniObject::callStaticMethod<jbyte>(cls, - "parseByte", - "(Ljava/lang/String;)B", - parameter.object<jstring>()); - QCOMPARE(returnValue, jbyte(number.toInt())); -} - -void tst_QAndroidJniObject::callStaticIntMethodClassName() -{ - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jint returnValue = QAndroidJniObject::callStaticMethod<jint>("java/lang/Integer", - "parseInt", - "(Ljava/lang/String;)I", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toInt()); -} - - -void tst_QAndroidJniObject::callStaticIntMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Integer"); - QVERIFY(cls != 0); - - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jint returnValue = QAndroidJniObject::callStaticMethod<jint>(cls, - "parseInt", - "(Ljava/lang/String;)I", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toInt()); -} - -void tst_QAndroidJniObject::callStaticCharMethodClassName() -{ - jchar returnValue = QAndroidJniObject::callStaticMethod<jchar>("java/lang/Character", - "toUpperCase", - "(C)C", - jchar('a')); - QCOMPARE(returnValue, jchar('A')); -} - - -void tst_QAndroidJniObject::callStaticCharMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Character"); - QVERIFY(cls != 0); - - jchar returnValue = QAndroidJniObject::callStaticMethod<jchar>(cls, - "toUpperCase", - "(C)C", - jchar('a')); - QCOMPARE(returnValue, jchar('A')); -} - -void tst_QAndroidJniObject::callStaticDoubleMethodClassName () -{ - QString number = QString::number(123.45); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jdouble returnValue = QAndroidJniObject::callStaticMethod<jdouble>("java/lang/Double", - "parseDouble", - "(Ljava/lang/String;)D", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toDouble()); -} - - -void tst_QAndroidJniObject::callStaticDoubleMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Double"); - QVERIFY(cls != 0); - - QString number = QString::number(123.45); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jdouble returnValue = QAndroidJniObject::callStaticMethod<jdouble>(cls, - "parseDouble", - "(Ljava/lang/String;)D", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toDouble()); -} - -void tst_QAndroidJniObject::callStaticFloatMethodClassName() -{ - QString number = QString::number(123.45); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jfloat returnValue = QAndroidJniObject::callStaticMethod<jfloat>("java/lang/Float", - "parseFloat", - "(Ljava/lang/String;)F", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toFloat()); -} - - -void tst_QAndroidJniObject::callStaticFloatMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Float"); - QVERIFY(cls != 0); - - QString number = QString::number(123.45); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jfloat returnValue = QAndroidJniObject::callStaticMethod<jfloat>(cls, - "parseFloat", - "(Ljava/lang/String;)F", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toFloat()); -} - -void tst_QAndroidJniObject::callStaticShortMethodClassName() -{ - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jshort returnValue = QAndroidJniObject::callStaticMethod<jshort>("java/lang/Short", - "parseShort", - "(Ljava/lang/String;)S", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toShort()); -} - - -void tst_QAndroidJniObject::callStaticShortMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Short"); - QVERIFY(cls != 0); - - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jshort returnValue = QAndroidJniObject::callStaticMethod<jshort>(cls, - "parseShort", - "(Ljava/lang/String;)S", - parameter.object<jstring>()); - QCOMPARE(returnValue, number.toShort()); -} - -void tst_QAndroidJniObject::callStaticLongMethodClassName() -{ - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jlong returnValue = QAndroidJniObject::callStaticMethod<jlong>("java/lang/Long", - "parseLong", - "(Ljava/lang/String;)J", - parameter.object<jstring>()); - QCOMPARE(returnValue, jlong(number.toLong())); -} - -void tst_QAndroidJniObject::callStaticLongMethod() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Long"); - QVERIFY(cls != 0); - - QString number = QString::number(123); - QAndroidJniObject parameter = QAndroidJniObject::fromString(number); - - jlong returnValue = QAndroidJniObject::callStaticMethod<jlong>(cls, - "parseLong", - "(Ljava/lang/String;)J", - parameter.object<jstring>()); - QCOMPARE(returnValue, jlong(number.toLong())); -} - -void tst_QAndroidJniObject::getStaticObjectFieldClassName() -{ - { - QAndroidJniObject boolObject = QAndroidJniObject::getStaticObjectField<jobject>("java/lang/Boolean", - "FALSE", - "Ljava/lang/Boolean;"); - QVERIFY(boolObject.isValid()); - - jboolean booleanValue = boolObject.callMethod<jboolean>("booleanValue"); - QVERIFY(!booleanValue); - } - - { - QAndroidJniObject boolObject = QAndroidJniObject::getStaticObjectField<jobject>("java/lang/Boolean", - "TRUE", - "Ljava/lang/Boolean;"); - QVERIFY(boolObject.isValid()); - - jboolean booleanValue = boolObject.callMethod<jboolean>("booleanValue"); - QVERIFY(booleanValue); - } - - { - QAndroidJniObject boolObject = QAndroidJniObject::getStaticObjectField("java/lang/Boolean", - "FALSE", - "Ljava/lang/Boolean;"); - QVERIFY(boolObject.isValid()); - jboolean booleanValue = boolObject.callMethod<jboolean>("booleanValue"); - QVERIFY(!booleanValue); - } -} - -void tst_QAndroidJniObject::getStaticObjectField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Boolean"); - QVERIFY(cls != 0); - - { - QAndroidJniObject boolObject = QAndroidJniObject::getStaticObjectField<jobject>(cls, - "FALSE", - "Ljava/lang/Boolean;"); - QVERIFY(boolObject.isValid()); - - jboolean booleanValue = boolObject.callMethod<jboolean>("booleanValue"); - QVERIFY(!booleanValue); - } - - { - QAndroidJniObject boolObject = QAndroidJniObject::getStaticObjectField<jobject>(cls, - "TRUE", - "Ljava/lang/Boolean;"); - QVERIFY(boolObject.isValid()); - - jboolean booleanValue = boolObject.callMethod<jboolean>("booleanValue"); - QVERIFY(booleanValue); - } - - { - QAndroidJniObject boolObject = QAndroidJniObject::getStaticObjectField(cls, - "FALSE", - "Ljava/lang/Boolean;"); - QVERIFY(boolObject.isValid()); - - jboolean booleanValue = boolObject.callMethod<jboolean>("booleanValue"); - QVERIFY(!booleanValue); - } -} - -void tst_QAndroidJniObject::getStaticIntFieldClassName() -{ - jint i = QAndroidJniObject::getStaticField<jint>("java/lang/Double", "SIZE"); - QCOMPARE(i, 64); -} - -void tst_QAndroidJniObject::getStaticIntField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Double"); - QVERIFY(cls != 0); - - jint i = QAndroidJniObject::getStaticField<jint>(cls, "SIZE"); - QCOMPARE(i, 64); -} - -void tst_QAndroidJniObject::getStaticByteFieldClassName() -{ - jbyte i = QAndroidJniObject::getStaticField<jbyte>("java/lang/Byte", "MAX_VALUE"); - QCOMPARE(i, jbyte(127)); -} - -void tst_QAndroidJniObject::getStaticByteField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Byte"); - QVERIFY(cls != 0); - - jbyte i = QAndroidJniObject::getStaticField<jbyte>(cls, "MAX_VALUE"); - QCOMPARE(i, jbyte(127)); -} - -void tst_QAndroidJniObject::getStaticLongFieldClassName() -{ - jlong i = QAndroidJniObject::getStaticField<jlong>("java/lang/Long", "MAX_VALUE"); - QCOMPARE(i, jlong(9223372036854775807L)); -} - -void tst_QAndroidJniObject::getStaticLongField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Long"); - QVERIFY(cls != 0); - - jlong i = QAndroidJniObject::getStaticField<jlong>(cls, "MAX_VALUE"); - QCOMPARE(i, jlong(9223372036854775807L)); -} - -void tst_QAndroidJniObject::getStaticDoubleFieldClassName() -{ - jdouble i = QAndroidJniObject::getStaticField<jdouble>("java/lang/Double", "NaN"); - jlong *k = reinterpret_cast<jlong*>(&i); - QCOMPARE(*k, jlong(0x7ff8000000000000L)); -} - -void tst_QAndroidJniObject::getStaticDoubleField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Double"); - QVERIFY(cls != 0); - - jdouble i = QAndroidJniObject::getStaticField<jdouble>(cls, "NaN"); - jlong *k = reinterpret_cast<jlong*>(&i); - QCOMPARE(*k, jlong(0x7ff8000000000000L)); -} - -void tst_QAndroidJniObject::getStaticFloatFieldClassName() -{ - jfloat i = QAndroidJniObject::getStaticField<jfloat>("java/lang/Float", "NaN"); - unsigned *k = reinterpret_cast<unsigned*>(&i); - QCOMPARE(*k, unsigned(0x7fc00000)); -} - -void tst_QAndroidJniObject::getStaticFloatField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Float"); - QVERIFY(cls != 0); - - jfloat i = QAndroidJniObject::getStaticField<jfloat>(cls, "NaN"); - unsigned *k = reinterpret_cast<unsigned*>(&i); - QCOMPARE(*k, unsigned(0x7fc00000)); -} - -void tst_QAndroidJniObject::getStaticShortFieldClassName() -{ - jshort i = QAndroidJniObject::getStaticField<jshort>("java/lang/Short", "MAX_VALUE"); - QCOMPARE(i, jshort(32767)); -} - -void tst_QAndroidJniObject::getStaticShortField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Short"); - QVERIFY(cls != 0); - - jshort i = QAndroidJniObject::getStaticField<jshort>(cls, "MAX_VALUE"); - QCOMPARE(i, jshort(32767)); -} - -void tst_QAndroidJniObject::getStaticCharFieldClassName() -{ - jchar i = QAndroidJniObject::getStaticField<jchar>("java/lang/Character", "MAX_VALUE"); - QCOMPARE(i, jchar(0xffff)); -} - -void tst_QAndroidJniObject::getStaticCharField() -{ - QAndroidJniEnvironment env; - jclass cls = env->FindClass("java/lang/Character"); - QVERIFY(cls != 0); - - jchar i = QAndroidJniObject::getStaticField<jchar>(cls, "MAX_VALUE"); - QCOMPARE(i, jchar(0xffff)); -} - - -void tst_QAndroidJniObject::getBooleanField() -{ - QAndroidJniObject obj("org/qtproject/qt/android/QtActivityDelegate"); - - QVERIFY(obj.isValid()); - QVERIFY(!obj.getField<jboolean>("m_fullScreen")); -} - -void tst_QAndroidJniObject::getIntField() -{ - QAndroidJniObject obj("org/qtproject/qt/android/QtActivityDelegate"); - - QVERIFY(obj.isValid()); - jint res = obj.getField<jint>("m_currentRotation"); - QCOMPARE(res, -1); -} - -void tst_QAndroidJniObject::templateApiCheck() -{ - QAndroidJniObject testClass(testClassName); - QVERIFY(testClass.isValid()); - - // void --------------------------------------------------------------------------------------- - QAndroidJniObject::callStaticMethod<void>(testClassName, "staticVoidMethod"); - QAndroidJniObject::callStaticMethod<void>(testClassName, - "staticVoidMethodWithArgs", - "(IZC)V", - 1, - true, - 'c'); - - testClass.callMethod<void>("voidMethod"); - testClass.callMethod<void>("voidMethodWithArgs", "(IZC)V", 1, true, 'c'); - - // jboolean ----------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jboolean>(testClassName, "staticBooleanMethod")); - QVERIFY(QAndroidJniObject::callStaticMethod<jboolean>(testClassName, - "staticBooleanMethodWithArgs", - "(ZZZ)Z", - true, - true, - true)); - - QVERIFY(testClass.callMethod<jboolean>("booleanMethod")); - QVERIFY(testClass.callMethod<jboolean>("booleanMethodWithArgs", - "(ZZZ)Z", - true, - true, - true)); - - // jbyte -------------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jbyte>(testClassName, - "staticByteMethod") == A_BYTE_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jbyte>(testClassName, - "staticByteMethodWithArgs", - "(BBB)B", - 1, - 1, - 1) == A_BYTE_VALUE); - - QVERIFY(testClass.callMethod<jbyte>("byteMethod") == A_BYTE_VALUE); - QVERIFY(testClass.callMethod<jbyte>("byteMethodWithArgs", "(BBB)B", 1, 1, 1) == A_BYTE_VALUE); - - // jchar -------------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jchar>(testClassName, - "staticCharMethod") == A_CHAR_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jchar>(testClassName, - "staticCharMethodWithArgs", - "(CCC)C", - jchar(1), - jchar(1), - jchar(1)) == A_CHAR_VALUE); - - QVERIFY(testClass.callMethod<jchar>("charMethod") == A_CHAR_VALUE); - QVERIFY(testClass.callMethod<jchar>("charMethodWithArgs", - "(CCC)C", - jchar(1), - jchar(1), - jchar(1)) == A_CHAR_VALUE); - - // jshort ------------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jshort>(testClassName, - "staticShortMethod") == A_SHORT_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jshort>(testClassName, - "staticShortMethodWithArgs", - "(SSS)S", - jshort(1), - jshort(1), - jshort(1)) == A_SHORT_VALUE); - - QVERIFY(testClass.callMethod<jshort>("shortMethod") == A_SHORT_VALUE); - QVERIFY(testClass.callMethod<jshort>("shortMethodWithArgs", - "(SSS)S", - jshort(1), - jshort(1), - jshort(1)) == A_SHORT_VALUE); - - // jint --------------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jint>(testClassName, - "staticIntMethod") == A_INT_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jint>(testClassName, - "staticIntMethodWithArgs", - "(III)I", - jint(1), - jint(1), - jint(1)) == A_INT_VALUE); - - QVERIFY(testClass.callMethod<jint>("intMethod") == A_INT_VALUE); - QVERIFY(testClass.callMethod<jint>("intMethodWithArgs", - "(III)I", - jint(1), - jint(1), - jint(1)) == A_INT_VALUE); - - // jlong -------------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jlong>(testClassName, - "staticLongMethod") == A_LONG_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jlong>(testClassName, - "staticLongMethodWithArgs", - "(JJJ)J", - jlong(1), - jlong(1), - jlong(1)) == A_LONG_VALUE); - - QVERIFY(testClass.callMethod<jlong>("longMethod") == A_LONG_VALUE); - QVERIFY(testClass.callMethod<jlong>("longMethodWithArgs", - "(JJJ)J", - jlong(1), - jlong(1), - jlong(1)) == A_LONG_VALUE); - - // jfloat ------------------------------------------------------------------------------------- - QVERIFY(QAndroidJniObject::callStaticMethod<jfloat>(testClassName, - "staticFloatMethod") == A_FLOAT_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jfloat>(testClassName, - "staticFloatMethodWithArgs", - "(FFF)F", - jfloat(1.1), - jfloat(1.1), - jfloat(1.1)) == A_FLOAT_VALUE); - - QVERIFY(testClass.callMethod<jfloat>("floatMethod") == A_FLOAT_VALUE); - QVERIFY(testClass.callMethod<jfloat>("floatMethodWithArgs", - "(FFF)F", - jfloat(1.1), - jfloat(1.1), - jfloat(1.1)) == A_FLOAT_VALUE); - - // jdouble ------------------------------------------------------------------------------------ - QVERIFY(QAndroidJniObject::callStaticMethod<jdouble>(testClassName, - "staticDoubleMethod") == A_DOUBLE_VALUE); - QVERIFY(QAndroidJniObject::callStaticMethod<jdouble>(testClassName, - "staticDoubleMethodWithArgs", - "(DDD)D", - jdouble(1.1), - jdouble(1.1), - jdouble(1.1)) == A_DOUBLE_VALUE); - - QVERIFY(testClass.callMethod<jdouble>("doubleMethod") == A_DOUBLE_VALUE); - QVERIFY(testClass.callMethod<jdouble>("doubleMethodWithArgs", - "(DDD)D", - jdouble(1.1), - jdouble(1.1), - jdouble(1.1)) == A_DOUBLE_VALUE); - - // jobject ------------------------------------------------------------------------------------ - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jobject>(testClassName, - "staticObjectMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jobject>("objectMethod"); - QVERIFY(res.isValid()); - } - - // jclass ------------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jclass>(testClassName, - "staticClassMethod"); - QVERIFY(res.isValid()); - QAndroidJniEnvironment env; - QVERIFY(env->IsInstanceOf(testClass.object(), res.object<jclass>())); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jclass>("classMethod"); - QVERIFY(res.isValid()); - QAndroidJniEnvironment env; - QVERIFY(env->IsInstanceOf(testClass.object(), res.object<jclass>())); - } - // jstring ------------------------------------------------------------------------------------ - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jstring>(testClassName, - "staticStringMethod"); - QVERIFY(res.isValid()); - QVERIFY(res.toString() == A_STRING_OBJECT()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jstring>("stringMethod"); - QVERIFY(res.isValid()); - QVERIFY(res.toString() == A_STRING_OBJECT()); - - } - // jthrowable --------------------------------------------------------------------------------- - { - // The Throwable object the same message (see: "getMessage()") as A_STRING_OBJECT - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jthrowable>(testClassName, - "staticThrowableMethod"); - QVERIFY(res.isValid()); - QVERIFY(res.callObjectMethod<jstring>("getMessage").toString() == A_STRING_OBJECT()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jthrowable>("throwableMethod"); - QVERIFY(res.isValid()); - QVERIFY(res.callObjectMethod<jstring>("getMessage").toString() == A_STRING_OBJECT()); - } - - // jobjectArray ------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jobjectArray>(testClassName, - "staticObjectArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jobjectArray>("objectArrayMethod"); - QVERIFY(res.isValid()); - } - - // jbooleanArray ------------------------------------------------------------------------------ - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jbooleanArray>(testClassName, - "staticBooleanArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jbooleanArray>("booleanArrayMethod"); - QVERIFY(res.isValid()); - } - - // jbyteArray --------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jbyteArray>(testClassName, - "staticByteArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jbyteArray>("byteArrayMethod"); - QVERIFY(res.isValid()); - } - - // jcharArray --------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jcharArray>(testClassName, - "staticCharArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jcharArray>("charArrayMethod"); - QVERIFY(res.isValid()); - } - - // jshortArray -------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jshortArray>(testClassName, - "staticShortArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jshortArray>("shortArrayMethod"); - QVERIFY(res.isValid()); - } - - // jintArray ---------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jintArray>(testClassName, - "staticIntArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jintArray>("intArrayMethod"); - QVERIFY(res.isValid()); - } - - // jlongArray --------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jlongArray>(testClassName, - "staticLongArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jlongArray>("longArrayMethod"); - QVERIFY(res.isValid()); - } - - // jfloatArray -------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jfloatArray>(testClassName, - "staticFloatArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jfloatArray>("floatArrayMethod"); - QVERIFY(res.isValid()); - } - - // jdoubleArray ------------------------------------------------------------------------------- - { - QAndroidJniObject res = QAndroidJniObject::callStaticObjectMethod<jdoubleArray>(testClassName, - "staticDoubleArrayMethod"); - QVERIFY(res.isValid()); - } - - { - QAndroidJniObject res = testClass.callObjectMethod<jdoubleArray>("doubleArrayMethod"); - QVERIFY(res.isValid()); - } - -} - -void tst_QAndroidJniObject::isClassAvailable() -{ - QVERIFY(QAndroidJniObject::isClassAvailable("java/lang/String")); - QVERIFY(!QAndroidJniObject::isClassAvailable("class/not/Available")); - QVERIFY(QAndroidJniObject::isClassAvailable("org/qtproject/qt/android/QtActivityDelegate")); -} - -void tst_QAndroidJniObject::fromLocalRef() -{ - const int limit = 512 + 1; - QAndroidJniEnvironment env; - for (int i = 0; i != limit; ++i) - QAndroidJniObject o = QAndroidJniObject::fromLocalRef(env->FindClass("java/lang/String")); -} - -QTEST_APPLESS_MAIN(tst_QAndroidJniObject) - -#include "tst_qandroidjniobject.moc" |