diff options
author | Oleg Yadrov <oleg.yadrov@qt.io> | 2016-11-28 12:43:24 -0800 |
---|---|---|
committer | Oleg Yadrov <oleg.yadrov@qt.io> | 2017-01-04 00:11:04 +0000 |
commit | 0b1a2b195a1499057408075242103615466b3ecf (patch) | |
tree | 9e0e555fd71908be79a827352196ad766599675d | |
parent | 0831aa531e559a2d6dba5cbd510289212949fa56 (diff) |
Long live set top box demo
Done-with: Jake Petroules <jake.petroules@qt.io>
Change-Id: I9b2b03aba1008e25c99a3b6943c25a360bfd000f
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
84 files changed, 7250 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c0b5a28 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,7 @@ +[submodule "secrets"] + path = secrets + url = ../tqtc-demo-secrets.git + update = none +[submodule "assets/shared"] + path = assets/shared + url = ../demo-assets.git diff --git a/APIKeys.qrc b/APIKeys.qrc new file mode 100644 index 0000000..71b2b14 --- /dev/null +++ b/APIKeys.qrc @@ -0,0 +1,6 @@ +<RCC> + <qresource prefix="/"> + <file>secrets/YouTube.qml</file> + <file>secrets/TMDb.qml</file> + </qresource> +</RCC> diff --git a/LICENSE.GPL3-EXCEPT b/LICENSE.GPL3-EXCEPT new file mode 100644 index 0000000..b1cb1be --- /dev/null +++ b/LICENSE.GPL3-EXCEPT @@ -0,0 +1,704 @@ +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>. @@ -0,0 +1,18 @@ +# Set-top box demo + +This demo shows a simple set-top box style interface with the ability to +browse films and watch trailers, browse the web, and access HbbTV content. + +## Compiling + +Prerequisites: + +* Qt 5.8.0 or later +* Qt WebEngine module for web browsing (optional) +* Qt WebKit module for HbbTV support (optional) + +The demo also requires API keys for accessing YouTube and TMDb. Hardcoded keys +are provided via a QML file in a Git submodule which is accessible only to +The Qt Company. If the file is not present, users will be prompted to enter +API keys via an in-app Settings menu, which will be persisted to the device's +local settings store. diff --git a/assets/assets.qrc b/assets/assets.qrc new file mode 100644 index 0000000..8033fc7 --- /dev/null +++ b/assets/assets.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>images/particle.png</file> + </qresource> +</RCC> diff --git a/assets/images/particle.png b/assets/images/particle.png Binary files differnew file mode 100644 index 0000000..3f94805 --- /dev/null +++ b/assets/images/particle.png diff --git a/assets/shared b/assets/shared new file mode 160000 +Subproject 80f238e90624d6d3dd48af308ed274f289e92dd diff --git a/assets/shared.qrc b/assets/shared.qrc new file mode 100644 index 0000000..a7cd388 --- /dev/null +++ b/assets/shared.qrc @@ -0,0 +1,11 @@ +<RCC> + <qresource prefix="/"> + <file alias="fonts/TitilliumWeb-Bold.ttf">shared/fonts/TitilliumWeb-Bold.ttf</file> + <file alias="fonts/TitilliumWeb-Italic.ttf">shared/fonts/TitilliumWeb-Italic.ttf</file> + <file alias="fonts/TitilliumWeb-Regular.ttf">shared/fonts/TitilliumWeb-Regular.ttf</file> + <file alias="fonts/fontawesome-webfont.ttf">shared/fonts/fontawesome-webfont.ttf</file> + <file alias="qml/controls/TvRemoteInputArea.qml">shared/qml/TvRemoteInputArea.qml</file> + <file alias="qml/controls/TvRemoteInputMethod.qml">shared/qml/TvRemoteInputMethod.qml</file> + <file alias="qml/components/Time.qml">shared/qml/Time.qml</file> + </qresource> +</RCC> diff --git a/openssl/openssl.qbs b/openssl/openssl.qbs new file mode 100644 index 0000000..91b6707 --- /dev/null +++ b/openssl/openssl.qbs @@ -0,0 +1,46 @@ +import qbs +import qbs.Probes + +Product { + Probes.PathProbe { + id: pkgConfigProbe + names: ["pkg-config"] + pathSuffixes: ["bin"] + } + + Probes.PkgConfigProbe { + id: opensslProbe + executable: pkgConfigProbe.filePath + name: "libssl" + minVersion: "1.0" + + // HACK: Homebrew doesn't install OpenSSL .pc files to the "correct" directory + libDirs: ["/usr/local/opt/openssl/lib/pkgconfig"] + } + + Group { + property stringList opensslLdflags: opensslProbe.libs + condition: qbs.targetOS.contains("macos") + name: "OpenSSL" + files: { + if (!opensslLdflags) + return []; + + var libsslPath; + var libsslName; + for (var i = 0; i < opensslLdflags.length; ++i) { + if (opensslLdflags[i].startsWith("-L")) + libsslPath = opensslLdflags[i].substr(2); + if (opensslLdflags[i].startsWith("-l")) + libsslName = opensslLdflags[i].substr(2); + } + if (qbs.sysroot && libsslPath.startsWith(qbs.sysroot)) + libsslPath = libsslPath.substr(qbs.sysroot.length); + return [[libsslPath, "lib" + libsslName + "*.dylib"].join(qbs.pathSeparator)]; + } + qbs.install: true + qbs.installDir: qbs.targetOS.contains("darwin") + ? "Applications/Qt TV.app/Contents/Frameworks" + : "lib" + } +} diff --git a/plugin/Info.plist b/plugin/Info.plist new file mode 100644 index 0000000..06cb945 --- /dev/null +++ b/plugin/Info.plist @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleIdentifier</key> + <string>org.example.qt-tv-npapi-host</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0.0</string> + <key>LSMinimumSystemVersion</key> + <string>10.7</string> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/plugin/cpp/main.cpp b/plugin/cpp/main.cpp new file mode 100644 index 0000000..1169488 --- /dev/null +++ b/plugin/cpp/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QFontDatabase> +#include <QtWebKit/QWebSettings> + +void loadFonts() { + QStringList fonts { + ":/fonts/TitilliumWeb-Black.ttf", + ":/fonts/TitilliumWeb-Bold.ttf", + ":/fonts/TitilliumWeb-BoldItalic.ttf", + ":/fonts/TitilliumWeb-ExtraLight.ttf", + ":/fonts/TitilliumWeb-ExtraLightItalic.ttf", + ":/fonts/TitilliumWeb-Italic.ttf", + ":/fonts/TitilliumWeb-Light.ttf", + ":/fonts/TitilliumWeb-LightItalic.ttf", + ":/fonts/TitilliumWeb-Regular.ttf", + ":/fonts/TitilliumWeb-SemiBold.ttf", + ":/fonts/TitilliumWeb-SemiBoldItalic.ttf", + ":/fonts/fontawesome-webfont.ttf" + }; + + foreach (const QString &font, fonts) { + QFontDatabase::addApplicationFont(font); + } +} + +int main(int argc, char *argv[]) { + QGuiApplication app(argc, argv); + + loadFonts(); + + QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled, true); + + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + + return app.exec(); +} diff --git a/plugin/plugin.pro b/plugin/plugin.pro new file mode 100644 index 0000000..37a6682 --- /dev/null +++ b/plugin/plugin.pro @@ -0,0 +1,18 @@ +TEMPLATE = app +QT += qml webkit +CONFIG += console +CONFIG -= app_bundle + +TARGET = qt-tv-npapi-host + +darwin { + QMAKE_RPATHDIR += @loader_path/../Frameworks + QMAKE_LFLAGS += "-Wl,-sectcreate,__TEXT,__info_plist,$$PWD/Info.plist" +} + + +SOURCES += \ + cpp/main.cpp + +RESOURCES += \ + qml/qml.qrc diff --git a/plugin/plugin.qbs b/plugin/plugin.qbs new file mode 100644 index 0000000..98f980c --- /dev/null +++ b/plugin/plugin.qbs @@ -0,0 +1,52 @@ +import qbs + +QtGuiApplication { + Depends { name: "Android.ndk"; required: false } + + Depends { name: "Qt.core"; versionAtLeast: project.minimumQtVersion } + Depends { name: "Qt"; submodules: ["qml"] } + Depends { name: "Qt.webkit"; required: false } + Depends { name: "openssl"; profiles: [] } + + condition: Qt.webkit.present + cpp.cxxLanguageVersion: "c++11" + cpp.rpaths: qbs.targetOS.contains("darwin") ? ["@loader_path/../Frameworks"] : undefined + consoleApplication: true + targetName: "qt-tv-npapi-host" + + Properties { + condition: qbs.targetOS.contains("android") + architectures: ["x86", "armv7"] + Android.ndk.appStl: "gnustl_shared" + } + + architectures: undefined + + files: [ + "Info.plist", + ] + + Group { + name: "C++" + prefix: "cpp/" + files: [ + "main.cpp", + ] + } + + QMLGroup { + name: "QML" + prefix: "qml/" + files: [ + "main.qml", + ] + } + + Group { + fileTagsFilter: product.type + qbs.install: true + qbs.installDir: qbs.targetOS.contains("darwin") + ? "Applications/Qt TV.app/Contents/Executables" + : "bin" + } +} diff --git a/plugin/qml/main.qml b/plugin/qml/main.qml new file mode 100644 index 0000000..3f50bf5 --- /dev/null +++ b/plugin/qml/main.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtWebKit 3.0 + +Window { + id: appWindow + + visible: true + visibility: Window.FullScreen + flags: Qt.FramelessWindowHint + color: "#000000" + title: Qt.application.name + + readonly property real dp: Screen.pixelDensity * 25.4 / 160 + + WebView { + id: webView + + anchors.fill: parent + + url: "http://www.flashls.org/latest/examples/chromeless/" + } +} diff --git a/plugin/qml/qml.qrc b/plugin/qml/qml.qrc new file mode 100644 index 0000000..59d301c --- /dev/null +++ b/plugin/qml/qml.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/qml"> + <file>main.qml</file> + </qresource> +</RCC> diff --git a/qbs/imports/QMLGroup.qbs b/qbs/imports/QMLGroup.qbs new file mode 100644 index 0000000..ac0a6da --- /dev/null +++ b/qbs/imports/QMLGroup.qbs @@ -0,0 +1,8 @@ +import qbs + +Group { + fileTags: ["qt.core.resource_data"] + + Qt.core.resourceSourceBase: "qml" + Qt.core.resourcePrefix: "/qml" +} diff --git a/secrets b/secrets new file mode 160000 +Subproject f380f73a6329f85943b01720dbfdc26290940aa diff --git a/stb-demo.pro b/stb-demo.pro new file mode 100644 index 0000000..bb6d285 --- /dev/null +++ b/stb-demo.pro @@ -0,0 +1,37 @@ +defineTest(minQtVersion) { + maj = $$1 + min = $$2 + patch = $$3 + isEqual(QT_MAJOR_VERSION, $$maj) { + isEqual(QT_MINOR_VERSION, $$min) { + isEqual(QT_PATCH_VERSION, $$patch) { + return(true) + } + greaterThan(QT_PATCH_VERSION, $$patch) { + return(true) + } + } + greaterThan(QT_MINOR_VERSION, $$min) { + return(true) + } + } + greaterThan(QT_MAJOR_VERSION, $$maj) { + return(true) + } + return(false) +} + +!minQtVersion(5, 8, 0) { + message("Cannot build this demo with Qt version $${QT_VERSION}.") + error("Use at least Qt 5.8.0.") +} + +TEMPLATE = subdirs + +SUBDIRS = \ + ui + +qtHaveModule(webkit) { + SUBDIRS += plugin + ui.depends = plugin +} diff --git a/stb-demo.qbs b/stb-demo.qbs new file mode 100644 index 0000000..f0be0b6 --- /dev/null +++ b/stb-demo.qbs @@ -0,0 +1,17 @@ +import qbs + +Project { + property string minimumQtVersion: "5.8" + minimumQbsVersion: "1.7.0" + qbsSearchPaths: ["qbs"] + references: [ + "openssl/openssl.qbs", + "plugin/plugin.qbs", + "ui/ui.qbs", + ] + + Product { + name: "qmake project files" + files: ["**/*.pr[io]"] + } +} diff --git a/ui/Info-ios.plist b/ui/Info-ios.plist new file mode 100644 index 0000000..a09fd27 --- /dev/null +++ b/ui/Info-ios.plist @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDisplayName</key> + <string>Qt TV</string> + <key>CFBundleExecutable</key> + <string>Qt TV</string> + <key>CFBundleIdentifier</key> + <string>org.example.Qt-TV</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Qt TV</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0.0</string> + <key>LSMinimumSystemVersion</key> + <string>10.7</string> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>LSRequiresIPhoneOS</key> + <true/> + <key>UISupportedInterfaceOrientations</key> + <array> + <string>UIInterfaceOrientationLandscapeLeft</string> + <string>UIInterfaceOrientationLandscapeRight</string> + </array> +</dict> +</plist> diff --git a/ui/Info.plist b/ui/Info.plist new file mode 100644 index 0000000..312651f --- /dev/null +++ b/ui/Info.plist @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDisplayName</key> + <string>Qt TV</string> + <key>CFBundleExecutable</key> + <string>Qt TV</string> + <key>CFBundleIdentifier</key> + <string>org.example.Qt-TV</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Qt TV</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0.0</string> + <key>LSMinimumSystemVersion</key> + <string>10.7</string> + <key>NSAppTransportSecurity</key> + <dict> + <key>NSAllowsArbitraryLoads</key> + <true/> + </dict> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/ui/android/AndroidManifest.xml b/ui/android/AndroidManifest.xml new file mode 100644 index 0000000..267dbcf --- /dev/null +++ b/ui/android/AndroidManifest.xml @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<manifest package="org.qtproject.qttv" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto"> + <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="Qt TV"> + <activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="Qt TV" android:screenOrientation="landscape" 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="qt-tv"/> + <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%% --"/> + <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> + <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> + <!-- 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" android:value="-- %%INSERT_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%% --"/> + <!-- 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"/> + <!-- Messages maps --> + + <!-- Splash screen --> + <!-- 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 : + * 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="full"/> + <!-- extract android style --> + </activity> + + <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices --> + + </application> + + <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19"/> + <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/> + + <!-- 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 --> + +</manifest> diff --git a/ui/android/build.gradle b/ui/android/build.gradle new file mode 100644 index 0000000..ef416b0 --- /dev/null +++ b/ui/android/build.gradle @@ -0,0 +1,57 @@ +buildscript { + repositories { + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:1.1.0' + } +} + +allprojects { + repositories { + jcenter() + } +} + +apply plugin: 'com.android.application' + +dependencies { + compile fileTree(dir: 'libs', include: ['*.jar']) +} + +android { + /******************************************************* + * The following variables: + * - androidBuildToolsVersion, + * - androidCompileSdkVersion + * - qt5AndroidDir - holds the path to qt android files + * needed to build any Qt application + * on Android. + * + * are defined in gradle.properties file. This file is + * updated by QtCreator and androiddeployqt tools. + * Changing them manually might break the compilation! + *******************************************************/ + + compileSdkVersion androidCompileSdkVersion.toInteger() + + buildToolsVersion androidBuildToolsVersion + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] + aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] + res.srcDirs = [qt5AndroidDir + '/res', 'res'] + resources.srcDirs = ['src'] + renderscript.srcDirs = ['src'] + assets.srcDirs = ['assets'] + jniLibs.srcDirs = ['libs'] + } + } + + lintOptions { + abortOnError false + } +} diff --git a/ui/android/res/values/libs.xml b/ui/android/res/values/libs.xml new file mode 100644 index 0000000..43296f2 --- /dev/null +++ b/ui/android/res/values/libs.xml @@ -0,0 +1,25 @@ +<?xml version='1.0' encoding='utf-8'?> +<resources> + <array name="qt_sources"> + <item>https://download.qt.io/ministro/android/qt5/qt-5.7</item> + </array> + + <!-- The following is handled automatically by the deployment tool. It should + not be edited manually. --> + + <array name="bundled_libs"> + <!-- %%INSERT_EXTRA_LIBS%% --> + </array> + + <array name="qt_libs"> + <!-- %%INSERT_QT_LIBS%% --> + </array> + + <array name="bundled_in_lib"> + <!-- %%INSERT_BUNDLED_IN_LIB%% --> + </array> + <array name="bundled_in_assets"> + <!-- %%INSERT_BUNDLED_IN_ASSETS%% --> + </array> + +</resources> diff --git a/ui/cpp/cuterectangle.cpp b/ui/cpp/cuterectangle.cpp new file mode 100644 index 0000000..5204a10 --- /dev/null +++ b/ui/cpp/cuterectangle.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#include "cuterectangle.h" + +CuteRectangle::CuteRectangle(QQuickItem *parent) : + QQuickPaintedItem(parent), + mColor("#000000"), + mBorderColor("#000000"), + mBorderWidth(0) +{ + connect(this, SIGNAL(colorChanged(QColor)), this, SLOT(update())); + connect(this, SIGNAL(borderColorChanged(QColor)), this, SLOT(update())); + connect(this, SIGNAL(borderWidthChanged(int)), this, SLOT(update())); +} + +void CuteRectangle::paint(QPainter *painter) +{ + QPen pen(mBorderColor); + pen.setWidth(0); + if (mBorderWidth == 0) { + pen.setColor(mColor); + } + painter->setPen(pen); + + QBrush brush(mColor); + painter->setBrush(brush); + + painter->setRenderHint(QPainter::Antialiasing); + + float centerX = width() / 2.0f; + float centerY = height() / 2.0f; + + const float padding = 1.0f; // from each side, to prevent clipping + float paintedWidth; + float paintedHeight; + float cornerRadius; + + if (width() > height()) { + paintedHeight = height() - padding * 2.0f; + paintedWidth = paintedHeight * 1.35f; + } else { + paintedWidth = width() - padding * 2.0f; + paintedHeight = paintedWidth * 0.74f; + } + + cornerRadius = paintedWidth * 0.143f; + + QPainterPath path; + // start from the top right corner + path.moveTo(centerX + paintedWidth / 2.0f, centerY - paintedHeight / 2.0f); + // moving clockwise + path.lineTo(centerX + paintedWidth / 2.0f, centerY + paintedHeight / 2.0f - cornerRadius); + path.lineTo(centerX + paintedWidth / 2.0f - cornerRadius, centerY + paintedHeight / 2.0f); + path.lineTo(centerX - paintedWidth / 2.0f, centerY + paintedHeight / 2.0f); + path.lineTo(centerX - paintedWidth / 2.0f, centerY - paintedHeight / 2.0f + cornerRadius); + path.lineTo(centerX - paintedWidth / 2.0f + cornerRadius, centerY - paintedHeight / 2.0f); + path.lineTo(centerX + paintedWidth / 2.0f, centerY - paintedHeight / 2.0f); + + painter->drawPath(path); +} + +QColor CuteRectangle::color() const +{ + return mColor; +} + +void CuteRectangle::setColor(const QColor &color) +{ + if (color == mColor) return; + mColor = color; + emit colorChanged(color); +} + +QColor CuteRectangle::borderColor() const +{ + return mBorderColor; +} + +void CuteRectangle::setBorderColor(const QColor &color) +{ + if (color == mBorderColor) return; + mBorderColor = color; + emit borderColorChanged(color); +} + +int CuteRectangle::borderWidth() const +{ + return mBorderWidth; +} + +void CuteRectangle::setBorderWidth(int width) +{ + if (width == mBorderWidth) return; + mBorderWidth = width; + emit borderWidthChanged(width); +} diff --git a/ui/cpp/cuterectangle.h b/ui/cpp/cuterectangle.h new file mode 100644 index 0000000..6a9293b --- /dev/null +++ b/ui/cpp/cuterectangle.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#ifndef CUTERECTANGLE_H +#define CUTERECTANGLE_H + +#include <QQuickPaintedItem> +#include <QPainter> +#include <QPainterPath> + +class CuteRectangle : public QQuickPaintedItem +{ + Q_OBJECT + + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor NOTIFY borderColorChanged) + Q_PROPERTY(int borderWidth READ borderWidth WRITE setBorderWidth NOTIFY borderWidthChanged) + +public: + CuteRectangle(QQuickItem *parent = 0); + + void paint(QPainter *painter); + + QColor color() const; + void setColor(const QColor &color); + QColor borderColor() const; + void setBorderColor(const QColor &color); + int borderWidth() const; + void setBorderWidth(int width); + +private: + QColor mColor; + QColor mBorderColor; + int mBorderWidth; + +signals: + void colorChanged(QColor color); + void borderColorChanged(QColor color); + void borderWidthChanged(int width); +}; + +#endif // CUTERECTANGLE_H diff --git a/ui/cpp/main.cpp b/ui/cpp/main.cpp new file mode 100644 index 0000000..453ed30 --- /dev/null +++ b/ui/cpp/main.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QQmlContext> +#include <QQmlFileSelector> +#include <QFontDatabase> +#include "cuterectangle.h" +#include "processcontroller.h" +#include "webutils.h" + +#ifdef QT_WEBENGINE_LIB +#include <QtWebEngine> +#endif + +#ifdef QT_WEBVIEW_LIB +#include <QtWebView> +#endif + +void loadFonts() { + QStringList fonts { + ":/fonts/TitilliumWeb-Bold.ttf", + ":/fonts/TitilliumWeb-Italic.ttf", + ":/fonts/TitilliumWeb-Regular.ttf", + ":/fonts/fontawesome-webfont.ttf" + }; + + foreach (const QString &font, fonts) { + QFontDatabase::addApplicationFont(font); + } +} + +int main(int argc, char *argv[]) { + QGuiApplication app(argc, argv); + + QStringList extraSelectors; + + // Order of the selectors is important on macOS, which supports both QtWebEngine and QtWebView. + // Currently, macOS does not support QtWebView well, regardless of whether the QtWebEngine or + // native backend is chosen. The webengine selector comes first and so is prioritized over + // webview. + +#ifdef QT_WEBENGINE_LIB + QtWebEngine::initialize(); + extraSelectors.append(QStringLiteral("webengine")); +#endif + +#ifdef QT_WEBVIEW_LIB + QtWebView::initialize(); + extraSelectors.append(QStringLiteral("webview")); +#endif + + loadFonts(); + + qmlRegisterType<CuteRectangle>("Shapes", 1, 0, "CuteRectangle"); + + QQmlApplicationEngine engine; + + QQmlFileSelector::get(&engine)->setExtraSelectors(extraSelectors); + + ProcessController processController(&app); + engine.rootContext()->setContextProperty("processController", &processController); + WebUtils webUtils(&app); + engine.rootContext()->setContextProperty("webUtils", &webUtils); + + engine.load(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + + return app.exec(); +} diff --git a/ui/cpp/processcontroller.cpp b/ui/cpp/processcontroller.cpp new file mode 100644 index 0000000..e2f0634 --- /dev/null +++ b/ui/cpp/processcontroller.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#include "processcontroller.h" +#include <QProcess> + +class ProcessControllerPrivate { +public: +#ifndef QT_NO_PROCESS + QProcess process; +#endif +}; + +ProcessController::ProcessController(QObject *parent) + : QObject(parent) + , d(new ProcessControllerPrivate) +{ +} + +ProcessController::~ProcessController() +{ +} + +QString ProcessController::program() const +{ +#ifndef QT_NO_PROCESS + return d->process.program(); +#else + return QString(); +#endif +} + +void ProcessController::setProgram(const QString &program) +{ +#ifndef QT_NO_PROCESS + if (d->process.program() != program) { + if (d->process.state() == QProcess::NotRunning) { + d->process.setProgram(program); + emit programChanged(); + } + } +#else + Q_UNUSED(program); +#endif +} + +bool ProcessController::isRunning() const +{ +#ifndef QT_NO_PROCESS + return d->process.state() == QProcess::NotRunning; +#else + return false; +#endif +} + +void ProcessController::setRunning(bool running) +{ +#ifndef QT_NO_PROCESS + if (running) { + if (d->process.state() == QProcess::NotRunning) { + d->process.start(); + emit runningChanged(); + } + } else { + if (d->process.state() != QProcess::NotRunning) { + d->process.close(); + emit runningChanged(); + } + } +#else + Q_UNUSED(running); +#endif +} + +bool ProcessController::isAvailable() const +{ +#ifndef QT_NO_PROCESS + return QFileInfo(d->process.program()).exists(); +#else + return false; +#endif +} diff --git a/ui/cpp/processcontroller.h b/ui/cpp/processcontroller.h new file mode 100644 index 0000000..59934ac --- /dev/null +++ b/ui/cpp/processcontroller.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#ifndef PROCESSCONTROLLER_H +#define PROCESSCONTROLLER_H + +#include <QObject> +#include <QCoreApplication> +#include <QFileInfo> +#include <QDebug> + +class ProcessControllerPrivate; + +class ProcessController : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QString program READ program WRITE setProgram NOTIFY programChanged) + Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) + Q_PROPERTY(bool available READ isAvailable NOTIFY programChanged) + +public: + explicit ProcessController(QObject *parent = 0); + virtual ~ProcessController(); + + QString program() const; + void setProgram(const QString &program); + + bool isRunning() const; + void setRunning(bool running); + + bool isAvailable() const; + +private: + QScopedPointer<ProcessControllerPrivate> d; + +signals: + void programChanged(); + void runningChanged(); +}; + +#endif // PROCESSCONTROLLER_H diff --git a/ui/cpp/webutils.cpp b/ui/cpp/webutils.cpp new file mode 100644 index 0000000..673af56 --- /dev/null +++ b/ui/cpp/webutils.cpp @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#include "webutils.h" + +WebUtils::WebUtils(QObject *parent) : + QObject(parent) +{ +} + +bool WebUtils::isAvailable() const +{ +#if defined(QT_WEBENGINE_LIB) || defined(QT_WEBVIEW_LIB) + return true; +#else + return false; +#endif +} diff --git a/ui/cpp/webutils.h b/ui/cpp/webutils.h new file mode 100644 index 0000000..bcbadb3 --- /dev/null +++ b/ui/cpp/webutils.h @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +#ifndef WEBUTILS_H +#define WEBUTILS_H + +#include <QtCore/QFileInfo> +#include <QtCore/QUrl> + +class WebUtils : public QObject { + Q_OBJECT + + Q_PROPERTY(bool available READ isAvailable CONSTANT) + +public: + WebUtils(QObject *parent = 0); + + bool isAvailable() const; + + Q_INVOKABLE static QUrl fromUserInput(const QString& userInput); +}; + +inline QUrl WebUtils::fromUserInput(const QString& userInput) +{ + QFileInfo fileInfo(userInput); + + if (fileInfo.exists()) { + return QUrl::fromLocalFile(fileInfo.absoluteFilePath()); + } + + return QUrl::fromUserInput(userInput); +} + +#endif // WEBUTILS_H diff --git a/ui/qml/components/Colors.qml b/ui/qml/components/Colors.qml new file mode 100644 index 0000000..2b6397b --- /dev/null +++ b/ui/qml/components/Colors.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +QtObject { + id: colors + + readonly property color background1: "#3b7c74" + readonly property color background2: "#104a58" + readonly property color background3: "#04304d" + readonly property color background4: "#041f3a" + readonly property color background5: "#021124" + + readonly property color gray1: Qt.rgba(0.0, 0.0, 0.0, 0.4) + readonly property color gray2: Qt.rgba(0.0, 0.0, 0.0, 0.8) + readonly property color gray3: "#999999" + readonly property color gray4: "#555555" + + readonly property color green1: "#41cd52" + readonly property color green2: "#dcfcbd" + + readonly property color yellow1: "#ffef26" + + readonly property color white1: "#ffffff" + readonly property color white2: Qt.rgba(1.0, 1.0, 1.0, 0.8) + readonly property color white3: Qt.rgba(1.0, 1.0, 1.0, 0.5) + readonly property color white4: Qt.rgba(1.0, 1.0, 1.0, 0.06) + + readonly property color black: "#000000" + readonly property color transparent: Qt.rgba(0.0, 0.0, 0.0, 0.0) +} diff --git a/ui/qml/components/Fonts.qml b/ui/qml/components/Fonts.qml new file mode 100644 index 0000000..d4db9a5 --- /dev/null +++ b/ui/qml/components/Fonts.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +QtObject { + id: fonts + + readonly property string titillium: "Titillium Web" + readonly property string fontAwesome: "FontAwesome" +} diff --git a/ui/qml/components/JSONListModel.qml b/ui/qml/components/JSONListModel.qml new file mode 100644 index 0000000..154c4ca --- /dev/null +++ b/ui/qml/components/JSONListModel.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../scripts/XMLHttpRequestCache.js" as XMLHttpRequestCache + +ListModel { + id: jsonListModel + + property string source: "" + property bool working: false + property string arrayPropertyName: "" + property bool cached: true + property int cacheUpdateInterval: 1000 * 60 * 10 // 10 minutes + + onSourceChanged: { + function processResponse(responseText) { + var items = JSON.parse(responseText)[arrayPropertyName] + + if (items) { + var i = 0 + var count = items.length + for (; i < count; i++) { + var item = items[i] + if (typeof item === "object") { + jsonListModel.append(item) + } + } + } + + working = false + } + + working = true + + jsonListModel.clear() + + var usingCacheData = false + + if (cached) { + var cacheData = XMLHttpRequestCache.cache[source] + + if (cacheData) { + if (new Date().getTime() - cacheData.timestamp < cacheUpdateInterval) { + usingCacheData = true + processResponse(cacheData.response) + } + } + } + + if (!usingCacheData) { + var xhr = new XMLHttpRequest + xhr.open("GET", source) + + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + XMLHttpRequestCache.cache[source] = { + timestamp: new Date().getTime(), + response: xhr.responseText + } + + processResponse(xhr.responseText) + } + } + + xhr.send() + } + } +} diff --git a/ui/qml/components/JSONQuery.qml b/ui/qml/components/JSONQuery.qml new file mode 100644 index 0000000..ac54af5 --- /dev/null +++ b/ui/qml/components/JSONQuery.qml @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.0 + +QtObject { + id: jsonQuery + + property var source + property var result + + onSourceChanged: { + var xhr = new XMLHttpRequest + xhr.open("GET", source) + + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status === 200) { + result = JSON.parse(xhr.responseText) + } else { + result = "Network error, status code: %1".arg(xhr.status) + } + + } + } + + xhr.send() + } +} diff --git a/ui/qml/components/Settings.qml b/ui/qml/components/Settings.qml new file mode 100644 index 0000000..32ba5bd --- /dev/null +++ b/ui/qml/components/Settings.qml @@ -0,0 +1,93 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../scripts/datamodels.js" as DataModels +import "../scripts/3rdparty/YoutubeClientV3.js" as YoutubeClient + +QtObject { + id: settings + + property string youTubeKey: "" + property string tmdbKey: "" + + readonly property int minimumVolume: 0 + readonly property int maximumVolume: 5 + property int volume: 5 + + readonly property var requiredKeys: ["YouTube", "TMDb"] + property var missingKeys: [] + + signal initialized() + + onYouTubeKeyChanged: { + YoutubeClient.youTubeDataKey = youTubeKey + } + + onTmdbKeyChanged: { + DataModels.apiKey = tmdbKey + } + + Component.onCompleted: { + if (requiredKeys.length > 0) { + keyLoader.loadKey(0) + } else { + initialized() + } + } + + property Loader keyLoader: Loader { + property int currentKeyIndex + + function loadKey(index) { + currentKeyIndex = index + source = Qt.resolvedUrl("qrc:/secrets/%1.qml".arg(requiredKeys[index])) + } + + onStatusChanged: { + if (status === Loader.Ready) { + switch (currentKeyIndex) { + case 0: + settings.youTubeKey = item.key + break + case 1: + settings.tmdbKey = item.key + break + } + } else if (status === Loader.Error) { + settings.missingKeys.push(settings.requiredKeys[currentKeyIndex]) + } + + if (status === Loader.Ready || + status === Loader.Error) { + if (currentKeyIndex < settings.requiredKeys.length - 1) { + loadKey(currentKeyIndex + 1) + } else { + settings.initialized() + } + } + } + } +} diff --git a/ui/qml/controls/+webengine/WebView.qml b/ui/qml/controls/+webengine/WebView.qml new file mode 100644 index 0000000..5c85300 --- /dev/null +++ b/ui/qml/controls/+webengine/WebView.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtWebEngine 1.3 as WebEngine + +// Some websites (https://youtube.com/leanback, for example) can grab focus forever +// https://bugreports.qt.io/browse/QTBUG-46251 +WebEngine.WebEngineView { + focus: true + settings.focusOnNavigationEnabled: false + settings.pluginsEnabled: true +} diff --git a/ui/qml/controls/+webview/WebView.qml b/ui/qml/controls/+webview/WebView.qml new file mode 100644 index 0000000..87e25f7 --- /dev/null +++ b/ui/qml/controls/+webview/WebView.qml @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtWebView 1.1 as WebView + +WebView.WebView { + focus: true +} diff --git a/ui/qml/controls/AbstractButton.qml b/ui/qml/controls/AbstractButton.qml new file mode 100644 index 0000000..e241456 --- /dev/null +++ b/ui/qml/controls/AbstractButton.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: abstractButton + + property alias pressed: mouseArea.pressed + signal clicked() + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + item: abstractButton + } + + MouseArea { + id: mouseArea + + anchors.fill: parent + + onPressed: { + abstractButton.forceActiveFocus() + } + + onClicked: { + abstractButton.clicked() + } + } + + Keys.onPressed: { + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) + { + abstractButton.clicked() + } + } +} diff --git a/ui/qml/controls/ApplicationButton.qml b/ui/qml/controls/ApplicationButton.qml new file mode 100644 index 0000000..a9d22d0 --- /dev/null +++ b/ui/qml/controls/ApplicationButton.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import Shapes 1.0 + +AbstractButton { + id: applicationButton + + opacity: enabled ? 1 : 0.25 + + width: 446 * dp + height: 330 * dp + + property alias text: label.text + property alias icon: icon.text + + states: [ + State { + name: "" + + PropertyChanges { + target: applicationButton + scale: 1 + } + }, + State { + name: "selected" + when: applicationButton.activeFocus + + PropertyChanges { + target: applicationButton + scale: 1.07 + } + } + ] + + transitions: [ + Transition { + from: "" + to: "selected" + + PropertyAnimation { + property: "scale" + duration: 160 + easing.type: Easing.InOutQuad + } + } + ] + + CuteRectangle { + anchors.fill: parent + + color: applicationButton.activeFocus ? colors.green1 + : colors.gray1 + } + + Label { + id: icon + + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -30 * dp + + horizontalAlignment: Text.AlignHCenter + + font.family: fonts.fontAwesome + font.pixelSize: 140 * dp + color: applicationButton.activeFocus ? colors.white1 + : colors.white2 + } + + Label { + id: label + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 * dp + + horizontalAlignment: Text.AlignHCenter + + font.family: fonts.titillium + font.pixelSize: 42 * dp + color: applicationButton.activeFocus ? colors.white1 + : colors.white2 + } +} diff --git a/ui/qml/controls/ApplicationWindow.qml b/ui/qml/controls/ApplicationWindow.qml new file mode 100644 index 0000000..857707b --- /dev/null +++ b/ui/qml/controls/ApplicationWindow.qml @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Window 2.2 +import "../components" + +Window { + id: applicationWindow + + visible: true + visibility: Window.FullScreen + flags: Qt.Window | Qt.WindowFullscreenButtonHint + color: colors.white1 + title: Qt.application.name + + readonly property Colors colors: Colors {} + readonly property Fonts fonts: Fonts {} + + readonly property real dp: physicalSizeMultiplier > 0 ? Screen.pixelDensity * 25.4 / 160 * physicalSizeMultiplier + : Screen.pixelDensity * 25.4 / 160 + readonly property real originalDeviceDiagonal: 15 // 15 inch macbook pro + property real physicalSizeMultiplier: (((Math.sqrt(Math.pow(Screen.width, 2) + Math.pow(Screen.height, 2)) / Screen.pixelDensity) / 25.4) / originalDeviceDiagonal) + +// Component.onCompleted: { +// var diagonalInPixels = Math.sqrt(Math.pow(Screen.width, 2) + Math.pow(Screen.height, 2)) +// var diagonalInMillimeters = diagonalInPixels / Screen.pixelDensity +// var diagonalInInches = diagonalInMillimeters / 25.4 + +// physicalSizeMultiplier = diagonalInInches / testDeviceDiagonal +// } + + property Item focusedItem: null + signal backPressed() + + onActiveFocusItemChanged: { + if (focusedItem !== null && focusedItem.Keys !== undefined) + focusedItem.Keys.onPressed.disconnect(onKeyPressed) + + if (activeFocusItem !== null) + { + activeFocusItem.Keys.onPressed.connect(onKeyPressed) + focusedItem = activeFocusItem + } + } + + function onKeyPressed(event) { + if (event.key === Qt.Key_Back || + event.key === Qt.Key_Escape || + event.key === Qt.Key_Menu) + { + if (Qt.inputMethod.visible) { + Qt.inputMethod.hide() + } else { + backPressed() + } + + event.accepted = true + } + } +} diff --git a/ui/qml/controls/BaseScreen.qml b/ui/qml/controls/BaseScreen.qml new file mode 100644 index 0000000..2439681 --- /dev/null +++ b/ui/qml/controls/BaseScreen.qml @@ -0,0 +1,32 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +FocusScope { + id: baseScreen + + enabled: !stackView.busy +} diff --git a/ui/qml/controls/BusyIndicator.qml b/ui/qml/controls/BusyIndicator.qml new file mode 100644 index 0000000..32f8084 --- /dev/null +++ b/ui/qml/controls/BusyIndicator.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Label { + id: busyIndicator + + property alias running: animation.running + + color: colors.white2 + font.family: fonts.fontAwesome + font.pixelSize: 160 * dp + + text: "\uf021" + + RotationAnimation on rotation { + id: animation + + from: 0 + to: 360 + duration: 1400 + loops: RotationAnimation.Infinite + running: busyIndicator.visible + } +} diff --git a/ui/qml/controls/HorizontalSpacer.qml b/ui/qml/controls/HorizontalSpacer.qml new file mode 100644 index 0000000..9813172 --- /dev/null +++ b/ui/qml/controls/HorizontalSpacer.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: horizontalSpacer + + anchors.top: parent.top + anchors.bottom: parent.bottom +} diff --git a/ui/qml/controls/InvalidSettingsOverlay.qml b/ui/qml/controls/InvalidSettingsOverlay.qml new file mode 100644 index 0000000..94d5cf1 --- /dev/null +++ b/ui/qml/controls/InvalidSettingsOverlay.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +OverlayItem { + id: invalidSettingsOverlay + + closeOnOuterClick: false + closeOnBackButtonPress: false + + signal accepted() + + Rectangle { + anchors.fill: parent + + color: colors.gray2 + } + + Rectangle { + anchors.centerIn: parent + + width: 1200 * dp + height: 360 * dp + + radius: 8 * dp + color: colors.black + border.width: 4 * dp + border.color: colors.white2 + + Column { + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.leftMargin: 40 * dp + anchors.rightMargin: 40 * dp + anchors.topMargin: 20 * dp + + Label { + anchors.left: parent.left + anchors.right: parent.right + + wrapMode: Text.Wrap + + color: colors.green1 + font.family: fonts.titillium + font.pixelSize: 50 * dp + + text: qsTr("Missing YouTube and/or TMDb API keys") + } + + Label { + anchors.left: parent.left + anchors.right: parent.right + + wrapMode: Text.Wrap + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + text: qsTr("Please enter valid API keys for these services in Settings to access film trailers and information in Movies.") + } + } + + TextButton { + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.rightMargin: 40 * dp + anchors.bottomMargin: 40 * dp + + width: 260 * dp + + focus: true + + text: qsTr("Go to Settings") + + onClicked: { + invalidSettingsOverlay.accepted() + } + } + } +} diff --git a/ui/qml/controls/Label.qml b/ui/qml/controls/Label.qml new file mode 100644 index 0000000..c5fe695 --- /dev/null +++ b/ui/qml/controls/Label.qml @@ -0,0 +1,35 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Text { + id: label + + font.family: "Titillium Web" + renderType: Text.QtRendering + elide: Text.ElideRight + color: colors.black +} diff --git a/ui/qml/controls/NavigationStack.qml b/ui/qml/controls/NavigationStack.qml new file mode 100644 index 0000000..954a1c5 --- /dev/null +++ b/ui/qml/controls/NavigationStack.qml @@ -0,0 +1,101 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 + +StackView { + id: navigationStack + + readonly property int transitionDuration: 300 + + onCurrentItemChanged: { + if (currentItem && overlay.visibleChildren.length === 0) { + currentItem.forceActiveFocus() + } + } + + delegate: StackViewDelegate { + pushTransition: StackViewTransition { + ParallelAnimation { + PropertyAnimation { + target: enterItem + property: "scale" + from: 1.4 + to: 1 + duration: navigationStack.transitionDuration + } + + PropertyAnimation { + target: enterItem + property: "opacity" + from: 0 + to: 1 + duration: navigationStack.transitionDuration + } + } + + ParallelAnimation { + PropertyAnimation { + target: exitItem + property: "opacity" + from: 1 + to: 0 + duration: navigationStack.transitionDuration / 2 + } + } + } + + popTransition: StackViewTransition { + ParallelAnimation { + PropertyAnimation { + target: exitItem + property: "scale" + from: 1 + to: 1.4 + duration: navigationStack.transitionDuration / 2 + } + + PropertyAnimation { + target: exitItem + property: "opacity" + from: 1 + to: 0 + duration: navigationStack.transitionDuration / 2 + } + } + + ParallelAnimation { + PropertyAnimation { + target: enterItem + property: "opacity" + from: 0 + to: 1 + duration: navigationStack.transitionDuration + } + } + } + } +} diff --git a/ui/qml/controls/OverlayItem.qml b/ui/qml/controls/OverlayItem.qml new file mode 100644 index 0000000..0867833 --- /dev/null +++ b/ui/qml/controls/OverlayItem.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +FocusScope { + id: overlayItem + + parent: overlay + anchors.fill: parent + + visible: false + + property bool closeOnOuterClick: true + property bool closeOnBackButtonPress: true + + function open() { + z = overlay.visibleChildren.length + visible = true + forceActiveFocus() + } + + function close() { + visible = false + stackView.currentItem.forceActiveFocus() + } + + MouseArea { + anchors.fill: parent + + onClicked: { + if (overlayItem.closeOnOuterClick) { + overlayItem.close() + } + } + } +} diff --git a/ui/qml/controls/PageIndicator.qml b/ui/qml/controls/PageIndicator.qml new file mode 100644 index 0000000..ad04f4a --- /dev/null +++ b/ui/qml/controls/PageIndicator.qml @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: pageIndicator + + property alias count: repeater.model + property int currentIndex: 0 + + width: row.width + height: row.height + + Row { + id: row + + anchors.centerIn: parent + + spacing: 10 * dp + + Repeater { + id: repeater + + delegate: Rectangle { + width: 16 * dp + height: width + + radius: width / 2 + + scale: index === pageIndicator.currentIndex ? 1.2 + : 1.0 + + color: index === pageIndicator.currentIndex ? colors.green1 + : colors.gray4 + } + } + } +} diff --git a/ui/qml/controls/RoundButton.qml b/ui/qml/controls/RoundButton.qml new file mode 100644 index 0000000..93b62f9 --- /dev/null +++ b/ui/qml/controls/RoundButton.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +AbstractButton { + id: roundButton + + width: 120 * dp + height: width + + property alias icon: label.text + + Rectangle { + anchors.fill: parent + + radius: roundButton.width / 2 + + color: roundButton.activeFocus ? colors.green1 + : colors.gray1 + } + + Label { + id: label + + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + + horizontalAlignment: Text.AlignHCenter + + font.family: fonts.fontAwesome + font.pixelSize: roundButton.height * 0.5 + color: roundButton.activeFocus ? colors.white1 + : colors.white2 + } +} diff --git a/ui/qml/controls/SeekSlider.qml b/ui/qml/controls/SeekSlider.qml new file mode 100644 index 0000000..e37bb83 --- /dev/null +++ b/ui/qml/controls/SeekSlider.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: seekSlider + + height: 80 * dp + + property real position: 0.5 + property real sliderHeight: 20 * dp + property alias seeking: mouseArea.pressed + readonly property alias seekingPosition: mouseArea.seekingPosition + + function updateHandlePosition() { + if (seeking) { + handle.x = (seekSlider.width - handle.width) * seekSlider.seekingPosition + } else { + handle.x = (seekSlider.width - handle.width) * seekSlider.position + } + } + + onWidthChanged: { + updateHandlePosition() + } + + onPositionChanged: { + updateHandlePosition() + } + + onSeekingChanged: { + updateHandlePosition() + } + + onSeekingPositionChanged: { + updateHandlePosition() + } + + Rectangle { + id: progressRectangle + + anchors.left: parent.left + anchors.right: handle.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: handle.radius + + height: seekSlider.sliderHeight + + radius: height / 2 + color: colors.white2 + } + + Rectangle { + id: backgroundRectangle + + anchors.left: handle.horizontalCenter + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.rightMargin: handle.radius + + height: seekSlider.sliderHeight + + radius: height / 2 + color: colors.white3 + } + + Rectangle { + id: handle + + anchors.verticalCenter: parent.verticalCenter + + width: 60 * dp + height: 60 * dp + + radius: 30 * dp + + color: colors.gray3 + border.width: 20 * dp + border.color: colors.white1 + } + + MouseArea { + id: mouseArea + + anchors.fill: parent + + property real seekingPosition: 0.0 + + onMouseXChanged: { + if (mouseX < handle.width / 2) { + seekingPosition = 0.0 + } else if (mouseX > seekSlider.width - handle.width / 2) { + seekingPosition = 1.0 + } else { + seekingPosition = (mouseX - handle.width / 2) / (seekSlider.width - handle.width) + } + } + } +} diff --git a/ui/qml/controls/TextButton.qml b/ui/qml/controls/TextButton.qml new file mode 100644 index 0000000..bde0de1 --- /dev/null +++ b/ui/qml/controls/TextButton.qml @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import Shapes 1.0 + +AbstractButton { + id: textButton + + implicitWidth: 220 * dp + implicitHeight: 80 * dp + + opacity: enabled ? 1 : 0.4 + + property alias text: label.text + + Rectangle { + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: textButton.activeFocus ? colors.green1 + : colors.gray1 + } + + Label { + id: label + + anchors.fill: parent + anchors.leftMargin: 30 * dp + anchors.rightMargin: 30 * dp + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + color: textButton.activeFocus ? colors.white1 + : colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + } +} diff --git a/ui/qml/controls/TextInputField.qml b/ui/qml/controls/TextInputField.qml new file mode 100644 index 0000000..d3ce735 --- /dev/null +++ b/ui/qml/controls/TextInputField.qml @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: textInputField + + implicitWidth: 400 * dp + implicitHeight: 80 * dp + + property alias placeholderText: placeholderLabel.text + property alias text: textInput.text + readonly property bool acceptingInput: textInput.activeFocus + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + item: textInputField + } + + Rectangle { + id: backgroundRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.gray1 + } + + TextInput { + id: textInput + + anchors.fill: parent + anchors.leftMargin: 30 * dp + anchors.rightMargin: 30 * dp + + verticalAlignment: Text.AlignVCenter + + clip: true + + color: if (textInputField.activeFocus) colors.green1 + else if (textInput.activeFocus) colors.white2 + else colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + cursorDelegate: Rectangle { + id: cursorDelegate + + width: 3 * dp + + color: colors.white2 + + Connections { + target: textInput + + onActiveFocusChanged: { + if (target.activeFocus) { + cursorAnimation.start() + } else { + cursorAnimation.stop() + } + } + + onCursorPositionChanged: { + if (target.activeFocus) { + cursorAnimation.restart() + } + } + } + + SequentialAnimation { + id: cursorAnimation + + running: false + loops: SequentialAnimation.Infinite + + onStopped: { + cursorDelegate.visible = false + } + + PropertyAction { + target: cursorDelegate + property: "visible" + value: true + } + + PauseAnimation { + duration: 440 + } + + PropertyAction { + target: cursorDelegate + property: "visible" + value: false + } + + PauseAnimation { + duration: 440 + } + } + } + + Keys.onPressed: { + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) + { + textInputField.forceActiveFocus() + event.accepted = true + } + } + } + + Label { + id: placeholderLabel + + anchors.fill: parent + anchors.leftMargin: 30 * dp + anchors.rightMargin: 30 * dp + + verticalAlignment: Text.AlignVCenter + + color: textInputField.activeFocus || textInput.activeFocus ? colors.green1 + : colors.white3 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + visible: !textInput.activeFocus && textInput.text === "" + } + + Rectangle { + id: focusRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.transparent + border.width: Math.round(3 * dp) + border.color: colors.green1 + + visible: textInputField.activeFocus || textInput.activeFocus + } + + Keys.onPressed: { + if (textInput.activeFocus) { + return + } + + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) + { + textInput.forceActiveFocus() + event.accepted = true + } + } +} diff --git a/ui/qml/controls/ToolBar.qml b/ui/qml/controls/ToolBar.qml new file mode 100644 index 0000000..2dfc0e5 --- /dev/null +++ b/ui/qml/controls/ToolBar.qml @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +FocusScope { + id: toolBar + + z: 2 + + MouseArea { + anchors.fill: parent + } +} diff --git a/ui/qml/controls/UrlInputField.qml b/ui/qml/controls/UrlInputField.qml new file mode 100644 index 0000000..0f1bccb --- /dev/null +++ b/ui/qml/controls/UrlInputField.qml @@ -0,0 +1,249 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: urlInputField + + implicitWidth: 400 * dp + implicitHeight: 80 * dp + + property real progress: 0.0 + property real minimumProgress: 0.1 + property bool loading: false + property alias placeholderText: placeholderLabel.text + property alias text: textInput.text + readonly property bool acceptingInput: textInput.activeFocus + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + item: urlInputField + } + + onLoadingChanged: { + if (loading) { + fadeOutAnimation.stop() + progressRectangle.width = 0 + progressRectangle.opacity = 1 + } else { + fadeOutAnimation.start() + } + } + + onProgressChanged: { + var newWidth = urlInputField.progress > urlInputField.minimumProgress + ? width * urlInputField.progress + : width * urlInputField.minimumProgress + + if (newWidth > progressRectangle.width) { + progressAnimation.stop() + progressAnimation.from = progressRectangle.width + progressAnimation.to = newWidth + progressAnimation.restart() + } else { + progressRectangle.width = newWidth + } + } + + Rectangle { + id: backgroundRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.gray1 + } + + Rectangle { + id: progressRectangle + + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: parent.bottom + + radius: Math.round(8 * dp) + color: colors.white4 + + NumberAnimation { + id: progressAnimation + target: progressRectangle + properties: "width" + duration: 200 + loops: 1 + running: false + } + + SequentialAnimation { + id: fadeOutAnimation + + loops: 1 + running: false + + PauseAnimation { + duration: 500 + } + + NumberAnimation { + target: progressRectangle + properties: "opacity" + from: 1 + to: 0 + duration: 200 + } + } + } + + TextInput { + id: textInput + + anchors.fill: parent + anchors.leftMargin: 30 * dp + anchors.rightMargin: 30 * dp + + verticalAlignment: Text.AlignVCenter + + clip: true + + color: if (urlInputField.activeFocus) colors.green1 + else if (textInput.activeFocus) colors.white2 + else colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + cursorDelegate: Rectangle { + id: cursorDelegate + + width: 3 * dp + + color: colors.white2 + + Connections { + target: textInput + + onActiveFocusChanged: { + if (target.activeFocus) { + cursorAnimation.start() + } else { + cursorAnimation.stop() + } + } + + onCursorPositionChanged: { + if (target.activeFocus) { + cursorAnimation.restart() + } + } + } + + SequentialAnimation { + id: cursorAnimation + + running: false + loops: SequentialAnimation.Infinite + + onStopped: { + cursorDelegate.visible = false + } + + PropertyAction { + target: cursorDelegate + property: "visible" + value: true + } + + PauseAnimation { + duration: 440 + } + + PropertyAction { + target: cursorDelegate + property: "visible" + value: false + } + + PauseAnimation { + duration: 440 + } + } + } + + Keys.onPressed: { + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) + { + urlInputField.forceActiveFocus() + event.accepted = true + } + } + } + + Label { + id: placeholderLabel + + anchors.fill: parent + anchors.leftMargin: 30 * dp + anchors.rightMargin: 30 * dp + + verticalAlignment: Text.AlignVCenter + + + color: urlInputField.activeFocus || textInput.activeFocus ? colors.green1 + : colors.white3 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + visible: !textInput.activeFocus && textInput.text === "" + } + + Rectangle { + id: focusRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.transparent + border.width: Math.round(3 * dp) + border.color: colors.green1 + + visible: urlInputField.activeFocus || textInput.activeFocus + } + + Keys.onPressed: { + if (textInput.activeFocus) { + return + } + + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) + { + textInput.forceActiveFocus() + event.accepted = true + } + } +} diff --git a/ui/qml/controls/VerticalDissolveEffect.qml b/ui/qml/controls/VerticalDissolveEffect.qml new file mode 100644 index 0000000..582abfc --- /dev/null +++ b/ui/qml/controls/VerticalDissolveEffect.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +ShaderEffect { + id: verticalDissolveEffect + + property real length: sourceHeight / 2 + property real sourceHeight: 0 + readonly property real effectiveLength: { + if (length <= 0) sourceHeight + else if (length >= (sourceHeight / 2)) 1 + else Math.sqrt(1 / Math.pow(length / sourceHeight, 2)) + } + + fragmentShader: " + varying highp vec2 qt_TexCoord0; + uniform lowp float qt_Opacity; + uniform sampler2D source; + + uniform lowp float effectiveLength; + + void main() { + lowp vec4 texture = texture2D(source, qt_TexCoord0); + + lowp float dist = abs(qt_TexCoord0.y - 0.5) * (effectiveLength * 2.0); + texture *= min(1.0, (effectiveLength - dist)); + + gl_FragColor = texture * qt_Opacity; + }" +} diff --git a/ui/qml/controls/VerticalSpacer.qml b/ui/qml/controls/VerticalSpacer.qml new file mode 100644 index 0000000..d346001 --- /dev/null +++ b/ui/qml/controls/VerticalSpacer.qml @@ -0,0 +1,33 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + id: verticalSpacer + + anchors.left: parent.left + anchors.right: parent.right +} diff --git a/ui/qml/controls/VideoPlayer.qml b/ui/qml/controls/VideoPlayer.qml new file mode 100644 index 0000000..e3e4cae --- /dev/null +++ b/ui/qml/controls/VideoPlayer.qml @@ -0,0 +1,474 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtMultimedia 5.5 + +FocusScope { + id: videoPlayer + + property alias autoPlay: video.autoPlay + property int hideControlPanelTimeout: hideControlPanelTimer.interval + property alias duration: video.duration + property alias playbackRate: video.playbackRate + property alias playbackState: video.playbackState + property alias position: video.position + property alias source: video.source + property alias volume: video.volume + + signal closePressed() + + function play() { + video.play() + } + + function stop() { + video.stop() + } + + function pause() { + video.pause() + } + + function seek(offset) { + video.seek(offset) + } + + Video { + id: video + + anchors.fill: parent + + autoPlay: true + volume: (settings.volume - settings.minimumVolume) / settings.maximumVolume + + function fastForwardPlaybackRate() { + if (playbackRate < 2.0) { + return 2.0 + } else if (playbackRate < 5.0) { + return 5.0 + } else if (playbackRate < 10.0) { + return 10.0 + } else if (playbackRate < 30.0) { + return 30.0 + } else if (playbackRate < 60.0) { + return 60.0 + } else { + return 2.0 + } + } + + function fastBackwardPlaybackRate() { + if (playbackRate > -2.0) { + return -2.0 + } else if (playbackRate > -5.0) { + return -5 + } else if (playbackRate > -10.0) { + return -10.0 + } else if (playbackRate > -30.0) { + return -30.0 + } else if (playbackRate > -60.0) { + return -60.0 + } else { + return -2.0 + } + } + + function formatDuration(durationInMilliseconds) { + var hours = Math.floor(durationInMilliseconds / (1000 * 60 * 60)) + hours = (hours > 0) ? hours + ":" : "" + var minutes = Math.floor((durationInMilliseconds / (1000 * 60)) % 60) + minutes = (minutes < 10) ? "0" + minutes : minutes + var seconds = Math.floor((durationInMilliseconds / 1000) % 60) + seconds = (seconds < 10) ? "0" + seconds : seconds + + return "%1%2:%3".arg(hours).arg(minutes).arg(seconds) + } + + function userActionDetected() { + if (!controlPanel.visible) { + controlPanel.visible = true + } + + hideControlPanelTimer.restart() + } + + onPlaybackStateChanged: { + if (playbackState === MediaPlayer.StoppedState) { + playbackRate = 1.0 + + if (position === duration) { + seek(0) + } + } + } + } + + Timer { + id: hideControlPanelTimer + + interval: 3000 + repeat: false + running: true + onTriggered: { + controlPanel.visible = false + } + } + + MouseArea { + anchors.fill: parent + + onPressedChanged: { + video.userActionDetected() + } + } + + FocusScope { + id: controlPanel + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + height: 180 * dp + + focus: true + + Rectangle { + anchors.fill: parent + + color: colors.gray2 + } + + VideoPlayerButton { + id: closeButton + + anchors.left: parent.left + anchors.top: parent.top + anchors.leftMargin: 50 * dp + anchors.topMargin: 30 * dp + + focus: true + + icon: "\uf053" + + KeyNavigation.right: fastBackwardButton + + Keys.onPressed: { + video.userActionDetected() + } + + onPressedChanged: { + video.userActionDetected() + } + + onClicked: { + videoPlayer.stop() + videoPlayer.closePressed() + } + } + + Label { + anchors.right: playbackControlButtonsRow.left + anchors.top: parent.top + anchors.rightMargin: 50 * dp + anchors.topMargin: 31 * dp + + visible: videoPlayer.playbackRate < -1.0 + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 35 * dp + + text: "%1×".arg(Math.abs(videoPlayer.playbackRate)) + } + + Row { + id: playbackControlButtonsRow + + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 30 * dp + + spacing: 60 * dp + + VideoPlayerButton { + id: fastBackwardButton + + icon: "\uf04a" + + onPressedChanged: { + video.userActionDetected() + } + + KeyNavigation.left: closeButton + KeyNavigation.right: playPauseButton + + Keys.onPressed: { + video.userActionDetected() + } + + onClicked: { + var temp = video.fastBackwardPlaybackRate() + + if (videoPlayer.playbackState === MediaPlayer.PausedState || + videoPlayer.playbackState === MediaPlayer.StoppedState) + { + videoPlayer.play() + } + + videoPlayer.playbackRate = temp + } + } + + VideoPlayerButton { + id: playPauseButton + + icon: videoPlayer.playbackState === MediaPlayer.PausedState || + videoPlayer.playbackState === MediaPlayer.StoppedState ? "\uf04b" + : "\uf04c" + + KeyNavigation.left: fastBackwardButton + KeyNavigation.right: fastForwardButton + + Keys.onPressed: { + video.userActionDetected() + } + + onPressedChanged: { + video.userActionDetected() + } + + onClicked: { + if (videoPlayer.playbackState === MediaPlayer.PausedState || + videoPlayer.playbackState === MediaPlayer.StoppedState) + { + videoPlayer.play() + } else { + videoPlayer.pause() + videoPlayer.playbackRate = 1.0 + } + } + } + + VideoPlayerButton { + id: fastForwardButton + + icon: "\uf04e" + + KeyNavigation.left: playPauseButton + KeyNavigation.right: volumeDownButton + + Keys.onPressed: { + video.userActionDetected() + } + + onPressedChanged: { + video.userActionDetected() + } + + onClicked: { + var temp = video.fastForwardPlaybackRate() + + if (videoPlayer.playbackState === MediaPlayer.PausedState || + videoPlayer.playbackState === MediaPlayer.StoppedState) + { + videoPlayer.play() + } + + videoPlayer.playbackRate = temp + } + } + } + + Label { + anchors.left: playbackControlButtonsRow.right + anchors.top: parent.top + anchors.leftMargin: 50 * dp + anchors.topMargin: 31 * dp + + visible: videoPlayer.playbackRate > 1.0 + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 35 * dp + + text: "%1×".arg(Math.abs(videoPlayer.playbackRate)) + } + + Row { + id: volumeControlButtonsRow + + anchors.right: parent.right + anchors.top: parent.top + anchors.rightMargin: 50 * dp + anchors.topMargin: 30 * dp + + spacing: 10 * dp + + VideoPlayerButton { + id: volumeDownButton + + icon: "\uf027" + + KeyNavigation.left: fastForwardButton + KeyNavigation.right: volumeUpButton + + Keys.onPressed: { + video.userActionDetected() + } + + onPressedChanged: { + video.userActionDetected() + } + + onClicked: { + var newVolume = (settings.volume - 1) + if (newVolume >= settings.minimumVolume) { + settings.volume = newVolume + } + } + } + + HorizontalSpacer { + width: 10 * dp + } + + Repeater { + model: 5 + delegate: Label { + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -5 * dp + + font.family: fonts.fontAwesome + font.pixelSize: 24 * dp + + color: colors.white2 + text: (index + 1) > settings.volume ? "\uf10c" : "\uf111" + } + } + + HorizontalSpacer { + width: 10 * dp + } + + VideoPlayerButton { + id: volumeUpButton + + icon: "\uf028" + + KeyNavigation.left: volumeDownButton + + Keys.onPressed: { + video.userActionDetected() + } + + onPressedChanged: { + video.userActionDetected() + } + + onClicked: { + var newVolume = (settings.volume + 1) + if (newVolume <= settings.maximumVolume) { + settings.volume = newVolume + } + } + } + } + + Label { + id: playbackPositionLabel + + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.leftMargin: 50 * dp + anchors.bottomMargin: 25 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 35 * dp + + text: video.formatDuration(videoPlayer.position) + } + + SeekSlider { + id: seekSlider + + anchors.left: playbackPositionLabel.right + anchors.right: durationLabel.left + anchors.bottom: parent.bottom + anchors.leftMargin: 20 * dp + anchors.rightMargin: 20 * dp + anchors.bottomMargin: 10 * dp + + position: (videoPlayer.duration > 0) ? videoPlayer.position / videoPlayer.duration : 0 + + property bool wasPlayingWhenSeekingStarted: false + + onSeekingChanged: { + video.userActionDetected() + + if (seeking) { + wasPlayingWhenSeekingStarted = (videoPlayer.playbackState === MediaPlayer.PlayingState) + videoPlayer.pause() + videoPlayer.playbackRate = 1.0 + } else { + videoPlayer.seek(videoPlayer.duration * seekingPosition) + + if (wasPlayingWhenSeekingStarted) { + videoPlayer.play() + } + } + } + + Timer { + interval: 1000 + repeat: true + running: seekSlider.seeking + triggeredOnStart: true + onTriggered: { + video.userActionDetected() + + videoPlayer.seek(videoPlayer.duration * seekSlider.seekingPosition) + } + } + } + + Label { + id: durationLabel + + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.rightMargin: 50 * dp + anchors.bottomMargin: 25 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 35 * dp + + text: video.formatDuration(videoPlayer.duration) + } + } +} diff --git a/ui/qml/controls/VideoPlayerButton.qml b/ui/qml/controls/VideoPlayerButton.qml new file mode 100644 index 0000000..1296bd2 --- /dev/null +++ b/ui/qml/controls/VideoPlayerButton.qml @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +AbstractButton { + id: videoPlayerButton + + property alias icon: label.text + + width: 70 * dp + height: 70 * dp + + Label { + id: label + + anchors.fill: parent + + color: videoPlayerButton.activeFocus ? colors.green1 + : colors.white1 + font.family: fonts.fontAwesome + font.pixelSize: 60 * dp + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignHCenter + } +} diff --git a/ui/qml/controls/WebView.qml b/ui/qml/controls/WebView.qml new file mode 100644 index 0000000..2a442f5 --- /dev/null +++ b/ui/qml/controls/WebView.qml @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + property url url + readonly property int loadProgress: 0 + readonly property bool loading: false + + Text { + anchors.fill: parent + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + color: colors.white1 + font.pixelSize: 140 * dp + text: qsTr("Browser unavailable") + } +} diff --git a/ui/qml/main.qml b/ui/qml/main.qml new file mode 100644 index 0000000..83a50b2 --- /dev/null +++ b/ui/qml/main.qml @@ -0,0 +1,161 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Window 2.2 +import QtGraphicalEffects 1.0 +import QtQuick.Particles 2.0 +import "components" +import "controls" +import "screens" + +ApplicationWindow { + id: appWindow + + property Settings settings: Settings { + onInitialized: { + if (missingKeys.length > 0) { + invalidSettingsOverlay.open() + } + } + } + + onBackPressed: { + if (overlay.visibleChildren.length > 0) { + var topOverlayItem = overlay.visibleChildren[overlay.visibleChildren.length - 1] + if (topOverlayItem.closeOnBackButtonPress) { + topOverlayItem.close() + } + } else if (stackView.depth > 1) { + stackView.pop() + } else { + Qt.quit() + } + } + + RadialGradient { + id: backgroundGradient + + anchors.fill: parent + + horizontalRadius: Math.min(width, height) + verticalRadius: horizontalRadius + + SequentialAnimation { + id: horizontalAnimation + + loops: Animation.Infinite + running: true + + NumberAnimation { + target: backgroundGradient + property: "horizontalOffset" + easing.type: Easing.InOutSine + duration: 8000 + from: -width / 4 + to: width / 4 + onFromChanged: horizontalAnimation.restart() + onToChanged: horizontalAnimation.restart() + } + + NumberAnimation { + target: backgroundGradient + property: "horizontalOffset" + easing.type: Easing.InOutSine + duration: 8000 + from: width / 4 + to: -width / 4 + onFromChanged: horizontalAnimation.restart() + onToChanged: horizontalAnimation.restart() + } + } + + gradient: Gradient { + GradientStop { position: 0.0; color: colors.background1 } + GradientStop { position: 0.25; color: colors.background2 } + GradientStop { position: 0.5; color: colors.background3 } + GradientStop { position: 0.75; color: colors.background4 } + GradientStop { position: 1.0; color: colors.background5 } + } + } + + ParticleSystem { + anchors.fill: parent + + ImageParticle { + groups: "green" + source: "qrc:/images/particle.png" + opacity: 0.1 + color: colors.green2 + } + + Emitter { + anchors.fill: parent + + group: "green" + + emitRate: 2 + startTime: lifeSpan + lifeSpan: 10000 + + size: 1200 * dp + sizeVariation: 400 * dp + + velocity: AngleDirection { + angleVariation: 360 + magnitude: 80 * dp + magnitudeVariation: 20 * dp + } + } + } + + NavigationStack { + id: stackView + + anchors.fill: parent + + initialItem: MainScreen {} + } + + Item { + id: overlay + + anchors.fill: parent + } + + InvalidSettingsOverlay { + id: invalidSettingsOverlay + + onAccepted: { + close() + stackView.push(Qt.resolvedUrl("qrc:/qml/screens/SettingsScreen.qml")) + } + } + + Loader { + anchors.fill: parent + source: Qt.platform.os === "tvos" ? "qrc:/qml/controls/TvRemoteInputArea.qml" : "" + } +} diff --git a/ui/qml/qml.qrc b/ui/qml/qml.qrc new file mode 100644 index 0000000..3e045dd --- /dev/null +++ b/ui/qml/qml.qrc @@ -0,0 +1,52 @@ +<RCC> + <qresource prefix="/qml"> + <file>components/Colors.qml</file> + <file>components/Fonts.qml</file> + <file>components/JSONListModel.qml</file> + <file>components/JSONQuery.qml</file> + <file>components/Settings.qml</file> + <file>controls/+webengine/WebView.qml</file> + <file>controls/+webview/WebView.qml</file> + <file>controls/AbstractButton.qml</file> + <file>controls/ApplicationButton.qml</file> + <file>controls/ApplicationWindow.qml</file> + <file>controls/BaseScreen.qml</file> + <file>controls/BusyIndicator.qml</file> + <file>controls/HorizontalSpacer.qml</file> + <file>controls/Label.qml</file> + <file>controls/NavigationStack.qml</file> + <file>controls/RoundButton.qml</file> + <file>controls/SeekSlider.qml</file> + <file>controls/TextButton.qml</file> + <file>controls/TextInputField.qml</file> + <file>controls/UrlInputField.qml</file> + <file>controls/VerticalSpacer.qml</file> + <file>controls/VideoPlayer.qml</file> + <file>controls/VideoPlayerButton.qml</file> + <file>controls/WebView.qml</file> + <file>main.qml</file> + <file>screens/MainScreen.qml</file> + <file>screens/MovieDetailsScreen.qml</file> + <file>screens/MoviesControls/AnimatedText.qml</file> + <file>screens/MoviesControls/BackgroundPoster.qml</file> + <file>screens/MoviesControls/MovieCatalogButton.qml</file> + <file>screens/MoviesControls/MoviePoster.qml</file> + <file>screens/MoviesControls/ImageButton.qml</file> + <file>screens/MoviesScreen.qml</file> + <file>screens/SettingsScreen.qml</file> + <file>screens/TrailerScreen.qml</file> + <file>screens/WebBrowserScreen.qml</file> + <file>scripts/3rdparty/YoutubeClientV3.js</file> + <file>scripts/datamodels.js</file> + <file>screens/MoviesControls/MovieCatalogView.qml</file> + <file>controls/VerticalDissolveEffect.qml</file> + <file>controls/ToolBar.qml</file> + <file>screens/MoviesControls/MovieImagesView.qml</file> + <file>controls/OverlayItem.qml</file> + <file>screens/MoviesControls/ImagePreviewOverlay.qml</file> + <file>screens/MoviesControls/WebViewOverlay.qml</file> + <file>scripts/XMLHttpRequestCache.js</file> + <file>controls/InvalidSettingsOverlay.qml</file> + <file>controls/PageIndicator.qml</file> + </qresource> +</RCC> diff --git a/ui/qml/screens/MainScreen.qml b/ui/qml/screens/MainScreen.qml new file mode 100644 index 0000000..d0a19ca --- /dev/null +++ b/ui/qml/screens/MainScreen.qml @@ -0,0 +1,149 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import Shapes 1.0 +import "../controls" +import "../components" + +BaseScreen { + id: mainScreen + + Time { + id: time + + twentyFourHourFormat: false + } + + Label { + id: timeLabel + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 100 * dp + font.weight: Font.Thin + text: "%1:%2" + .arg(time.hour) + .arg(time.minute < 10 ? "0" + time.minute : time.minute) + + Label { + anchors.left: parent.right + anchors.leftMargin: 8 * dp + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: 26 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + text: time.amPm + } + } + + Grid { + id: buttonsGrid + + anchors.centerIn: parent + + columns: 2 + rows: 2 + columnSpacing: 50 * dp + rowSpacing: 50 * dp + + ApplicationButton { + id: moviesButton + + focus: true + + icon: "\uf26c" + text: qsTr("MOVIES") + + KeyNavigation.right: settingsButton + KeyNavigation.down: webBrowserButton + + onClicked: { + stackView.push(Qt.resolvedUrl("qrc:/qml/screens/MoviesScreen.qml")) + } + } + + ApplicationButton { + id: settingsButton + + icon: "\uf085" + text: qsTr("SETTINGS") + + KeyNavigation.left: moviesButton + KeyNavigation.down: npapiPluginButton + + onClicked: { + stackView.push(Qt.resolvedUrl("qrc:/qml/screens/SettingsScreen.qml")) + } + } + + ApplicationButton { + id: webBrowserButton + + enabled: webUtils.available + + icon: "\uf0ac" + text: qsTr("WEB BROWSER") + + KeyNavigation.up: moviesButton + KeyNavigation.right: npapiPluginButton + + onClicked: { + stackView.push(Qt.resolvedUrl("qrc:/qml/screens/WebBrowserScreen.qml")) + } + } + + ApplicationButton { + id: npapiPluginButton + + enabled: processController.available + + icon: "\uf1c8" + text: qsTr("NPAPI PLUGIN") + + Component.onCompleted: { + if (Qt.platform.os === "macos") { + processController.program = "./../Executables/qt-tv-npapi-host" + } else { + processController.program = "./qt-tv-npapi-host" + } + } + + KeyNavigation.left: webBrowserButton + KeyNavigation.up: settingsButton + + onClicked: { + processController.running = true + } + } + } +} diff --git a/ui/qml/screens/MovieDetailsScreen.qml b/ui/qml/screens/MovieDetailsScreen.qml new file mode 100644 index 0000000..a339ab5 --- /dev/null +++ b/ui/qml/screens/MovieDetailsScreen.qml @@ -0,0 +1,373 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import "../scripts/datamodels.js" as DataModels +import "../controls" +import "../components" +import "MoviesControls" + +BaseScreen { + id: movieDetailsScreen + + property var selectedMovie + + ToolBar { + id: toolBar + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + height: 170 * dp + + focus: true + + RoundButton { + id: backButton + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 40 * dp + + focus: true + + icon: "\uf060" + + KeyNavigation.right: trailerButton + KeyNavigation.down: movieImagesView.count > 0 ? movieImagesView : null + + onClicked: { + stackView.pop() + } + } + + Row { + anchors.left: backButton.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 50 * dp + + spacing: 30 * dp + + TextButton { + id: trailerButton + + width: 260 * dp + + text: qsTr("Watch Trailer") + + KeyNavigation.left: backButton + KeyNavigation.right: imdbButton + KeyNavigation.down: movieImagesView.count > 0 ? movieImagesView : null + + onClicked: { + stackView.push({ + item: Qt.resolvedUrl("qrc:/qml/screens/TrailerScreen.qml"), + properties: { + "movieId" : movieQuery.youtubeId, + "movieTitle" : selectedMovie.title + } + }) + } + } + + TextButton { + id: imdbButton + + text: qsTr("IMDB") + + KeyNavigation.left: trailerButton + KeyNavigation.down: movieImagesView.count > 0 ? movieImagesView : null + + onClicked: { + if (movieQuery.imdbId !== "") { + webViewOverlay.url = "http://www.imdb.com/title/%1".arg(movieQuery.imdbId) + } else { + webViewOverlay.url = "https://www.themoviedb.org/movie/%1".arg(selectedMovie.movieId) + } + webViewOverlay.open() + } + } + } + } + + MoviePoster { + id: moviePosterImage + + anchors.left: parent.left + anchors.top: toolBar.bottom + anchors.bottom: movieImagesView.top + anchors.leftMargin: 80 * dp + anchors.topMargin: 20 * dp + anchors.bottomMargin: 40 * dp + + width: height * 0.66 + + source: selectedMovie.imageUrl + } + + Label { + id: movieTitleLabel + + anchors.left: moviePosterImage.right + anchors.right: parent.right + anchors.top: toolBar.bottom + anchors.leftMargin: 40 * dp + anchors.rightMargin: 20 * dp + anchors.topMargin: 20 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 50 * dp + font.bold: true + + text: selectedMovie.title + } + + Row { + id: movieInfoRow + + anchors.left: moviePosterImage.right + anchors.right: parent.right + anchors.top: movieTitleLabel.bottom + + anchors.leftMargin: 40 * dp + anchors.rightMargin: 20 * dp + + spacing: 10 * dp + + Label { + anchors.verticalCenter: parent.verticalCenter + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + text: selectedMovie.releaseYear + } + + Row { + anchors.verticalCenter: parent.verticalCenter + + spacing: 5 * dp + + Repeater { + id: ratingStarsRepeater + + model: 5 + delegate: Label { + color: colors.yellow1 + font.family: fonts.fontAwesome + font.pixelSize: 30 * dp + + text: { + if (index + 1 < movieQuery.vote_average) "\uf005" + else if (movieQuery.vote_average - index > 0.25) "\uf123" + else "\uf006" + } + } + } + } + + AnimatedText { + anchors.verticalCenter: parent.verticalCenter + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + text: movieQuery.runtime + } + } + + AnimatedText { + id: movieGenresLabel + + anchors.left: moviePosterImage.right + anchors.right: parent.right + anchors.top: movieInfoRow.bottom + + anchors.leftMargin: 40 * dp + anchors.rightMargin: 20 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.italic: true + + text: movieQuery.genres + } + + AnimatedText { + id: movieDescriptionLabel + + anchors.left: moviePosterImage.right + anchors.right: parent.right + anchors.top: movieGenresLabel.bottom + anchors.bottom: movieImagesView.bottom + anchors.leftMargin: 40 * dp + anchors.rightMargin: 20 * dp + anchors.topMargin: 20 * dp + anchors.bottomMargin: 20 * dp + + wrapMode: Text.Wrap + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + + text: movieQuery.synopsis + } + + MovieImagesView { + id: movieImagesView + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.leftMargin: 80 * dp + anchors.rightMargin: 80 * dp + anchors.bottomMargin: 40 * dp + + KeyNavigation.up: toolBar + KeyNavigation.priority: KeyNavigation.BeforeItem + + onClicked: { + imagePreviewOverlay.model = movieQuery.images + imagePreviewOverlay.currentIndex = currentIndex + imagePreviewOverlay.open() + } + + onSwipedLeft: { + movieImagesView.decrementCurrentIndex() + } + + onSwipedRight: { + movieImagesView.incrementCurrentIndex() + } + + onSwipedUp: { + var item = movieImagesView.KeyNavigation.up + if (item && item.enabled) { + item.forceActiveFocus() + } + } + + onSwipedDown: { + var item = movieImagesView.KeyNavigation.down + if (item && item.enabled) { + item.forceActiveFocus() + } + } + } + + JSONQuery { + id: movieQuery + + property string synopsis + property string youtubeId + property real vote_average + property int vote_count + property string imdbId + property string genres + property string runtime + property var images: [] + + source: DataModels.formatQuery("movie/%1".arg(selectedMovie.movieId), { append_to_response: "trailers,images"} ) + + onResultChanged: { + var i + + // Extract genres + if (result.genres) { + var genresArray = [] + + for (i = 0; i < result.genres.length; i++) { + genresArray.push(result.genres[i].name) + } + + genres = genresArray.join(", ") + } + + // Extract trailer if available + var trailer + if (result.trailers) { + for (i = 0; i < result.trailers.youtube.length; i++) { + trailer = result.trailers.youtube[i].source + break + } + } + + youtubeId = trailer ? trailer : "" + + // Extract previews + if (result.images) { + var backdrops = result.images.backdrops + + for (i = 0; i < backdrops.length; i++) { + images.push(backdrops[i].file_path) + } + } + + // Extract overview + if (result.overview) { + synopsis = result.overview + } else { + synopsis = qsTr("No synopsis available") + } + + if (result.imdb_id) { + imdbId = result.imdb_id + } + + if (result.vote_average) { + vote_average = result.vote_average / 2 + } else { + vote_average = 0 + } + + // Extract runtime + if (result.runtime) { + var hours = Math.floor(result.runtime / 60) + var minutes = result.runtime - hours * 60 + if (hours > 0) { + runtime = "%1h %2m".arg(hours).arg(minutes) + } else { + runtime = "%1m".arg(minutes) + } + } + + movieImagesView.model = images + } + } + + ImagePreviewOverlay { + id: imagePreviewOverlay + } + + WebViewOverlay { + id: webViewOverlay + } +} diff --git a/ui/qml/screens/MoviesControls/AnimatedText.qml b/ui/qml/screens/MoviesControls/AnimatedText.qml new file mode 100644 index 0000000..2717fcd --- /dev/null +++ b/ui/qml/screens/MoviesControls/AnimatedText.qml @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" + +Label { + id: animatedText + + onTextChanged: { + animation.restart() + } + + NumberAnimation { + id: animation + + target: animatedText + property: "opacity" + from: 0 + to: 1 + duration: 500 + easing.type: Easing.InSine + } +} diff --git a/ui/qml/screens/MoviesControls/BackgroundPoster.qml b/ui/qml/screens/MoviesControls/BackgroundPoster.qml new file mode 100644 index 0000000..efacb16 --- /dev/null +++ b/ui/qml/screens/MoviesControls/BackgroundPoster.qml @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 + +Image { + id: backgroundPoster + + fillMode: Image.PreserveAspectCrop + + ParallelAnimation { + id: opacityAnimation + + NumberAnimation { + target: backgroundPoster + property: "opacity" + from: 0 + to: 0.05 + duration: 1000 + easing.type: Easing.InOutCubic + } + + NumberAnimation { + target: backgroundPoster + property: "scale" + from: 1.3 + to: 1 + duration: 10000 + easing.type: Easing.OutSine + } + } + + onStatusChanged: { + if (status == Image.Ready) { + opacityAnimation.restart() + } + } +} diff --git a/ui/qml/screens/MoviesControls/ImageButton.qml b/ui/qml/screens/MoviesControls/ImageButton.qml new file mode 100644 index 0000000..28c532c --- /dev/null +++ b/ui/qml/screens/MoviesControls/ImageButton.qml @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" + +AbstractButton { + id: imageButton + + implicitWidth: 540 * dp + implicitHeight: 321 * dp + + property alias imageSource: image.source + + states: [ + State { + name: "" + + PropertyChanges { + target: imageButton + scale: 1 + } + }, + State { + name: "selected" + when: imageButton.activeFocus + + PropertyChanges { + target: imageButton + scale: 1.07 + } + } + ] + + transitions: [ + Transition { + from: "selected" + to: "" + + PropertyAnimation { + property: "scale" + duration: 160 + easing.type: Easing.InOutQuad + } + } + ] + + Rectangle { + id: backgroundRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.gray1 + } + + Rectangle { + id: focusRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.transparent + border.width: Math.round(3 * dp) + border.color: colors.green1 + + visible: imageButton.activeFocus + } + + Image { + id: image + + anchors.fill: parent + anchors.margins: 20 * dp + + height: width + + visible: status === Image.Ready + opacity: status === Image.Ready ? 1 : 0 + + Behavior on opacity { + NumberAnimation { + duration: 1000 + } + } + + fillMode: Image.PreserveAspectCrop + } +} diff --git a/ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml b/ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml new file mode 100644 index 0000000..5e1967f --- /dev/null +++ b/ui/qml/screens/MoviesControls/ImagePreviewOverlay.qml @@ -0,0 +1,142 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../scripts/datamodels.js" as DataModels +import "../../controls" + +OverlayItem { + id: imagePreviewOverlay + + property int currentIndex: -1 + property alias model: listView.model + + onCurrentIndexChanged: { + listView.positionViewAtIndex(currentIndex, ListView.Center) + listView.currentIndex = currentIndex + } + + Rectangle { + anchors.fill: parent + + color: colors.gray2 + } + + ListView { + id: listView + + anchors.fill: parent + + focus: true + + orientation: ListView.Horizontal + snapMode: ListView.SnapToItem + boundsBehavior: Flickable.StopAtBounds + highlightMoveDuration: 300 + cacheBuffer: width * 2 + highlightRangeMode: ListView.StrictlyEnforceRange + preferredHighlightBegin: 0 + preferredHighlightEnd: width + + delegate: Item { + width: listView.width + height: listView.height + + Keys.onPressed: { + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) { + imagePreviewOverlay.close() + } + } + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + mode: manualFocusMode + + onSwipedLeft: { + listView.decrementCurrentIndex() + } + + onSwipedRight: { + listView.incrementCurrentIndex() + } + } + + MouseArea { + anchors.fill: parent + + onClicked: { + imagePreviewOverlay.close() + } + } + + BusyIndicator { + id: busyIndicator + + anchors.centerIn: parent + + visible: image.status !== Image.Ready + } + + Rectangle { + anchors.fill: image + anchors.margins: -8 * dp + + radius: 8 * dp + color: colors.white2 + + visible: image.status === Image.Ready + } + + Image { + id: image + + anchors.centerIn: parent + + property real aspectRatio: sourceSize.width / sourceSize.height + width: parent.width * 0.8 + height: width / aspectRatio + + source: DataModels.posterPathURL(modelData, 1000) + } + } + } + + Item { + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + // distance between bottom side of the image and bottom side of the screen + height: (parent.height - (parent.width * 0.8 / 1.78)) / 2 + + PageIndicator { + anchors.centerIn: parent + + count: listView.count + currentIndex: listView.currentIndex + } + } +} diff --git a/ui/qml/screens/MoviesControls/MovieCatalogButton.qml b/ui/qml/screens/MoviesControls/MovieCatalogButton.qml new file mode 100644 index 0000000..5438448 --- /dev/null +++ b/ui/qml/screens/MoviesControls/MovieCatalogButton.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" + +AbstractButton { + id: movieCatalogButton + + implicitWidth: 100 * dp + implicitHeight: 100 * dp + + property alias thumbnailSource: thumbnail.source + property alias text: label.text + + states: [ + State { + name: "" + + PropertyChanges { + target: movieCatalogButton + scale: 1 + } + }, + State { + name: "selected" + when: movieCatalogButton.activeFocus + + PropertyChanges { + target: movieCatalogButton + scale: 1.07 + } + } + ] + + transitions: [ + Transition { + from: "selected" + to: "" + + PropertyAnimation { + property: "scale" + duration: 160 + easing.type: Easing.InOutQuad + } + } + ] + + Rectangle { + id: backgroundRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.gray1 + } + + Rectangle { + id: focusRectangle + + anchors.fill: parent + + radius: Math.round(8 * dp) + + color: colors.transparent + border.width: Math.round(3 * dp) + border.color: colors.green1 + + visible: movieCatalogButton.activeFocus + } + + Image { + id: thumbnail + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.margins: 20 * dp + + height: width + + visible: status === Image.Ready + opacity: status === Image.Ready ? 1 : 0 + + Behavior on opacity { + NumberAnimation { + duration: 1000 + } + } + + fillMode: Image.PreserveAspectCrop + } + + Label { + id: label + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: thumbnail.bottom + anchors.bottom: parent.bottom + anchors.leftMargin: 20 * dp + anchors.rightMargin: 20 * dp + anchors.topMargin: 10 * dp + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignTop + wrapMode: Text.Wrap + maximumLineCount: 2 + + font.family: fonts.titillium + font.pixelSize: height / 4 + font.bold: true + + color: movieCatalogButton.activeFocus ? colors.green1 + : colors.white2 + } +} diff --git a/ui/qml/screens/MoviesControls/MovieCatalogView.qml b/ui/qml/screens/MoviesControls/MovieCatalogView.qml new file mode 100644 index 0000000..f2b2c66 --- /dev/null +++ b/ui/qml/screens/MoviesControls/MovieCatalogView.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" +import "../../scripts/datamodels.js" as DataModels + +ListView { + id: movieCatalogView + + property alias title: titleLabel.text + + property int itemsOnScreen: 7 + property real delegateSizeAspectRatio: 0.7 + spacing: 30 * dp + property int spacesOnScreen: Math.max(itemsOnScreen - 1, 0) + property real delegateWidth: spacesOnScreen > 0 ? width / itemsOnScreen - spacing * spacesOnScreen / itemsOnScreen + : 200 * dp + property real delegateHeight: delegateWidth / delegateSizeAspectRatio + property int firstVisibleItemIndex: Math.round(Math.abs(contentX / (delegateWidth + spacing))) + + height: customHeaderItem.height + delegateHeight + orientation: ListView.Horizontal + snapMode: ListView.SnapToItem + boundsBehavior: Flickable.StopAtBounds + highlightMoveDuration: 200 + displayMarginBeginning: delegateWidth + displayMarginEnd: delegateWidth + + signal clicked() + signal swipedLeft() + signal swipedRight() + signal swipedUp() + signal swipedDown() + + Item { + id: customHeaderItem + + height: 80 * dp + + Label { + id: titleLabel + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + } + } + + delegate: MovieCatalogButton { + anchors.bottom: movieCatalogView.contentItem.bottom + + width: movieCatalogView.delegateWidth + height: movieCatalogView.delegateHeight + + thumbnailSource: DataModels.posterPathURL(model.poster_path, 92) + text: model.title ? model.title : "" + + onPressedChanged: { + if (pressed) { + movieCatalogView.currentIndex = index + } + } + + onClicked: movieCatalogView.clicked() + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + mode: manualFocusMode + + onSwipedLeft: { + movieCatalogView.swipedLeft() + } + + onSwipedRight: { + movieCatalogView.swipedRight() + } + + onSwipedUp: { + movieCatalogView.swipedUp() + } + + onSwipedDown: { + movieCatalogView.swipedDown() + } + } + } +} diff --git a/ui/qml/screens/MoviesControls/MovieImagesView.qml b/ui/qml/screens/MoviesControls/MovieImagesView.qml new file mode 100644 index 0000000..daccfd0 --- /dev/null +++ b/ui/qml/screens/MoviesControls/MovieImagesView.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" +import "../../scripts/datamodels.js" as DataModels + +ListView { + id: movieImagesView + + property int itemsOnScreen: 5 + property real delegateSizeAspectRatio: 1.4 + spacing: 30 * dp + property int spacesOnScreen: Math.max(itemsOnScreen - 1, 0) + property real delegateWidth: spacesOnScreen > 0 ? width / itemsOnScreen - spacing * spacesOnScreen / itemsOnScreen + : 200 * dp + property real delegateHeight: delegateWidth / delegateSizeAspectRatio + property int firstVisibleItemIndex: Math.round(Math.abs(contentX / (delegateWidth + spacing))) + + signal clicked() + signal swipedLeft() + signal swipedRight() + signal swipedUp() + signal swipedDown() + + height: delegateHeight + orientation: ListView.Horizontal + snapMode: ListView.SnapToItem + boundsBehavior: Flickable.StopAtBounds + highlightMoveDuration: 200 + displayMarginBeginning: delegateWidth + displayMarginEnd: delegateWidth + + delegate: ImageButton { + width: movieImagesView.delegateWidth + height: movieImagesView.delegateHeight + + imageSource: DataModels.posterPathURL(modelData, 300) + + onClicked: { + movieImagesView.currentIndex = index + movieImagesView.clicked() + } + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + mode: manualFocusMode + + onSwipedLeft: { + movieImagesView.swipedLeft() + } + + onSwipedRight: { + movieImagesView.swipedRight() + } + + onSwipedUp: { + movieImagesView.swipedUp() + } + + onSwipedDown: { + movieImagesView.swipedDown() + } + } + } +} diff --git a/ui/qml/screens/MoviesControls/MoviePoster.qml b/ui/qml/screens/MoviesControls/MoviePoster.qml new file mode 100644 index 0000000..aad6065 --- /dev/null +++ b/ui/qml/screens/MoviesControls/MoviePoster.qml @@ -0,0 +1,82 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" + +Item { + id: moviePoster + + property string source: "" + + Rectangle { + id: backgroundRectangle + + anchors.fill: parent + + color: colors.gray1 + } + + Label { + anchors.fill: parent + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + visible: moviePoster.source === "" + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + + text: qsTr("No poster found") + } + + Image { + id: image + + anchors.fill: parent + + source: moviePoster.source + + onStatusChanged: { + if (status === Image.Ready) { + animation.restart() + } + } + + NumberAnimation { + id: animation + + target: image + property: "opacity" + from: 0 + to: 1 + duration: 500 + easing.type: Easing.InSine + } + } +} diff --git a/ui/qml/screens/MoviesControls/WebViewOverlay.qml b/ui/qml/screens/MoviesControls/WebViewOverlay.qml new file mode 100644 index 0000000..ac63af9 --- /dev/null +++ b/ui/qml/screens/MoviesControls/WebViewOverlay.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import "../../controls" + +OverlayItem { + id: webBrowserOverlay + + property alias url: webView.url + + Keys.onPressed: { + if (event.key === Qt.Key_Enter || + event.key === Qt.Key_Return || + event.key === Qt.Key_Select) { + close() + } + } + + Rectangle { + anchors.fill: parent + + color: colors.gray2 + } + + Rectangle { + anchors.fill: webView + anchors.margins: -8 * dp + + radius: 8 * dp + color: colors.white2 + } + + WebView { + id: webView + + anchors.centerIn: parent + + width: parent.width * 0.8 + height: parent.height * 0.8 + + focus: true + } +} diff --git a/ui/qml/screens/MoviesScreen.qml b/ui/qml/screens/MoviesScreen.qml new file mode 100644 index 0000000..fa12de2 --- /dev/null +++ b/ui/qml/screens/MoviesScreen.qml @@ -0,0 +1,379 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import "../scripts/datamodels.js" as DataModels +import "../controls" +import "../components" +import "MoviesControls" + +BaseScreen { + id: moviesScreen + + QtObject { + id: selectedMovie + + property string movieId + property string title + property string synopsis + property string imageUrl + property string releaseYear + + function update(data) { + if (data) { + selectedMovie.title = data.title ? data.title : "" + selectedMovie.imageUrl = data.poster_path ? DataModels.posterPathURL(data.poster_path, 500) : "" + selectedMovie.releaseYear = data.release_date ? new Date(data.release_date).getFullYear() : "" + selectedMovie.movieId = data.id + } + } + } + + ToolBar { + id: toolBar + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + height: 170 * dp + + focus: true + + RoundButton { + id: backButton + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 40 * dp + + focus: true + + icon: "\uf060" + + KeyNavigation.right: searchInputField + KeyNavigation.down: if (catalogsListView.visible && catalogsListView.count > 0) { + catalogsListView + } else if (searchCatalogView.visible && searchCatalogView.count > 0) { + searchCatalogView + } else { + null + } + + onClicked: { + stackView.pop() + } + } + + TextInputField { + id: searchInputField + + anchors.left: backButton.right + anchors.right: clearButton.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 50 * dp + anchors.rightMargin: 50 * dp + + placeholderText: qsTr("Search") + + KeyNavigation.left: backButton + KeyNavigation.right: clearButton + KeyNavigation.down: if (catalogsListView.visible && catalogsListView.count > 0) { + catalogsListView + } else if (searchCatalogView.visible && searchCatalogView.count > 0) { + searchCatalogView + } else { + null + } + + Timer { + id: searchInputTimer + + interval: 2000 + running: searchInputField.acceptingInput + repeat: true + triggeredOnStart: true + + onTriggered: { + searchModel.source = DataModels.formatQuery("search/movie", { "query" : searchInputField.text }) + } + } + } + + TextButton { + id: clearButton + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.rightMargin: 40 * dp + + text: qsTr("Clear") + + KeyNavigation.left: searchInputField + KeyNavigation.down: if (catalogsListView.visible && catalogsListView.count > 0) { + catalogsListView + } else if (searchCatalogView.visible && searchCatalogView.count > 0) { + searchCatalogView + } else { + null + } + + onClicked: { + searchInputField.text = "" + } + } + } + + MovieCatalogView { + id: searchCatalogView + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: toolBar.bottom + anchors.leftMargin: 40 * dp + anchors.rightMargin: 40 * dp + anchors.bottomMargin: 40 * dp + + visible: searchInputField.text !== "" + + displayMarginBeginning: anchors.leftMargin + displayMarginEnd: anchors.rightMargin + + title: qsTr("Search Results") + model: searchModel + + onCurrentIndexChanged: { + var data = model.get(currentIndex) + selectedMovie.update(data) + } + + onClicked: { + stackView.push({ + item: Qt.resolvedUrl("qrc:/qml/screens/MovieDetailsScreen.qml"), + properties: { + "selectedMovie" : selectedMovie + } + }) + } + + KeyNavigation.up: toolBar + KeyNavigation.priority: KeyNavigation.BeforeItem + } + + Item { + id: catalogsListViewArea + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: toolBar.bottom + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 * dp + + layer.enabled: true + layer.samplerName: "source" + layer.effect: VerticalDissolveEffect { + length: 150 * dp + sourceHeight: catalogsListViewArea.height + } + + ListView { + id: catalogsListView + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + anchors.leftMargin: 40 * dp + anchors.rightMargin: 40 * dp + anchors.topMargin: 20 * dp + anchors.bottomMargin: 80 * dp + + visible: searchInputField.text === "" + + orientation: ListView.Vertical + snapMode: ListView.SnapToItem + boundsBehavior: Flickable.StopAtBounds + highlightMoveDuration: 200 + cacheBuffer: currentItem ? (currentItem.height * count - height) + : 0 + displayMarginBeginning: currentItem ? currentItem.delegateHeight : 0 + displayMarginEnd: currentItem ? currentItem.delegateHeight : 0 + + readonly property real delegateWidth: currentItem ? currentItem.width : 0 + readonly property real delegateHeight: currentItem ? currentItem.height : 0 + function item(index) { + return itemAt(delegateWidth / 2, delegateHeight * (index + 1) + spacing * index - delegateHeight / 2) + } + + onActiveFocusChanged: { + if (activeFocus) { + var data = currentItem.model.get(currentItem.currentIndex) + selectedMovie.update(data) + } + } + + // different catalog is selected + onCurrentIndexChanged: { + if (activeFocus && currentItem !== null) { + var data = currentItem.model.get(currentItem.currentIndex) + selectedMovie.update(data) + } + } + + model: ListModel { + // https://developers.themoviedb.org/3/movies + ListElement { titleText: QT_TR_NOOP("Popular"); query: "movie/popular" } + ListElement { titleText: QT_TR_NOOP("Now Playing"); query: "movie/now_playing" } + ListElement { titleText: QT_TR_NOOP("Upcoming"); query: "movie/upcoming" } + ListElement { titleText: QT_TR_NOOP("Top Rated"); query: "movie/top_rated" } + // https://www.themoviedb.org/genres + ListElement { titleText: QT_TR_NOOP("Action"); query: "genre/28/movies" } + ListElement { titleText: QT_TR_NOOP("Adventure"); query: "genre/12/movies" } + ListElement { titleText: QT_TR_NOOP("Animation"); query: "genre/16/movies" } + ListElement { titleText: QT_TR_NOOP("Comedy"); query: "genre/35/movies" } + ListElement { titleText: QT_TR_NOOP("Crime"); query: "genre/80/movies" } + ListElement { titleText: QT_TR_NOOP("Documentary"); query: "genre/99/movies" } + ListElement { titleText: QT_TR_NOOP("Drama"); query: "genre/18/movies" } + ListElement { titleText: QT_TR_NOOP("Fantasy"); query: "genre/14/movies" } + ListElement { titleText: QT_TR_NOOP("History"); query: "genre/36/movies" } + ListElement { titleText: QT_TR_NOOP("Horror"); query: "genre/27/movies" } + ListElement { titleText: QT_TR_NOOP("Music"); query: "genre/10402/movies" } + ListElement { titleText: QT_TR_NOOP("Mystery"); query: "genre/9648/movies" } + ListElement { titleText: QT_TR_NOOP("Romance"); query: "genre/10749/movies" } + ListElement { titleText: QT_TR_NOOP("Science Fiction"); query: "genre/878/movies" } + ListElement { titleText: QT_TR_NOOP("TV Movie"); query: "genre/10770/movies" } + ListElement { titleText: QT_TR_NOOP("Thriller"); query: "genre/53/movies" } + ListElement { titleText: QT_TR_NOOP("War"); query: "genre/10752/movies" } + ListElement { titleText: QT_TR_NOOP("Western"); query: "genre/37/movies" } + } + + function moveFocusUp() { + var screenFocusIndex = currentItem.currentIndex - currentItem.firstVisibleItemIndex + var previousCatalog = item(currentIndex - 1) + previousCatalog.currentIndex = previousCatalog.firstVisibleItemIndex + screenFocusIndex + decrementCurrentIndex() + } + + function moveFocusDown() { + var screenFocusIndex = currentItem.currentIndex - currentItem.firstVisibleItemIndex + var nextCatalog = item(currentIndex + 1) + nextCatalog.currentIndex = nextCatalog.firstVisibleItemIndex + screenFocusIndex + incrementCurrentIndex() + } + + KeyNavigation.up: toolBar + Keys.onPressed: { + var screenFocusIndex + + switch (event.key) { + case Qt.Key_Up: + if (currentIndex > 0) { + moveFocusUp() + event.accepted = true + } + break + case Qt.Key_Down: + if (currentIndex < count - 1) { + moveFocusDown() + event.accepted = true + } + break + } + } + + delegate: MovieCatalogView { + id: movieCatalogView + + anchors.left: catalogsListView.contentItem.left + anchors.right: catalogsListView.contentItem.right + anchors.leftMargin: 40 * dp + anchors.rightMargin: 40 * dp + + title: titleText + + model: JSONListModel { + arrayPropertyName: "results" + source: DataModels.formatQuery(query) + } + + // different movie is selected + onCurrentIndexChanged: { + if (activeFocus && currentItem !== null) { + var data = model.get(currentIndex) + selectedMovie.update(data) + } + } + + onClicked: { + catalogsListView.currentIndex = index + + stackView.push({ + item: Qt.resolvedUrl("qrc:/qml/screens/MovieDetailsScreen.qml"), + properties: { + "selectedMovie" : selectedMovie + } + }) + } + + onSwipedLeft: { + movieCatalogView.decrementCurrentIndex() + } + + onSwipedRight: { + movieCatalogView.incrementCurrentIndex() + } + + onSwipedUp: { + if (catalogsListView.currentIndex > 0) { + catalogsListView.moveFocusUp() + } else { + var item = catalogsListView.KeyNavigation.up + if (item && item.enabled) { + item.forceActiveFocus() + } + } + } + + onSwipedDown: { + if (catalogsListView.currentIndex < catalogsListView.count - 1) { + catalogsListView.moveFocusDown() + } else { + var item = catalogsListView.KeyNavigation.down + if (item && item.enabled) { + item.forceActiveFocus() + } + } + } + } + } + } + + JSONListModel { + id: searchModel + + arrayPropertyName: "results" + } +} diff --git a/ui/qml/screens/SettingsScreen.qml b/ui/qml/screens/SettingsScreen.qml new file mode 100644 index 0000000..c2d9d18 --- /dev/null +++ b/ui/qml/screens/SettingsScreen.qml @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import "../controls" + +BaseScreen { + id: settingsScreen + + ToolBar { + id: toolBar + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + height: 170 * dp + + focus: true + + RoundButton { + id: backButton + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 40 * dp + + focus: true + + icon: "\uf060" + + KeyNavigation.down: youTubeKeyInputField + + onClicked: { + stackView.pop() + } + } + + Label { + anchors.left: backButton.right + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 40 * dp + anchors.rightMargin: 40 * dp + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 50 * dp + font.bold: true + + text: qsTr("Settings") + } + } + + Column { + anchors.left: parent.left + anchors.right: parent.right + anchors.top: toolBar.bottom + anchors.leftMargin: 40 * dp + anchors.rightMargin: 40 * dp + + Label { + anchors.left: parent.left + anchors.right: parent.right + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + + text: qsTr("YouTube Data Key") + } + + VerticalSpacer { + height: 10 * dp + } + + TextInputField { + id: youTubeKeyInputField + anchors.left: parent.left + anchors.right: parent.right + + text: settings.youTubeKey + + onTextChanged: { + settings.youTubeKey = text + } + + KeyNavigation.up: backButton + KeyNavigation.down: tmbKeyInputField + } + + VerticalSpacer { + height: 20 * dp + } + + Label { + anchors.left: parent.left + anchors.right: parent.right + + color: colors.white2 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + + text: qsTr("TMDb API Key") + } + + VerticalSpacer { + height: 10 * dp + } + + TextInputField { + id: tmbKeyInputField + anchors.left: parent.left + anchors.right: parent.right + + text: settings.tmdbKey + + onTextChanged: { + settings.tmdbKey = text + } + + KeyNavigation.up: youTubeKeyInputField + } + } +} diff --git a/ui/qml/screens/TrailerScreen.qml b/ui/qml/screens/TrailerScreen.qml new file mode 100644 index 0000000..27ad8e2 --- /dev/null +++ b/ui/qml/screens/TrailerScreen.qml @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import QtMultimedia 5.5 +import "../scripts/3rdparty/YoutubeClientV3.js" as YoutubeClient +import "../controls" + +BaseScreen { + id: trailerScreen + + property string movieTitle + property string movieId + + function onFailure(error) { + busyIndicator.visible = false + errorLabel.text = error.details + } + + function onVideoUrlObtained(url) { + videoPlayer.source = url + busyIndicator.visible = false + } + + Component.onCompleted: { + YoutubeClient.getVideoUrl(movieId, onVideoUrlObtained, onFailure) + } + + Rectangle { + anchors.fill: parent + + color: colors.black + } + + BusyIndicator { + id: busyIndicator + + anchors.centerIn: parent + } + + Label { + id: errorLabel + + anchors.fill: parent + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + + wrapMode: Text.Wrap + + color: colors.white1 + font.family: fonts.titillium + font.pixelSize: 30 * dp + font.bold: true + } + + VideoPlayer { + id: videoPlayer + + anchors.fill: parent + + focus: true + + onClosePressed: { + stackView.pop() + } + } +} diff --git a/ui/qml/screens/WebBrowserScreen.qml b/ui/qml/screens/WebBrowserScreen.qml new file mode 100644 index 0000000..3bf8932 --- /dev/null +++ b/ui/qml/screens/WebBrowserScreen.qml @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Controls 1.4 +import "../controls" + +BaseScreen { + id: webBrowserScreen + + property alias url: webView.url + + ToolBar { + id: toolBar + + anchors.left: parent.left + anchors.right: parent.right + anchors.top: parent.top + + height: 170 * dp + + focus: true + + RoundButton { + id: backButton + + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 40 * dp + + focus: true + + icon: "\uf060" + + KeyNavigation.right: urlInputField + KeyNavigation.down: webView + + onClicked: { + stackView.pop() + } + } + + UrlInputField { + id: urlInputField + + anchors.left: backButton.right + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.leftMargin: 50 * dp + anchors.rightMargin: 40 * dp + + progress: webView.loadProgress / 100 + loading: webView.loading + + placeholderText: qsTr("Type URL") + text: webBrowserScreen.url + + KeyNavigation.left: backButton + KeyNavigation.down: webView + + onAcceptingInputChanged: { + if (!acceptingInput) { + var oldUrl = webBrowserScreen.url + webBrowserScreen.url = webUtils.fromUserInput(text) + + if (oldUrl === webBrowserScreen.url) { + webView.reload() + } + } + } + } + } + + FocusScope { + anchors.left: parent.left + anchors.right: parent.right + anchors.top: toolBar.bottom + anchors.bottom: parent.bottom + + KeyNavigation.up: toolBar + + WebView { + id: webView + + anchors.fill: parent + focus: true + + url: "https://youtube.com/" + + property TvRemoteInputMethod tvRemoteInputMethod: TvRemoteInputMethod { + item: webView + } + } + } +} diff --git a/ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt b/ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt new file mode 100644 index 0000000..b18ad22 --- /dev/null +++ b/ui/qml/scripts/3rdparty/YoutubeClientV3-License.txt @@ -0,0 +1,26 @@ +Copyright (c) 2014 Peter Tworek +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. +3. Neither the name of the author nor the names of any co-contributors +may be used to endorse or promote products derived from this software +without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. diff --git a/ui/qml/scripts/3rdparty/YoutubeClientV3.js b/ui/qml/scripts/3rdparty/YoutubeClientV3.js new file mode 100644 index 0000000..4ceb0f1 --- /dev/null +++ b/ui/qml/scripts/3rdparty/YoutubeClientV3.js @@ -0,0 +1,276 @@ +/*- + * Copyright (c) 2014 Peter Tworek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + +.pragma library + +var _youtube_data_v3_url = "https://www.googleapis.com/youtube/v3/"; + +//Replace this line with your own key +var youTubeDataKey = "" + +function getYoutubeV3Url(reference, queryParams) +{ + var locale = Qt.locale().name; + if (locale === "C") { + locale = "en_US"; + } + + var url = _youtube_data_v3_url + reference + + "?regionCode=" + regionCode + + "&key=" + youTubeDataKey + + "&hl=" + locale + + "&maxResults=" + 25 + + for (var key in queryParams) { + if (queryParams.hasOwnProperty(key)) { + url += "&" + key + "=" + queryParams[key]; + } + } + return url; +} + +function getVideoCategories(onSuccess, onFailure) +{ + var url = getYoutubeV3Url("videoCategories", {"part" : "snippet"}); + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status == 200) { + var categories = JSON.parse(xhr.responseText)["items"]; + onSuccess(categories); + } else { + var details = xhr.responseText ? JSON.parse(xhr.responseText) : undefined; + onFailure({"code" : xhr.status, "details" : details}); + } + } + } + xhr.open("GET", url); + xhr.send(); +} + +function getVideosInCategory(categoryId, onSuccess, onFailure, pageToken) +{ + var qParams = {}; + + qParams["part"] = "snippet"; + //qParams["maxResults"] = resultsPerPage; + qParams["chart"] = "mostPopular"; + qParams["videoCategoryId"] = categoryId; + + var url = getYoutubeV3Url("videos", qParams); + + if (pageToken !== undefined) { + url += "&pageToken=" + pageToken; + } + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status == 200) { + onSuccess(JSON.parse(xhr.responseText)); + } else { + var details = xhr.responseText ? JSON.parse(xhr.responseText) : ""; + onFailure({"code" : xhr.status, "details" : details}); + } + } + } + xhr.open("GET", url); + xhr.send(); +} + +function getVideosInPlaylist(playlistId, onSuccess, onFailure) +{ + var url = getYoutubeV3Url("playlistItems",{"part" : "snippet", "playlistId" : playlistId}); + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status !== 200) { + var errDetails = xhr.responseText ? JSON.parse(xhr.responseText) : undefined; + onFailure({"code" : xhr.status, "details" : errDetails}); + return; + } + var response = JSON.parse(xhr.responseText); + onSuccess(response); + } + } + xhr.open("GET", url); + xhr.send() +} + +function getVideoDetails(videoId, onSuccess, onFailure) +{ + var url = getYoutubeV3Url("videos", {"part" : "contentDetails, snippet, statistics", + "id" : videoId}); + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status !== 200) { + var errDetails = xhr.responseText ? JSON.parse(xhr.responseText) : undefined; + onFailure({"code" : xhr.status, "details" : errDetails}); + return; + } + var details = JSON.parse(xhr.responseText); + onSuccess(details.items[0]); + } + } + xhr.open("GET", url); + xhr.send(); +} + +function getChannelDetails(channelId, onSuccess, onFailure) +{ + var url = getYoutubeV3Url("channels", + {"part" : "snippet,statistics,contentDetails", "id" : channelId}); + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status !== 200) { + var errDetails = xhr.responseText ? JSON.parse(xhr.responseText) : undefined; + onFailure({"code" : xhr.status, "details" : errDetails}); + return; + } + var response = JSON.parse(xhr.responseText); + onSuccess(response); + } + } + xhr.open("GET", url); + xhr.send(); +} + +function getSearchResults(query, onSuccess, onFailure, pageToken) +{ + var qParams = {}; + qParams["q"] = query; + qParams["part"] = "snippet"; + qParams["type"] = "video,channel"; + qParams["safeSearch"] = "none"; + + if (pageToken) { + qParams["pageToken"] = pageToken; + } + + var url = getYoutubeV3Url("search", qParams); + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState == XMLHttpRequest.DONE) { + if (xhr.status !== 200) { + var details = xhr.responseText ? JSON.parse(xhr.responseText) : undefined; + onFailure({"code" : xhr.status, "details" : details}); + return; + } + var response = JSON.parse(xhr.responseText); + onSuccess(response); + } + } + xhr.open("GET", url); + xhr.send(); +} + +function getVideoUrl(videoId, onSuccess, onFailure) +{ + var req = "https://www.youtube.com/get_video_info?video_id=" + videoId + + "&el=player_embedded&gl=US&hl=en&eurl=https://youtube.googleapis.com/v/&asf=3&sts=1588"; + var availableSizes = []; + + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange = function() { + if (xhr.readyState === XMLHttpRequest.DONE) { + if (xhr.status !== 200) { + onFailure({"code" : xhr.status, "details" : JSON.parse(xhr.responseText)}); + return; + } + var stream_map_str = undefined; + var tokens = xhr.responseText.split("&"); + for (var i = 0; i < tokens.length; i++) { + var pair = tokens[i].split("="); + if (pair[0] === "url_encoded_fmt_stream_map") { + stream_map_str = decodeURIComponent(pair[1]); + break; + } + } + + if (stream_map_str === undefined) { + onFailure({"code" : 0, "details" : "No video streams found!"}); + return; + } + + var stream_map_array = []; + tokens = stream_map_str.split(','); + for (var i = 0; i < tokens.length; i++) { + var map_elements = tokens[i].split('&'); + var map = {}; + for (var k = 0; k < map_elements.length; k++) { + var map_entry = map_elements[k].split('='); + if ( map_entry[0] == "itag" ) { // get sizes + availableSizes.push(map_entry[1]) + } + + if (map_entry[0] === 'url') { + map[map_entry[0]] = decodeURIComponent(map_entry[1]); + } else { + map[map_entry[0]] = map_entry[1]; + } + } + stream_map_array[i] = map; + } + + var selected_url = undefined; + for (var i = 0; i < stream_map_array.length; i++) { + var size = availableSizes.indexOf("22") !== -1 ? "22" : "18" + if (stream_map_array[i].itag === size) { // 22 + if ("s" in stream_map_array[i]) { + onFailure({"code" : 0, "details" : "Encrypted signature detected, can't play video directly"}); + return + } else if ("sig" in stream_map_array[i]) { + selected_url = stream_map_array[i].url + + "&signature=" + stream_map_array[i].sig; + } else { + selected_url = stream_map_array[i].url; + } + + break; + } + } + + if (selected_url === undefined) { + onFailure({"code" : 0, "details" : "No 360p video stream found!"}); + return; + } + + onSuccess(selected_url); + } + } + xhr.open("GET", req); + xhr.send(); +} diff --git a/ui/qml/scripts/3rdparty/qt_attribution.json b/ui/qml/scripts/3rdparty/qt_attribution.json new file mode 100644 index 0000000..593fb9e --- /dev/null +++ b/ui/qml/scripts/3rdparty/qt_attribution.json @@ -0,0 +1,10 @@ +{ + "Id": "youtubeclient", + "Name": "YoutubeClientV3", + "QDocModule": "-", + "QtUsage": "Used in set top box demo.", + "License": "BSD 3-clause \"New\" or \"Revised\" License", + "LicenseId": "BSD-3-Clause", + "LicenseFile": "YoutubeClientV3-License.txt", + "Copyright": "Copyright (c) 2014 Peter Tworek" +} diff --git a/ui/qml/scripts/XMLHttpRequestCache.js b/ui/qml/scripts/XMLHttpRequestCache.js new file mode 100644 index 0000000..5c204c1 --- /dev/null +++ b/ui/qml/scripts/XMLHttpRequestCache.js @@ -0,0 +1,28 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +.pragma library + +var cache = [] diff --git a/ui/qml/scripts/datamodels.js b/ui/qml/scripts/datamodels.js new file mode 100644 index 0000000..180359b --- /dev/null +++ b/ui/qml/scripts/datamodels.js @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt demos. +** +** 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. +** +****************************************************************************/ + +.pragma library + +var baseurl = "https://api.themoviedb.org/3/" +var apiKey = "" + +function formatQuery(query, arguments) { + var result = "%1%2?api_key=%3".arg(baseurl).arg(query).arg(apiKey) + + for (var key in arguments) { + result += "&%1=%2".arg(key).arg(arguments[key]) + } + + return result +} + +function posterPathURL(posterPath, size) { + return posterPath ? "https://image.tmdb.org/t/p/w%1%2".arg(size).arg(posterPath) : "" +} diff --git a/ui/ui.pro b/ui/ui.pro new file mode 100644 index 0000000..03bd320 --- /dev/null +++ b/ui/ui.pro @@ -0,0 +1,54 @@ +TEMPLATE = app +QT += core gui qml quick network multimedia +qtHaveModule(webengine): QT += webengine +qtHaveModule(webview): QT += webview + +darwin: \ + TARGET = "Qt TV" +else: \ + TARGET = qt-tv + +darwin: QMAKE_RPATHDIR += @loader_path/../Frameworks + +SOURCES += \ + cpp/cuterectangle.cpp \ + cpp/main.cpp \ + cpp/processcontroller.cpp \ + cpp/webutils.cpp + +HEADERS += \ + cpp/cuterectangle.h \ + cpp/processcontroller.h \ + cpp/webutils.h + +RESOURCES += \ + ../assets/assets.qrc \ + ../assets/shared.qrc \ + qml/qml.qrc + +exists(../secrets/TMDb.qml):exists(../secrets/YouTube.qml): \ + RESOURCES += ../APIKeys.qrc + +macos: QMAKE_INFO_PLIST = Info.plist +ios|tvos: QMAKE_INFO_PLIST = Info-ios.plist + +qtHaveModule(webkit):macos { + plugin_exe.files = "$$OUT_PWD/../plugin/qt-tv-npapi-host" + plugin_exe.path = Contents/Executables + QMAKE_BUNDLE_DATA += plugin_exe +} + +darwin: \ + target.path = /Applications +else: \ + target.path = /bin +INSTALLS += target + +android { + DISTFILES += \ + android/AndroidManifest.xml \ + android/res/values/libs.xml \ + android/build.gradle + + ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android +} diff --git a/ui/ui.qbs b/ui/ui.qbs new file mode 100644 index 0000000..1779748 --- /dev/null +++ b/ui/ui.qbs @@ -0,0 +1,172 @@ +import qbs +import qbs.File +import qbs.FileInfo +import qbs.Utilities + +Project { + AndroidApk { + condition: qbs.targetOS.contains("android") + name: "qt-tv" + packageName: "io.qt.stbdemo" + targetName: "qt-tv" + Depends { + productTypes: ["android.nativelibrary"] + limitToSubProject: true + } + } + + QtGuiApplication { + Depends { name: "Android.ndk"; required: false } + + Depends { name: "Qt.core"; versionAtLeast: project.minimumQtVersion } + Depends { name: "Qt"; submodules: ["gui", "qml", "quick", "network", "multimedia"] } + Depends { name: "openssl"; profiles: [] } + + Depends { name: "Qt.webengine"; required: false } + Depends { name: "Qt.webview"; required: false } + + Properties { + condition: qbs.targetOS.contains("android") + architectures: ["x86", "armv7"] + Android.ndk.appStl: "gnustl_shared" + } + + architectures: undefined + cpp.minimumIosVersion: "8.0" + cpp.cxxLanguageVersion: "c++11" + cpp.rpaths: qbs.targetOS.contains("darwin") ? ["@loader_path/../Frameworks"] : undefined + bundle.isBundle: qbs.targetOS.contains("darwin") + targetName: bundle.isBundle ? "Qt TV" : "qt-tv" + + files: [ + "Info.plist", + ] + + Group { + name: "C++" + prefix: "cpp/" + files: [ + "main.cpp", + "processcontroller.cpp", + "processcontroller.h", + "cuterectangle.cpp", + "cuterectangle.h", + "webutils.cpp", + "webutils.h", + ] + } + + Group { + name: "Resources" + files: [ + "../assets/assets.qrc", + "../assets/shared.qrc", + ] + } + + QMLGroup { + name: "API Keys" + condition: files.every(function (f) { + return File.exists(FileInfo.joinPaths(product.sourceDirectory, prefix, f)); + }) + prefix: "../secrets/" + files: [ + "TMDb.qml", + "YouTube.qml" + ] + + Qt.core.resourceSourceBase: "../secrets" + Qt.core.resourcePrefix: "/secrets" + } + + QMLGroup { + name: "QML" + prefix: "qml/" + files: [ + "main.qml", + ] + } + + QMLGroup { + name: "QML - Components" + prefix: "qml/components/" + files: [ + "Colors.qml", + "Fonts.qml", + "JSONListModel.qml", + "JSONQuery.qml", + "Settings.qml", + ] + } + + QMLGroup { + name: "QML - Controls" + prefix: "qml/controls/" + files: [ + "+webengine/WebView.qml", + "+webview/WebView.qml", + "AbstractButton.qml", + "ApplicationButton.qml", + "ApplicationWindow.qml", + "BaseScreen.qml", + "BusyIndicator.qml", + "InvalidSettingsOverlay.qml", + "Label.qml", + "NavigationStack.qml", + "RoundButton.qml", + "TextButton.qml", + "TextInputField.qml", + "VideoPlayer.qml", + "VerticalSpacer.qml", + "UrlInputField.qml", + "SeekSlider.qml", + "VideoPlayerButton.qml", + "HorizontalSpacer.qml", + "WebView.qml", + "VerticalDissolveEffect.qml", + "OverlayItem.qml", + "ToolBar.qml", + "PageIndicator.qml", + ] + } + + QMLGroup { + name: "QML - Screens" + prefix: "qml/screens/" + files: [ + "MainScreen.qml", + "MoviesControls/AnimatedText.qml", + "MoviesControls/BackgroundPoster.qml", + "MoviesControls/MovieCatalogButton.qml", + "MoviesControls/MoviePoster.qml", + "MoviesControls/ImageButton.qml", + "MoviesControls/MovieCatalogView.qml", + "MoviesControls/ImagePreviewOverlay.qml", + "MoviesControls/MovieImagesView.qml", + "MoviesControls/WebViewOverlay.qml", + "MoviesScreen.qml", + "SettingsScreen.qml", + "TrailerScreen.qml", + "WebBrowserScreen.qml", + "MovieDetailsScreen.qml", + ] + } + + QMLGroup { + name: "Scripts" + prefix: "qml/scripts/" + files: [ + "datamodels.js", + "3rdparty/YoutubeClientV3.js", + "XMLHttpRequestCache.js", + ] + } + + Group { + fileTagsFilter: ["application", "aggregate_infoplist", "pkginfo"] + qbs.install: true + qbs.installDir: bundle.isBundle ? "Applications" : "bin" + qbs.installSourceBase: product.buildDirectory + } + } +} |