commit 316dc60b690a9e007606de6f117c5deca76c44b3 Author: PANIK\chris Date: Tue Aug 5 22:36:00 2025 +0200 first re-commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4dc9981 --- /dev/null +++ b/.gitignore @@ -0,0 +1,44 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# qt specific +build* +doc/ + +moc_* +*.autosave +raDIYo.pro.user +*.pro.user.* +*.pro.user +*.user +ui_* diff --git a/.qmake.stash b/.qmake.stash new file mode 100644 index 0000000..15dfdef --- /dev/null +++ b/.qmake.stash @@ -0,0 +1,23 @@ +QMAKE_CXX.QT_COMPILER_STDCXX = 201402L +QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 10 +QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2 +QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 1 +QMAKE_CXX.COMPILER_MACROS = \ + QT_COMPILER_STDCXX \ + QMAKE_GCC_MAJOR_VERSION \ + QMAKE_GCC_MINOR_VERSION \ + QMAKE_GCC_PATCH_VERSION +QMAKE_CXX.INCDIRS = \ + /usr/include/c++/10 \ + /usr/include/arm-linux-gnueabihf/c++/10 \ + /usr/include/c++/10/backward \ + /usr/lib/gcc/arm-linux-gnueabihf/10/include \ + /usr/local/include \ + /usr/include/arm-linux-gnueabihf \ + /usr/include +QMAKE_CXX.LIBDIRS = \ + /usr/lib/gcc/arm-linux-gnueabihf/10 \ + /usr/lib/arm-linux-gnueabihf \ + /usr/lib \ + /lib/arm-linux-gnueabihf \ + /lib diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..f288702 --- /dev/null +++ b/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d7a2abb --- /dev/null +++ b/Makefile @@ -0,0 +1,1437 @@ +############################################################################# +# Makefile for building: raDIYo +# Generated by qmake (3.1) (Qt 5.15.2) +# Project: raDIYo.pro +# Template: app +# Command: /usr/lib/qt5/bin/qmake -o Makefile raDIYo.pro +############################################################################# + +MAKEFILE = Makefile + +EQ = = + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_MULTIMEDIA_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_BLUETOOTH_LIB -DQT_CORE_LIB +CFLAGS = -pipe -O2 -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -std=gnu++1z -Wall -Wextra -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I. -I. -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I. -I. -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ +QMAKE = /usr/lib/qt5/bin/qmake +DEL_FILE = rm -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p +COPY = cp -f +COPY_FILE = cp -f +COPY_DIR = cp -f -R +INSTALL_FILE = install -m 644 -p +INSTALL_PROGRAM = install -m 755 -p +INSTALL_DIR = cp -f -R +QINSTALL = /usr/lib/qt5/bin/qmake -install qinstall +QINSTALL_PROGRAM = /usr/lib/qt5/bin/qmake -install qinstall -exe +DEL_FILE = rm -f +SYMLINK = ln -f -s +DEL_DIR = rmdir +MOVE = mv -f +TAR = tar -cf +COMPRESS = gzip -9f +DISTNAME = raDIYo1.0.0 +DISTDIR = /home/pi/share/projects.nxt/raDIYo/.tmp/raDIYo1.0.0 +LINK = g++ +LFLAGS = -Wl,-O1 -Wl,-rpath-link,/usr/lib/arm-linux-gnueabihf +LIBS = $(SUBLIBS) -lpigpio -lpigpiod_if2 -lrt /usr/lib/arm-linux-gnueabihf/libQt5Multimedia.so /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so /usr/lib/arm-linux-gnueabihf/libQt5Gui.so /usr/lib/arm-linux-gnueabihf/libQt5Network.so /usr/lib/arm-linux-gnueabihf/libQt5Bluetooth.so /usr/lib/arm-linux-gnueabihf/libQt5Core.so -lGLESv2 -lpthread -latomic +AR = ar cqs +RANLIB = +SED = sed +STRIP = strip + +####### Output directory + +OBJECTS_DIR = ./ + +####### Files + +SOURCES = SWPiGPIO.cpp \ + main.cpp \ + raDIYoglobals.cpp \ + raDIYo.cpp \ + swadjustabledigit.cpp \ + swalarmcontrol.cpp \ + swbarwidget.cpp \ + swbasecontrol.cpp \ + swbluetoothcontrol.cpp \ + swbuttongroup.cpp \ + swclockcontrol.cpp \ + swcontrol.cpp \ + swdialbutton.cpp \ + swdialhandler.cpp \ + swdialcontrol.cpp \ + swdialwidget.cpp \ + swdummydialdialog.cpp \ + swdummypushdial.cpp \ + swfftcalc.cpp \ + swflipdigit.cpp \ + swlistcontrol.cpp \ + swradiobutton.cpp \ + swrangevalue.cpp \ + swurl.cpp \ + swusbcontrol.cpp \ + swplayercontrol.cpp \ + swsendercontrol.cpp \ + swsetupcontrol.cpp \ + swshutdowncontrol.cpp \ + swsongscontrol.cpp \ + swspectrumwidget.cpp \ + swtoggleswitch.cpp \ + swvolumewidget.cpp qrc_raDIYo.cpp \ + moc_SWPiGPIO.cpp \ + moc_raDIYo.cpp \ + moc_swadjustabledigit.cpp \ + moc_swalarmcontrol.cpp \ + moc_swbarwidget.cpp \ + moc_swbasecontrol.cpp \ + moc_swbluetoothcontrol.cpp \ + moc_swclockcontrol.cpp \ + moc_swcontrol.cpp \ + moc_swdialbutton.cpp \ + moc_swdialcontrol.cpp \ + moc_swdummydialdialog.cpp \ + moc_swdummypushdial.cpp \ + moc_swfftcalc.cpp \ + moc_swflipdigit.cpp \ + moc_swlistcontrol.cpp \ + moc_swradiobutton.cpp \ + moc_swusbcontrol.cpp \ + moc_swplayercontrol.cpp \ + moc_swsendercontrol.cpp \ + moc_swsetupcontrol.cpp \ + moc_swshutdowncontrol.cpp \ + moc_swsongscontrol.cpp \ + moc_swspectrumwidget.cpp \ + moc_swtoggleswitch.cpp \ + moc_swvolumewidget.cpp +OBJECTS = SWPiGPIO.o \ + main.o \ + raDIYoglobals.o \ + raDIYo.o \ + swadjustabledigit.o \ + swalarmcontrol.o \ + swbarwidget.o \ + swbasecontrol.o \ + swbluetoothcontrol.o \ + swbuttongroup.o \ + swclockcontrol.o \ + swcontrol.o \ + swdialbutton.o \ + swdialhandler.o \ + swdialcontrol.o \ + swdialwidget.o \ + swdummydialdialog.o \ + swdummypushdial.o \ + swfftcalc.o \ + swflipdigit.o \ + swlistcontrol.o \ + swradiobutton.o \ + swrangevalue.o \ + swurl.o \ + swusbcontrol.o \ + swplayercontrol.o \ + swsendercontrol.o \ + swsetupcontrol.o \ + swshutdowncontrol.o \ + swsongscontrol.o \ + swspectrumwidget.o \ + swtoggleswitch.o \ + swvolumewidget.o \ + qrc_raDIYo.o \ + moc_SWPiGPIO.o \ + moc_raDIYo.o \ + moc_swadjustabledigit.o \ + moc_swalarmcontrol.o \ + moc_swbarwidget.o \ + moc_swbasecontrol.o \ + moc_swbluetoothcontrol.o \ + moc_swclockcontrol.o \ + moc_swcontrol.o \ + moc_swdialbutton.o \ + moc_swdialcontrol.o \ + moc_swdummydialdialog.o \ + moc_swdummypushdial.o \ + moc_swfftcalc.o \ + moc_swflipdigit.o \ + moc_swlistcontrol.o \ + moc_swradiobutton.o \ + moc_swusbcontrol.o \ + moc_swplayercontrol.o \ + moc_swsendercontrol.o \ + moc_swsetupcontrol.o \ + moc_swshutdowncontrol.o \ + moc_swsongscontrol.o \ + moc_swspectrumwidget.o \ + moc_swtoggleswitch.o \ + moc_swvolumewidget.o +DIST = /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/unix.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/linux.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/qconfig.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_bluetooth.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_nfc.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_opengl.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_Qt5Keychain.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/spec_post.prf \ + .qmake.stash \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/default_post.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resources_functions.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resources.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/moc.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/uic.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/yacc.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/lex.prf \ + raDIYo.pro SWPiGPIO.h \ + raDIYoglobals.h \ + raDIYo.h \ + swadjustabledigit.h \ + swalarmcontrol.h \ + swbarwidget.h \ + swbasecontrol.h \ + swbluetoothcontrol.h \ + swbuttongroup.h \ + swclockcontrol.h \ + swcontrol.h \ + swdialbutton.h \ + swdialhandler.h \ + swdialcontrol.h \ + swdialwidget.h \ + swdummydialdialog.h \ + swdummypushdial.h \ + swfftcalc.h \ + swflipdigit.h \ + swlistcontrol.h \ + swradiobutton.h \ + swrangevalue.h \ + swurl.h \ + swusbcontrol.h \ + swplayercontrol.h \ + swsendercontrol.h \ + swsetupcontrol.h \ + swshutdowncontrol.h \ + swsongscontrol.h \ + swspectrumwidget.h \ + swtoggleswitch.h \ + swvolumewidget.h SWPiGPIO.cpp \ + main.cpp \ + raDIYoglobals.cpp \ + raDIYo.cpp \ + swadjustabledigit.cpp \ + swalarmcontrol.cpp \ + swbarwidget.cpp \ + swbasecontrol.cpp \ + swbluetoothcontrol.cpp \ + swbuttongroup.cpp \ + swclockcontrol.cpp \ + swcontrol.cpp \ + swdialbutton.cpp \ + swdialhandler.cpp \ + swdialcontrol.cpp \ + swdialwidget.cpp \ + swdummydialdialog.cpp \ + swdummypushdial.cpp \ + swfftcalc.cpp \ + swflipdigit.cpp \ + swlistcontrol.cpp \ + swradiobutton.cpp \ + swrangevalue.cpp \ + swurl.cpp \ + swusbcontrol.cpp \ + swplayercontrol.cpp \ + swsendercontrol.cpp \ + swsetupcontrol.cpp \ + swshutdowncontrol.cpp \ + swsongscontrol.cpp \ + swspectrumwidget.cpp \ + swtoggleswitch.cpp \ + swvolumewidget.cpp +QMAKE_TARGET = raDIYo +DESTDIR = +TARGET = raDIYo + + +first: all +####### Build rules + +raDIYo: ui_raDIYo.h ui_swalarmcontrol.h ui_swbasecontrol.h ui_swbluetoothcontrol.h ui_swclockcontrol.h ui_swdummydialdialog.h ui_swdummypushdial.h ui_swlistcontrol.h ui_swplayercontrol.h ui_swsetupcontrol.h ui_swshutdowncontrol.h $(OBJECTS) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) + +Makefile: raDIYo.pro /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++/qmake.conf /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/spec_pre.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/unix.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/linux.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/sanitize.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/gcc-base.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/gcc-base-unix.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/g++-base.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/g++-unix.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/qconfig.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_bluetooth.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_concurrent.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_core.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_core_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_dbus.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_dbus_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_edid_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_egl_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_fb_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_gui.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_gui_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_input_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_kms_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_multimedia.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_network.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_network_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_nfc.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_opengl.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_opengl_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_openglextensions.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_printsupport.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_printsupport_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_service_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_sql.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_sql_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_testlib.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_testlib_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_theme_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_widgets.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_widgets_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xml.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xml_private.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_Qt5Keychain.pri \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt_functions.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt_config.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++/qmake.conf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/spec_post.prf \ + .qmake.stash \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/exclusive_builds.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/toolchain.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/default_pre.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resolve_config.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/default_post.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/warn_on.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resources_functions.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resources.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/moc.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/unix/opengl.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/uic.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/unix/thread.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qmake_use.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/file_copies.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/testcase_targets.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/exceptions.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/yacc.prf \ + /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/lex.prf \ + raDIYo.pro \ + raDIYo.qrc + $(QMAKE) -o Makefile raDIYo.pro +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/spec_pre.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/unix.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/linux.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/sanitize.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/gcc-base.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/gcc-base-unix.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/g++-base.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/common/g++-unix.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/qconfig.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_accessibility_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_bluetooth.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_concurrent.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_concurrent_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_core.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_core_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_dbus.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_dbus_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_devicediscovery_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_edid_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_egl_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eglfs_kms_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eglfsdeviceintegration_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_fb_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_fontdatabase_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_gui.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_gui_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_input_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_kms_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_linuxaccessibility_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_multimedia.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_multimediawidgets.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_network.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_network_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_nfc.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_opengl.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_opengl_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_openglextensions.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_platformcompositor_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_printsupport.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_printsupport_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_service_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_sql.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_sql_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_testlib.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_testlib_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_theme_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_vulkan_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_widgets.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_widgets_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xcb_qpa_lib_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xkbcommon_support_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xml.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_lib_xml_private.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/modules/qt_Qt5Keychain.pri: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt_functions.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt_config.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++/qmake.conf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/spec_post.prf: +.qmake.stash: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/exclusive_builds.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/toolchain.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/default_pre.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resolve_config.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/default_post.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/warn_on.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qt.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resources_functions.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/resources.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/moc.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/unix/opengl.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/uic.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/unix/thread.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/qmake_use.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/file_copies.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/testcase_targets.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/exceptions.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/yacc.prf: +/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/lex.prf: +raDIYo.pro: +raDIYo.qrc: +qmake: FORCE + @$(QMAKE) -o Makefile raDIYo.pro + +qmake_all: FORCE + + +all: Makefile raDIYo + +dist: distdir FORCE + (cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR) + +distdir: FORCE + @test -d $(DISTDIR) || mkdir -p $(DISTDIR) + $(COPY_FILE) --parents $(DIST) $(DISTDIR)/ + $(COPY_FILE) --parents raDIYo.qrc $(DISTDIR)/ + $(COPY_FILE) --parents /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/data/dummy.cpp $(DISTDIR)/ + $(COPY_FILE) --parents SWPiGPIO.h raDIYoglobals.h raDIYo.h swadjustabledigit.h swalarmcontrol.h swbarwidget.h swbasecontrol.h swbluetoothcontrol.h swbuttongroup.h swclockcontrol.h swcontrol.h swdialbutton.h swdialhandler.h swdialcontrol.h swdialwidget.h swdummydialdialog.h swdummypushdial.h swfftcalc.h swflipdigit.h swlistcontrol.h swradiobutton.h swrangevalue.h swurl.h swusbcontrol.h swplayercontrol.h swsendercontrol.h swsetupcontrol.h swshutdowncontrol.h swsongscontrol.h swspectrumwidget.h swtoggleswitch.h swvolumewidget.h $(DISTDIR)/ + $(COPY_FILE) --parents SWPiGPIO.cpp main.cpp raDIYoglobals.cpp raDIYo.cpp swadjustabledigit.cpp swalarmcontrol.cpp swbarwidget.cpp swbasecontrol.cpp swbluetoothcontrol.cpp swbuttongroup.cpp swclockcontrol.cpp swcontrol.cpp swdialbutton.cpp swdialhandler.cpp swdialcontrol.cpp swdialwidget.cpp swdummydialdialog.cpp swdummypushdial.cpp swfftcalc.cpp swflipdigit.cpp swlistcontrol.cpp swradiobutton.cpp swrangevalue.cpp swurl.cpp swusbcontrol.cpp swplayercontrol.cpp swsendercontrol.cpp swsetupcontrol.cpp swshutdowncontrol.cpp swsongscontrol.cpp swspectrumwidget.cpp swtoggleswitch.cpp swvolumewidget.cpp $(DISTDIR)/ + $(COPY_FILE) --parents raDIYo.ui swalarmcontrol.ui swbasecontrol.ui swbluetoothcontrol.ui swclockcontrol.ui swdummydialdialog.ui swdummypushdial.ui swlistcontrol.ui swplayercontrol.ui swsetupcontrol.ui swshutdowncontrol.ui $(DISTDIR)/ + + +clean: compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) *~ core *.core + + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) .qmake.stash + -$(DEL_FILE) Makefile + + +####### Sub-libraries + +mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all + +check: first + +benchmark: first + +compiler_rcc_make_all: qrc_raDIYo.cpp +compiler_rcc_clean: + -$(DEL_FILE) qrc_raDIYo.cpp +qrc_raDIYo.cpp: raDIYo.qrc \ + /usr/lib/qt5/bin/rcc \ + images/radiyo.pause.hover.png \ + images/radiyo.bluetooth.checked.png \ + images/radiyo.stop.checked.png \ + images/radiyo.stop.png \ + images/radiyo.play.checked.png \ + images/radiyo.songs.png \ + images/radiyo.setup.png \ + images/radiyo.pause.checked.png \ + images/radiyo.alarm.hover.png \ + images/radiyo.setup.hover.png \ + images/radiyo.sender.checked.png \ + images/radiyo.bluetooth.png \ + images/radiyo.bluetooth.hover.png \ + images/radiyo.halt.png \ + images/radiyo.setup.checked.png \ + images/radiyo.clock.png \ + images/radiyo.shutdown.png \ + images/radiyo.pause.png \ + images/radiyo.songs.checked.png \ + images/radiyo.weekday.checked.png \ + images/radiyo.play.png \ + images/radiyo.down.png \ + images/radiyo.stop.hover.png \ + images/radiyo.shutdown.checked.png \ + images/radiyo.clock.hover.png \ + images/radiyo.songs.hover.png \ + images/radiyo.usb.checked.png \ + images/radiyo.clock.checked.png \ + images/radiyo.down.hover.png \ + images/radiyo.weekday.hover.png \ + images/radiyo.shutdown.hover.png \ + images/radiyo.sender.hover.png \ + images/radiyo.down.checked.png \ + images/radiyo.alarm.png \ + images/radiyo.weekday.png \ + images/radiyo.usb.png \ + images/radiyo.sender.png \ + images/radiyo.usb.hover.png \ + images/radiyo.play.hover.png \ + images/radiyo.alarm.checked.png \ + data/radiyo.senderlist.csv \ + data/radiyo.titlelabel.css \ + fonts/gradogradoonf.regular.ttf \ + fonts/SelznickRemixNF.ttf \ + fonts/valleygrrrlnf.regular.ttf \ + fonts/Afterclap_Personal_Use.otf \ + fonts/JosefinSans-SemiBold.ttf \ + fonts/JosefinSans-VariableFont_wght.ttf + /usr/lib/qt5/bin/rcc -name raDIYo raDIYo.qrc -o qrc_raDIYo.cpp + +compiler_moc_predefs_make_all: moc_predefs.h +compiler_moc_predefs_clean: + -$(DEL_FILE) moc_predefs.h +moc_predefs.h: /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/data/dummy.cpp + g++ -pipe -O2 -std=gnu++1z -Wall -Wextra -dM -E -o moc_predefs.h /usr/lib/arm-linux-gnueabihf/qt5/mkspecs/features/data/dummy.cpp + +compiler_moc_header_make_all: moc_SWPiGPIO.cpp moc_raDIYo.cpp moc_swadjustabledigit.cpp moc_swalarmcontrol.cpp moc_swbarwidget.cpp moc_swbasecontrol.cpp moc_swbluetoothcontrol.cpp moc_swclockcontrol.cpp moc_swcontrol.cpp moc_swdialbutton.cpp moc_swdialcontrol.cpp moc_swdummydialdialog.cpp moc_swdummypushdial.cpp moc_swfftcalc.cpp moc_swflipdigit.cpp moc_swlistcontrol.cpp moc_swradiobutton.cpp moc_swusbcontrol.cpp moc_swplayercontrol.cpp moc_swsendercontrol.cpp moc_swsetupcontrol.cpp moc_swshutdowncontrol.cpp moc_swsongscontrol.cpp moc_swspectrumwidget.cpp moc_swtoggleswitch.cpp moc_swvolumewidget.cpp +compiler_moc_header_clean: + -$(DEL_FILE) moc_SWPiGPIO.cpp moc_raDIYo.cpp moc_swadjustabledigit.cpp moc_swalarmcontrol.cpp moc_swbarwidget.cpp moc_swbasecontrol.cpp moc_swbluetoothcontrol.cpp moc_swclockcontrol.cpp moc_swcontrol.cpp moc_swdialbutton.cpp moc_swdialcontrol.cpp moc_swdummydialdialog.cpp moc_swdummypushdial.cpp moc_swfftcalc.cpp moc_swflipdigit.cpp moc_swlistcontrol.cpp moc_swradiobutton.cpp moc_swusbcontrol.cpp moc_swplayercontrol.cpp moc_swsendercontrol.cpp moc_swsetupcontrol.cpp moc_swshutdowncontrol.cpp moc_swsongscontrol.cpp moc_swspectrumwidget.cpp moc_swtoggleswitch.cpp moc_swvolumewidget.cpp +moc_SWPiGPIO.cpp: SWPiGPIO.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include SWPiGPIO.h -o moc_SWPiGPIO.cpp + +moc_raDIYo.cpp: raDIYo.h \ + swurl.h \ + swbuttongroup.h \ + swdialhandler.h \ + raDIYoglobals.h \ + swcontrol.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include raDIYo.h -o moc_raDIYo.cpp + +moc_swadjustabledigit.cpp: swadjustabledigit.h \ + swflipdigit.h \ + swdialwidget.h \ + swdialhandler.h \ + swrangevalue.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swadjustabledigit.h -o moc_swadjustabledigit.cpp + +moc_swalarmcontrol.cpp: swalarmcontrol.h \ + swbuttongroup.h \ + swdialhandler.h \ + ui_swalarmcontrol.h \ + swadjustabledigit.h \ + swflipdigit.h \ + swdialwidget.h \ + swrangevalue.h \ + swtoggleswitch.h \ + swdialcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + ui_swbasecontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h \ + swdialbutton.h \ + swurl.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swalarmcontrol.h -o moc_swalarmcontrol.cpp + +moc_swbarwidget.cpp: swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swbarwidget.h -o moc_swbarwidget.cpp + +moc_swbasecontrol.cpp: swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swbasecontrol.h -o moc_swbasecontrol.cpp + +moc_swbluetoothcontrol.cpp: swbluetoothcontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + ui_swbluetoothcontrol.h \ + swdialbutton.h \ + swdialwidget.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swbluetoothcontrol.h -o moc_swbluetoothcontrol.cpp + +moc_swclockcontrol.cpp: swclockcontrol.h \ + swcontrol.h \ + swdialhandler.h \ + swflipdigit.h \ + swdialwidget.h \ + swrangevalue.h \ + ui_swclockcontrol.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swclockcontrol.h -o moc_swclockcontrol.cpp + +moc_swcontrol.cpp: swcontrol.h \ + swdialhandler.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swcontrol.h -o moc_swcontrol.cpp + +moc_swdialbutton.cpp: swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swdialbutton.h -o moc_swdialbutton.cpp + +moc_swdialcontrol.cpp: swdialcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h \ + swdialbutton.h \ + swdialwidget.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swdialcontrol.h -o moc_swdialcontrol.cpp + +moc_swdummydialdialog.cpp: swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swdummydialdialog.h -o moc_swdummydialdialog.cpp + +moc_swdummypushdial.cpp: swdummypushdial.h \ + ui_swdummypushdial.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swdummypushdial.h -o moc_swdummypushdial.cpp + +moc_swfftcalc.cpp: swfftcalc.h \ + raDIYoglobals.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swfftcalc.h -o moc_swfftcalc.cpp + +moc_swflipdigit.cpp: swflipdigit.h \ + swdialwidget.h \ + swdialhandler.h \ + swrangevalue.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swflipdigit.h -o moc_swflipdigit.cpp + +moc_swlistcontrol.cpp: swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swlistcontrol.h -o moc_swlistcontrol.cpp + +moc_swradiobutton.cpp: swradiobutton.h \ + swdialwidget.h \ + swdialhandler.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swradiobutton.h -o moc_swradiobutton.cpp + +moc_swusbcontrol.cpp: swusbcontrol.h \ + swsongscontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swusbcontrol.h -o moc_swusbcontrol.cpp + +moc_swplayercontrol.cpp: swplayercontrol.h \ + ui_swplayercontrol.h \ + swspectrumwidget.h \ + swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h \ + swcontrol.h \ + swfftcalc.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swplayercontrol.h -o moc_swplayercontrol.cpp + +moc_swsendercontrol.cpp: swsendercontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swsendercontrol.h -o moc_swsendercontrol.cpp + +moc_swsetupcontrol.cpp: swsetupcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + ui_swsetupcontrol.h \ + swdialbutton.h \ + swdialwidget.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swsetupcontrol.h -o moc_swsetupcontrol.cpp + +moc_swshutdowncontrol.cpp: swshutdowncontrol.h \ + ui_swshutdowncontrol.h \ + swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h \ + swdialcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + ui_swbasecontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swshutdowncontrol.h -o moc_swshutdowncontrol.cpp + +moc_swsongscontrol.cpp: swsongscontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swsongscontrol.h -o moc_swsongscontrol.cpp + +moc_swspectrumwidget.cpp: swspectrumwidget.h \ + swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swspectrumwidget.h -o moc_swspectrumwidget.cpp + +moc_swtoggleswitch.cpp: swtoggleswitch.h \ + swdialwidget.h \ + swdialhandler.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swtoggleswitch.h -o moc_swtoggleswitch.cpp + +moc_swvolumewidget.cpp: swvolumewidget.h \ + swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h \ + moc_predefs.h \ + /usr/lib/qt5/bin/moc + /usr/lib/qt5/bin/moc $(DEFINES) --include /home/pi/share/projects.nxt/raDIYo/moc_predefs.h -I/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/linux-g++ -I/home/pi/share/projects.nxt/raDIYo -I/home/pi/share/projects.nxt/raDIYo -I/usr/include/arm-linux-gnueabihf/qt5 -I/usr/include/arm-linux-gnueabihf/qt5/QtMultimedia -I/usr/include/arm-linux-gnueabihf/qt5/QtWidgets -I/usr/include/arm-linux-gnueabihf/qt5/QtGui -I/usr/include/arm-linux-gnueabihf/qt5/QtNetwork -I/usr/include/arm-linux-gnueabihf/qt5/QtBluetooth -I/usr/include/arm-linux-gnueabihf/qt5/QtCore -I/usr/include/c++/10 -I/usr/include/arm-linux-gnueabihf/c++/10 -I/usr/include/c++/10/backward -I/usr/lib/gcc/arm-linux-gnueabihf/10/include -I/usr/local/include -I/usr/include/arm-linux-gnueabihf -I/usr/include swvolumewidget.h -o moc_swvolumewidget.cpp + +compiler_moc_objc_header_make_all: +compiler_moc_objc_header_clean: +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: ui_raDIYo.h ui_swalarmcontrol.h ui_swbasecontrol.h ui_swbluetoothcontrol.h ui_swclockcontrol.h ui_swdummydialdialog.h ui_swdummypushdial.h ui_swlistcontrol.h ui_swplayercontrol.h ui_swsetupcontrol.h ui_swshutdowncontrol.h +compiler_uic_clean: + -$(DEL_FILE) ui_raDIYo.h ui_swalarmcontrol.h ui_swbasecontrol.h ui_swbluetoothcontrol.h ui_swclockcontrol.h ui_swdummydialdialog.h ui_swdummypushdial.h ui_swlistcontrol.h ui_swplayercontrol.h ui_swsetupcontrol.h ui_swshutdowncontrol.h +ui_raDIYo.h: raDIYo.ui \ + /usr/lib/qt5/bin/uic \ + swradiobutton.h \ + swdialwidget.h \ + swdialhandler.h + /usr/lib/qt5/bin/uic raDIYo.ui -o ui_raDIYo.h + +ui_swalarmcontrol.h: swalarmcontrol.ui \ + /usr/lib/qt5/bin/uic \ + swadjustabledigit.h \ + swtoggleswitch.h \ + swflipdigit.h \ + swdialwidget.h \ + swdialhandler.h \ + swrangevalue.h \ + swdialwidget.h \ + swdialhandler.h + /usr/lib/qt5/bin/uic swalarmcontrol.ui -o ui_swalarmcontrol.h + +ui_swbasecontrol.h: swbasecontrol.ui \ + /usr/lib/qt5/bin/uic + /usr/lib/qt5/bin/uic swbasecontrol.ui -o ui_swbasecontrol.h + +ui_swbluetoothcontrol.h: swbluetoothcontrol.ui \ + /usr/lib/qt5/bin/uic \ + swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h + /usr/lib/qt5/bin/uic swbluetoothcontrol.ui -o ui_swbluetoothcontrol.h + +ui_swclockcontrol.h: swclockcontrol.ui \ + /usr/lib/qt5/bin/uic \ + swflipdigit.h \ + swdialwidget.h \ + swdialhandler.h \ + swrangevalue.h + /usr/lib/qt5/bin/uic swclockcontrol.ui -o ui_swclockcontrol.h + +ui_swdummydialdialog.h: swdummydialdialog.ui \ + /usr/lib/qt5/bin/uic \ + swdummypushdial.h \ + ui_swdummypushdial.h + /usr/lib/qt5/bin/uic swdummydialdialog.ui -o ui_swdummydialdialog.h + +ui_swdummypushdial.h: swdummypushdial.ui \ + /usr/lib/qt5/bin/uic + /usr/lib/qt5/bin/uic swdummypushdial.ui -o ui_swdummypushdial.h + +ui_swlistcontrol.h: swlistcontrol.ui \ + /usr/lib/qt5/bin/uic + /usr/lib/qt5/bin/uic swlistcontrol.ui -o ui_swlistcontrol.h + +ui_swplayercontrol.h: swplayercontrol.ui \ + /usr/lib/qt5/bin/uic \ + swspectrumwidget.h \ + swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h + /usr/lib/qt5/bin/uic swplayercontrol.ui -o ui_swplayercontrol.h + +ui_swsetupcontrol.h: swsetupcontrol.ui \ + /usr/lib/qt5/bin/uic \ + swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h + /usr/lib/qt5/bin/uic swsetupcontrol.ui -o ui_swsetupcontrol.h + +ui_swshutdowncontrol.h: swshutdowncontrol.ui \ + /usr/lib/qt5/bin/uic \ + swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h + /usr/lib/qt5/bin/uic swshutdowncontrol.ui -o ui_swshutdowncontrol.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_rcc_clean compiler_moc_predefs_clean compiler_moc_header_clean compiler_uic_clean + +####### Compile + +SWPiGPIO.o: SWPiGPIO.cpp SWPiGPIO.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o SWPiGPIO.o SWPiGPIO.cpp + +main.o: main.cpp SWPiGPIO.h \ + raDIYo.h \ + swurl.h \ + swbuttongroup.h \ + swdialhandler.h \ + raDIYoglobals.h \ + swcontrol.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h \ + swtoggleswitch.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp + +raDIYoglobals.o: raDIYoglobals.cpp raDIYoglobals.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o raDIYoglobals.o raDIYoglobals.cpp + +raDIYo.o: raDIYo.cpp raDIYo.h \ + swurl.h \ + swbuttongroup.h \ + swdialhandler.h \ + raDIYoglobals.h \ + swcontrol.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h \ + swdialbutton.h \ + swsendercontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + ui_swbasecontrol.h \ + ui_swlistcontrol.h \ + swsongscontrol.h \ + swshutdowncontrol.h \ + ui_swshutdowncontrol.h \ + swdialcontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h \ + swclockcontrol.h \ + swflipdigit.h \ + ui_swclockcontrol.h \ + swalarmcontrol.h \ + ui_swalarmcontrol.h \ + swadjustabledigit.h \ + swtoggleswitch.h \ + swusbcontrol.h \ + swbluetoothcontrol.h \ + ui_swbluetoothcontrol.h \ + swplayercontrol.h \ + ui_swplayercontrol.h \ + swspectrumwidget.h \ + swfftcalc.h \ + SWPiGPIO.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o raDIYo.o raDIYo.cpp + +swadjustabledigit.o: swadjustabledigit.cpp swadjustabledigit.h \ + swflipdigit.h \ + swdialwidget.h \ + swdialhandler.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swadjustabledigit.o swadjustabledigit.cpp + +swalarmcontrol.o: swalarmcontrol.cpp swalarmcontrol.h \ + swbuttongroup.h \ + swdialhandler.h \ + ui_swalarmcontrol.h \ + swadjustabledigit.h \ + swflipdigit.h \ + swdialwidget.h \ + swrangevalue.h \ + swtoggleswitch.h \ + swdialcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + ui_swbasecontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h \ + swdialbutton.h \ + swurl.h \ + raDIYo.h \ + raDIYoglobals.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swalarmcontrol.o swalarmcontrol.cpp + +swbarwidget.o: swbarwidget.cpp swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swbarwidget.o swbarwidget.cpp + +swbasecontrol.o: swbasecontrol.cpp swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swbasecontrol.o swbasecontrol.cpp + +swbluetoothcontrol.o: swbluetoothcontrol.cpp swbluetoothcontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + ui_swbluetoothcontrol.h \ + swdialbutton.h \ + swdialwidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swbluetoothcontrol.o swbluetoothcontrol.cpp + +swbuttongroup.o: swbuttongroup.cpp swbuttongroup.h \ + swdialhandler.h \ + raDIYoglobals.h \ + swradiobutton.h \ + swdialwidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swbuttongroup.o swbuttongroup.cpp + +swclockcontrol.o: swclockcontrol.cpp swclockcontrol.h \ + swcontrol.h \ + swdialhandler.h \ + swflipdigit.h \ + swdialwidget.h \ + swrangevalue.h \ + ui_swclockcontrol.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swclockcontrol.o swclockcontrol.cpp + +swcontrol.o: swcontrol.cpp swcontrol.h \ + swdialhandler.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swcontrol.o swcontrol.cpp + +swdialbutton.o: swdialbutton.cpp swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swdialbutton.o swdialbutton.cpp + +swdialhandler.o: swdialhandler.cpp swdialhandler.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swdialhandler.o swdialhandler.cpp + +swdialcontrol.o: swdialcontrol.cpp swdialcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h \ + swdialbutton.h \ + swdialwidget.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swdialcontrol.o swdialcontrol.cpp + +swdialwidget.o: swdialwidget.cpp swdialwidget.h \ + swdialhandler.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swdialwidget.o swdialwidget.cpp + +swdummydialdialog.o: swdummydialdialog.cpp swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swdummydialdialog.o swdummydialdialog.cpp + +swdummypushdial.o: swdummypushdial.cpp swdummypushdial.h \ + ui_swdummypushdial.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swdummypushdial.o swdummypushdial.cpp + +swfftcalc.o: swfftcalc.cpp swfftcalc.h \ + raDIYoglobals.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swfftcalc.o swfftcalc.cpp + +swflipdigit.o: swflipdigit.cpp swflipdigit.h \ + swdialwidget.h \ + swdialhandler.h \ + swrangevalue.h \ + raDIYoglobals.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swflipdigit.o swflipdigit.cpp + +swlistcontrol.o: swlistcontrol.cpp swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swlistcontrol.o swlistcontrol.cpp + +swradiobutton.o: swradiobutton.cpp swradiobutton.h \ + swdialwidget.h \ + swdialhandler.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swradiobutton.o swradiobutton.cpp + +swrangevalue.o: swrangevalue.cpp swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swrangevalue.o swrangevalue.cpp + +swurl.o: swurl.cpp raDIYoglobals.h \ + swurl.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swurl.o swurl.cpp + +swusbcontrol.o: swusbcontrol.cpp swusbcontrol.h \ + swsongscontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + raDIYo.h \ + swbuttongroup.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swusbcontrol.o swusbcontrol.cpp + +swplayercontrol.o: swplayercontrol.cpp swplayercontrol.h \ + ui_swplayercontrol.h \ + swspectrumwidget.h \ + swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h \ + swcontrol.h \ + swfftcalc.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swplayercontrol.o swplayercontrol.cpp + +swsendercontrol.o: swsendercontrol.cpp swsendercontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + raDIYo.h \ + swbuttongroup.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swsendercontrol.o swsendercontrol.cpp + +swsetupcontrol.o: swsetupcontrol.cpp swsetupcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + ui_swsetupcontrol.h \ + swdialbutton.h \ + swdialwidget.h \ + raDIYo.h \ + swurl.h \ + swbuttongroup.h \ + raDIYoglobals.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swsetupcontrol.o swsetupcontrol.cpp + +swshutdowncontrol.o: swshutdowncontrol.cpp raDIYoglobals.h \ + swshutdowncontrol.h \ + ui_swshutdowncontrol.h \ + swdialbutton.h \ + swdialwidget.h \ + swdialhandler.h \ + swdialcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + ui_swbasecontrol.h \ + swsetupcontrol.h \ + ui_swsetupcontrol.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swshutdowncontrol.o swshutdowncontrol.cpp + +swsongscontrol.o: swsongscontrol.cpp swsongscontrol.h \ + swlistcontrol.h \ + swbasecontrol.h \ + swcontrol.h \ + swdialhandler.h \ + ui_swbasecontrol.h \ + swurl.h \ + ui_swlistcontrol.h \ + raDIYoglobals.h \ + raDIYo.h \ + swbuttongroup.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swsongscontrol.o swsongscontrol.cpp + +swspectrumwidget.o: swspectrumwidget.cpp swspectrumwidget.h \ + swbarwidget.h \ + raDIYoglobals.h \ + swdialhandler.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swspectrumwidget.o swspectrumwidget.cpp + +swtoggleswitch.o: swtoggleswitch.cpp swtoggleswitch.h \ + swdialwidget.h \ + swdialhandler.h \ + raDIYoglobals.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swtoggleswitch.o swtoggleswitch.cpp + +swvolumewidget.o: swvolumewidget.cpp raDIYo.h \ + swurl.h \ + swbuttongroup.h \ + swdialhandler.h \ + raDIYoglobals.h \ + swcontrol.h \ + swdummydialdialog.h \ + ui_swdummydialdialog.h \ + swdummypushdial.h \ + ui_swdummypushdial.h \ + swdialwidget.h \ + ui_raDIYo.h \ + swradiobutton.h \ + swvolumewidget.h \ + swbarwidget.h \ + swrangevalue.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o swvolumewidget.o swvolumewidget.cpp + +qrc_raDIYo.o: qrc_raDIYo.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_raDIYo.o qrc_raDIYo.cpp + +moc_SWPiGPIO.o: moc_SWPiGPIO.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_SWPiGPIO.o moc_SWPiGPIO.cpp + +moc_raDIYo.o: moc_raDIYo.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_raDIYo.o moc_raDIYo.cpp + +moc_swadjustabledigit.o: moc_swadjustabledigit.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swadjustabledigit.o moc_swadjustabledigit.cpp + +moc_swalarmcontrol.o: moc_swalarmcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swalarmcontrol.o moc_swalarmcontrol.cpp + +moc_swbarwidget.o: moc_swbarwidget.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swbarwidget.o moc_swbarwidget.cpp + +moc_swbasecontrol.o: moc_swbasecontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swbasecontrol.o moc_swbasecontrol.cpp + +moc_swbluetoothcontrol.o: moc_swbluetoothcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swbluetoothcontrol.o moc_swbluetoothcontrol.cpp + +moc_swclockcontrol.o: moc_swclockcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swclockcontrol.o moc_swclockcontrol.cpp + +moc_swcontrol.o: moc_swcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swcontrol.o moc_swcontrol.cpp + +moc_swdialbutton.o: moc_swdialbutton.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swdialbutton.o moc_swdialbutton.cpp + +moc_swdialcontrol.o: moc_swdialcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swdialcontrol.o moc_swdialcontrol.cpp + +moc_swdummydialdialog.o: moc_swdummydialdialog.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swdummydialdialog.o moc_swdummydialdialog.cpp + +moc_swdummypushdial.o: moc_swdummypushdial.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swdummypushdial.o moc_swdummypushdial.cpp + +moc_swfftcalc.o: moc_swfftcalc.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swfftcalc.o moc_swfftcalc.cpp + +moc_swflipdigit.o: moc_swflipdigit.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swflipdigit.o moc_swflipdigit.cpp + +moc_swlistcontrol.o: moc_swlistcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swlistcontrol.o moc_swlistcontrol.cpp + +moc_swradiobutton.o: moc_swradiobutton.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swradiobutton.o moc_swradiobutton.cpp + +moc_swusbcontrol.o: moc_swusbcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swusbcontrol.o moc_swusbcontrol.cpp + +moc_swplayercontrol.o: moc_swplayercontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swplayercontrol.o moc_swplayercontrol.cpp + +moc_swsendercontrol.o: moc_swsendercontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swsendercontrol.o moc_swsendercontrol.cpp + +moc_swsetupcontrol.o: moc_swsetupcontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swsetupcontrol.o moc_swsetupcontrol.cpp + +moc_swshutdowncontrol.o: moc_swshutdowncontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swshutdowncontrol.o moc_swshutdowncontrol.cpp + +moc_swsongscontrol.o: moc_swsongscontrol.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swsongscontrol.o moc_swsongscontrol.cpp + +moc_swspectrumwidget.o: moc_swspectrumwidget.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swspectrumwidget.o moc_swspectrumwidget.cpp + +moc_swtoggleswitch.o: moc_swtoggleswitch.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swtoggleswitch.o moc_swtoggleswitch.cpp + +moc_swvolumewidget.o: moc_swvolumewidget.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_swvolumewidget.o moc_swvolumewidget.cpp + +####### Install + +install_target: first FORCE + @test -d $(INSTALL_ROOT)/opt/raDIYo/bin || mkdir -p $(INSTALL_ROOT)/opt/raDIYo/bin + $(QINSTALL_PROGRAM) $(QMAKE_TARGET) $(INSTALL_ROOT)/opt/raDIYo/bin/$(QMAKE_TARGET) + -$(STRIP) $(INSTALL_ROOT)/opt/raDIYo/bin/$(QMAKE_TARGET) + +uninstall_target: FORCE + -$(DEL_FILE) $(INSTALL_ROOT)/opt/raDIYo/bin/$(QMAKE_TARGET) + -$(DEL_DIR) $(INSTALL_ROOT)/opt/raDIYo/bin/ + + +install: install_target FORCE + +uninstall: uninstall_target FORCE + +FORCE: + diff --git a/README.md b/README.md new file mode 100644 index 0000000..852774f --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# Aufgabenstellung IoT Native Entwicklung + +**Abstract**: +Ein Erzeuger generiert Werte die an einen Verbraucher übertragen werden. +Der Verbraucher zeigt die einzelnen Werte in der Konsole an. +Der Erzeuger kann erst neue Werte an den Verbraucher senden, wenn der Verbraucher den Wert verbraucht (ausgegeben) hat. + +**Feature**: +Der Erzeuger überträgt ein variables Objekt an einen Verbraucher der das Objekt auf der Konsole ausgibt + +**Scenario**: Das erzeugte, variable Objekt stellt in der ersten Ausprägung einen Sekunden Zeitwert mit aktuellem Zeitstempel in msec dar +**Given** der aktuelle Zeitwert in Sekunden +**When** das Objekt erstellt wird +**Then** Sekunden Wert und ein Zeitstempel in msec wird in das Objekt eingetragen + +**Scenario**: Das Objekt wird an den Verbraucher übertragen +**Given** ein erstelltes Objekt +**When** das Objekt übertragen wird +**Then** wird auf den Verbraucher gewartet bis er das Objekt verarbeiten kann + +**Scenario**: Das Objekt ist im Verbraucher angekommen +**Given** ein übertragenes Objekt +**When** das Objekt ausgegeben ist +**Then** wird der Erzeuger informiert ein neues Objekt zu erzeugen + +**Scenario**: Das Objekt wird im Verbraucher ausgegeben +**Given** eine übertragenes Objekt +**When** das Objekt ausgegeben wird +**Then** der Wert in Sekunden wird numerisch, der Zeitstempel in lesbarer vollständiger Form, ausgegeben + +**Scenario**: Das Objekt wird vom Erzeuger übertragen +**Given** ein erstelltes Objekt +**When** das Objekt übertragen wird +**Then** der Erzeuger wartet bis der Verbraucher eine Erzeugung angefordert hat + +**Scenario**: Das Objekt wird übertragen +**Given** ein erstelltes Objekt +**When** das Objekt übertragen wird +**Then** das Objekt wird serialisiert über einen Socket übertragen + +## Development Guidelines + +- Die Verwendung von C++ Standards, C11 und neuer +- Die Implementierung soll eine Linux und Windows Plattform abdecken +- Das Build System für die gesamte Anwendung ist CMake +- Die gesamte Anwendung verfügt über Unit Tests die mit google test zu erstellen sind +- Die Versionsverwaltung git ist zu verwenden +- Eine Dokumentation des Anwendungsentwurfs ist verfügbar +- Die Übertragung kann von Sockets auf andere Mechanismen (Shared File) umgestellt werden. Der Impact auf die Anwendung soll begrenzt sein. + diff --git a/README.md.backup b/README.md.backup new file mode 100644 index 0000000..1b0f802 --- /dev/null +++ b/README.md.backup @@ -0,0 +1,12 @@ +# README.md raDIYo + +### Eine Mediaplayer-Software für den RaspberryPi, zugleich ein Hardware-Updgrade eines Nora 'Rienzi' Radios, Bj. ca. 1935 + + +Der Raspberry Pi eignet sich mit etwas Zusatzhardware bekanntermaßen hervorragend als Mediaplayer,da lag es nahe, einen Pi4 Internetradio-Wecker zu verwenden. + +Impl. + + + +Arch. diff --git a/SWPiGPIO.cpp b/SWPiGPIO.cpp new file mode 100644 index 0000000..4aba484 --- /dev/null +++ b/SWPiGPIO.cpp @@ -0,0 +1,279 @@ +/*************************************************************************** + + source::worx PiGPIO + Copyright © 2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +#include +#include + +#include + +#ifdef Q_OS_LINUX + +#include +//#include +//#include "/usr/include/pigpio.h" + +#include + +PiGPIO::PiGPIO() +{ + //::gpioInitialise(); + // Connect to Pi. + constexpr char* optHost = nullptr; + constexpr char* optPort = nullptr; + PI = ::pigpio_start( optHost, optPort ); + qDebug() << " -- PiGPIO::PiGPIO(): " << PI; + if( PI < 0 ) + qDebug() << "-- PiGPIO::PiGPIO() FAIL"; +} + + +PiGPIO::~PiGPIO() +{ + ::pigpio_stop( PI ); +} + + +//---------------------------------------------- + + + +/** + * @brief Implementierung für Linux + */ + +PiGRotaryDial::PiGRotaryDial( unsigned dialA, unsigned dialB, unsigned button, QObject* parent ) + : QObject( parent ), + _dialA( dialA ), _dialB( dialB ), _button( button ) + +{ + + _Pi = PiGPIO::Instance().PI; + + //_mode = mode; + //_cb = cb_func; + _levA = 0; + _levB = 0; + _step = 0; + + ::set_mode( _Pi, _dialA, PI_INPUT ); + ::set_mode( _Pi, _dialB, PI_INPUT ); + ::set_mode( _Pi, _button, PI_INPUT ); + + // pull up is needed as encoder common is grounded + + ::set_pull_up_down( _Pi, _dialA, PI_PUD_UP ); + ::set_pull_up_down( _Pi, _dialB, PI_PUD_UP ); + ::set_pull_up_down( _Pi, _button, PI_PUD_UP ); + + _glitch = 1000; + + ::set_glitch_filter( _Pi, _dialA, _glitch ); + ::set_glitch_filter( _Pi, _dialB, _glitch ); + ::set_glitch_filter( _Pi, _button, _glitch ); + + _oldState = ( ::gpio_read( _Pi, _dialA ) << 1) | ::gpio_read( _Pi, _dialB ); + + // monitor encoder level changes + //int callback_ex(int pi, unsigned user_gpio, unsigned edge, CBFuncEx_t f, void *userdata) + // typedef void (*CBFuncEx_t)(int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata); + _callbackIdA = ::callback_ex( _Pi, _dialA, EITHER_EDGE, PiGPIOPulse, this ); + _callbackIdB = ::callback_ex( _Pi, _dialB, EITHER_EDGE, PiGPIOPulse, this ); + _callbackIdC = ::callback_ex( _Pi, _button, EITHER_EDGE, PiGPIOPulse, this ); +} + + +PiGRotaryDial::~PiGRotaryDial() +{ + + if( _callbackIdA >= 0 ) + { + ::callback_cancel( _callbackIdA ); + _callbackIdA = -1; + } + + if( _callbackIdB >= 0 ) + { + ::callback_cancel( _callbackIdB ); + _callbackIdB = -1; + } + + if( _callbackIdC >= 0 ) + { + ::callback_cancel( _callbackIdC ); + _callbackIdC = -1; + } + + ::set_glitch_filter( _Pi, _dialA, 0 ); + ::set_glitch_filter( _Pi, _dialB, 0 ); + ::set_glitch_filter( _Pi, _button, 0 ); + +} + + +void PiGRotaryDial::setGlitchFilter( int glitch ) +{ + if( _glitch == glitch ) + return; + _glitch = glitch; + ::set_glitch_filter( _Pi, _dialA, glitch ); + ::set_glitch_filter( _Pi, _dialB, glitch ); + ::set_glitch_filter( _Pi, _button, glitch ); +} + + +void PiGRotaryDial::pulse( unsigned gpio, unsigned level ) +{ + + + if( level == PI_TIMEOUT ) + return; + if( gpio == _button ) + return handleClick( level ); + + if( gpio == _dialA ) + _levA = level; + else + _levB = level; + + // sourceworx proudly presents: + // den primitivstmöglichen Auslese-algorithmus + // für Rotary-Dials. + // Die klugen Varianten stehen hier: + // https://www.best-microcontroller-projects.com/rotary-encoder.html + // https://web.engr.oregonstate.edu/~traylor/ece473/student_projects/ReadingEncoderSwitches.pdf + + // wenn sich was geändert hatte ... + if( gpio == _dialB && level == 1 ) + { + // bestimmt der andere Kontakt die + // die Drehrichtung + + int delta = _levA ? -1 : +1; + //qDebug() << "###### EMIT: " << delta; + emit deltaChanged( delta ); + } +} + + +void PiGRotaryDial::handleClick( unsigned level ) +{ + if( !_pressed && level == 0 ) + { + _pressed = true; + return; + } + if( _pressed && level == 1 ) + { + _pressed = false; + emit clicked(); + } + +} + +#endif // Q_OS_LINUX + + +/*************************************************************************** + + source::worx PiGPIO + Copyright © 2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +#ifdef Q_OS_WIN + + +PiGPIO::PiGPIO() +{ + +} + +PiGPIO::~PiGPIO() +{ +} + + +PiGRotaryDial::PiGRotaryDial( unsigned dialA, unsigned dialB, unsigned button, QObject* parent ) + : QObject( parent ), + _dialA( dialA ), _dialB( dialB ), _button( button ) + +{ + +} + +PiGRotaryDial::~PiGRotaryDial() +{ + +} + + +void PiGRotaryDial::setGlitchFilter( int ) +{ + +} + + +void PiGRotaryDial::pulse( unsigned, unsigned ) +{ + +} + +#endif //Q_OS_WIN + + + +/*************************************************************************** + + source::worx PiGPIO + Copyright © 2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + + +void PiGRotaryDial::PiGPIOPulse( int pi, unsigned gpio, unsigned level, uint32_t tick, void *user ) +{ + + Q_UNUSED( pi ); + Q_UNUSED( tick ); + + // Need a static callback to link with C. + PiGRotaryDial* mySelf = static_cast( user ); + if( mySelf ) + mySelf->pulse( gpio, level ); // Call the instance callback. +} + +/* +void PiGRotaryDial::setPosition( int position ) +{ + _step = position * 4; +} + + +int PiGRotaryDial::position() +{ + return _step / 4; +} +*/ diff --git a/SWPiGPIO.h b/SWPiGPIO.h new file mode 100644 index 0000000..5668398 --- /dev/null +++ b/SWPiGPIO.h @@ -0,0 +1,162 @@ +/*************************************************************************** + + source::worx PiGPIO + Copyright © 2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWPIGPIO_H +#define SWPIGPIO_H + +#include + +class PiGPIOFactory; +class PiGPIOLinFactory; +class PiGPIOWinFactory; +class PiGPIOWidget; + + + + +#ifdef Q_OS_WIN + +// Fake4Win +typedef void (*CBFuncEx_t)( int pi, unsigned user_gpio, unsigned level, uint32_t tick, void * userdata ); + +extern int PI_INPUT; +extern int PI_PUD_UP; +extern int EITHER_EDGE; +extern int PI_TIMEOUT; +//int PI_TIMEOUT = 42; + +extern int set_mode(int,int,int); +extern int set_pull_up_down(int,int,int); +extern int set_glitch_filter(int,int,int); +extern int callback_cancel(int); +extern int callback_ex(int,unsigned,int,CBFuncEx_t,void*); +extern int gpio_read(int,int); + +#endif //Q_OS_WIN + + +/** + * @brief @brief Prototypische Implementierung eines Wrappers für die 'pigpiod' library. + */ + +class PiGPIO +{ + +public: + + static PiGPIO& Instance() + { + static PiGPIO _Instance; // Guaranteed to be destroyed. + return _Instance; // Instantiated on first use. + } + + + PiGPIO( PiGPIO const& ) = delete; + void operator=(PiGPIO const&) = delete; + + ~PiGPIO(); + + int PI; + +private: + + PiGPIO(); + + bool _initCalled = false; + +}; + + +//--------------------------------------------------------------------- + +/** + + +---------+ +---------+ 0 + | | | | + A | | | | + | | | | + +---------+ +---------+ +----- 1 + + +---------+ +---------+ 0 + | | | | + B | | | | + | | | | + ----+ +---------+ +---------+ 1 + +*/ + +/** + * @brief Implentiert die Anbindung eines RotaryDials (Dreh-Drück Regler) + * an die Benutzeroberfläche + * + * Version über den 'pigpiod' _ohne_ direkten Hardwarezugriff (welcher root-Rechte + * benötigen würde) + */ + +class PiGRotaryDial : public QObject +{ + Q_OBJECT + +public: + + explicit PiGRotaryDial( unsigned dialA, unsigned dialB, unsigned button, QObject* parent = nullptr ); + virtual ~PiGRotaryDial(); + void setGlitchFilter( int glitch ); + +signals: + + void clicked(); + void deltaChanged( int value ); + +protected: + + void pulse( unsigned gpio, unsigned level ); + void handleClick( unsigned level ); + //void handlePulse( int value ); + + // Need a static callback to link with C. + static void PiGPIOPulse( int Pi, unsigned gpio, unsigned level, uint32_t tick, void *user ); + + /* + constexpr const static int Transits[16]= + { + // 0000 0001 0010 0011 0100 0101 0110 0111 + 0, -1, 1, 0, 1, 0, 0, -1, + // 1000 1001 1010 1011 1100 1101 1110 1111 + -1, 0, 0, 1, 0, 1, -1, 0 + }; + */ + + + int _Pi = -1; + unsigned _dialA = -1; + unsigned _dialB = -1; + unsigned _button = -1; + int _callbackIdA = -1; + int _callbackIdB = -1; + int _callbackIdC = -1; + int _levA = -1; + int _levB = -1; + int _oldState = -1; + int _glitch = -1; + int _step = 0; + int _oldStep = 0; + + bool _pressed = false; + + +}; + + +#endif // SWPIGPIO_H diff --git a/data/radiyo.senderlist.csv b/data/radiyo.senderlist.csv new file mode 100644 index 0000000..db1da86 --- /dev/null +++ b/data/radiyo.senderlist.csv @@ -0,0 +1,10 @@ +egoFM HQ;http://streams.egofm.de/egoFM-hq +Flux FM Berlin;http://streams.fluxfm.de/live/mp3-128/audio/ +egoFM Snow;http://streams.egofm.de/egoSNOW-egoFM +egoFM Riff;http://streams.egofm.de/egoRIFF-hq +Flux FM 60s: Back to the Sixties;http://streams.fluxfm.de/60er/mp3-128/streams.fluxfm.de/ +egoFM SUN;http://streams.egofm.de/egoSUN-hq +egoFM Hall of Fame;http://streams.egofm.de/egoFMHallOfFame-hq +Flux FM 90s: Der 90er Channel;http://streams.fluxfm.de/90er/mp3-128/audio/ +Flux FM 70s: Der 70er Channel;http://streams.fluxfm.de/70er/mp3-128/audio/ +Jäger Music Radio;http://streams.fluxfm.de/studio56/mp3-128/audio/ diff --git a/data/radiyo.titlelabel.css b/data/radiyo.titlelabel.css new file mode 100644 index 0000000..f196229 --- /dev/null +++ b/data/radiyo.titlelabel.css @@ -0,0 +1,5 @@ + margin-left: 0px; + border: 2px solid gray; + border-radius: 12px; + color: %1; + background: rgb(44,44,44); diff --git a/fonts/Afterclap_Personal_Use.otf b/fonts/Afterclap_Personal_Use.otf new file mode 100644 index 0000000..b14d132 Binary files /dev/null and b/fonts/Afterclap_Personal_Use.otf differ diff --git a/fonts/JosefinSans-SemiBold.ttf b/fonts/JosefinSans-SemiBold.ttf new file mode 100644 index 0000000..76ed61c Binary files /dev/null and b/fonts/JosefinSans-SemiBold.ttf differ diff --git a/fonts/JosefinSans-VariableFont_wght.ttf b/fonts/JosefinSans-VariableFont_wght.ttf new file mode 100644 index 0000000..70e1d82 Binary files /dev/null and b/fonts/JosefinSans-VariableFont_wght.ttf differ diff --git a/fonts/SelznickRemixNF.ttf b/fonts/SelznickRemixNF.ttf new file mode 100644 index 0000000..1558219 Binary files /dev/null and b/fonts/SelznickRemixNF.ttf differ diff --git a/fonts/gradogradoonf.regular.ttf b/fonts/gradogradoonf.regular.ttf new file mode 100644 index 0000000..350e11e Binary files /dev/null and b/fonts/gradogradoonf.regular.ttf differ diff --git a/fonts/valleygrrrlnf.regular.ttf b/fonts/valleygrrrlnf.regular.ttf new file mode 100644 index 0000000..ee4832a Binary files /dev/null and b/fonts/valleygrrrlnf.regular.ttf differ diff --git a/images/btn.pdn b/images/btn.pdn new file mode 100644 index 0000000..ded436c Binary files /dev/null and b/images/btn.pdn differ diff --git a/images/btn2.pdn b/images/btn2.pdn new file mode 100644 index 0000000..3a890a2 Binary files /dev/null and b/images/btn2.pdn differ diff --git a/images/radiyo.alarm.checked.png b/images/radiyo.alarm.checked.png new file mode 100644 index 0000000..cd766eb Binary files /dev/null and b/images/radiyo.alarm.checked.png differ diff --git a/images/radiyo.alarm.hover.png b/images/radiyo.alarm.hover.png new file mode 100644 index 0000000..7b20b30 Binary files /dev/null and b/images/radiyo.alarm.hover.png differ diff --git a/images/radiyo.alarm.png b/images/radiyo.alarm.png new file mode 100644 index 0000000..3528e44 Binary files /dev/null and b/images/radiyo.alarm.png differ diff --git a/images/radiyo.bluetooth.checked.png b/images/radiyo.bluetooth.checked.png new file mode 100644 index 0000000..ab9d752 Binary files /dev/null and b/images/radiyo.bluetooth.checked.png differ diff --git a/images/radiyo.bluetooth.hover.png b/images/radiyo.bluetooth.hover.png new file mode 100644 index 0000000..65f2085 Binary files /dev/null and b/images/radiyo.bluetooth.hover.png differ diff --git a/images/radiyo.bluetooth.png b/images/radiyo.bluetooth.png new file mode 100644 index 0000000..b8bdf07 Binary files /dev/null and b/images/radiyo.bluetooth.png differ diff --git a/images/radiyo.btn.clock.pdn b/images/radiyo.btn.clock.pdn new file mode 100644 index 0000000..3b51606 Binary files /dev/null and b/images/radiyo.btn.clock.pdn differ diff --git a/images/radiyo.btn.tpl.pdn b/images/radiyo.btn.tpl.pdn new file mode 100644 index 0000000..40d3aff Binary files /dev/null and b/images/radiyo.btn.tpl.pdn differ diff --git a/images/radiyo.clock.checked.png b/images/radiyo.clock.checked.png new file mode 100644 index 0000000..efe7d1c Binary files /dev/null and b/images/radiyo.clock.checked.png differ diff --git a/images/radiyo.clock.hover.png b/images/radiyo.clock.hover.png new file mode 100644 index 0000000..2543b53 Binary files /dev/null and b/images/radiyo.clock.hover.png differ diff --git a/images/radiyo.clock.png b/images/radiyo.clock.png new file mode 100644 index 0000000..a334edf Binary files /dev/null and b/images/radiyo.clock.png differ diff --git a/images/radiyo.digiclock.checked.png b/images/radiyo.digiclock.checked.png new file mode 100644 index 0000000..50b31d6 Binary files /dev/null and b/images/radiyo.digiclock.checked.png differ diff --git a/images/radiyo.digiclock.hover.png b/images/radiyo.digiclock.hover.png new file mode 100644 index 0000000..d17c3eb Binary files /dev/null and b/images/radiyo.digiclock.hover.png differ diff --git a/images/radiyo.digiclock.png b/images/radiyo.digiclock.png new file mode 100644 index 0000000..8ac7b28 Binary files /dev/null and b/images/radiyo.digiclock.png differ diff --git a/images/radiyo.down.checked.png b/images/radiyo.down.checked.png new file mode 100644 index 0000000..9610863 Binary files /dev/null and b/images/radiyo.down.checked.png differ diff --git a/images/radiyo.down.hover.png b/images/radiyo.down.hover.png new file mode 100644 index 0000000..852663f Binary files /dev/null and b/images/radiyo.down.hover.png differ diff --git a/images/radiyo.down.png b/images/radiyo.down.png new file mode 100644 index 0000000..d15ccfa Binary files /dev/null and b/images/radiyo.down.png differ diff --git a/images/radiyo.halt.png b/images/radiyo.halt.png new file mode 100644 index 0000000..1bdda18 Binary files /dev/null and b/images/radiyo.halt.png differ diff --git a/images/radiyo.pause.checked.png b/images/radiyo.pause.checked.png new file mode 100644 index 0000000..868206e Binary files /dev/null and b/images/radiyo.pause.checked.png differ diff --git a/images/radiyo.pause.hover.png b/images/radiyo.pause.hover.png new file mode 100644 index 0000000..18ba542 Binary files /dev/null and b/images/radiyo.pause.hover.png differ diff --git a/images/radiyo.pause.png b/images/radiyo.pause.png new file mode 100644 index 0000000..c540c03 Binary files /dev/null and b/images/radiyo.pause.png differ diff --git a/images/radiyo.play.checked.png b/images/radiyo.play.checked.png new file mode 100644 index 0000000..e1ccb7e Binary files /dev/null and b/images/radiyo.play.checked.png differ diff --git a/images/radiyo.play.hover.png b/images/radiyo.play.hover.png new file mode 100644 index 0000000..816b0a5 Binary files /dev/null and b/images/radiyo.play.hover.png differ diff --git a/images/radiyo.play.png b/images/radiyo.play.png new file mode 100644 index 0000000..baa244f Binary files /dev/null and b/images/radiyo.play.png differ diff --git a/images/radiyo.sender.checked.png b/images/radiyo.sender.checked.png new file mode 100644 index 0000000..3c66924 Binary files /dev/null and b/images/radiyo.sender.checked.png differ diff --git a/images/radiyo.sender.hover.png b/images/radiyo.sender.hover.png new file mode 100644 index 0000000..d9335e1 Binary files /dev/null and b/images/radiyo.sender.hover.png differ diff --git a/images/radiyo.sender.png b/images/radiyo.sender.png new file mode 100644 index 0000000..115af0b Binary files /dev/null and b/images/radiyo.sender.png differ diff --git a/images/radiyo.setup.checked.png b/images/radiyo.setup.checked.png new file mode 100644 index 0000000..bf46934 Binary files /dev/null and b/images/radiyo.setup.checked.png differ diff --git a/images/radiyo.setup.hover.png b/images/radiyo.setup.hover.png new file mode 100644 index 0000000..a7e1936 Binary files /dev/null and b/images/radiyo.setup.hover.png differ diff --git a/images/radiyo.setup.png b/images/radiyo.setup.png new file mode 100644 index 0000000..73ef232 Binary files /dev/null and b/images/radiyo.setup.png differ diff --git a/images/radiyo.shutdown.checked.png b/images/radiyo.shutdown.checked.png new file mode 100644 index 0000000..d805293 Binary files /dev/null and b/images/radiyo.shutdown.checked.png differ diff --git a/images/radiyo.shutdown.hover.png b/images/radiyo.shutdown.hover.png new file mode 100644 index 0000000..cef46f9 Binary files /dev/null and b/images/radiyo.shutdown.hover.png differ diff --git a/images/radiyo.shutdown.png b/images/radiyo.shutdown.png new file mode 100644 index 0000000..6207086 Binary files /dev/null and b/images/radiyo.shutdown.png differ diff --git a/images/radiyo.songs.checked.png b/images/radiyo.songs.checked.png new file mode 100644 index 0000000..a6152b2 Binary files /dev/null and b/images/radiyo.songs.checked.png differ diff --git a/images/radiyo.songs.hover.png b/images/radiyo.songs.hover.png new file mode 100644 index 0000000..8bdc97a Binary files /dev/null and b/images/radiyo.songs.hover.png differ diff --git a/images/radiyo.songs.png b/images/radiyo.songs.png new file mode 100644 index 0000000..7167fc0 Binary files /dev/null and b/images/radiyo.songs.png differ diff --git a/images/radiyo.stop.checked.png b/images/radiyo.stop.checked.png new file mode 100644 index 0000000..14dc6cd Binary files /dev/null and b/images/radiyo.stop.checked.png differ diff --git a/images/radiyo.stop.hover.png b/images/radiyo.stop.hover.png new file mode 100644 index 0000000..52f299f Binary files /dev/null and b/images/radiyo.stop.hover.png differ diff --git a/images/radiyo.stop.png b/images/radiyo.stop.png new file mode 100644 index 0000000..5abff78 Binary files /dev/null and b/images/radiyo.stop.png differ diff --git a/images/radiyo.usb.checked.png b/images/radiyo.usb.checked.png new file mode 100644 index 0000000..792c5fd Binary files /dev/null and b/images/radiyo.usb.checked.png differ diff --git a/images/radiyo.usb.hover - Kopie.png b/images/radiyo.usb.hover - Kopie.png new file mode 100644 index 0000000..3f39f49 Binary files /dev/null and b/images/radiyo.usb.hover - Kopie.png differ diff --git a/images/radiyo.usb.hover.png b/images/radiyo.usb.hover.png new file mode 100644 index 0000000..d0a3e77 Binary files /dev/null and b/images/radiyo.usb.hover.png differ diff --git a/images/radiyo.usb.png b/images/radiyo.usb.png new file mode 100644 index 0000000..fa186d6 Binary files /dev/null and b/images/radiyo.usb.png differ diff --git a/images/radiyo.weekday.checked.png b/images/radiyo.weekday.checked.png new file mode 100644 index 0000000..bc89916 Binary files /dev/null and b/images/radiyo.weekday.checked.png differ diff --git a/images/radiyo.weekday.hover.png b/images/radiyo.weekday.hover.png new file mode 100644 index 0000000..475b595 Binary files /dev/null and b/images/radiyo.weekday.hover.png differ diff --git a/images/radiyo.weekday.png b/images/radiyo.weekday.png new file mode 100644 index 0000000..6c92515 Binary files /dev/null and b/images/radiyo.weekday.png differ diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..236f26c --- /dev/null +++ b/main.cpp @@ -0,0 +1,62 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +/** + BUGS: + + - play pause nicht Rotary synchron + - Icon-hint auch für linken rotary? '<-->' wäre konsequent + - dazu setup opfern + - ein-hand bedienung: Volume per Left-Rotary ? + + */ + +int main(int argc, char *argv[] ) +{ + + + QCoreApplication::setOrganizationName ( raDIYo::OrgName ); + QCoreApplication::setOrganizationDomain( raDIYo::DomainName ); + QCoreApplication::setApplicationName ( raDIYo::AppName ); + + QApplication application( argc, argv ); + + // get the dimension available on this screen + QSize availableSize = QGuiApplication::primaryScreen()->availableGeometry().size(); + int width = availableSize.width(); + int height = availableSize.height(); + int xpos = ( width - RaDIYo::SWScreenLargeX ) / 2; + int ypos = ( height - RaDIYo::SWScreenLargeY ) / 2; + + + RaDIYo raDIYo; + + raDIYo.move( xpos, ypos + 40 ); + raDIYo.show(); + + return application.exec(); + +} diff --git a/raDIYo b/raDIYo new file mode 100644 index 0000000..2dae566 Binary files /dev/null and b/raDIYo differ diff --git a/raDIYo.cpp b/raDIYo.cpp new file mode 100644 index 0000000..5fea43e --- /dev/null +++ b/raDIYo.cpp @@ -0,0 +1,515 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +//#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + +RaDIYo::RaDIYo() +: QWidget( nullptr ) +{ + + + setupUi( this ); + + // startup + + // Das ist die Bildschirmgröße des Raspi 7 inch displays + resize( SWScreenLargeX, SWScreenLargeY ); + + setupFonts(); + setupControls(); + setupConnections(); + setupDefaults(); + + // bei untätigkeit kommt wieder die Uhr + //_idleTimer.setInterval( raDIYo::IdleTimeOut ); + //_idleTimer.setSingleShot( true ); + + // hier sind wir auch für die voreinstellungen zuständig: falls + // nicht vorhanden, default setzen + + // '_alarmControl->onShow();' stellt den Alarmtimer ein + // Das gehört hierher ins setup, weil + // wir den Alarm auch gesetzt haben wollen + // _ohne_ das AlarmConmtrol aufrufen zu müssen. + + _alarmControl->onShow(); + + + // wir starten mit der Uhr + onChangeState( RaDIYo::Clock ); + + // Der Startwert für die Lautstärke + // ist 20% vom Maximum und muss + // hier als Absolutwert gesetzt werden + // weil zur Laufzeit nur mit deltas + // gearbeitet wird. + + int vol = 20; + _nowPlaying.volume = vol; + _volumeWidget->setValue( vol ); + _playerControl->setValue( vol ); + + // not least + _version->setText( raDIYo::Version ); + qDebug( raDIYo::Version ); + +} + + +RaDIYo::~RaDIYo() +{ + _playerControl->stopPlaying(); + +#ifdef Q_OS_LINUX + delete _dialLeft; + delete _dialRight; +#endif + + for( SWControl* ctrl : _controls ) + delete ctrl; +} + +/** + * Behandelt die 'direkten' (vom touchscreen) Buttonsclicks aus der Buttongroup + * und den 'indirekten' Aufruf über die RotaryDials: Wenn die Buttonleiste aktiv ist, + * wird beim Klick auf den SenderButton auch 'idActivated(newId)' gesendet. + * + * @param newID id des Buttons ( entspricht der id des neuen Controls ) + */ + +void RaDIYo::onChangeState( int newState ) +{ + + //qDebug() << " ------- RaDIYo::onChangeState: " << newState << ": " << stateName( newState ) << " old: " << stateName( _curCtrlIdx ); + + bool pauseClicked = false; + + switch( newState ) + { + + // wir sind am abspielen, pause geklickt + case RaDIYo::Pause : + + // hide button + pauseClicked = true; + newState = RaDIYo::Play; + // fallthrough ... + + // play button geklickt + case RaDIYo::Play : + + showTitleText( pauseClicked ); + _playerControl->togglePlaying( !pauseClicked ); + _buttonPlay->setVisible( pauseClicked ); + _buttonPause->setVisible( !pauseClicked ); + break; + + case RaDIYo::Stop : + + showTitleText( false ); + _playerControl->stopPlaying(); + // Pause gilt nicht mehr nach 'stop' + _buttonPlay->setVisible( true ); + _buttonPause->setVisible( false ); + // fallthrough.. + + case RaDIYo::Back : + + //_curCtrlIdx = _lstState; + newState = Clock; //?? oder select + + } // switch + + + if( _curCtrlIdx == newState ) + return; + + // Hier wird unterschieden zwischen 'echten' Controls ('play', 'sender' ...) + // und dummies ohne eigene Seite ('stop', 'pause', 'back' ) + + _upMode = true; + SWControl* newControl = _controls[newState]; + + // wenn vorhanden ... + if( nullptr != newControl ) + { + // ... dann das alte aus- + _controls[_curCtrlIdx]->fadeOut(); + //_curCtrlIdx = newState; + + // und das neue Control einblenden ... + newControl->fadeIn(); + + // Kontrolle übergeben ... + _activeReceiver = newControl; + + // Wird das 'neue' Control vom RotaryDial gesteuert? + if( !newControl->acceptDial() ) + { + _activeReceiver = static_cast( &_raDIYoButtons ); + _upMode = false; + } + } + + _buttonBack->setVisible( _upMode ); + _buttonShutdown->setVisible( !_upMode ); + + _curCtrlIdx = newState; + + _raDIYoButtons.setCurrentActiveId( _curCtrlIdx ); + bool isPlaying = _playerState == QMediaPlayer::PlayingState; + _buttonStop->setEnabled( isPlaying ); + + +} + +void RaDIYo::showTitleText( bool pauseClicked ) +{ + QString color = pauseClicked ? "rgb(181,181,181)" : "white" ; + _currentTitle->setStyleSheet( _titleCss.arg( color ) ); + _currentTitle->setText( _nowPlaying.title ); +} + + + +// Wird nicht verwendet +void RaDIYo::onIdleTimeOut() +{ + // swap back + onChangeState( RaDIYo::Clock ); +} + + +/** + * @brief Slot, der bei Zustandsänderungen des Players + * aufgerufen wird + * @param state der neue PlayerState + */ + +void RaDIYo::onPlayingChanged( QMediaPlayer::State state ) +{ + bool callStop = false; + + // State-Änderung kommt von 'innen', also vom Player weil der Song zu Ende ist. + if( _curCtrlIdx == RaDIYo::Play && state == QMediaPlayer::StoppedState ) + callStop = true; + + _playerState = state; + + if( callStop ) + onChangeState( RaDIYo::Stop ); + +} + + +/** + * @brief Es wurde ein Sender oder Song aus der jeweiligen ListView ausgewählt. + * @param item der Sender/Song + + * @brief Event von aussen: Ein PlayListEntry wurde aktiviert + * und wir jetzt abgespielt. + * @param item + */ + +void RaDIYo::onPlayUrl( SWUrl item ) +{ + _nowPlaying = item; + onPlayCurrentUrl(); +} + + +/** + * @brief von aussen und von innen, spielt + * die derzeitige defaultquelle ab, wird + * vom Wecker benutzt. + */ + +void RaDIYo::onPlayCurrentUrl() +{ + _playerControl->setUrl( _nowPlaying.urlText ); + onChangeState( RaDIYo::Play ); +} + + +/** + */ + +void RaDIYo::onRightButtonClicked() +{ + onChangeState( _upMode ? RaDIYo::Back : RaDIYo::Shutdown ); +} + + +/** + * @brief Behandelt Impulse der Linken DialControls. + * @param delta: +1 oder -1 je nach Drehrichtung + */ + +void RaDIYo::onRightDeltaChanged( int delta ) +{ + // 'setValue( value )' reicht hier nicht, + // denn der neue Wert muss weiter gereicht + // werden, also 'onDialDeltaChanged' + + _volumeWidget->onDialDeltaChanged( delta ); + _playerControl->onDialDeltaChanged( delta ); + +} + + +/** + * @brief Der linke Button wird an das aktive Control + * weitergeleitet. + */ + +void RaDIYo::onLeftButtonClicked() +{ + // ex.left + Q_ASSERT( _activeReceiver != nullptr ); + _activeReceiver->onDialPushed(); +} + + +/** + * @brief KISS: der rechte Regler steuert immer die Lautstärke. + */ + +void RaDIYo::onLeftDeltaChanged( int delta ) +{ + + + + Q_ASSERT( _activeReceiver != nullptr ); + _activeReceiver->onDialDeltaChanged( delta ); + +} + + + + +/// +/// --- Setup +/// + + +/** + * @brief Fonts explicit laden, _vor_ setupUi + */ + +void RaDIYo::setupFonts() +{ + + QStringList fontList = QDir( raDIYo::FontDir ).entryList(); + for( const QString& fontName : fontList ) + QFontDatabase::addApplicationFont( raDIYo::FontDir + fontName ); + +} + + +/** + * @brief + * @param id + * @param control + */ + +void RaDIYo::addControl( int id, SWControl* control ) +{ + _controls[ id ] = control; +} + + +/** + * @brief setupControls + */ + +void RaDIYo::setupControls() +{ + + // Setup Controls: 'RaDIYo' Buttons + + _raDIYoButtons.addKeyButton( _buttonPlay, Play, "play" ); + _raDIYoButtons.addKeyButton( _buttonPause, Pause, "pause" ); + _raDIYoButtons.addKeyButton( _buttonStop, Stop, "stop" ); + _raDIYoButtons.addKeyButton( _buttonAlarm, Alarm, "alarm" ); + _raDIYoButtons.addKeyButton( _buttonClock, Clock, "clock" ); + _raDIYoButtons.addKeyButton( _buttonSender, Sender, "sender" ); + _raDIYoButtons.addKeyButton( _buttonSongs, Songs, "songs" ); + _raDIYoButtons.addKeyButton( _buttonUSB, USB, "usb" ); + _raDIYoButtons.addKeyButton( _buttonBack, Back, "down" ); + _raDIYoButtons.addKeyButton( _buttonShutdown, Shutdown, "shutdown" ); + + // Startzustand darstellen + _buttonBack->hide(); + _buttonPause->hide(); + + // Alle Controls + _senderControl = new SWSenderControl( this, &_mainSettings ); + _songsControl = new SWSongsControl( this, &_mainSettings ); + _playerControl = new SWPlayerControl( this, &_mainSettings ); + _alarmControl = new SWAlarmControl( this, &_mainSettings ); + _usbControl = new SWUSBControl( this, &_mainSettings ); + + // Leere Plätze mit 'nullptr' als solche kennzeichnen + addControl( Play, _playerControl ); + addControl( Pause, nullptr ); + addControl( Stop, nullptr ); + addControl( Clock, new SWClockControl( this, &_mainSettings ) ); + addControl( Alarm, _alarmControl ) ; + addControl( Sender, _senderControl ); + addControl( Songs, _songsControl ); + addControl( USB, _usbControl ); + addControl( Back, nullptr ); + addControl( Shutdown, new SWShutdownControl( this, &_mainSettings ) ); + +} + + +void RaDIYo::setupConnections() +{ + + // Linux, kompiliert auch unter Win + _dialLeft = new PiGRotaryDial( 22, 27, 17, this ); + _dialRight = new PiGRotaryDial( 06, 13, 05, this ); + +#ifdef Q_OS_LINUX + + connect( _dialLeft, SIGNAL(clicked()), this, SLOT(onLeftButtonClicked() ) ); + connect( _dialLeft, SIGNAL(deltaChanged(int)), this, SLOT(onLeftDeltaChanged(int) ) ); + + connect( _dialRight, SIGNAL(clicked()), this, SLOT(onRightButtonClicked() ) ); + connect( _dialRight, SIGNAL(deltaChanged(int)), this, SLOT(onRightDeltaChanged(int) ) ); + +#endif + +#ifdef Q_OS_WIN + + // Setup Controls: Fake Dials + + connect( &_dialDialog.leftDial().pushButton(), &QPushButton::clicked, this, &RaDIYo::onLeftButtonClicked ); + connect( &_dialDialog, &SWDummyDialDialog::leftDeltaChanged, this, &RaDIYo::onLeftDeltaChanged ); + + connect( &_dialDialog.rightDial().pushButton(), &QPushButton::clicked, this, &RaDIYo::onRightButtonClicked ); + connect( &_dialDialog, &SWDummyDialDialog::rightDeltaChanged, this, &RaDIYo::onRightDeltaChanged ); + + _dialDialog.show(); + +#endif + + connect( _senderControl, SIGNAL( entryActivated(SWUrl) ), this, SLOT( onPlayUrl(SWUrl) ) ); + connect( _songsControl, SIGNAL( entryActivated(SWUrl) ), this, SLOT( onPlayUrl(SWUrl) ) ); + connect( _usbControl, SIGNAL( entryActivated(SWUrl) ), this, SLOT( onPlayUrl(SWUrl) ) ); + connect( _usbControl, SIGNAL( driveMounted(int) ), this, SLOT( onChangeState(int) ) ); + + qRegisterMetaType< QMediaPlayer::State>(" QMediaPlayer::State"); + connect( _playerControl, SIGNAL( stateChanged(QMediaPlayer::State) ), this, SLOT( onPlayingChanged(QMediaPlayer::State) ) ); + + // Der Wecker sendet ggf auch ... + connect( _alarmControl, SIGNAL( playCurrentUrl() ), this, SLOT( onPlayCurrentUrl() ) ); + connect( &_raDIYoButtons,SIGNAL( idClicked(int) ), this, SLOT( onChangeState(int) ) ); + // weiterleiten + connect( _volumeWidget, SIGNAL( deltaChanged(int) ), this, SLOT( onRightDeltaChanged(int) ) ); +} + + +void RaDIYo::setupDefaults() +{ + + // default Sender belegen + if( !_mainSettings.contains( raDIYo::KeyDefaultSender ) ) + _mainSettings.setValue( raDIYo::KeyDefaultSender, raDIYo::DefaultSender ); + + // default playlist item soll nicht leer sein + QString defSender =_mainSettings.value( raDIYo::KeyDefaultSender ).toString(); + _nowPlaying = SWUrl( defSender, raDIYo::DefaultVolume ); + _playerControl->setUrl( _nowPlaying.urlText ); + + // wir nehmen den default-sender + _currentTitle->setText( _nowPlaying.title ); + + // not least: Pfad setzen + // windows: c:\users\chris\ + // linux: /home/chris/ + + QString songsPath = _mainSettings.value( raDIYo::KeySongsPath ).toString(); + if( songsPath.isEmpty() ) + { + songsPath = QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ); + songsPath += _mainSettings.value( raDIYo::KeySongsDir, raDIYo::SongsDir ).toString(); + _mainSettings.setValue( raDIYo::KeySongsPath, songsPath ); + } + + // css kram erzeugen + _titleCss = readResource( raDIYo::ResTitleStyle ); +} + + +/** + * @brief Debugfunktion, die den Namen eines State ausgibt. + * @param state + */ + +QString RaDIYo::stateName( int state ) +{ + + switch( state ) + { + case Sender: return "Sender"; + case Songs: return "Songs"; + case USB: return "USB"; + case Clock: return "Clock"; + case Alarm: return "Alarm"; + case Play: return "Player"; + case Pause: return "Pause"; + case Stop: return "Stop"; + case Back: return "Back"; + case Shutdown: return "Shutdown"; + } + return "42"; +} + diff --git a/raDIYo.h b/raDIYo.h new file mode 100644 index 0000000..f09a638 --- /dev/null +++ b/raDIYo.h @@ -0,0 +1,194 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef RADIYO_H +#define RADIYO_H + + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +//#include +#include +#include + +#include + +/** + +@mainpage raDIYo + +@section sec1 raDIYo + +Eine Mediaplayer-Software für den RaspberryPi, zugleich ein +Hardware-Updgrade eines Nora 'Rienzi' Radios, Bj. ca. 1935 + + +@section sec3 Ideen & TODO: + +@subsection sec3_1 TODO 1.0.xx RC + +@remarks + +Für 1.0x + + - lib vlc player nehmen! + - videos einbauen, fürs geschmäckle + - artist anzeigen + - progressbar anzeigen + - volume % einblenden + - Qt 6.x upgrade + - Gestensteuerung via Ultraschall Sensor + - Dazu Arduino Bindings + - Config per App + - Röhrenoszi als Pegel Anzeige ?? + - mp3 taglib einsetzen + - peak level halten im SpectroViewer + - Player verbessern: Loop / Shuffle + - Player verbessern: Lieblinslautstärke pro song speichern + - Player verbessern: Liste weiterspielen + + @bug + + - Bluetooth-Einbindung läuft nur über Systemeinstellungen + +*/ + + +namespace raDIYo +{ + // misc + //#define raDIYo:Version "Version 0.0.01 / 19.12.2020" + [[maybe_unused]] constexpr static const char* Version = "raDIYo 0.5.45 / 01.12.2022 © 2020-22 chris@sourceworx.org"; + + [[maybe_unused]] constexpr static const char* OrgName = "source::worx"; + [[maybe_unused]] constexpr static const char* DomainName = "sourceworx.org"; + [[maybe_unused]] constexpr static const char* AppName = "raDIYo"; +} + +class SWDialHandler; +class PiGRotaryDial; +class SWControl; +class SWPlayerControl; +class SWSenderControl; +class SWSongsControl; +class SWAlarmControl; +class SWUSBControl; + + +/** + * @brief The RaDIYo class: Erbt alles von RaDIYoWidget, + * Dort wird das GUI implementiert, hier werden die + * Zustandssteuerungen behandelt + */ + +class RaDIYo : public QWidget, private Ui_RaDIYoWidget +{ + Q_OBJECT + +public: + + constexpr static const int SWScreenSmallX = 480; + constexpr static const int SWScreenSmallY = 320; + constexpr static const int SWScreenLargeX = 800; + constexpr static const int SWScreenLargeY = 480 - 40; + + typedef enum + { + Play = 0, + Pause, + Stop, + Clock, + Alarm, + Sender, + Songs, + USB, + Back, + Shutdown, + ControlsSize + } ControlType; + + RaDIYo(); + virtual ~RaDIYo(); + +public slots: + + void onChangeState( int id ); + // dial handling: kommt von aussen + void onLeftButtonClicked(); + void onLeftDeltaChanged(int); + + void onRightButtonClicked(); + void onRightDeltaChanged(int); + +public slots: + + void onPlayingChanged( QMediaPlayer::State state ); + void onPlayCurrentUrl(); + void onPlayUrl( SWUrl item ); + +protected: + + using SWControlMap = QMap; + + void onIdleTimeOut(); + QString stateName( int state ); + + void showTitleText( bool pauseClicked ); + void addControl( int id, SWControl* control ); + + void setupFonts(); + void setupControls(); + void setupConnections(); + void setupDefaults(); + + SWDialHandler* _activeReceiver = nullptr; // das aktive Control, bzw. die Buttongroup + int _curCtrlIdx = RaDIYo::Songs; // index des aktiven Controls + bool _upMode = false; + + QMediaPlayer::State _playerState = QMediaPlayer::StoppedState; + + SWPlayerControl* _playerControl = nullptr; + SWSenderControl* _senderControl = nullptr; + SWSongsControl* _songsControl = nullptr; + SWAlarmControl* _alarmControl = nullptr; + SWUSBControl* _usbControl = nullptr; + + SWUrl _nowPlaying; + QString _titleCss; + QTimer _idleTimer; + + SWDummyDialDialog _dialDialog; // fake dials für windows + PiGRotaryDial* _dialLeft = nullptr; // raspi rotary dials + PiGRotaryDial* _dialRight = nullptr; + + QSettings _mainSettings; + + SWDialButtonGroup _raDIYoButtons; + SWControlMap _controls; // alle Controls + +}; + + +#endif // RADIYO_H diff --git a/raDIYo.pro b/raDIYo.pro new file mode 100644 index 0000000..2374767 --- /dev/null +++ b/raDIYo.pro @@ -0,0 +1,115 @@ +QT += core gui multimedia widgets bluetooth + + +CONFIG += c++17 + +# um die Dateien im 'data' dir zu finden ?? -> +# https://stackoverflow.com/questions/16250593/reading-from-and-writing-to-file-in-the-qt-resource-system-qt-5-0-2 +INCLUDEPATH += . + +linux { + LIBS += -lpigpio -lpigpiod_if2 -lrt + # FIXME SOURCES += +} + +windows { + #LIBS += -lpigpio -lpigpiod_if2 -lrt + # FIXME SOURCES += +} + +# You can make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + SWPiGPIO.cpp \ + main.cpp \ + raDIYoglobals.cpp \ + raDIYo.cpp \ + swadjustabledigit.cpp \ + swalarmcontrol.cpp \ + swbarwidget.cpp \ + swbasecontrol.cpp \ + swbluetoothcontrol.cpp \ + swbuttongroup.cpp \ + swclockcontrol.cpp \ + swcontrol.cpp \ + swdialbutton.cpp \ + swdialhandler.cpp \ + swdialcontrol.cpp \ + swdialwidget.cpp \ + swdummydialdialog.cpp \ + swdummypushdial.cpp \ + swfftcalc.cpp \ + swflipdigit.cpp \ + swlistcontrol.cpp \ + swradiobutton.cpp \ + swrangevalue.cpp \ + swurl.cpp \ + swusbcontrol.cpp \ + swplayercontrol.cpp \ + swsendercontrol.cpp \ + swsetupcontrol.cpp \ + swshutdowncontrol.cpp \ + swsongscontrol.cpp \ + swspectrumwidget.cpp \ + swtoggleswitch.cpp \ + swvolumewidget.cpp + +HEADERS += \ + SWPiGPIO.h \ + raDIYoglobals.h \ + raDIYo.h \ + swadjustabledigit.h \ + swalarmcontrol.h \ + swbarwidget.h \ + swbasecontrol.h \ + swbluetoothcontrol.h \ + swbuttongroup.h \ + swclockcontrol.h \ + swcontrol.h \ + swdialbutton.h \ + swdialhandler.h \ + swdialcontrol.h \ + swdialwidget.h \ + swdummydialdialog.h \ + swdummypushdial.h \ + swfftcalc.h \ + swflipdigit.h \ + swlistcontrol.h \ + swradiobutton.h \ + swrangevalue.h \ + swurl.h \ + swusbcontrol.h \ + swplayercontrol.h \ + swsendercontrol.h \ + swsetupcontrol.h \ + swshutdowncontrol.h \ + swsongscontrol.h \ + swspectrumwidget.h \ + swtoggleswitch.h \ + swvolumewidget.h + +FORMS += \ + raDIYo.ui \ + swalarmcontrol.ui \ + swbasecontrol.ui \ + swbluetoothcontrol.ui \ + swclockcontrol.ui \ + swdummydialdialog.ui \ + swdummypushdial.ui \ + swlistcontrol.ui \ + swplayercontrol.ui \ + swsetupcontrol.ui \ + swshutdowncontrol.ui + +RESOURCES += \ + raDIYo.qrc + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target + + + diff --git a/raDIYo.qrc b/raDIYo.qrc new file mode 100644 index 0000000..a6f55c7 --- /dev/null +++ b/raDIYo.qrc @@ -0,0 +1,52 @@ + + + data/radiyo.senderlist.csv + data/radiyo.titlelabel.css + fonts/Afterclap_Personal_Use.otf + fonts/JosefinSans-SemiBold.ttf + fonts/JosefinSans-VariableFont_wght.ttf + fonts/SelznickRemixNF.ttf + fonts/gradogradoonf.regular.ttf + fonts/valleygrrrlnf.regular.ttf + images/radiyo.alarm.checked.png + images/radiyo.alarm.hover.png + images/radiyo.alarm.png + images/radiyo.bluetooth.checked.png + images/radiyo.bluetooth.hover.png + images/radiyo.bluetooth.png + images/radiyo.clock.checked.png + images/radiyo.clock.hover.png + images/radiyo.clock.png + images/radiyo.halt.png + images/radiyo.pause.checked.png + images/radiyo.pause.hover.png + images/radiyo.pause.png + images/radiyo.play.checked.png + images/radiyo.play.hover.png + images/radiyo.play.png + images/radiyo.sender.checked.png + images/radiyo.sender.hover.png + images/radiyo.sender.png + images/radiyo.setup.checked.png + images/radiyo.setup.hover.png + images/radiyo.setup.png + images/radiyo.shutdown.checked.png + images/radiyo.shutdown.hover.png + images/radiyo.shutdown.png + images/radiyo.songs.checked.png + images/radiyo.songs.hover.png + images/radiyo.songs.png + images/radiyo.stop.checked.png + images/radiyo.stop.hover.png + images/radiyo.stop.png + images/radiyo.usb.checked.png + images/radiyo.usb.hover.png + images/radiyo.usb.png + images/radiyo.weekday.checked.png + images/radiyo.weekday.hover.png + images/radiyo.weekday.png + images/radiyo.down.checked.png + images/radiyo.down.hover.png + images/radiyo.down.png + + diff --git a/raDIYo.ui b/raDIYo.ui new file mode 100644 index 0000000..f08f7ec --- /dev/null +++ b/raDIYo.ui @@ -0,0 +1,552 @@ + + + RaDIYoWidget + + + + 0 + 0 + 800 + 480 + + + + SWRadiyo + + + background:black; +color:grey; + + + + false + + + + 5 + 328 + 790 + 41 + + + + + Valley Grrrl NF + 14 + + + + padding-bottom: 7px; +margin-left: 0px; +border: 2px solid gray; +border-radius: 3px; +border-color: rgb( 66,66,66 ); +background:rgb(44,44,44); +color: rgb( 181, 181, 181 ); + + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + russisches Kriegsschiff, fick dich! + + + + + + 247 + 264 + 306 + 58 + + + + background: gold; + + + + + + 557 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url( :/images/radiyo.sender.png); +} + +QPushButton:hover +{ + background-image:url( :/images/radiyo.sender.checked.png); +} + +QPushButton:checked +{ + background-image:url( :/images/radiyo.sender.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + false + + + + + + 180 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url(:/images/radiyo.clock.png); +} + +QPushButton:hover +{ + background-image:url(:/images/radiyo.clock.checked.png); +} + +QPushButton:checked +{ + background-image:url(:/images/radiyo.clock.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 120 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url(:/images/radiyo.alarm.png) +} + +QPushButton:hover +{ + background-image:url(:/images/radiyo.alarm.checked.png) +} + +QPushButton:checked +{ + background-image:url(:/images/radiyo.alarm.hover.png) +} + + + + + + + 80 + 80 + + + + true + + + + + + 0 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url(:/images/radiyo.play.png); +} + +QPushButton:hover +{ + background-image:url(:/images/radiyo.play.checked.png); +} + +QPushButton:checked +{ + background-image:url(:/images/radiyo.play.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 617 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url(:/images/radiyo.songs.png); +} + +QPushButton:hover +{ + background-image:url(:/images/radiyo.songs.checked.png); +} + +QPushButton:checked +{ + background-image:url(:/images/radiyo.songs.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 2 + 373 + 800 + 51 + + + + + Josefin Sans SemiBold + 12 + true + + + + color:rgb( 234, 234, 234 ); + + + TextLabel + + + Qt::AlignHCenter|Qt::AlignTop + + + + + + 677 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url(:/images/radiyo.usb.png); +} + +QPushButton:hover +{ + background-image:url(:/images/radiyo.usb.checked.png); +} + +QPushButton:checked +{ + background-image:url(:/images/radiyo.usb.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 0 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image:url(:/images/radiyo.pause.png); +} + +QPushButton:hover +{ + background-image:url(:/images/radiyo.pause.checked.png); +} + +QPushButton:checked +{ + background-image:url(:/images/radiyo.pause.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 737 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image: url(:/images/radiyo.shutdown.png); +} + + +QPushButton:hover +{ + background-image: url(:/images/radiyo.shutdown.checked.png); +} + +QPushButton:checked +{ + background-image: url(:/images/radiyo.shutdown.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 737 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image: url(:/images/radiyo.down.png); +} + + +QPushButton:hover +{ + background-image: url(:/images/radiyo.down.checked.png); +} + +QPushButton:checked +{ + background-image: url(:/images/radiyo.down.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + 60 + 260 + 64 + 64 + + + + + 18 + + + + QPushButton +{ + background-image: url(:/images/radiyo.stop.png); +} + + +QPushButton:hover +{ + background-image: url(:/images/radiyo.stop.checked.png); +} + +QPushButton:checked +{ + background-image: url(:/images/radiyo.stop.hover.png); +} + + + + + + + 80 + 80 + + + + true + + + + + + SWVolumeWidget + QWidget +
swvolumewidget.h
+ 1 +
+ + SWRadioButton + QPushButton +
swradiobutton.h
+
+
+ + +
diff --git a/raDIYoglobals.cpp b/raDIYoglobals.cpp new file mode 100644 index 0000000..89ee7c1 --- /dev/null +++ b/raDIYoglobals.cpp @@ -0,0 +1,58 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include + + + + + +/** + * @brief liest einen String aus den Resourcen und gibt ihn zurück + * @param fileName Der Bezeichner + * @return + */ + +QString readResource( const QString& fileName ) +{ + + QFile resourceFile( fileName ); + + if( !resourceFile.open( QFile::ReadOnly | QFile::Text) ) + return resourceFile.errorString(); + + QTextStream in( &resourceFile ); + QString text = in.readAll(); + resourceFile.close(); + + return text; + +} + + +/** + * @brief formatInt: Formatiert einen Integer in einen QString + * @param value der Zahlenwert + * @param len die Anzeigelänge + */ + +QString formatInt(int value, int len ) +{ + QString result( "%0" ); + result = result.arg( value, len, 10, QChar( '0' ) ); + return result; +} diff --git a/raDIYoglobals.h b/raDIYoglobals.h new file mode 100644 index 0000000..424fadf --- /dev/null +++ b/raDIYoglobals.h @@ -0,0 +1,79 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef RADIYOGLOBALS_H +#define RADIYOGLOBALS_H + +#include +#include +#include +#include +#include + +using SWColorVec = QVector; +using SWValVec = QVector; + +QString readResource( const QString& fileName ); +QString formatInt(int value, int len ); + + +/** + * @brief Globale Konstanten und Voreinstellungen. + */ + + +namespace raDIYo +{ + // basics + [[maybe_unused]] constexpr static const char* KeyPlayerVolume = "PlayerVolume"; + [[maybe_unused]] constexpr static const char* KeySongsDir = "SongsDir"; + [[maybe_unused]] constexpr static const char* SongsDir = "/my.raDIYo/"; + [[maybe_unused]] constexpr static const char* SenderFile = "/my.raDIYo.csv"; + [[maybe_unused]] constexpr static const char* KeySongsPath = "SongsPath"; + [[maybe_unused]] constexpr static const char* KeySenderPath = "SenderFile"; + [[maybe_unused]] constexpr static const char* MountDir = "/media/"; + [[maybe_unused]] constexpr static const char* ResSenderList = ":/data/radiyo.senderlist.csv"; + [[maybe_unused]] constexpr static const char* ResTitleStyle = ":/data/radiyo.titlelabel.css"; + [[maybe_unused]] constexpr static const char* KeyDefaultSender = "DefaultSender"; + [[maybe_unused]] constexpr static const char* DefaultSender = "egoFM;http://streams.egofm.de/egoFM-hq"; + [[maybe_unused]] constexpr static const int DefaultVolume = 20; // 20% + + // alarm handling + [[maybe_unused]] constexpr static const char* KeyAlarmEnabled = "AlarmEnabled"; + [[maybe_unused]] constexpr static const bool AlarmEnabled = false; + [[maybe_unused]] constexpr static const char* KeyAlarmRepeat = "AlarmRepeat"; + [[maybe_unused]] constexpr static const bool AlarmRepeat = false; + [[maybe_unused]] constexpr static const char* KeyWeekdaysOnly = "WeekdaysOnly"; + [[maybe_unused]] constexpr static const bool WeekdaysOnly = true; + [[maybe_unused]] constexpr static const char* KeyAlarmHour = "AlarmHour"; + [[maybe_unused]] constexpr static const int AlarmHour = 05; + [[maybe_unused]] constexpr static const char* KeyAlarmMinute = "AlarmMinute"; + [[maybe_unused]] constexpr static const int AlarmMinute = 59; + + + // optik, haptik :) + [[maybe_unused]] constexpr static const char* FontDir = ":/fonts/"; + [[maybe_unused]] constexpr static const char* NoMedia = "(no media)"; + [[maybe_unused]] constexpr static const int IdleTimeOut = 20000; // 20 sec + [[maybe_unused]] constexpr static const int HighlightWidth = 3; + + // restart etc. + [[maybe_unused]] constexpr static const char* CmdShutDown = "sudo halt"; + [[maybe_unused]] constexpr static const char* CmdReboot = "sudo reboot"; + [[maybe_unused]] constexpr static const char* CmdRestart = "kill -9 `pidof raDIYo`; x-terminal-emulator -e /home/pi/raDIYo/raDIYo"; + [[maybe_unused]] constexpr static const char* CmdVolume = "/usr/bin/amixer -q sset 'Master' %0% "; + +} + +#endif // RADIYOGLOBALS_H diff --git a/swadjustabledigit.cpp b/swadjustabledigit.cpp new file mode 100644 index 0000000..edd628f --- /dev/null +++ b/swadjustabledigit.cpp @@ -0,0 +1,146 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include + +using namespace std::chrono; + + +/** + * @brief Standartkonstruktor: Erzeugt ein AdjustableDigit Widget, also + * eine FlipDigit, deren Zahlerwert per Maus, Touchscreen oder RotaryDial + * geändert werden kann. + * Erbt von @see SWFlipDigit + * @param parent + */ + +SWAdjustableDigit::SWAdjustableDigit( QWidget* parent ) + : SWFlipDigit( parent ) +{ + _fontScale = 0.75; //0.85 + + //_fontFamily = "Valley Grrrl NF"; + //_fontFamily = "Lansbury FG"; + //_fontFamily = "Selznick Remix NF"; + //_fontFamily = "Josefin Sans Thin"; + //_fontFamily = "ThickDeco"; + + +} + + +/** + * @brief Setzt einen Zahlenwert. Wenn der Wert nicht in den + * vorgegebenen Wertebereich passt, wird er angepasst und + * SIGNAL valueOverflow ausgelöst. + * @see setRange + */ + +void SWAdjustableDigit::setValue( int value ) +{ + + _value = qBound( _rangeFrom, value, _rangeTo ); + + if( value > _rangeTo ) + emit valueOverflow( value ); + else if( value < _rangeFrom ) + emit valueOverflow( value ); + preparePixmap(); + update(); + + emit valueChanged( _value ); + +} + + +/** + * @brief Teil der Maussteuerung, mit der Zahlenwert der Klappzahl + * geändert werden kann. + * @param event + */ + +void SWAdjustableDigit::mousePressEvent( QMouseEvent* event ) +{ + // timer merken + _timerID = startTimer( 200 ); + // aktuelle Y-Pos/Höhe des Mauszeigers merken, um + // delta plus oder minus zu ermitteln + _posY = event->pos().y(); + int middle = rect().height() / 2; + _delta = _posY >= middle ? -1 : +1 ; + setValue( _value + _delta ); + _waiting = true; + +} + + +/** + * @brief Teil der Maussteuerung, mit der Zahlenwert der Klappzahl + * geändert werden kann. + * @param event + */ + +void SWAdjustableDigit::mouseMoveEvent( QMouseEvent* event ) +{ + + // Wenn wir uns dem Digit 'rausgezappelt haben, dann ist schluss ... + if( !rect().contains( event->pos() ) ) + mouseReleaseEvent( event ); + +} + + +/** + * @brief Teil der Maussteuerung, mit der Zahlenwert der Klappzahl + * geändert werden kann. + * @param event + */ + +void SWAdjustableDigit::mouseReleaseEvent( QMouseEvent* ) +{ + // und schluss + killTimer( _timerID ); + _delta = 0; + _timerID = -1; + _waiting = false; +} + + +/** + * @brief Timersteuerung. Verlangsamt die Wertänderung per Maus. + */ + +void SWAdjustableDigit::timerEvent( QTimerEvent* ) +{ + // zwei Fälle: der erste TimerEvent kommt + // wenn die 'Festhalthürde' von 200 ms genommen ist, + // dann kommen die Hoch/Runterzähl TickerEvents. + + // zähltimer tick + if( !_waiting && _delta ) + { + setValue( _value + _delta ); + return; + } + + // erster Timer: alten Timer wegschmeissen ... + killTimer( _timerID ); + // ...und den neuen schnelleren starten + _timerID = startTimer( 100 ); + _waiting = false; + +} diff --git a/swadjustabledigit.h b/swadjustabledigit.h new file mode 100644 index 0000000..09b796a --- /dev/null +++ b/swadjustabledigit.h @@ -0,0 +1,63 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWADJUSTABLEDIGIT_H +#define SWADJUSTABLEDIGIT_H + +#include + +#include +#include + + +/** + * @brief Erweiterte 'SWFlipDigit', die sich auch mit der Maus einstellen + * lässt. + */ + +class SWAdjustableDigit : public SWFlipDigit +{ + + Q_OBJECT + +public: + + explicit SWAdjustableDigit( QWidget* parent = nullptr ); + virtual ~SWAdjustableDigit() = default; + + void setValue( int n ) override; + +signals: + + void valueOverflow( int value ); + void valueChanged( int newValue ); + // fulfill interface of SWDialAdapter + void clicked(); + +protected: + + void mousePressEvent( QMouseEvent* event ) override; + void mouseMoveEvent( QMouseEvent* event ) override; + void mouseReleaseEvent( QMouseEvent* event ) override; + void timerEvent( QTimerEvent* event ) override; + + bool _waiting = false; + int _delta = 0; + int _timerID = -1; + int _posY = -1; + +}; + + +#endif // SWADJUSTABLEDIGIT_H diff --git a/swalarmcontrol.cpp b/swalarmcontrol.cpp new file mode 100644 index 0000000..fb3ef6c --- /dev/null +++ b/swalarmcontrol.cpp @@ -0,0 +1,231 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + + +/** + * @brief Das AlarmControl steuert den Wecker. + * @param parent + * @param psettings + */ + +SWAlarmControl::SWAlarmControl( QWidget* parent, QSettings* psettings ) + : SWDialControl( parent, psettings ) +{ + + Ui_SWAlarmControl::setupUi( this ); + setHeaderText( "Alarm" ); + + connect( &_alarmTimer, SIGNAL( timeout() ), this, SLOT( onWakeUp() ) ); + // die Minuten beobachten, um die Stunden anzupassen + connect( _digitMinute, SIGNAL( valueOverflow(int) ), this, SLOT( onMinuteOverflow(int) ) ); + connect( _digitHour, SIGNAL( valueOverflow(int) ), this, SLOT( onHourOverflow(int) ) ); + + connect( _switchAlarm, SIGNAL( widgetClicked(SWDialWidget*) ), this, SLOT( onWidgetClicked(SWDialWidget*) ) ); + connect( _switchRepeat, SIGNAL( widgetClicked(SWDialWidget*) ), this, SLOT( onWidgetClicked(SWDialWidget*) ) ); + connect( _switchWeekdays, SIGNAL( widgetClicked(SWDialWidget*) ), this, SLOT( onWidgetClicked(SWDialWidget*) ) ); + + connect( _digitMinute, &SWAdjustableDigit::valueChanged, this, [=]{ if( _alarmEnabled ) setAlarm(); } ); + connect( _digitHour, &SWAdjustableDigit::valueChanged, this, [=]{ if( _alarmEnabled ) setAlarm(); } ); + + _digitHour->setRange( 0, 23 ); + _digitMinute->setRange( 0, 59 ); + + collectDialWidgets(); + + +} + + + +void SWAlarmControl::onMinuteOverflow( int value ) +{ + + int hour = _digitHour->value(); + if( value < 0 ) + { + _digitMinute->setValue( 59 ); + _digitHour->setValue( hour-1 ); + } + else if( value > 59 ) + { + _digitMinute->setValue( 0 ); + _digitHour->setValue( hour+1 ); + } + +} + +void SWAlarmControl::onHourOverflow( int value ) +{ + // Stunde < 0: Stunde zurück + if( value < 0 ) + _digitHour->setValue( 23 ); + else if( value > 23 ) + _digitHour->setValue( 0 ); + +} + + +void SWAlarmControl::onShow() +{ + + current().setHightlighted( true ); + + // sync sttings -> screen + _alarmEnabled = settings().value( raDIYo::KeyAlarmEnabled, raDIYo::AlarmEnabled ).toBool(); + _switchAlarm->setChecked( _alarmEnabled ); + + _alarmRepeat = settings().value( raDIYo::KeyAlarmRepeat, raDIYo::AlarmRepeat ).toBool(); + _switchRepeat->setChecked( _alarmWeekdays ); + + _alarmWeekdays = settings().value( raDIYo::KeyWeekdaysOnly, raDIYo::WeekdaysOnly ).toBool(); + _switchWeekdays->setChecked( _alarmWeekdays ); + + // die Uhrzeit setzen + int alarmHour = settings().value( raDIYo::KeyAlarmHour, raDIYo::KeyAlarmHour ).toInt(); + int alarmMinute = settings().value( raDIYo::KeyAlarmMinute, raDIYo::KeyAlarmMinute ).toInt(); + _digitHour->setValue( alarmHour ); + _digitMinute->setValue( alarmMinute ); + + setAlarm(); + +} + + +void SWAlarmControl::onHide() +{ + + // sync screen to settings + settings().setValue( raDIYo::KeyAlarmEnabled, _switchAlarm->isChecked() ); + settings().setValue( raDIYo::KeyAlarmRepeat, _switchRepeat->isChecked() ); + settings().setValue( raDIYo::KeyWeekdaysOnly, _switchWeekdays->isChecked() ); + + settings().setValue( raDIYo::KeyAlarmHour, _digitHour->value() ); + settings().setValue( raDIYo::KeyAlarmMinute, _digitMinute->value() ); + + setAlarm(); + +} + + + +void SWAlarmControl::onWidgetClicked( SWDialWidget* child ) +{ + if( _switchAlarm == child ) + { + _alarmEnabled = !_alarmEnabled; + _switchAlarm->setChecked( _alarmEnabled ); + _labelAlarm->setText( _alarmEnabled ? SWAlarmOn : SWAlarmOff ); + _switchRepeat->setEnabled( _alarmEnabled ); + _switchWeekdays->setEnabled( _alarmEnabled ); + goto end; + } + + if( _switchRepeat == child ) + { + _alarmRepeat = !_alarmRepeat; + _switchRepeat->setChecked( _alarmRepeat ); + _labelRepeat->setText( _alarmRepeat ? SWAlarmRepeat : SWAlarmOnce ); + goto end; + } + + if( _switchWeekdays == child ) + { + _alarmWeekdays = !_alarmWeekdays; + _switchWeekdays->setChecked( _alarmWeekdays ); + _labelWeekdays->setText( _alarmWeekdays ? SWAlarmWeekdays : SWAlarmAlldays ); + goto end; + } + + //if( _digitHour == child || _digitMinute == child ) + // onTimeChanged( 42 ); + +end: + + setAlarm(); + +} + + +/** + * @brief Berechnet den nächsten Alarmzeitpunkt aus den Vorgaben der Benutzeroberfläche + * und startet den Alarmtimer. + */ + +void SWAlarmControl::setAlarm() +{ + + _alarmTimer.stop(); + if( !_alarmEnabled ) + return; + + /* + if( !_alarmEnabled ) + { + _labelAlarm->setText( SWAlarmOff ); + return; + } + */ + + // ab hier: alarm gewüschnt + + int hour = _digitHour->value(); + int minute = _digitMinute->value(); + + // timer basteln + QTime alarmTime( hour, minute ); + QDateTime now = QDateTime::currentDateTime(); + + int millisToAlarm = 1000 * now.time().secsTo( alarmTime ); + int shiftDays = 0; + // ist der Alarm nicht mehr heute? + if( millisToAlarm < 0 ) + shiftDays = 1; + + // Gnade am Wochenende? + if( _alarmWeekdays ) + { + int today = now.date().dayOfWeek(); + // samstag? + shiftDays += today >= 6 ? (today == 7) ? 1 : 2 : 0 ; + } + + millisToAlarm += shiftDays * SecsPerDay * 1000; + _labelAlarm->setText( SWAlarmOn + now.addMSecs( millisToAlarm ).toString( " dd.MM, hh:mm" ) ); + _alarmTimer.start( millisToAlarm ); +} + + +void SWAlarmControl::onWakeUp() +{ + _alarmTimer.stop(); + emit playCurrentUrl(); +} + + + + + diff --git a/swalarmcontrol.h b/swalarmcontrol.h new file mode 100644 index 0000000..11b6470 --- /dev/null +++ b/swalarmcontrol.h @@ -0,0 +1,82 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWALARMCONTROL_H +#define SWALARMCONTROL_H + + +#include +#include +#include + +#include +#include +#include + + +/** + * @brief Das 'Wecker'-Control des RaDIYos. + */ + +class SWAlarmControl : public SWDialControl, private Ui_SWAlarmControl +{ + + Q_OBJECT + +public: + + explicit SWAlarmControl( QWidget* parent, QSettings* settings ); + virtual ~SWAlarmControl() = default; + +signals: + + void playCurrentUrl(); + +public slots: + + void onShow() override; + void onHide() override; + void onWakeUp(); + + void setAlarm(); + +public slots: + + void onWidgetClicked( SWDialWidget* ) override; + +protected slots: + + void onMinuteOverflow( int value ); + void onHourOverflow( int value ); + +protected: + + const char* SWAlarmOn = "Alarm:"; + const char* SWAlarmOff = "Alarm off"; + const char* SWAlarmOnce = "Only once"; + const char* SWAlarmRepeat = "Repeat Alarm daily"; + const char* SWAlarmWeekdays = "Weekdays only"; + const char* SWAlarmAlldays = "Alldays"; + + static const int SecsPerDay = 86400; + + bool _alarmEnabled = false; + bool _alarmRepeat = false; + bool _alarmWeekdays = false; + + QTimer _alarmTimer; + +}; + +#endif // SWALARMCONTROL_H diff --git a/swalarmcontrol.ui b/swalarmcontrol.ui new file mode 100644 index 0000000..f205f9c --- /dev/null +++ b/swalarmcontrol.ui @@ -0,0 +1,271 @@ + + + SWAlarmControl + + + + 0 + 0 + 800 + 275 + + + + Form + + + + + + + false + + + + 90 + 92 + 260 + 40 + + + + + Josefin Sans + 16 + + + + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + Alarm OFF + + + + + + 5 + 92 + 76 + 40 + + + + + 18 + + + + 01 + + + + + + + + + + 32 + 32 + + + + true + + + + + false + + + + 90 + 196 + 261 + 40 + + + + + Josefin Sans + 16 + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + Weekdays only + + + + + + 5 + 196 + 76 + 40 + + + + + 18 + + + + 03 + + + + + + + + + + 32 + 32 + + + + true + + + + + + 360 + 90 + 210 + 168 + + + + 04 + + + background:gold + + + + + + 580 + 90 + 210 + 168 + + + + 05 + + + background:gold + + + + + false + + + + 90 + 145 + 261 + 40 + + + + + Josefin Sans + 16 + + + + + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + Repeat Alarm daily + + + + + + 5 + 145 + 76 + 40 + + + + + 18 + + + + 02 + + + + + + + + + + 32 + 32 + + + + true + + + + + + SWAdjustableDigit + QWidget +
swadjustabledigit.h
+ 1 +
+ + SWToggleSwitch + QPushButton +
swtoggleswitch.h
+
+
+ + +
diff --git a/swbarwidget.cpp b/swbarwidget.cpp new file mode 100644 index 0000000..a0891df --- /dev/null +++ b/swbarwidget.cpp @@ -0,0 +1,151 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +#include +#include +#include + +#include + + +/** + * @brief SWBarWidget::SWBarWidget : Konstruktor. + * Hier werden die für alle Subklassen gemeinsam gültigen + * Paramter initialisiert, etwa @see setColorRange, @see calcSizeRatio + */ + +SWBarWidget::SWBarWidget( QWidget* parent ) + : QWidget( parent ) +{ + + + // Papas Lieblingsfarben + QStringList list { "#010130", "#20014e", "#0C0786", "#40039C", + "#6A00A7", "#8F0DA3", "#B02A8F", "#CA4678", + "#E06461", "#F1824C", "#FCA635", "#FCCC25", + "#FFEE00", "#EFF821" }; + setColorRange( list ); + + +} + + +/** + * @brief gibt die Anzahl der Balken des Diagramms zurück. + */ + +int SWBarWidget::numBars() +{ + return _numBars; +} + + +/** + * Setzt die die Anzahl der Balken des Diagramms. + */ + +void SWBarWidget::setNumBars( int bars ) +{ + Q_ASSERT( bars > 0 ); + _numBars = bars; + update(); +} + + +/** + * Gibt die Anzahl der Blöcke pro Balken des Diagramms zurück. + */ + +int SWBarWidget::numBlocks() +{ + return _numBlocks; +} + + +/** + * Setzt die Anzahl der Blöcke pro Balken des Diagramms. + * + */ + +void SWBarWidget::setNumBlocks( int blocks ) +{ + Q_ASSERT( blocks > 0 ); + _numBlocks = blocks; + update(); +} + + +/** + * Gib denb Abstand in Pixeln zwischen Blöcken und Balken zurück. + * Default ist 3. + */ + +int SWBarWidget::padding() +{ + return _padding; +} + +/** + * @brief Setzt das 'padding', also den Abstand zwischen Blöcken und Balken des Diagramms + * @param padding der Abstand in Pixeln. + */ + +void SWBarWidget::setPadding( int padding ) +{ + _padding = padding; +} + + +/** + * Intere Funktion zur Ermittlung der Farbe eines Blocks. + */ + +QColor SWBarWidget::getBlockColor( int x, int y ) +{ + Q_UNUSED( x ) + int virtIdx = _numBlocks - 1 - y; + double _sizeRatio = (double) _numBlocks / (double) _colors.size(); + int realIdx = (int) ( (double) virtIdx / _sizeRatio ); + return _colors[ realIdx ]; +} + + +/** + * Setzt die Farbliste zur Darstellung der Blöcke eines Balkens. + * @param colorlist Eine Stringliste mit den Hexcodes der Farben. + */ + +void SWBarWidget::setColorRange( const QStringList& colorlist ) +{ + Q_ASSERT( !colorlist.empty() ); + + _colors.clear(); + for( const QString& color : colorlist ) + _colors.append( QColor( color ) ); + _numBlocks =_colors.size(); +} + +/** + * Setzt die Farbliste zur Darstellung der Blöcke eines Balkens. + * @param Ein Vector mit QColors. + */ + +void SWBarWidget::setColorRange( const SWColorVec& colorlist ) +{ + Q_ASSERT( !colorlist.empty() ); + + _colors.clear(); + for( const QColor& color : colorlist ) + _colors.append( color ); + _numBlocks =_colors.size(); +} diff --git a/swbarwidget.h b/swbarwidget.h new file mode 100644 index 0000000..26dbe7a --- /dev/null +++ b/swbarwidget.h @@ -0,0 +1,68 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWBARWIDGET_H +#define SWBARWIDGET_H + +#include + +#include +#include +#include + + +/** + * @brief Abstrakte Basisklasse für Balkendiagramme. + * @see SWDialHandler + * @see SWVolumeWidget + * @see SWSpectrumWidget + */ + +class SWBarWidget : public QWidget, public SWDialHandler, public SWRangeValue +{ + Q_OBJECT + +public: + + explicit SWBarWidget( QWidget* parent = 0 ); + virtual ~SWBarWidget() = default; + + virtual void paintEvent( QPaintEvent* event ) override = 0; + + int numBars(); + void setNumBars( int bars ); + + int numBlocks(); + void setNumBlocks( int blocks ); + + int padding(); + void setPadding( int padding ); + + void setColorRange( const QStringList& colorlist ); + void setColorRange( const SWColorVec& colorlist ); + +protected: + + QColor getBlockColor( int x, int y ); + + int _numBars = -1; + int _numBlocks = -1; + int _padding = 3; + + SWColorVec _colors; + +}; + + +#endif // SWBARWIDGET_H diff --git a/swbasecontrol.cpp b/swbasecontrol.cpp new file mode 100644 index 0000000..5c39d67 --- /dev/null +++ b/swbasecontrol.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + + +/** + * Konstruktor. + * @param parent das Elternwidget + * @param settings das Settingsobjekt des MainWidget. + */ + +SWBaseControl::SWBaseControl( QWidget* parent, QSettings* settings ) + : SWControl( parent, settings ) + +{ + Ui_SWBaseControl::setupUi( this ); +} + + +/** + * Gibt den Header-Text zurück. + */ + +QString SWBaseControl::headerText() +{ + return _headerLabel->text(); +} + + +/** + * Setzt den Headertext des Controls. Der Headertext zeigt die die Funktion + * des Controls an: Sender, Songs, Alarm etc. + */ + +void SWBaseControl::setHeaderText( const QString& headerText ) +{ + _headerLabel->setText( headerText ); +} diff --git a/swbasecontrol.h b/swbasecontrol.h new file mode 100644 index 0000000..c898a99 --- /dev/null +++ b/swbasecontrol.h @@ -0,0 +1,42 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWBASECONTROL_H +#define SWBASECONTROL_H + + +#include +#include + + +/** + * @brief Basisklasse für alle Controls, die einen Headertext anzeigen. + */ + +class SWBaseControl : public SWControl, protected Ui_SWBaseControl +{ + + Q_OBJECT + +public: + + explicit SWBaseControl( QWidget* parent, QSettings* settings ); + virtual ~SWBaseControl() = default; + + QString headerText(); + void setHeaderText( const QString& headerText ); + +}; + +#endif // SWBASECONTROL_H diff --git a/swbasecontrol.ui b/swbasecontrol.ui new file mode 100644 index 0000000..02f920c --- /dev/null +++ b/swbasecontrol.ui @@ -0,0 +1,50 @@ + + + SWBaseControl + + + + 0 + 0 + 800 + 255 + + + + Form + + + background:black; +color:rgb( 234, 234, 234 ); + + + + + 5 + 42 + 795 + 40 + + + + + Valley Grrrl NF + 14 + + + + padding-top: 2px; +border: 2px solid gray; +border-radius: 3px; +border-color: rgb( 66,66,66 ); +background:rgb(44,44,44); +color: rgb( 181, 181, 181 ); + + + HeaderLabel + + + + + + diff --git a/swbluetoothcontrol.cpp b/swbluetoothcontrol.cpp new file mode 100644 index 0000000..fabb4bb --- /dev/null +++ b/swbluetoothcontrol.cpp @@ -0,0 +1,160 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include +#include + +using QBTState = QBluetoothLocalDevice::Pairing; +using QBTLocDev = QBluetoothLocalDevice; +using QBTAgent = QBluetoothDeviceDiscoveryAgent; +using QBTDevInfo = QBluetoothDeviceInfo; + +SWBlueToothControl::SWBlueToothControl( QWidget* parent, QSettings* settings ) + : SWListControl( parent, settings ) +{ + + Ui_SWBlueToothControl::setupUi( this ); + setHeaderText( "Bluetooth " ); + _contentView->resize( 790, 130 ); + + _localDevice.powerOn(); + _localDevice.setHostMode( QBTLocDev::HostDiscoverable ); + + /* + // Get connected devices + QList remotes; + remotes = _localDevice.connectedDevices(); + for( const auto& entry : remotes ) + qDebug() << "remote entry: " << entry; + */ + + //_discoveryAgent.setInquiryType( QBluetoothDeviceDiscoveryAgent::GeneralUnlimitedInquiry ); + + connect( _buttonScan, &QPushButton::toggled, this, + [=](bool enabled ) + { + _buttonScan->setChecked( enabled ); + //_buttonScan->setEnabled( enabled ); + enabled ? _discoveryAgent.start() : _discoveryAgent.stop(); + _buttonScan->setText( enabled ? "scanning..." : "start scan" ); + } ); + + connect( &_discoveryAgent, &QBTAgent::finished, this, + [=] + { + _buttonScan->setChecked( false ); + //_buttonScan->setEnabled( true ); + _buttonScan->setText( "start scan" ); + } ); + + connect( &_discoveryAgent, SIGNAL( deviceDiscovered(QBluetoothDeviceInfo) ), + this, SLOT( addDevice(QBluetoothDeviceInfo) ) + ); + + connect( _contentView, SIGNAL( itemActivated(QListWidgetItem*) ), + this, SLOT( onItemActivated(QListWidgetItem*) ) + ); + + connect( &_localDevice, SIGNAL( pairingFinished(QBluetoothAddress,QBluetoothLocalDevice::Pairing)), + this, SLOT(pairingDone(QBluetoothAddress,QBluetoothLocalDevice::Pairing))); + + +} + +/** + * Wird beim Einbblenden des Controls automatisch + * aufgerufen. Überladene Funktion, inm diesem Fall ein Dummy + * ohne Funktion. + */ + +void SWBlueToothControl::onShow() +{ + +} + + +/** + * Wird beim Ausblenden des Controls automatisch aufgerufen. + * Überladene Funktion, stoppt in diesem Fall einen eventuell + * noch aktiven Scan-Process. + */ + +void SWBlueToothControl::onHide() +{ + _discoveryAgent.stop(); +} + + +/** + * Fügt ein BlueTooth-Device in die Device-Liste hinzu. + */ + +void SWBlueToothControl::addDevice( const QBluetoothDeviceInfo& info ) +{ + + QString label = info.name(); //QString("%1 %2").arg(info.address().toString()).arg(info.name()); + QList items = _contentView->findItems( label, Qt::MatchExactly ); + if( !items.empty() ) + return; + + QListWidgetItem& item = createItem( label, info.address().toString() ); + QBTState pairingStatus = _localDevice.pairingStatus( info.address() ); + bool paired = ( pairingStatus == QBTLocDev::Paired || pairingStatus == QBTLocDev::AuthorizedPaired ); + QColor bg = paired ? Qt::green : Qt::white ; + item.setForeground( bg ); + +} + + +/** + * Überladene Funktion, wird ein beim aktivieren eines Eintrag der Device-Liste + * aufgerufen und bindet das Device als Soud-Sink ein. + */ + +void SWBlueToothControl::onItemActivated( QListWidgetItem* item ) +{ + + QString addrStr= item->data( SWListControlRole ).toString(); + qDebug() << "BT Pair device: " << addrStr; + QBluetoothAddress address( addrStr ); + + QBTState pairingStatus = _localDevice.pairingStatus( address ); + bool paired = ( pairingStatus == QBTState::Paired || pairingStatus == QBTState::AuthorizedPaired ); + QBTState newState = paired ? QBTState::Paired : QBTState::Unpaired; + _localDevice.requestPairing( address, newState ); +} + + +/** + * SIGNAL, wird nach dem Erfolgreichen Einbinden eines BlueTooth Device aufgerufen. + * Passt die Listenabzeige der Devices entsprechend der Verbindungszustands der Devices + * an. + */ + +void SWBlueToothControl::pairingDone( const QBluetoothAddress &address, QBTState pairing ) +{ + + QList items = _contentView->findItems( address.toString(), Qt::MatchContains ); + QColor foreground = Qt::red; + if( pairing == QBTLocDev::Paired || pairing == QBTLocDev::AuthorizedPaired ) + foreground = Qt::green; + + for (int var = 0; var < items.count(); ++var) + items.at(var)->setForeground( foreground ); + +} + diff --git a/swbluetoothcontrol.h b/swbluetoothcontrol.h new file mode 100644 index 0000000..21c176b --- /dev/null +++ b/swbluetoothcontrol.h @@ -0,0 +1,69 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWBLUETOOTHCONTROL_H +#define SWBLUETOOTHCONTROL_H + + +#include +#include + + +#include +#include + +//#include + + +/** + * @brief Das Bluetooth Control. Bindet Bluetooth Soundquellen ein. + */ + +class SWBlueToothControl : public SWListControl, private Ui_SWBlueToothControl +{ + + Q_OBJECT + +public: + + explicit SWBlueToothControl( QWidget* parent, QSettings* settings ); + virtual ~SWBlueToothControl() = default; + +public slots: + + void onShow() override; + void onHide() override; + + void addDevice( const QBluetoothDeviceInfo& ); + //void on_power_clicked(bool clicked); + //void on_discoverable_clicked(bool clicked ); + //void displayPairingMenu(const QPoint& pos ); + void pairingDone( const QBluetoothAddress&, QBluetoothLocalDevice::Pairing ); + + void onItemActivated( QListWidgetItem* item ) override; + +private slots: + + + //void onDialPushed() override; + //void onDialDeltaChanged( int value ) override; + +private: + + QBluetoothDeviceDiscoveryAgent _discoveryAgent; + QBluetoothLocalDevice _localDevice; + +}; + +#endif // SWBLUETOOTHCONTROL_H diff --git a/swbluetoothcontrol.ui b/swbluetoothcontrol.ui new file mode 100644 index 0000000..341fa28 --- /dev/null +++ b/swbluetoothcontrol.ui @@ -0,0 +1,77 @@ + + + SWBlueToothControl + + + + 0 + 0 + 800 + 255 + + + + Form + + + + + 5 + 210 + 150 + 42 + + + + + Josefin Sans + 14 + false + + + + 0 + + + QPushButton +{ + padding-bottom: 0px; + margin-left: 0px; + border: 2px solid gray; + border-radius: 3px; + border-color: rgb( 66,66,66 ); + background:rgb(44,44,44); + color: rgb( 181, 181, 181 ); +} + +QPushButton:hover +{ + border-color: white; +} + +QPushButton:checked +{ + background:rgb(99,99,99); +} + + + start scan + + + true + + + true + + + + + + SWDialButton + QPushButton +
swdialbutton.h
+
+
+ + +
diff --git a/swbuttongroup.cpp b/swbuttongroup.cpp new file mode 100644 index 0000000..bc2611d --- /dev/null +++ b/swbuttongroup.cpp @@ -0,0 +1,126 @@ +#include + +#include +#include + +#include +#include + + + +SWDialButtonGroup::SWDialButtonGroup(QObject *parent) + : QButtonGroup{parent} +{ + +} + +void SWDialButtonGroup::addKeyButton( SWRadioButton* button, int id, const QString& key ) +{ + button->setKey( key ); + QButtonGroup::addButton( button, id ); +} + + +/** + * @brief Gibt den Button mit gegebenen ID zurück + */ + +SWRadioButton& SWDialButtonGroup::buttonAt( int id ) +{ + // Du HONK! Das ist der Index, _nicht_ die ID + //return *( dynamic_cast( buttons().at( id ) ) ); + return *( dynamic_cast( button( id ) ) ); + +} + +void SWDialButtonGroup::setCurrentActiveId( int newID ) +{ + // schon Ok, dass darf vorkommen + //Q_ASSERT( newID >= 0 ); + //Q_ASSERT( newID < buttons().size() ); + if( newID >= 0 && newID < buttons().size() ) + { + // unhover & uncheck current button + if( _hoverdID > -1 ) + buttonAt( _hoverdID ).unHover(); + _checkedID = _hoverdID = newID; + buttonAt(_checkedID ).setChecked( true ); + } +} + +/** + * @brief 'Klick' von aussen, kommt von den RotaryDials. + * Wird 'umgewandelt' in SIGNAL 'idClicked' + */ + +void SWDialButtonGroup::onDialPushed() +{ + + Q_ASSERT( _hoverdID >= 0 ); + Q_ASSERT( _hoverdID < buttons().size() ); + + emit idClicked( _hoverdID ); + +} + + +/** + * @param delta + * Schiebt den 'Hover'-Anzeigestatus zum nächsten Button innerhalb der Buttongroup. + * @param forward Vorwärts, also auf dem Bildschirm nach rechts oder eben nach links. + * + * Das ist ein Hack: Ich möchte einem einzelnen Button den Focus, also hier den Hover-Zustand + * aus dem Programm heraus zuweisen. Das wird für die Steuerung per RotaryDial gebraucht. + * Experimente ::notify( QHoverEvent( QHoverEnter ... ) waren erstmal ohne Wirkung. + * Derzeit wird einfach ein ge-hovertes (helleres) Icon gesetzt. + */ + +void SWDialButtonGroup::onDialDeltaChanged( int delta ) +{ + + int listSize = buttons().size(); + if( !listSize ) + return; + + // hatten wir schon einen button ge-hovert? + if( _hoverdID > -1 ) + buttonAt( _hoverdID ).unHover(); + + // wir sucne den nächsten Button zum Hovern, einen, + // der nicht 'gecheckt' oder 'unsichtbar' ist. + //SWRadioButton* tmpBtn = nullptr; + QAbstractButton* tmpBtn = nullptr; + + do + { + _hoverdID = ( _hoverdID + delta ) % listSize; + if( _hoverdID < 0 ) + _hoverdID = listSize - 1; + + //tmpBtn = buttons().at( _hoverdID ); + tmpBtn = button( _hoverdID ); + } + while( !tmpBtn->isEnabled()|| tmpBtn->isChecked() || !tmpBtn->isVisible() ); + //while( !tmpBtn->isVisible() ); + + buttonAt( _hoverdID ).hover(); + +} + + + + + + + + + + + + + + + + + + diff --git a/swbuttongroup.h b/swbuttongroup.h new file mode 100644 index 0000000..01156d4 --- /dev/null +++ b/swbuttongroup.h @@ -0,0 +1,53 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWBUTTONGROUP_H +#define SWBUTTONGROUP_H + +#include +#include +#include + + +class SWRadioButton; + + +class SWDialButtonGroup : public QButtonGroup, public SWDialHandler +{ + +public: + + explicit SWDialButtonGroup(QObject *parent = nullptr); + + + void addKeyButton( SWRadioButton* button, int id, const QString& key ); + SWRadioButton& buttonAt( int id ); + + void setCurrentActiveId( int newID ); + + + +public slots: + + void onDialPushed() override; + void onDialDeltaChanged( int delta ) override; + +protected: + + int _checkedID = -1; // die aktive, ge-checkte id + int _hoverdID = -1; // die vom Dial ge-hoverte id + +}; + +#endif // SWBUTTONGROUP_H diff --git a/swclockcontrol.cpp b/swclockcontrol.cpp new file mode 100644 index 0000000..11f1c57 --- /dev/null +++ b/swclockcontrol.cpp @@ -0,0 +1,136 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include + +#include + + + +SWClockControl::SWClockControl( QWidget* parent, QSettings* settings ) +: SWControl( parent, settings ) +{ + setupUi( this ); + setAcceptDial( false ); + + + + _flipHour->setTransition ( SWFlipDigit::Flip ); + _flipMinute->setTransition( SWFlipDigit::Flip ); + _flipSecond->setTransition( SWFlipDigit::Flip ); + + _flipHour->show(); + _flipMinute->show(); + _flipSecond->show(); + + QPalette pal = palette(); + pal.setColor( QPalette::Window, Qt::black ); + setPalette( pal ); + + _ticker.start( 1000, this ); + QTime time = QTime::currentTime(); + _flipHour->setValue( time.hour() ); + _flipMinute->setValue( time.minute() ); + + updateTime(); + +} + + +SWClockControl::~SWClockControl() +{ + +} + + +void SWClockControl::updateTime() +{ + QTime now = QTime::currentTime(); + _flipHour->flipTo( now.hour() ); + _flipMinute->flipTo( now.minute() ); + _flipSecond->flipTo( now.second() ); + + +} + + +void SWClockControl::switchTransition( int delta ) +{ + int i = ( _flipHour->transition() + delta + 3) % 3; + _flipHour->setTransition( (SWFlipDigit::FlipMode) i ); + _flipMinute->setTransition( (SWFlipDigit::FlipMode) i ); + updateTime(); +} + + +/* +void SWClockControl::resizeEvent(QResizeEvent*) +{ + int digitsWidth = width() / 3; + int digitsHeight = digitsWidth * 1.2; + + int y = (double) (height() - digitsHeight) / 1.8; + + _flipHour->resize( digitsWidth, digitsHeight ); + _flipHour->move( 0, y ); + + _flipMinute->resize( digitsWidth, digitsHeight ); + _flipMinute->move( width() / 3, y ); + + _flipSecond->resize( digitsWidth, digitsHeight ); + _flipSecond->move( width() /3 * 2, y ); +} +*/ + +void SWClockControl::timerEvent( QTimerEvent* event ) +{ + Q_UNUSED( event ) + updateTime(); +} + + + + +void SWClockControl::chooseSlide() +{ + _flipHour->setTransition( SWFlipDigit::Slide ); + _flipMinute->setTransition( SWFlipDigit::Slide ); + _flipSecond->setTransition( SWFlipDigit::Slide ); + updateTime(); +} + + +void SWClockControl::chooseFlip() +{ + _flipHour->setTransition( SWFlipDigit::Flip ); + _flipMinute->setTransition( SWFlipDigit::Flip ); + _flipSecond->setTransition( SWFlipDigit::Flip ); + updateTime(); +} + + +void SWClockControl::chooseRotate() +{ + _flipHour->setTransition( SWFlipDigit::Rotate ); + _flipMinute->setTransition( SWFlipDigit::Rotate ); + _flipSecond->setTransition( SWFlipDigit::Rotate ); + updateTime(); +} + + + diff --git a/swclockcontrol.h b/swclockcontrol.h new file mode 100644 index 0000000..5f10a4b --- /dev/null +++ b/swclockcontrol.h @@ -0,0 +1,60 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWCLOCKCONTROL_H +#define SWCLOCKCONTROL_H + +#include +#include +#include +#include + + + +/** + * @brief Das Clock-Control ist die 'Hauptseite' der RaDIYo-Gui und zeigt die + * Uhrzeit als FlipClock an. + * @see SWControl + * @see SWFlipDigit + */ + +class SWClockControl : public SWControl, private Ui_SWClock +{ + + Q_OBJECT + +public: + + explicit SWClockControl( QWidget* parent, QSettings* settings ); + virtual ~SWClockControl(); + + void timerEvent( QTimerEvent* event ) override; + + void updateTime(); + void switchTransition( int delta ); + +protected slots: + + void chooseSlide(); + void chooseFlip(); + void chooseRotate(); + +protected: + + QBasicTimer _ticker; + + +}; + +#endif // SWCLOCKCONTROL_H diff --git a/swclockcontrol.ui b/swclockcontrol.ui new file mode 100644 index 0000000..52176c5 --- /dev/null +++ b/swclockcontrol.ui @@ -0,0 +1,66 @@ + + + SWClock + + + + 0 + 0 + 800 + 275 + + + + Form + + + + + 9 + 42 + 254 + 215 + + + + background:darkBlue + + + + + + 274 + 42 + 254 + 215 + + + + background:darkBlue + + + + + + 537 + 42 + 254 + 215 + + + + background:darkBlue + + + + + + SWFlipDigit + QWidget +
swflipdigit.h
+ 1 +
+
+ + +
diff --git a/swcontrol.cpp b/swcontrol.cpp new file mode 100644 index 0000000..5c41bcc --- /dev/null +++ b/swcontrol.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include + + +SWControl::SWControl( QWidget* parent, QSettings* settings ) + : QWidget( parent ), _settings{ settings } +{ + + _effect = new QGraphicsOpacityEffect; + //setGraphicsEffect( _effect ); + + _animFadeIn = new QPropertyAnimation( _effect, "opacity" ); + _animFadeIn->setDuration( SWFadingDuration ); + _animFadeIn->setStartValue( 0.0 ); + _animFadeIn->setEndValue( 1.0 ); + //_animFadeIn->setEasingCurve( QEasingCurve::InBack ); + + _animFadeOut = new QPropertyAnimation( _effect, "opacity" ); + _animFadeOut->setDuration( SWFadingDuration ); + _animFadeOut->setStartValue( 1.0 ); + _animFadeOut->setEndValue( 0.0 ); + //_animFadeOut->setEasingCurve( QEasingCurve::OutBack ); + + connect( _animFadeOut, &QPropertyAnimation::finished, [=] { hide(); } ); + hide(); + +} + + +SWControl::~SWControl() +{ + // ?? + //saveSettings(); + delete _effect; + delete _animFadeIn; + delete _animFadeOut; +} + + + +QSettings& SWControl::settings() +{ + Q_ASSERT( nullptr != _settings ); + return *_settings; +} + + +/** + * @brief Wird beim vor dem Einblenden des Controls + * aufgerufen, um ggf. eine Eingabemaske vorzubereiten. + * Die Funktion ist nur dann nötig, wenn Eingabemöglichkeiten + * vorhanden sind, deswegen nicht abstract sondern in einer + * dummy-Implementierung + */ + +void SWControl::onShow() +{ + +} + + +/** + * @brief Wird nach dem Ausblenden des Controls aufgerufen. + * @see onShow() + */ + +void SWControl::onHide() +{ + +} + + +/** + * @brief Blendet das Control ein + * @see onShow() + */ + +void SWControl::fadeIn() +{ + onShow(); + show(); + setGraphicsEffect( _effect ); + _animFadeIn->start(); +} + + +/** + * @brief Blendet das Control aus + * @see onHide() + */ + +void SWControl::fadeOut() +{ + onHide(); + setGraphicsEffect( _effect ); + _animFadeOut->start(); +} + diff --git a/swcontrol.h b/swcontrol.h new file mode 100644 index 0000000..03aa950 --- /dev/null +++ b/swcontrol.h @@ -0,0 +1,66 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWCONTROL_H +#define SWCONTROL_H + + +#include +#include +#include +#include + +#include + + +/** + * @brief Basisklasse für alle 'Controls'. Erbt von QWidget und stellt + * die Basisfunktionalität aller Controls zur Verfügung: + * - Animiertes Ein- und Ausblenden der Benutzeroberfläche + * - Automatischen Laden und Sichern der Nutzerdaten beim Aktivieren und Deaktivieren. + * @see SWClockControl etc. + */ + +class SWControl : public QWidget, public SWDialHandler +{ + + Q_OBJECT + +public: + + explicit SWControl( QWidget* parent, QSettings* settings ); + virtual ~SWControl(); + + virtual void fadeIn(); + virtual void fadeOut(); + +public slots: + + virtual void onShow(); + virtual void onHide(); + +protected: + + QSettings& settings(); + + static const int SWFadingDuration = 650; + + QSettings* _settings = nullptr; + QGraphicsOpacityEffect* _effect = nullptr; + QPropertyAnimation* _animFadeIn = nullptr; + QPropertyAnimation* _animFadeOut = nullptr; + +}; + +#endif // SWCONTROL_H diff --git a/swdialbutton.cpp b/swdialbutton.cpp new file mode 100644 index 0000000..156970c --- /dev/null +++ b/swdialbutton.cpp @@ -0,0 +1,43 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + + +#include +#include + +/** + * @brief Standardkostruktor. + */ + +SWDialButton::SWDialButton( QWidget* parent ) + : QPushButton( parent ) +{ + setAcceptDial( false ); + // clicks auf mich weiterleiten + connect( this, &QPushButton::clicked, this, [=]{ emit widgetClicked(this); } ); +} + + +/** + * Zeichnet diesen Button. Überschriebene Methode, ruft zusätzlich zu + * @see QPushButton::paintEvent( event ) auch @drawMark() auf, um + * den Button ggf. als 'aktiviert', als Bereit zur Eingabe per RotaryDial, + * darzustellen. + */ + +void SWDialButton::paintEvent( QPaintEvent *event ) +{ + QPushButton::paintEvent( event ); + drawMark( this ); +} diff --git a/swdialbutton.h b/swdialbutton.h new file mode 100644 index 0000000..61e91b7 --- /dev/null +++ b/swdialbutton.h @@ -0,0 +1,53 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWDIALBUTTON_H +#define SWDIALBUTTON_H + +#include +#include + +#include + + +/** + * @brief Ein QPushButtonder der sich programmatisch 'hovern' + * und per RotaryControl bedienen lässt. + * + * @see QPushButton, + * @see SWDialWidget + */ + +class SWDialButton : public QPushButton, public SWDialWidget +{ + Q_OBJECT + +public: + + explicit SWDialButton( QWidget* parent = nullptr ); + virtual ~SWDialButton() = default; + +signals: + + void widgetClicked( SWDialWidget* ); + +protected: + + void paintEvent( QPaintEvent* ) override; + +}; + + + +#endif // SWDIALBUTTON_H diff --git a/swdialcontrol.cpp b/swdialcontrol.cpp new file mode 100644 index 0000000..3208c6b --- /dev/null +++ b/swdialcontrol.cpp @@ -0,0 +1,107 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include + + + +SWDialControl::SWDialControl( QWidget* parent, QSettings* settings ) +: SWBaseControl( parent, settings ) +{ + + +} + + + + +/** + * @brief Sammelt alle Kindwidgets, die den Aspekt 'SWDialWidget' implementieren. + * Wird im Konstruktor aufgerufen. + * @see SWDialWidget + */ + +void SWDialControl::collectDialWidgets() +{ + + // speichert die Dialwidgets sortiert nach ihrem AccessibleName + // über den namen wird eine 'KlickOrder' im Sinne einer TabOrder simuliert + QMap tmpMap; + QList widgets = findChildren(); + for( QWidget* entry : widgets ) + { + SWDialWidget* dialWdgt = dynamic_cast( entry ); + if( nullptr != dialWdgt ) + { + tmpMap.insert( entry->accessibleName(), dialWdgt ); + _crntIdx = 0; + } + } + // die nach namen sortierten DialWidgets unter beibehaltung der Reihenfolge + // ins _dialWidgets Array übernehmen + for( SWDialWidget* dialWdgt : tmpMap ) + _dialWidgets.append( dialWdgt ); + +} + + +/** + * @brief Gibt das aktuell aktive DialWidget zurück + */ + +SWDialWidget& SWDialControl::current() +{ + Q_ASSERT( _crntIdx > -1 && _crntIdx < _dialWidgets.size() ); + return *_dialWidgets[ _crntIdx ]; +} + + +/** + * @brief Wird beim Drücken des RotaryDials aufgerufen. + * Das Signal wir an das aktuell aktive Control + * weitergereicht. + */ + +void SWDialControl::onDialPushed() +{ + + if( current().acceptDial() ) + current().toggleDialInput(); + onWidgetClicked( ¤t() ); + update(); + +} + + +/** + * @brief Wird beim Drehen des RotaryDials aufgerufen. + * @param value die Winkelstellung, also der Zahlenwert, des RotaryDials. + * Wird an das aktuell aktive Dial weitergereicht. + */ + +void SWDialControl::onDialDeltaChanged( int delta ) +{ + + // weiterreichen falls erwünscht... + if( current().hasDialInput() ) + return current().onDialDeltaChanged( delta ); + + // ...sonst zum nächtsten Handler 'weiterdrehen' + current().setHightlighted( false ); + _crntIdx = ( _crntIdx + delta ) % _dialWidgets.size(); + if( _crntIdx < 0 ) + _crntIdx = _dialWidgets.size() - 1; + current().setHightlighted( true ); + update(); +} diff --git a/swdialcontrol.h b/swdialcontrol.h new file mode 100644 index 0000000..09e6736 --- /dev/null +++ b/swdialcontrol.h @@ -0,0 +1,61 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWDIALCONTROL_H +#define SWDIALCONTROL_H + +#include + +#include +#include + + +/** + * @brief Basisklasse für Controls, die über eine eigene Benutzeroberfläche verfügen. + * + * Die einzelnen Kind-elemente (Buttons, Switches, Digits ...) können per DialControl angesteuert + * und ausgelöst werden werden. + */ + +class SWDialControl : public SWBaseControl +{ + + Q_OBJECT + +public: + + explicit SWDialControl( QWidget* parent, QSettings* settings ); + virtual ~SWDialControl() = default; + +public slots: + + void onDialPushed() override; + void onDialDeltaChanged( int delta ) override; + + virtual void onWidgetClicked( SWDialWidget* ) = 0; + +protected: + + void collectDialWidgets(); + SWDialWidget& current(); + + using SWDialList = QVector; + + SWDialList _dialWidgets; + int _crntIdx = -1; + +}; + + +#endif // SWDIALCONTROL_H diff --git a/swdialhandler.cpp b/swdialhandler.cpp new file mode 100644 index 0000000..6e2a116 --- /dev/null +++ b/swdialhandler.cpp @@ -0,0 +1,52 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include + + + +/** + * @brief Ist die Reaktion auf Rotarydials eingeschaltet? + */ + +bool SWDialHandler::acceptDial() +{ + return _acceptDial; +} + + +/** + * @brief Schaltet die Reaktion auf Rotarydials ein oder aus. + * @param acceptDial + */ + +void SWDialHandler::setAcceptDial( bool acceptDial ) +{ + _acceptDial = acceptDial; +} + + +void SWDialHandler::onDialPushed() +{ + qDebug() << "BASE SWDialHandler::onDialPushed"; +} + + +void SWDialHandler::onDialDeltaChanged( int ) +{ + qDebug() << "BASE SWDialHandler::onDialDeltaChanged"; +} diff --git a/swdialhandler.h b/swdialhandler.h new file mode 100644 index 0000000..dade90a --- /dev/null +++ b/swdialhandler.h @@ -0,0 +1,52 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWDIALHANDLER_H +#define SWDIALHANDLER_H + + +/** + * @brief Modelliert den Aspekt des 'Empfangenkönnens' von Signals eines RotaryDials. + * + * Wird den entsprechenden Unterklassen per Mehrfachvererbung zugeordnet. + * + * @see SWControl + * @see SWDialButtonGroup + * @see SWBarWidget + * @see SWDialWidget + */ + +class SWDialHandler +{ + +public: + + explicit SWDialHandler() = default; + virtual ~SWDialHandler() = default; + + bool acceptDial(); + void setAcceptDial( bool acceptDial ); + + // wir sind kein QObject, deshalb keine public slots + virtual void onDialPushed(); + virtual void onDialDeltaChanged( int value ); + +protected: + + bool _acceptDial = true; + +}; + + +#endif // SWDIALHANDLER_H diff --git a/swdialwidget.cpp b/swdialwidget.cpp new file mode 100644 index 0000000..380ec0c --- /dev/null +++ b/swdialwidget.cpp @@ -0,0 +1,72 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include + + +//?? +const QPen SWDialWidget::MarkPen1 = QPen( Qt::white, 4 ); +const QPen SWDialWidget::MarkPen2 = QPen( Qt::darkRed, 4 ); + + +const QPen& SWDialWidget::getPen() +{ + if( hasDialInput() ) + return MarkPen2; + return MarkPen1; +} + + +bool SWDialWidget::isHighlighted() +{ + return _isHighlighted; +} + + +void SWDialWidget::setHightlighted( bool marked ) +{ + _isHighlighted = marked; + +} + +bool SWDialWidget::hasDialInput() +{ + return _hasDialInput; +} + +void SWDialWidget::toggleDialInput() +{ + setDialInput( !hasDialInput() ); +} + +void SWDialWidget::setDialInput( bool active ) +{ + _hasDialInput = active; +} + + +void SWDialWidget::drawMark( QWidget* target ) +{ + if( !isHighlighted() ) + return; + + QPainter painter( target ); + painter.setPen( getPen() ); + painter.setBrush( Qt::NoBrush ); + //painter.drawRect( target->rect() ); + painter.drawRoundedRect( target->rect(), 8, 8 ); +} diff --git a/swdialwidget.h b/swdialwidget.h new file mode 100644 index 0000000..d6b4920 --- /dev/null +++ b/swdialwidget.h @@ -0,0 +1,63 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWABSTRACTMMARK_H +#define SWABSTRACTMMARK_H + +#include +#include +#include + + +#include + +class SWDialAdapter; + +/** + * @brief Eine Aspektkompente, die das 'Highlighting' + * eines Widgets steuert. + */ + +class SWDialWidget : public SWDialHandler +{ + +public: + + explicit SWDialWidget() = default; + virtual ~SWDialWidget() = default; + + const QPen& getPen(); + + bool isHighlighted(); + void setHightlighted( bool mark ); + + bool hasDialInput(); + void setDialInput( bool active ); + + void toggleDialInput(); + + virtual void drawMark( QWidget* target ); + +protected: + + static const QPen MarkPen1; + static const QPen MarkPen2; + + bool _isHighlighted = false; + bool _hasDialInput = false; + +}; + + +#endif // SWABSTRACTMMARK_H diff --git a/swdummydialdialog.cpp b/swdummydialdialog.cpp new file mode 100644 index 0000000..6fdd73c --- /dev/null +++ b/swdummydialdialog.cpp @@ -0,0 +1,51 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + + +SWDummyDialDialog::SWDummyDialDialog( QWidget* parent ) + : QDialog( parent ) + +{ + setupUi( this ); + + connect( &leftDial().dial(), SIGNAL(valueChanged(int)), this, SLOT( onLeftValueChanged(int) ) ); + connect( &rightDial().dial(), SIGNAL(valueChanged(int)), this, SLOT( onRightValueChanged(int) ) ); + +} + + +SWDummyDialDialog::~SWDummyDialDialog() +{ + +} + + +void SWDummyDialDialog::onLeftValueChanged( int value ) +{ + int delta = value > _oldLeft ? +1 : -1 ; + emit leftDeltaChanged( delta ); + _oldLeft = value; +} + + +void SWDummyDialDialog::onRightValueChanged( int value ) +{ + int delta = value > _oldRight ? +1 : -1 ; + emit rightDeltaChanged( delta ); + _oldRight = value; + +} diff --git a/swdummydialdialog.h b/swdummydialdialog.h new file mode 100644 index 0000000..79036f4 --- /dev/null +++ b/swdummydialdialog.h @@ -0,0 +1,64 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWDUMMYDIALDIALOG_H +#define SWDUMMYDIALDIALOG_H + +#include +#include + + +/** + * @brief Dummy-Dialog, der zwei QDials mit Buttons anzeigt. Das simuliert + * die RotaryDials unter Windows. + */ + +class SWDummyDialDialog : public QDialog, private Ui_SWDummyDialDialog +{ + + Q_OBJECT + +public: + + explicit SWDummyDialDialog( QWidget* parent = nullptr ); + virtual ~SWDummyDialDialog(); + + SWDummyPushDial& leftDial() + { + return *_leftDial; + } + + SWDummyPushDial& rightDial() + { + return *_rightDial; + } + +public slots: + + void onLeftValueChanged( int ); + void onRightValueChanged( int ); + +signals: + + void leftDeltaChanged(int); + void rightDeltaChanged(int); + +protected: + + int _oldLeft = 0; + int _oldRight = 0; + +}; + +#endif // SWDUMMYDIALDIALOG_H diff --git a/swdummydialdialog.ui b/swdummydialdialog.ui new file mode 100644 index 0000000..a68ebe4 --- /dev/null +++ b/swdummydialdialog.ui @@ -0,0 +1,50 @@ + + + SWDummyDialDialog + + + + 0 + 0 + 231 + 167 + + + + Dialog + + + background:rgb(55,55,55) + + + + + 20 + 20 + 90 + 130 + + + + + + + 130 + 20 + 90 + 130 + + + + + + + SWDummyPushDial + QWidget +
swdummypushdial.h
+ 1 +
+
+ + +
diff --git a/swdummypushdial.cpp b/swdummypushdial.cpp new file mode 100644 index 0000000..480ba57 --- /dev/null +++ b/swdummypushdial.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include + + +SWDummyPushDial::SWDummyPushDial( QWidget *parent ) + : QWidget( parent ) +{ + setupUi( this ); + dial().setFocus(); + dial().setWrapping( true ); +} + + +QPushButton& SWDummyPushDial::pushButton() +{ + return *_button; +} + + +QDial& SWDummyPushDial::dial() +{ + return *_dial; +} + diff --git a/swdummypushdial.h b/swdummypushdial.h new file mode 100644 index 0000000..e72ca30 --- /dev/null +++ b/swdummypushdial.h @@ -0,0 +1,41 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +#ifndef SWDUMMYPUSHDIAL_H +#define SWDUMMYPUSHDIAL_H + +#include + +#include + + +/** + * @brief Simuliert einen RotaryEncoder unter Windows als Gui-Widget + */ + +class SWDummyPushDial : public QWidget, private Ui_SWDummyPushDial +{ + Q_OBJECT + +public: + + explicit SWDummyPushDial( QWidget* parent = nullptr ); + + //?? + QPushButton& pushButton(); + QDial& dial(); + + +}; + +#endif // SWDUMMYPUSHDIAL_H diff --git a/swdummypushdial.ui b/swdummypushdial.ui new file mode 100644 index 0000000..4dad977 --- /dev/null +++ b/swdummypushdial.ui @@ -0,0 +1,76 @@ + + + SWDummyPushDial + + + + 0 + 0 + 90 + 135 + + + + Form + + + background:black + + + + + 10 + 85 + 70 + 40 + + + + QPushButton { + color: #333; + border: 2px solid #555; + border-radius: 20px; + border-style: outset; + background: qradialgradient( + cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, + radius: 1.35, stop: 0 #fff, stop: 1 #888 + ); + padding: 5px; + } + +QPushButton:hover { + background: qradialgradient( + cx: 0.3, cy: -0.4, fx: 0.3, fy: -0.4, + radius: 1.35, stop: 0 #fff, stop: 1 #bbb + ); + } + +QPushButton:pressed { + border-style: inset; + background: qradialgradient( + cx: 0.4, cy: -0.1, fx: 0.4, fy: -0.1, + radius: 1.35, stop: 0 #fff, stop: 1 #ddd + ); + } + + + click me! + + + + + + 0 + -3 + 90 + 90 + + + + + + + + + + diff --git a/swfftcalc.cpp b/swfftcalc.cpp new file mode 100644 index 0000000..b6b93e8 --- /dev/null +++ b/swfftcalc.cpp @@ -0,0 +1,199 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +//#include +//#include + + +#include +#include + + +//const qint16 PCMS16MaxValue = 32767; +const quint16 PCMS16MaxAmplitude = 32768; // because minimum is -32768 + + +qreal xpcmToReal(qint16 pcm) +{ + return qreal(pcm) / PCMS16MaxAmplitude; +} + + +SWFFTCalc::SWFFTCalc( QObject* parent ) + : QObject( parent ) +{ + + _timer.start(); + // window functions are used to filter some undesired + // information for fft calculation. + _hannWindow.resize( SWNumSamples ); + + // the complex frame that is sent to fft function + _complexFrame.resize( SWNumSamples ); + + // only half spectrum is used because of the simetry property + _spectrum.resize( SWNumSamples/2 ); + + // logscale is used for audio spectrum display + //_logScale.resize( SWNumSamples/2+1 ); + + // by default, spectrum is log scaled (compressed) + //compressed = false; + + // window function (HANN) + for( int i=0; i anlegen + - mit Peak(X) auf [0.0 ... 1.0 [ normalisieren + - FFT drüber + +*/ + + +/** + * https://stackoverflow.com/questions/46947668/draw-waveform-from-raw-data-using-qaudioprobe + * @brief Track::getPeakValue + * @param format + * @return The peak value + */ + + +void SWFFTCalc::onAudioProbed( const QAudioBuffer &audiobuffer ) +{ + + + // + // Step 1. Daten anreichern bis ca. 100 ms + // + + QAudioFormat format = audiobuffer.format(); + + if( !format.isValid() + || format.channelCount() != 2 + || format.sampleType() == QAudioFormat::Unknown ) + return; + + //int duration = format.durationForFrames( audiobuffer.frameCount() ) / 1000; + // _timer.start(); + + //if( duration < 70 ) + //return; + + // Initialize data array + _complexFrame = CArray( 0.0, SWNumSamples ); + const char* ptr = (char*) audiobuffer.constData(); + int to = qMin( SWNumSamples, audiobuffer.frameCount() ); + + //for( int i=0; i( ptr ); + // Scale down to range [-1.0, 1.0] + //_input[i] = pcmToReal(pcmSample) * _hannWindow[i]; + _complexFrame[i] = Complex( _hannWindow[i] * xpcmToReal(pcmSample), 0 ); + ptr += 4; //bytesPerSample; + } + + // do the magic + bareFFT( _complexFrame ); + + // Analyze output to obtain amplitude and phase for each frequency + //for( int i=2; i < SWNumSamples/2; ++i ) + for( int i=0; i < SWNumSamples/2; ++i ) + { + + const qreal magnitude = abs( _complexFrame[i] ); + + //?? + //qreal amplitude = qLn( magnitude ); + //qreal amplitude = 0.27 * qLn( magnitude ); + qreal amplitude = SWFudgeFactor * qLn( magnitude ); + //qreal amplitude = SpectrumAnalyserMultiplier * qLn( magnitude ); + //qreal amplitude = SpectrumAnalyserMultiplier * magnitude; + //qreal amplitude = SWFudgeFactor * magnitude; + + //qreal amplitude = magnitude; + + _spectrum[i] = qBound( 0.0, amplitude, 1.0 ); + + } + + emit spectrumReady( _spectrum ); + + +} + +void SWFFTCalc::bareFFT( CArray& x ) +{ + + // fft function. + // + // ATTENTION /////////// + // + // size of x must be a power of two + // + //////////////////// + + const size_t N = x.size(); + if (N <= 1) + return; + + // divide + CArray even = x[ std::slice( 0, N/2, 2 ) ]; + CArray odd = x[ std::slice( 1, N/2, 2 ) ]; + + // conquer + bareFFT( even ); + bareFFT( odd ); + + // combine + for (size_t k = 0; k < N/2; ++k) + { + Complex t = std::polar( 1.0, -2 * PI * k / N ) * odd[k]; + x[k ] = even[k] + t; + x[k+N/2] = even[k] - t; + } + +} + + diff --git a/swfftcalc.h b/swfftcalc.h new file mode 100644 index 0000000..b956649 --- /dev/null +++ b/swfftcalc.h @@ -0,0 +1,92 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWFFTCALC_H +#define SWFFTCALC_H + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +// Scale PCM value to [-1.0, 1.0] +qreal xpcmToReal(qint16 pcm); + + + + +/** + * @brief Berechnet mittels FFT ein Spectrum + * aus dem @see @QAudioBuffer. Das Spectrum wird beim + * Abspielen eines Songs angezeigt. + * @see SWSpectrumWidget + * @see SWPlayerControl + */ + +class SWFFTCalc : public QObject +{ + + Q_OBJECT + +public: + + explicit SWFFTCalc( QObject* parent = nullptr ); + virtual ~SWFFTCalc(); + +signals: + + void spectrumReady( const SWValVec& spectrum ); + +public slots: + + void onAudioProbed( const QAudioBuffer& audiobuffer ); + +protected: + + using Complex = std::complex; + using CArray = std::valarray; + + void bareFFT( CArray& x ); + + static constexpr const int SWNumSamples = 4096; + const double PI = 3.141592653589793238460; + + // Fudge factor used to calculate the spectrum bar heights + //const qreal SpectrumAnalyserMultiplier = 0.15; + const qreal SWFudgeFactor = 0.17; + + + int _bufferDuration = 0; + QElapsedTimer _timer; + SWValVec _frames; + SWValVec _hannWindow; + // überdenken: geht das so schneller? + // SWValVec _logscale; + SWValVec _spectrum; + CArray _complexFrame; + +}; + + +#endif // SWFFTCALC_H + + diff --git a/swflipdigit.cpp b/swflipdigit.cpp new file mode 100644 index 0000000..418006b --- /dev/null +++ b/swflipdigit.cpp @@ -0,0 +1,329 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +/** + * contains copy-writen material from qt example code: + * @see shaped clock example + * @see embedded/flipdigits example + * + * **/ + + +#include +#include +#include +#include +#include +#include + +#include +#include + + +SWFlipDigit::SWFlipDigit( QWidget *parent ) + : QWidget( parent ), + _transition( Slide ) +{ + + setFocusPolicy( Qt::StrongFocus ); + + //setAttribute( Qt::WA_OpaquePaintEvent, true ); + setAttribute( Qt::WA_NoSystemBackground, true ); + connect(&_animator, SIGNAL(frameChanged(int)), SLOT(update())); + _animator.setFrameRange( 0, 100 ); + _animator.setDuration( 600 ); + _animator.setEasingCurve( ( QEasingCurve( QEasingCurve::InOutQuad ) ) ); + + _fontFamily = SWDEFAULTFONT; + +} + +SWFlipDigit::~SWFlipDigit() +{ + +} + + +void SWFlipDigit::setTransition( FlipMode tr) +{ + _transition = tr; +} + + +SWFlipDigit::FlipMode SWFlipDigit::transition() const +{ + return _transition; +} + + + +void SWFlipDigit::setValue( int value ) +{ + if( _value != value ) + { + _value = qBound( _rangeFrom, value, _rangeTo ); + preparePixmap(); + update(); + } +} + + +void SWFlipDigit::flipTo( int n ) +{ + if( _value != n ) + { + _value = qBound( _rangeFrom, n, _rangeTo ); + _lastPixmap = _pixmap; + preparePixmap(); + _animator.stop(); + _animator.start(); + } +} + + + +void SWFlipDigit::drawFrame( QPainter* painter, const QRect &rect ) +{ + + painter->setPen(Qt::NoPen); + + QLinearGradient gradient( rect.topLeft(), rect.bottomLeft() ); + gradient.setColorAt(0.00, QColor(245, 245, 245) ); + gradient.setColorAt(0.49, QColor(192, 192, 192) ); + gradient.setColorAt(0.51, QColor(245, 245, 245) ); + gradient.setColorAt(1.00, QColor(192, 192, 192) ); + painter->setBrush( gradient ); + + QRect r = rect; + painter->drawRoundedRect( r, 15, 15, Qt::RelativeSize ); + r.adjust( 1, 4, -1, -4 ); + painter->setPen (QColor( 181, 181, 181 ) ); + painter->setBrush( Qt::NoBrush ); + painter->drawRoundedRect( r, 15, 15, Qt::RelativeSize ); + painter->setPen( QColor( 159, 159, 159 )); + int y = rect.top() + rect.height() / 2 - 1; + painter->drawLine( rect.left(), y, rect.right(), y ); + + +} + + +QPixmap SWFlipDigit::drawDigits( int digit, const QRect &rect ) +{ + + QString strDigit = QString::number( digit ); + if( strDigit.length() == 1 ) + strDigit.prepend( '0' ); + + // FIX! + QFont font; + + font.setFamily( _fontFamily ); + + int fontHeight = _scaleFactor * _fontScale * rect.height(); + font.setPixelSize( fontHeight ); + //font.setBold( true ); + + QPixmap pixmap( rect.size() * _scaleFactor ); + pixmap.fill( Qt::transparent ); + + QLinearGradient gradient( QPoint( 0, 0 ), QPoint( 0, pixmap.height() ) ); + gradient.setColorAt( 0.00, QColor(128, 128, 128) ); + gradient.setColorAt( 0.49, QColor(64, 64, 64) ); + gradient.setColorAt( 0.51, QColor(128, 128, 128) ); + gradient.setColorAt( 1.00, QColor(16, 16, 16) ); + + QPainter painter; + painter.begin( &pixmap ); + painter.setFont( font ); + QPen pen; + pen.setBrush( QBrush( gradient ) ); + painter.setPen( pen ); + + QRect pos = pixmap.rect(); + pos.adjust( 0, -100, 0, 0 ); + + painter.drawText( pos, Qt::AlignCenter, strDigit ); + painter.end(); + + return pixmap.scaledToWidth( width(), Qt::SmoothTransformation ); + +} + + +void SWFlipDigit::preparePixmap() +{ + _pixmap = QPixmap( size() ); + _pixmap.fill(Qt::transparent); + QPainter painter( &_pixmap ); + painter.drawPixmap( 0, 0, drawDigits( _value, rect() ) ); +} + + +void SWFlipDigit::resizeEvent( QResizeEvent* ) +{ + preparePixmap(); + update(); +} + + + + +void SWFlipDigit::paintStatic() +{ + QPainter painter( this ); + drawFrame( &painter, rect() ); + painter.drawPixmap( 0, 0, _pixmap ); +} + + +void SWFlipDigit::paintSlide() +{ + QPainter painter( this ); + painter.fillRect( rect(), Qt::black ); + + //int pad = SWPADWIDTH; + //QRect fr = rect().adjusted( pad, pad, -pad, -pad ); + drawFrame( &painter, rect() ); + painter.setClipRect( rect() ); + + int y = height() * _animator.currentFrame() / 100; + painter.drawPixmap( 0, y, _lastPixmap ); + painter.drawPixmap( 0, y - height(), _pixmap ); +} + + +void SWFlipDigit::paintFlip() +{ + + QPainter painter( this ); + painter.setRenderHint( QPainter::SmoothPixmapTransform, true ); + painter.setRenderHint( QPainter::Antialiasing, true ); + + + int hw = width() / 2; + int hh = height() / 2; + + // behind is the new pixmap + + // int pad = SWPADWIDTH; + QRect fr = rect();//.adjusted( pad, pad, -pad, -pad ); + drawFrame( &painter, fr ); + painter.drawPixmap( 0, 0, _pixmap ); + + int index = _animator.currentFrame(); + + if( index <= 50 ) + { + + // the top part of the old pixmap is flipping + int angle = -180 * index / 100; + QTransform transform; + transform.translate(hw, hh); + transform.rotate( angle, Qt::XAxis ); + painter.setTransform(transform); + drawFrame( &painter, fr.adjusted(-hw, -hh, -hw, -hh ) ); + painter.drawPixmap(-hw, -hh, _lastPixmap); + + // the bottom part is still the old pixmap + painter.resetTransform(); + painter.setClipRect(0, hh, width(), hh); + drawFrame( &painter, fr ); + painter.drawPixmap( 0, 0, _lastPixmap ); + return; + } + + + painter.setClipRect( 0, hh, width(), hh ); + + // the bottom part is still the old pixmap + drawFrame( &painter, fr ); + painter.drawPixmap(0, 0, _lastPixmap ); + + // the bottom part of the new pixmap is flipping + int angle = 180 - 180 * _animator.currentFrame() / 100; + QTransform transform; + transform.translate( hw, hh); + transform.rotate( angle, Qt::XAxis ); + painter.setTransform( transform ); + drawFrame( &painter, fr.adjusted( -hw, -hh, -hw, -hh ) ); + painter.drawPixmap( -hw, -hh, _pixmap ); + + + +} + + +void SWFlipDigit::paintRotate() +{ + QPainter p(this); + + //int pad = SWPADWIDTH; + QRect fr = rect();//.adjusted(pad, pad, -pad, -pad); + drawFrame(&p, fr); + p.setClipRect(fr); + + int angle1 = -180 * _animator.currentFrame() / 100; + int angle2 = 180 - 180 * _animator.currentFrame() / 100; + int angle = ( _animator.currentFrame() <= 50 ) ? angle1 : angle2; + QPixmap pix = ( _animator.currentFrame() <= 50 ) ? _lastPixmap : _pixmap; + + QTransform transform; + transform.translate( width() / 2, height() / 2 ); + transform.rotate( angle, Qt::XAxis ); + + p.setTransform(transform); + p.setRenderHint( QPainter::SmoothPixmapTransform, true ); + p.drawPixmap(-width() / 2, -height() / 2, pix); +} + + +void SWFlipDigit::paintEvent( QPaintEvent* ) +{ + QPainter painter( this ); + painter.fillRect( rect(), Qt::black ); + + if( _animator.state() == QTimeLine::Running ) + { + if(_transition == Slide ) + paintSlide(); + if(_transition == Flip ) + paintFlip(); + if(_transition == Rotate ) + paintRotate(); + } + else + { + paintStatic(); + } + + drawMark( this ); + + +} + + +void SWFlipDigit::onDialDeltaChanged( int delta ) +{ + + // gültigkeit sicherstellen + int newval = _value + delta; + newval = qBound( _rangeFrom, newval, _rangeTo ); + if( _value == newval ) + return; + setValue( newval ); + update(); + +} + diff --git a/swflipdigit.h b/swflipdigit.h new file mode 100644 index 0000000..5848ed5 --- /dev/null +++ b/swflipdigit.h @@ -0,0 +1,98 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +/** + * contains copy-written material from qt example code: + * @see shaped clock example + * @see embedded/flipdigits example + * + * **/ + + +#ifndef SWFLIPDIGIT_H +#define SWFLIPDIGIT_H + +#include +#include + +#include +#include + + +/** + * @brief Simuliert die 'Klappzahl'-Darstellung einer Ziffer. + */ + +class SWFlipDigit : public QWidget, public SWDialWidget, public SWRangeValue +{ + + Q_OBJECT + +public: + + enum FlipMode + { + Slide, + Flip, + Rotate + }; + + explicit SWFlipDigit(QWidget *parent = nullptr); + virtual ~SWFlipDigit(); + + void setTransition( FlipMode tr ); + FlipMode transition() const; + + void onDialDeltaChanged( int delta ) override; + +public slots: + + virtual void setValue( int n ) override; + void flipTo( int n ); + +protected: + + const char* SWDEFAULTFONT = "Grado Gradoo Nf"; + const double SWSCALEFACTOR = 2.7; + const double SWFONTSCALE = 0.85; + + void drawFrame( QPainter* p, const QRect& rect ); + QPixmap drawDigits(int n, const QRect &rect); + void preparePixmap(); + + void resizeEvent( QResizeEvent* event ) override; + virtual void paintEvent( QPaintEvent* event ) override; + + void paintStatic(); + void paintSlide(); + void paintFlip(); + void paintRotate(); + + //const int SWPADWIDTH = 0;//1;//15; + + double _scaleFactor = SWSCALEFACTOR; + double _fontScale = SWFONTSCALE; + + QString _fontFamily; + FlipMode _transition; + QPixmap _pixmap; + QPixmap _lastPixmap; + QTimeLine _animator; + + +}; + + + + +#endif // SWFLIPDIGIT_H diff --git a/swlistcontrol.cpp b/swlistcontrol.cpp new file mode 100644 index 0000000..6fa031b --- /dev/null +++ b/swlistcontrol.cpp @@ -0,0 +1,105 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include + +#include + + +SWListControl::SWListControl( QWidget* parent, QSettings* settings ) + : SWBaseControl( parent, settings ), _checkedID( 0 ) + +{ + + Ui_SWListControl::setupUi( this ); + _contentView->setFocus(); + // ListControls können auch per DIAL gesteuert werden. + setAcceptDial( true ); + + // Scrollbars sind Ihh-Bä + _contentView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + + // 'innere' SIGNALS einsammeln ... + // click + connect( _contentView, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( onItemActivated(QListWidgetItem*) ) ); + // doublelcick, 'enter' + connect( _contentView, SIGNAL( itemActivated(QListWidgetItem*) ), this, SLOT( onItemActivated(QListWidgetItem*) ) ); + + + +} + + +/** + * @brief Standard-Destruktor + */ + +SWListControl::~SWListControl() +{ + +} + + +/** + * kommt von aussen vom RotaryDial + */ + +void SWListControl::onDialPushed() +{ + QListWidgetItem* item = _contentView->item( _checkedID ); + // das schickt ein SIGNAL, wann kommt das zurück? + onItemActivated( item ); +} + + +/** + * kommt von aussen vom RotaryDial + */ + +void SWListControl::onDialDeltaChanged( int delta ) +{ + if( 0 == _contentView->count() ) + return; + _checkedID = ( _checkedID + delta ) % _contentView->count(); + if( _checkedID < 0 ) + _checkedID = _contentView->count() - 1; + _contentView->setCurrentRow( _checkedID, QItemSelectionModel::ClearAndSelect ); +} + + +/** + * kommt von innen + */ + +void SWListControl::onItemActivated( QListWidgetItem* item ) +{ + QString urltext = item->data( SWListControlRole ).toString(); + SWUrl entry( item->text(), urltext ); + _checkedID = _contentView->currentRow(); + emit entryActivated( entry ); + +} + + +QListWidgetItem& SWListControl::createItem( const QString& title, const QString& body ) +{ + QListWidgetItem* item = new QListWidgetItem( title, _contentView ); + item->setData( SWListControlRole, body ); + + return *item; +} diff --git a/swlistcontrol.h b/swlistcontrol.h new file mode 100644 index 0000000..3d1cd05 --- /dev/null +++ b/swlistcontrol.h @@ -0,0 +1,65 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWLISTCONTROL_H +#define SWLISTCONTROL_H + + +#include + +#include +#include +#include +#include + + +/** + * @brief ein Control zu Anzeige von Listen wie der PlayList und der SenderList. + * @see SWSongs + * @see SWSender + */ + +class SWListControl : public SWBaseControl, protected Ui_SWListControl +{ + Q_OBJECT + +public: + + explicit SWListControl( QWidget* parent, QSettings* settings ); + virtual ~SWListControl(); + +signals: + + void entryActivated( SWUrl item ); + +public slots: + + virtual void onItemActivated( QListWidgetItem* item ); + + void onDialPushed() override; + void onDialDeltaChanged( int delta ) override; + + virtual QListWidgetItem& createItem( const QString& title, const QString& body ); + +protected: + + + static const int SWListControlRole = Qt::UserRole+1; + + int _checkedID = 0; + +}; + + +#endif // SWLISTCONTROL_H diff --git a/swlistcontrol.ui b/swlistcontrol.ui new file mode 100644 index 0000000..f48686a --- /dev/null +++ b/swlistcontrol.ui @@ -0,0 +1,60 @@ + + + SWListControl + + + + 0 + 0 + 800 + 255 + + + + + Josefin Sans Light + 14 + + + + Form + + + + + 5 + 84 + 790 + 170 + + + + + Josefin Sans + 14 + + + + QListWidget +{ + background: rgb(22,22,22); + color: rgb(200,200,200); +} + +QListWidget::Item:selected +{ + background: rgb(200,200,200); + color: rgb(22,22,22); +} + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + diff --git a/swplayercontrol.cpp b/swplayercontrol.cpp new file mode 100644 index 0000000..109878a --- /dev/null +++ b/swplayercontrol.cpp @@ -0,0 +1,199 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include + + +SWPlayerControl::SWPlayerControl( QWidget* parent, QSettings* settings ) +: SWControl( parent, settings ) +{ + + setupUi( this ); + _pauseLabel->hide(); + setAcceptDial( false ); + _audioProbe.setSource( &_player ); + // man weiss ja nie, default ist die maximale Lautstärke + _value = 0; + _player.setVolume( _value ); + +#ifdef Q_OS_LINUX + // unter linux kriegt der _interne_ player 100%, weil die + // Lautstärke über das globale Volume via 'amixer' geregelt wird. + // Dadurch können auch eingehende BT-Stream geregelt werden. + _player.setVolume( 100 ); +#endif + + + // weiterreichen + connect( &_player, &QMediaPlayer::stateChanged, this, + [=]( QMediaPlayer::State newState ) + { + emit stateChanged( newState ); + }); + + _FFTCalc.moveToThread( &_workerThread ); + + qRegisterMetaType("SWValVec"); + connect( &_audioProbe, SIGNAL( audioBufferProbed(QAudioBuffer) ), &_FFTCalc, SLOT(onAudioProbed(QAudioBuffer) ) ); + //connect( &_audioProbe, SIGNAL( audioBufferProbed(QAudioBuffer) ), this, SLOT(onAudioProbed(QAudioBuffer) ) ); + connect( &_FFTCalc, SIGNAL( spectrumReady(SWValVec) ), this, SLOT( onSpectrumReady(SWValVec) ) ); + + _workerThread.start(); +} + + +SWPlayerControl::~SWPlayerControl() +{ + //_audioProbe.setSource( nullptr ); + _workerThread.quit(); + _workerThread.wait(); +} + + +/** + * @brief Wird aufgerufen, wenn das (externe) Dial gedreht wurde. + */ + +void SWPlayerControl::onDialDeltaChanged( int delta ) +{ + setValue( _value += 2*delta ); +} + + +/** + * @brief Überschreibt SWRangeValue::setValue: es wird nicht + * nur _value neu gesetzt, sondern auch das player Volume + * angepasst + */ + +void SWPlayerControl::setValue( int value ) +{ + if( _value != value ) + _value = qBound( _rangeFrom, value, _rangeTo ); + +#ifdef Q_OS_WIN + _player.setVolume( _value ); +#endif + +#ifdef Q_OS_LINUX + QString cmd = _volCmd.arg( _value ); + ::system( cmd.toLocal8Bit().data() ); +#endif + +} + + +void SWPlayerControl::onAudioProbed( const QAudioBuffer& audiobuffer ) +{ + _FFTCalc.onAudioProbed( audiobuffer ); +} + + +void SWPlayerControl::onSpectrumReady( const SWValVec& spectrum ) +{ + + if( _player.state() != QMediaPlayer::PlayingState ) + return; + + // hier verteilen wir das gesamtspectrum + // auf die xx balken des Displays + int numbins = _spectrumWidget->numBars(); + //int numvals = spectrum.size(); + int numvals = spectrum.size() / 4 * 2; + //int numvals = spectrum.size() / 3 * 2; + int divider = numvals / numbins; + QVector bins( numbins ); + SWValVec vals( numbins ); + + for( int i=0; ionValueListChanged( vals ); + +} + + +/** + * @brief SWPlayerControl::setUrl + * @param urlText + */ + +void SWPlayerControl::setUrl( const QString& urlText ) +{ + _mediaUrl = urlText; + _player.setMedia( _mediaUrl ); +} + + +/** + * @brief SWPlayerControl::togglePlaying + * @param playIt + */ + +void SWPlayerControl::togglePlaying( bool playIt ) +{ + playIt ? startPlaying() : pausePlaying() ; +} + + +/** + * @brief SWPlayerControl::startPlaying: Erwartet eine _ordentliche_ URL als String + * @param urlText + */ + +void SWPlayerControl::startPlaying() +{ + //_player.setVolume( _value ); + _pauseLabel->hide(); + _player.play(); +} + + +/** + * @brief Pausiert den Player an und löscht die Anzeige. + */ + +void SWPlayerControl::pausePlaying() +{ + _player.pause(); + _pauseLabel->show(); +} + + +/** + * @brief Hält den Player an und löscht die Anzeige. + */ + +void SWPlayerControl::stopPlaying() +{ + _player.stop(); + _pauseLabel->hide(); + _spectrumWidget->clearValueList(); +} + + + diff --git a/swplayercontrol.h b/swplayercontrol.h new file mode 100644 index 0000000..d71269d --- /dev/null +++ b/swplayercontrol.h @@ -0,0 +1,84 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWPlayerControl_H +#define SWPlayerControl_H + + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +/** + * @brief Dieses Control steuert den Mediaplayer und zeigt das Soundspektrum an. + * @see QMediaPlayer + * @see SWSpectrumWidget + */ + + + +class SWPlayerControl : public SWControl, public SWRangeValue, private Ui_SWPlayerControl +{ + Q_OBJECT + +public: + + + + explicit SWPlayerControl( QWidget* parent, QSettings* settings ); + virtual ~SWPlayerControl(); + + void setValue( int value ) override; + + void setUrl( const QString& urlText ); + void togglePlaying( bool playIt ); + void startPlaying(); + void pausePlaying(); + void stopPlaying(); + +signals: + + void stateChanged( QMediaPlayer::State ); + +public slots: + + void onDialDeltaChanged( int value ) override; + void onSpectrumReady( const SWValVec& spectrum ); + void onAudioProbed( const QAudioBuffer& audiobuffer ); + +protected: + + QString _volCmd = raDIYo::CmdVolume; + QUrl _mediaUrl ; + + QAudioProbe _audioProbe; + QMediaPlayer _player; + + SWFFTCalc _FFTCalc; + + QThread _workerThread; + + + +}; + +#endif // SWPlayerControl_H diff --git a/swplayercontrol.ui b/swplayercontrol.ui new file mode 100644 index 0000000..1137fd7 --- /dev/null +++ b/swplayercontrol.ui @@ -0,0 +1,82 @@ + + + SWPlayerControl + + + + 0 + 0 + 800 + 255 + + + + Form + + + + + 0 + 0 + 800 + 255 + + + + + + + + false + + + + 150 + 90 + 501 + 91 + + + + + Valley Grrrl NF + 20 + + + + +padding-bottom: 7px; +margin-left: 0px; +border: 5px solid gray; +border-radius: 3px; +border-color: rgb( 66,66,66 ); +background:rgb(44,44,44); +color: rgb( 181, 181, 181 ); +text-align: center; + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + Paused + + + + + + + SWSpectrumWidget + QWidget +
swspectrumwidget.h
+ 1 +
+
+ + +
diff --git a/swradiobutton.cpp b/swradiobutton.cpp new file mode 100644 index 0000000..363bbc3 --- /dev/null +++ b/swradiobutton.cpp @@ -0,0 +1,70 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + + +#include +#include + +/** + * @brief Standardkostruktor. + */ + +SWRadioButton::SWRadioButton( QWidget* parent ) + : QPushButton( parent ) +{ + //setAcceptDial( false ); + // semi schlimmer hack: clicks auf mich weiterleiten + //connect( this, &QPushButton::clicked, this, [=]{ emit widgetClicked(this); } ); +} + + +/** + * Setzt den Zugriffsschlüssel für diesen Butten. Der Schlüssel bestimmt das + * für diesen Button vorgesehen Icon. + */ + +void SWRadioButton::setKey( const QString& key ) +{ + _hoverStyle = QString( ButtonIcon ).arg( key ); +} + + +/** + * Simuliert pprogrammatisch einen Mousehover-Effekt, in dem ein + * entsprechendes Icon gesetzt wird. + * @see setKey + */ + +void SWRadioButton::hover() +{ + setIcon( QIcon( _hoverStyle ) ); +} + + +/** + * Macht den Hover-Effekt rückgängig, in dem das Hover-Icon + * wieder entfernt wird. + */ + +void SWRadioButton::unHover() +{ + + // hatten wir schon einen button gehovert? + // dann ebendiesen restaurieren, in das Hover-Icon glöscht + // und des StyleSheet dadurch wieder aktiviert wird. + + setIcon( QIcon() ); + setChecked( false ); +} + diff --git a/swradiobutton.h b/swradiobutton.h new file mode 100644 index 0000000..711d032 --- /dev/null +++ b/swradiobutton.h @@ -0,0 +1,55 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWRADIOBUTTON_H +#define SWRADIOBUTTON_H + +#include +#include + +#include + + +/** + * @brief Ein QPushButtonder der sich programmatisch 'hovern' + * und per RotaryControl bedienen lässt. + * + * @see QPushButton, + * @see SWDialWidget + */ + +class SWRadioButton : public QPushButton +{ + Q_OBJECT + +public: + + explicit SWRadioButton( QWidget* parent = nullptr ); + virtual ~SWRadioButton() = default; + + virtual void setKey( const QString& key ); + virtual void unHover(); + virtual void hover(); + +protected: + + constexpr static const char* const ButtonIcon = ":/images/radiyo.%1.checked.png"; + + QString _hoverStyle; + +}; + + + +#endif // SWRADIOBUTTON_H diff --git a/swradiyomainwidget.cpp b/swradiyomainwidget.cpp new file mode 100644 index 0000000..daf24d5 --- /dev/null +++ b/swradiyomainwidget.cpp @@ -0,0 +1,442 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + c.holzheuer@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//#include +//#include + +//#include // std::swap +//#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + + + + + +/* +static QString formatTime( qint64 timeMilliSeconds ) +{ + qint64 seconds = timeMilliSeconds / 1000; + const qint64 minutes = seconds / 60; + seconds -= minutes * 60; + return QStringLiteral("%1:%2") + .arg(minutes, 2, 10, QLatin1Char('0')) + .arg(seconds, 2, 10, QLatin1Char('0')); +} +*/ + +/** + * @brief SWRaDIYoMainWidget --doku begins here --- + * @param parent + * + * contains copy-writen material from qt example code: + * @see shaped clock example + * @see embedded/flipdigits example + * + */ + +SWRaDIYoMainWidget::SWRaDIYoMainWidget( QWidget *parent ) + : SWRaDIYoBaseWidget( parent ) +{ + + setupFonts(); + setupUi( this ); + + + /// Setup Controls: 'RaDIYo' Buttons + /// Reihenfolge beachten, die iost wichtig für + /// die button-asuwahl per dial + + _controller.addButton( _buttonPlay, PlayerControl, "play" ); + _controller.addButton( _buttonSender, SenderControl, "sender" ); + _controller.addButton( _buttonSongs, SongsControl, "songs" ); + _controller.addButton( _buttonUSB, UsbControl, "usb" ); + //_controller.addButton( _buttonBlueTooth, SWBLUETOOTHCONTROL, "bluetooth" ); + + _controller.addButton( _buttonClock, ClockControl, "clock" ); + _controller.addButton( _buttonAlarm, AlarmControl, "alarm" ); + _controller.addButton( _buttonSetup, SetupControl, "setup" ); + _controller.addButton( _buttonShutdown, ShutdownControl, "shutdown" ); + + /// Alle Controls, schön vorsortiert. + _senderControl = new SWSenderControl( this ); + _songsControl = new SWSongsControl( this ); + _playerControl = new SWPlayerControl( this ); + + + _controller.addControl( PlayerControl, _playerControl ); + _controller.addControl( SenderControl, _senderControl ); + _controller.addControl( SongsControl, _songsControl ); + _controller.addControl( UsbControl, new SWUSBControl( this ) ); + _controller.addControl( ClockControl, new SWClockControl( this ) ); + _controller.addControl( AlarmControl, new SWAlarmControl( this ) ); + _controller.addControl( SetupControl, new SWSetupControl( this ) ); + _controller.addControl( ShutdownControl, new SWShutdownControl( this ) ); + //_controller.addControl( SWBLUETOOTHCONTROL] = new SWBlueToothControl( this ); + + connect( &_raDIYoButtons, &QButtonGroup::idClicked, this, &SWControlStates::onIdActivated ); + /// play button hat ne sonderstellung + connect( _buttonPlay, &QPushButton::clicked, this, &SWControlStates::onVolumeButtonClicked ); + + + /// Setup Controls: Fake Dials unter Win, echte für Linux + setupDials(); + + /// startup + loadSettings(); + + /// bei untätigkeit kommt wieder die Uhr + _idleTimer.setInterval( raDIYo::IdleTimeOut ); + _idleTimer.setSingleShot( true ); + connect( &_idleTimer, &QTimer::timeout, this, &SWRaDIYoMainWidget::onIdleTimeOut ); + + /// Setup Controls: Volume + connect( _volumeWidget, SIGNAL(valueChanged(int)), this, SLOT(onVolumeValueChanged(int)) ); + + + QString defSender =_settings.value( raDIYo::KeyDefaultSender ).toString(); + _nowPlaying = SWPlayableItem( defSender, SWPlayableItem::WebStream, raDIYo::DefaultVolume ); + onVolumeValueChanged( _nowPlaying.volume ); + + /// wir nehmen den default-sender + _currentTitle->setText( _nowPlaying.title ); + + /// not least + _version->setText( raDIYo::Version ); + + + +} + +/** + * @brief ~SWRaDIYoMainWidget Destructor. + */ + +SWRaDIYoMainWidget::~SWRaDIYoMainWidget() +{ + + +} + +void SWRaDIYoMainWidget::setCurrentControl( SWAbstractControl* control ) +{ + _currentCtrl = control; + _currentCtrl->show(); +} + +void SWRaDIYoMainWidget::setupDials() +{ + + /* FIX! + * Schaltschema bei Click: + * Radio aus / Uhr -click-> Radio ein + * Radio ein -click-> Radio aus / Uhr + * Radio aus / Uhr -turn-> Radio ein / VolumeDislay + * Radio ein -turn-> Radio ein / VolumeDislay + */ + + + // Prinzip: Clicks (also 'drücken' in echt) schalten weiter, drehen schaltet auch weiter + // wenn das control mit 'drehen' nix anfangen kann, wie z.B. das FlipClock control + +//#ifdef Q_OS_LINUX + + // Linux, kompiliert auch unter Win + _dialLeft = new PiGPIORotaryDial( 13, 6, 5, this ); + _dialRight = new PiGPIORotaryDial( 22, 27, 17, this ); + + connect( _dialLeft, SIGNAL(clicked()), _controller, SLOT(onSenderButtonClicked()) ); + connect( _dialRight, SIGNAL(clicked()), _controller, SLOT(onVolumeButtonClicked()) ); + connect( _dialLeft, SIGNAL(valueChanged(int)), _controller, SLOT(onSenderValueChanged(int)) ); + connect( _dialRight, SIGNAL(valueChanged(int)), _volumeWidget, SLOT(onDialValueChanged(int)) ); + +//#endif + +#ifdef Q_OS_WIN + + qDebug() << " --- Q_OS_WIN"; + /// Setup Controls: Fake Dials + + connect( &_dialDialog.leftDial().pushButton(), &QPushButton::clicked, _controller, &SWControlStates::onSenderButtonClicked ); + connect( &_dialDialog.leftDial().dial(), &QDial::valueChanged, _controller, &SWControlStates::onSenderValueChanged ); + connect( &_dialDialog.rightDial().pushButton(), &QPushButton::clicked, _controller, &SWControlStates::onVolumeButtonClicked ); + + connect( &_dialDialog.rightDial().dial(), &QDial::valueChanged, _volumeWidget, &SWVolumeWidget::onDialValueChanged ); + + _dialDialog.show(); + +#endif + + + +} + + +QSettings& SWRaDIYoMainWidget::settings() +{ + return _settings; +} + + +/// ??? +void SWRaDIYoMainWidget::onIdleTimeOut() +{ + qDebug() << "--- onIdleTimeOut"; + // swap back + //swapControls( IDClockControl ); +} + + +void SWRaDIYoMainWidget::swapControls( int newID ) +{ + + /// FIX! ButtonGroup anpassen!!! + /* + qDebug() << "Fade IN" << newID << " Fade OUT: " << _currentCtrlID; + + // ausblenden + currentControl().fadeOut(); + _raDIYoButtons.button( _currentCtrlID )->setChecked( false ); + + // alte ID merken + _lastControlID = _currentCtrlID; + + // einblenden + _currentCtrlID = newID; + _raDIYoButtons.button( newID )->setChecked( true ); + currentControl().fadeIn(); + */ + +} + + +/** + * @brief onIDTriggered + * @param newID + */ + +void SWRaDIYoMainWidget::onIDTriggered( int newID ) +{ + + +} + + + + + + + + +void SWRaDIYoMainWidget::onVolumeValueChanged( int value ) +{ + + /// 'setValue( value )' reicht hier nicht, + /// denn der neue Wert muss weiter gereicht + /// werden, also 'onDialValueChanged' + + _volumeWidget->onDialValueChanged( value ); + _playerControl->onDialValueChanged( value ); + _dialDialog.rightDial().dial().setValue( value ); + //_dialRight.setValue( value ); + +} + + +// ... +void SWRaDIYoMainWidget::onEntryActivated( SWPlayableItem item ) +{ + qDebug() << "--:onEntryActivated: " << item.title << ": " << item.urlText; + + // Das SIGNAL kommt von einem Control, also schalten wir wieder + // zurück auf die Buttons + + _isCtrlActive = false; + // mehrfache ansagen ignorieren + if( _nowPlaying.urlText == item.urlText ) + return; + + // merken + _nowPlaying = item; + // abschalten ... + _isPlayerActive = false; + // ... und wieder anschalten + togglePlayMode(); + +} + + +/** + * @brief startPlaying: von aussen und von innen + * @param title< + * @param urlText + * @param startnow + */ + +void SWRaDIYoMainWidget::togglePlayMode() +{ + /* + _isPlayerActive = !_isPlayerActive; + + //QString fullUrl = raDIYo::SngDir + urlText; + qDebug() << "\n\n+++ togglePlayMode(): " << _currentCtrlID << " :" << _nowPlaying.title << " Url: " << _nowPlaying.urlText << "\n\n"; + + //FIX! + //QString color = _isPlayerActive ? "rgb(181,181,181)" : "rgb(69,69,69);"; + //_currentTitle->setStyleSheet( _titleCss.arg( color ) ); + _currentTitle->setText( _nowPlaying.title ); + + _buttonPlay->setStyleSheet( _isPlayerActive ? _buttonPauseCss : _buttonPlayCss ) ; + //_buttonPlay->setStyleSheet( _buttonPauseCss ) ; + + // FIX! das haut nicht hin + if( !_isPlayerActive ) + { + qDebug() << " --- Player OFF"; + _playerControl->stopPlaying(); + /// SpectrumDisplay abschalten, aber nur wenn eingeschaltet war + if( _currentCtrlID == IDPlayerControl ) + swapControls( _lastControlID ); + return; + } + + qDebug() << " --- Player ON"; + swapControls( IDPlayerControl ); + + _playerControl->startPlaying( _nowPlaying.urlText ); + */ +} + + +/** + * @brief Fonts explicit laden, _vor_ setupUi + */ + +void SWRaDIYoMainWidget::setupFonts() +{ + + QStringList fontList = QDir( raDIYo::FontDir ).entryList(); + for( const QString& fontName : fontList ) + QFontDatabase::addApplicationFont( raDIYo::FontDir + fontName ); + +} + + +/** + * @brief loadSettings: die Einstellungen laden + */ + +void SWRaDIYoMainWidget::loadSettings() +{ + /// Dss ist die Bildschirmgröße des Raspi 7 inch displays + resize( SWScreenLargeX, SWScreenLargeY ); + + + /// hier sind wir auch für die voreinstellungen zuständig: falls + /// nicht vorhanden, default setzen + if( !_settings.contains( raDIYo::KeySongsDir ) ) + _settings.setValue( raDIYo::KeySongsDir, QDir::homePath() + raDIYo::SongsDir ); + + /// default Sender belegen + if( !_settings.contains( raDIYo::KeyDefaultSender ) ) + _settings.setValue( raDIYo::KeyDefaultSender, raDIYo::DefaultSender ); + + /// Wir lesen die Hard-Kodierte Senderliste und schreiben sie in die + /// settings datenbank + if( !_settings.contains( raDIYo::KeySenderList ) ) + { + QString senderList = readResource( raDIYo::ResSenderList ); + // oder doch lieber in ein FILE? + _settings.setValue( raDIYo::KeySenderList, senderList ); + } + + // setup list controls + _senderControl->loadEntryList( _settings.value( raDIYo::KeySenderList ).toString() ); + _songsControl->loadEntryList( _settings.value( raDIYo::KeySongsDir ).toString() ); + + +} + + +/** + * @brief setAlarm @todo implementation + */ +void SWRaDIYoMainWidget::setAlarm() +{ + +} + + +/** + * @brief saveSettings @todo implementation + */ + +void SWRaDIYoMainWidget::saveSettings() +{ + +} + + +/** + * @brief onShutDown + * @todo implementation + * @todo shutdown der hardware -> use linux 'sudo kill me' + */ + +void SWRaDIYoMainWidget::onShutDown() +{ + + + + + + // wir wollen sterben + ::exit( 0 ); + + +} + + + + diff --git a/swradiyomainwidget.h b/swradiyomainwidget.h new file mode 100644 index 0000000..e69de29 diff --git a/swrangevalue.cpp b/swrangevalue.cpp new file mode 100644 index 0000000..87cafde --- /dev/null +++ b/swrangevalue.cpp @@ -0,0 +1,74 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include + + +/** + * @brief Gibt den aktuellen Wert des Rotarydials zurück. Dieser + * liegt in der Voreinstellung innerhalb des gültigen Bereichs von 0 .. 99. + * @see setRange + */ + +int SWRangeValue::value() +{ + return _value; +} + + +/** + * @brief Setzt den aktuellen Wert des Rotarydials. Dieser muss + * in der Voreinstellung innerhalb des gültigen Bereichs liegen. + * + * @see setRange + */ + + +void SWRangeValue::setValue( int value ) +{ + if( _value != value ) + { + _value = qBound( _rangeFrom, value, _rangeTo ); + } +} + + +/** + * @brief Setzt den Gültigkeitsbereich des Wertes vom RotaryDial. + * @param rangeFrom: Minimalwert (default: 0) + * @param rangeTo: Maximalwert (default: 99) + */ + +void SWRangeValue::setRange( int rangeFrom, int rangeTo ) +{ + Q_ASSERT( rangeFrom >= 0 ); + Q_ASSERT( rangeFrom < rangeTo ); + _rangeFrom = rangeFrom; + _rangeTo = rangeTo; +} + + +int SWRangeValue::rangeFrom() +{ + return _rangeFrom; +} + + +int SWRangeValue::rangeTo() +{ + return _rangeTo; +} diff --git a/swrangevalue.h b/swrangevalue.h new file mode 100644 index 0000000..20f6fc6 --- /dev/null +++ b/swrangevalue.h @@ -0,0 +1,49 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWRANGEVALUE_H +#define SWRANGEVALUE_H + + +/** + * @brief Aspektklasse für 'werthaltige' (Lautstärke, Uhrzeit) Widgets. + * @see SWVolumeWidget + * @see SWFlipDigit + */ + +class SWRangeValue +{ + +public: + + SWRangeValue() = default; + virtual ~SWRangeValue() = default; + + int value(); + virtual void setValue( int value ); + virtual void setRange( int rangeFrom, int rangeTo ); + + int rangeFrom(); + int rangeTo(); + +protected: + + int _rangeFrom = 0; + int _rangeTo = 99; + int _value = 0; + +}; + + +#endif // SWRANGEVALUE_H diff --git a/swsendercontrol.cpp b/swsendercontrol.cpp new file mode 100644 index 0000000..2ed690c --- /dev/null +++ b/swsendercontrol.cpp @@ -0,0 +1,81 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include + +#include +#include + + +SWSenderControl::SWSenderControl( QWidget* parent, QSettings* settings ) + : SWListControl( parent, settings ) +{ + setHeaderText( "Sender" ); +} + + +/** + * @brief Wird jeweils beim Einblenden aufgerufen. + * + * Lädt die aktuelle Liste der voreingestellten Internetsender. + */ + +void SWSenderControl::onShow() +{ + _contentView->clear(); + + QString path = settings().value( raDIYo::KeySenderPath ).toString(); + QFile senderFile( path ); + + // Wir lesen die Hard-Kodierte Senderliste und schreiben sie ggf. + // auf Platte + if( !senderFile.exists() || senderFile.size() == 0 ) + { + QString senderList = readResource( raDIYo::ResSenderList ); + // geht nicht gibts nicht + Q_ASSERT( senderFile.open( QIODevice::WriteOnly ) ); + senderFile.write( senderList.toUtf8() ); + senderFile.close(); + } + + // geht nicht gibts nicht + Q_ASSERT( senderFile.exists() ); + + senderFile.open( QIODevice::ReadOnly ); + QTextStream mediaList( &senderFile ); + while( !mediaList.atEnd() ) + { + QString line = mediaList.readLine(); + QStringList entry = line.split( ';'); + if( entry.size() == 2 ) + createItem( entry[0], entry[1] ); + } + + // Es gibt Inhalte + if( _contentView->count() > 0 ) + { + // _checkedID nur resetten falls notwendig + _checkedID = qMin( _checkedID, _contentView->count() ); + _contentView->setCurrentRow( _checkedID ); + } + +} + + + + diff --git a/swsendercontrol.h b/swsendercontrol.h new file mode 100644 index 0000000..0993106 --- /dev/null +++ b/swsendercontrol.h @@ -0,0 +1,41 @@ + +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +#ifndef SWSENDERCONTROL_H +#define SWSENDERCONTROL_H + + +#include + +/** + * @brief Control, das die Senderliste darstellt. + */ + +class SWSenderControl : public SWListControl +{ + Q_OBJECT + +public: + + explicit SWSenderControl( QWidget* parent, QSettings* settings ); + virtual ~SWSenderControl() = default; + +public slots: + + void onShow() override; + +}; + + +#endif // SWSENDERCONTROL_H diff --git a/swsetupcontrol.cpp b/swsetupcontrol.cpp new file mode 100644 index 0000000..8812823 --- /dev/null +++ b/swsetupcontrol.cpp @@ -0,0 +1,82 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include + +#include +#include + + +SWSetupControl::SWSetupControl( QWidget* parent, QSettings* settings ) + : SWBaseControl( parent, settings ) +{ + + Ui_SWSetup::setupUi( this ); + setHeaderText( "Setup" ); + + connect( _buttonSongs, SIGNAL( clicked() ), this, SLOT( onSongsClicked() ) ); + connect( _buttonSender, SIGNAL( clicked() ), this, SLOT( onSenderClicked() ) ); + +} + + +void SWSetupControl::onShow() +{ + QString dirName = settings().value( raDIYo::KeySongsPath ).toString(); + _labelSongs->setText( dirName ); + QString senderList = settings().value( raDIYo::KeySenderPath ).toString(); + _labelSender->setText( senderList ); +} + + +void SWSetupControl::onSongsClicked() +{ + + QString defName = _settings->value( raDIYo::KeySongsPath ).toString(); + QDir defDir( defName ); + if( !defDir.exists() ) + defName = QDir::homePath(); + + defName = QFileDialog::getExistingDirectory( this, tr("Songs Directory"), + defName, + QFileDialog::ShowDirsOnly + | QFileDialog::DontResolveSymlinks ); + + if( defName.isEmpty() ) + return; + + settings().setValue( raDIYo::KeySongsPath,defName ); + _labelSongs->setText( defName ); + +} + + + +void SWSetupControl::onSenderClicked() +{ + + QString defName = QFileDialog::getOpenFileName(this, tr("Open Sender File"), + QDir::homePath(), + tr("List (*.csv)")); + + if( defName.isEmpty() ) + return; + + settings().setValue( raDIYo::KeySenderPath, defName ); + _labelSender->setText( defName ); + +} + diff --git a/swsetupcontrol.h b/swsetupcontrol.h new file mode 100644 index 0000000..94551ca --- /dev/null +++ b/swsetupcontrol.h @@ -0,0 +1,47 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWSETUPCONTROL_H +#define SWSETUPCONTROL_H + +#include +#include + + +/** + * @brief Control, das die Setup-Seite darstellt. + */ + +class SWSetupControl : public SWBaseControl, private Ui_SWSetup +{ + + Q_OBJECT + +public: + + explicit SWSetupControl( QWidget* parent, QSettings* settings ); + virtual ~SWSetupControl() = default; + +public slots: + + void onShow() override; + + +protected slots: + + void onSongsClicked(); + void onSenderClicked(); +}; + +#endif // SWSETUPCONTROL_H diff --git a/swsetupcontrol.ui b/swsetupcontrol.ui new file mode 100644 index 0000000..0e7812b --- /dev/null +++ b/swsetupcontrol.ui @@ -0,0 +1,204 @@ + + + SWSetup + + + + 0 + 0 + 800 + 255 + + + + Form + + + + + 5 + 110 + 100 + 42 + + + + + Josefin Sans + 14 + false + + + + QPushButton +{ + padding-bottom: 0px; + margin-left: 0px; + border: 2px solid gray; + border-radius: 3px; + border-color: rgb( 66,66,66 ); + background:rgb(44,44,44); + color: rgb( 181, 181, 181 ); +} + +QPushButton:hover +{ + border-color: white; +} + +QPushButton:checked +{ + background:rgb(99,99,99); +} + + + Sender + + + false + + + false + + + + + + 5 + 160 + 100 + 42 + + + + + Josefin Sans + 14 + + + + QPushButton +{ + padding-bottom: 0px; + margin-left: 0px; + border: 2px solid gray; + border-radius: 3px; + border-color: rgb( 66,66,66 ); + background:rgb(44,44,44); + color: rgb( 181, 181, 181 ); +} + +QPushButton:hover +{ + border-color: white; +} + +QPushButton:checked +{ + background:rgb(99,99,99); +} + + + Songs + + + true + + + false + + + + + false + + + + 110 + 110 + 681 + 42 + + + + + Josefin Sans + 14 + + + + 12 + + + padding-bottom: 5px; + margin-left: 0px; + border: 2px solid gray; + border-radius: 3px; + background:rgb( 44, 44, 44 ); + color: rgb( 181, 181, 181 ); + + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + ... + + + + + false + + + + 110 + 160 + 681 + 42 + + + + + Josefin Sans + 14 + + + + padding-bottom: 5px; + margin-left: 0px; + border: 2px solid gray; + border-radius: 3px; + background:rgb( 44, 44, 44 ); + color: rgb( 181, 181, 181 ); + + + + QFrame::Panel + + + QFrame::Sunken + + + 3 + + + ... + + + + + + SWDialButton + QPushButton +
swdialbutton.h
+
+
+ + +
diff --git a/swshutdowncontrol.cpp b/swshutdowncontrol.cpp new file mode 100644 index 0000000..adab488 --- /dev/null +++ b/swshutdowncontrol.cpp @@ -0,0 +1,84 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include + +#ifdef Q_OS_LINUX +#include +#include +#endif + +#include +#include + + +SWShutdownControl::SWShutdownControl( QWidget* parent, QSettings* settings ) +: SWDialControl( parent, settings ) +{ + + Ui_SWShutdownControl::setupUi( this ); + setHeaderText( "Shutdown?" ); + + QString sysName = "raDIYo"; +#ifdef Q_OS_LINUX + char buf[20]; + ::gethostname( buf, 20 ); + sysName = buf; +#endif + + _buttonShutdown->setText( _buttonShutdown->text().arg( sysName ) ); + _buttonReboot->setText( _buttonReboot->text().arg( sysName ) ); + + connect( _buttonReboot, SIGNAL( widgetClicked( SWDialWidget* ) ), this, SLOT( onWidgetClicked( SWDialWidget* ) ) ); + connect( _buttonShutdown, SIGNAL( widgetClicked( SWDialWidget* ) ), this, SLOT( onWidgetClicked( SWDialWidget* ) ) ); + connect( _buttonExit, SIGNAL( widgetClicked( SWDialWidget* ) ), this, SLOT( onWidgetClicked( SWDialWidget* ) ) ); + + collectDialWidgets(); + +} + + +/** + * @brief Implementiert SWDialControl::onWidgetClicked und behandelt + * Drücken/Klicken der Kindwidgets. + */ + +void SWShutdownControl::onWidgetClicked( SWDialWidget* child ) +{ + if( _buttonExit == child ) + { + qDebug() << "good bye!"; + ::exit( 0 ); + return; + } + + if( _buttonShutdown == child ) + { + qDebug() << "shutdown"; + ::system( raDIYo::CmdShutDown ); + return; + } + + if( _buttonReboot == child ) + { + qDebug() << "restart"; + ::system( raDIYo::CmdReboot); + return; + } + +} + + diff --git a/swshutdowncontrol.h b/swshutdowncontrol.h new file mode 100644 index 0000000..a74c78d --- /dev/null +++ b/swshutdowncontrol.h @@ -0,0 +1,45 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWSHUTDOWNCONTROL_H +#define SWSHUTDOWNCONTROL_H + +class QSettings; + +#include +#include + + +/** + * @brief Control, das die Shutdown-Seite darstellt. + */ + +class SWShutdownControl : public SWDialControl, private Ui_SWShutdownControl +{ + + Q_OBJECT + +public: + + explicit SWShutdownControl( QWidget* parent, QSettings* settings ); + virtual ~SWShutdownControl() = default; + +public slots: + + void onWidgetClicked( SWDialWidget* ) override; + +}; + + +#endif // SWSHUTDOWNCONTROL_H diff --git a/swshutdowncontrol.ui b/swshutdowncontrol.ui new file mode 100644 index 0000000..f5e36bc --- /dev/null +++ b/swshutdowncontrol.ui @@ -0,0 +1,142 @@ + + + SWShutdownControl + + + + 0 + 0 + 800 + 255 + + + + Form + + + + + + + + 200 + 90 + 161 + 161 + + + + 01 + + + QPushButton:hover +{ + border-color: white; +} + + + + + + + + :/images/radiyo.halt.png:/images/radiyo.halt.png + + + + 166 + 167 + + + + + + + 380 + 100 + 200 + 60 + + + + + Selznick Remix NF + 20 + + + + 1 + + + 02 + + + QPushButton +{ + color:rgb(234,234,234); + border: 2px solid gray; + border-radius: 5px; +} + +QPushButton:hover +{ + border-color: white; +} + + + + reboot '%0' + + + + + + 380 + 180 + 200 + 60 + + + + + Selznick Remix NF + 20 + + + + 1 + + + 03 + + + QPushButton +{ + color:rgb(234,234,234); + border: 2px solid gray; + border-radius: 5px; +} + +QPushButton:hover +{ + border-color: white; +} + + + + halt '%0' + + + + + + SWDialButton + QPushButton +
swdialbutton.h
+
+
+ + + + +
diff --git a/swsongscontrol.cpp b/swsongscontrol.cpp new file mode 100644 index 0000000..fb21dda --- /dev/null +++ b/swsongscontrol.cpp @@ -0,0 +1,75 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include + +#include +#include + + +SWSongsControl::SWSongsControl( QWidget* parent, QSettings* settings ) + : SWListControl( parent, settings ) +{ + + setHeaderText( "Songs" ); + +} + + +/** + * Überschriebene Methode. Wird jedesmal beim Einblenden des Controls aufgerufen. Lädt + * in diesem Fall das Songs-Verzeichnis. + * @see loadDir() + */ + +void SWSongsControl::onShow() +{ + const QString& songsDir = settings().value( raDIYo::KeySongsPath ).toString(); + loadDir( songsDir ); +} + + + +/** + * Lädt das Songs-Verzeichnis und zeigt den Inhalt im ListWisget an. + * @param songsDir Verzeichnispfad. + */ + +void SWSongsControl::loadDir( const QString& songsDir ) +{ + QDir songs( songsDir ); + _contentView->clear(); + songs.setFilter( QDir::Files ); + QFileInfoList list = songs.entryInfoList(); + for( auto& entry : list ) + { + QString lowName = entry.fileName().toLower(); + if( lowName.endsWith( ".mp3") ) + createItem( entry.fileName(), "file:" + entry.absoluteFilePath() ); + + } + + // Es gibt Inhalte + if( _contentView->count() > 0 ) + { + // _checkedID nur resetten falls notwendig + _checkedID = qMin( _checkedID, _contentView->count() ); + _contentView->setCurrentRow( _checkedID ); + } + // und sonst ?? +} + + diff --git a/swsongscontrol.h b/swsongscontrol.h new file mode 100644 index 0000000..220cbdd --- /dev/null +++ b/swsongscontrol.h @@ -0,0 +1,47 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWSONGSCONTROL_H +#define SWSONGSCONTROL_H + + +#include + + +/** + * @brief Control, das die Playlist-Seite zur Songauswahl darstellt. + */ + +class SWSongsControl : public SWListControl +{ + Q_OBJECT + +public: + + explicit SWSongsControl( QWidget* parent , QSettings* settings ); + virtual ~SWSongsControl() = default; + +public slots: + + virtual void onShow() override; + + +protected: + + void loadDir( const QString& path ); + +}; + + +#endif // SWSONGSCONTROL_H diff --git a/swspectrumwidget.cpp b/swspectrumwidget.cpp new file mode 100644 index 0000000..79803ce --- /dev/null +++ b/swspectrumwidget.cpp @@ -0,0 +1,122 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include + + +/** + * @brief SWSpectrumWidget::SWSpectrumWidget + * @param parent + */ + +SWSpectrumWidget::SWSpectrumWidget( QWidget* parent ) + : SWBarWidget( parent ) +{ + + setNumBars( 16 ); + setNumBlocks( 16 ); + _valueList.resize( _numBars ); +} + + + + + +/** + * @brief SWSpectrumWidget::~SWSpectrumWidget + */ + +SWSpectrumWidget::~SWSpectrumWidget() +{ + // stop threads +} + + +/** + * @brief Löscht die Werteliste und ruft 'update' auf. + */ + +void SWSpectrumWidget::clearValueList() +{ + _valueList.clear(); + _valueList.resize( _numBars ); + update(); +} + + +/** + * @brief Slot; Wird aufgerufen, wenn sich die Werteliste geändert hat. + * Ruft update auf. + * @param freshdata + */ + +void SWSpectrumWidget::onValueListChanged( const SWValVec& freshdata ) +{ + _valueList = freshdata; + _valueList.resize( _numBars ); + update(); + +} + + +/** + * @brief Zeichnet das Widget neu. + * @param event + */ + +void SWSpectrumWidget::paintEvent( QPaintEvent* ) +{ + + QPainter painter( this ); + painter.setBackgroundMode( Qt::TransparentMode ); + //painter.fillRect(rect(), Qt::darkGray); + + // Draw the bars + + // der Rand wird im Parentwidget 'beschlossen' + int frameWidth = rect().width(); + int frameHeight = rect().height(); + int blockHeight = frameHeight / _numBlocks; + int blockWidth = qRound( double( frameWidth ) / double( _numBars ) ); + //int blockWidth = frameWidth / _numBars; + + int blockPosX = 0; + for( int x=0; x<_numBars; ++x ) + { + + int barHeight = qRound( _valueList[x] * frameHeight ); + int blocks = barHeight / blockHeight; + int blockPosY = frameHeight - blocks * blockHeight; + + for( int y = 0; y < blocks; ++y ) + { + QRect block = QRect( blockPosX, blockPosY, blockWidth - _padding, blockHeight - _padding ); + painter.fillRect( block, getBlockColor( x, y ) ); + //painter.fillRect( block, _colors[y] ); + //painter.drawText( block, QString::number(y) ); + blockPosY += blockHeight; + } + + blockPosX += blockWidth; + + } + +} + + + + diff --git a/swspectrumwidget.h b/swspectrumwidget.h new file mode 100644 index 0000000..947ebda --- /dev/null +++ b/swspectrumwidget.h @@ -0,0 +1,56 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWSPECTRUMWIDGET_H +#define SWSPECTRUMWIDGET_H + +#include +#include + + +/** + * @brief Stellt das per FFT erzeugte Spektrum dar + */ + +class SWSpectrumWidget : public SWBarWidget +{ + Q_OBJECT + +public: + + explicit SWSpectrumWidget( QWidget* parent = nullptr ); + virtual ~SWSpectrumWidget(); + + void paintEvent( QPaintEvent* event ) override; + void clearValueList(); + +public slots: + + void onValueListChanged( const SWValVec& freshdata ); + +signals: + +protected: + + + // Brainfuck! + double _minValue = 0.0; + double _maxValue = 1.0; + + SWValVec _valueList; + +}; + + +#endif // SWSPECTRUMWIDGET_H diff --git a/swtoggleswitch.cpp b/swtoggleswitch.cpp new file mode 100644 index 0000000..9fe3470 --- /dev/null +++ b/swtoggleswitch.cpp @@ -0,0 +1,199 @@ +/*************************************************************************** + + source::worx libWidgets + Copyright © 2021 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +/** + * @brief Standardkonstruktor. + * @param parent das Elternwidget + * @param trackRadius Radius der Hintergrundrundung, default 16 px. + * @param thumbRadius Radius des Schalterelements, default 20 px. + */ + +SWToggleSwitch::SWToggleSwitch( QWidget* parent, int trackRadius, int thumbRadius ) + : QAbstractButton( parent ) +{ + + setCheckable( true ); + setAcceptDial( false ); + + //setSizePolicy(QSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed)); + _trackRadius = trackRadius; + _thumbRadius = thumbRadius; + _animation = new QPropertyAnimation(this); + _animation->setTargetObject(this); + + _margin = 0 > (_thumbRadius - _trackRadius) ? 0 : (_thumbRadius - _trackRadius); + _baseOffset = _thumbRadius > _trackRadius ? _thumbRadius : _trackRadius; + _endOffset.insert( true, 4 * _trackRadius + 2 * _margin - _baseOffset); // width - offset + _endOffset.insert( false, _baseOffset); + _offset = _baseOffset; + QPalette palette = this->palette(); + + _trackColor.insert( true, QBrush( Qt::lightGray ) ); + _trackColor.insert( false, palette.dark() ); + + //_thumbColor.insert( true, palette.highlight()); + _thumbColor.insert( true, QBrush( Qt::gray ) ); + //_thumbColor.insert( false, palette.light()); + _thumbColor.insert( false, QBrush( Qt::darkGray ) ); + _textColor.insert( true, palette.highlightedText().color()); + _textColor.insert( false, palette.dark().color()); + _thumbText.insert( true, ""); + _thumbText.insert( false, ""); + _opacity = 0.5; + + // semi schlimmer hack: clicks auf mich weiterleiten + connect( this, &QAbstractButton::clicked, this, [=]{ emit widgetClicked(this); } ); +} + + +SWToggleSwitch::~SWToggleSwitch() +{ + delete _animation; +} + + +/** + * @brief Ermittelt die ideale Widgetgrösse. + */ + +QSize SWToggleSwitch::sizeHint() const +{ + int w = 4 * _trackRadius + 2 * _margin; + int h = 2 * _trackRadius + 2 * _margin; + + return QSize(w, h); +} + + +/** + * @brief Setzt die geometrischen Vorgabewerte. + * @param trackRadius Radius der Hintergrundrundung. + * @param thumbRadius Radius des Schalterelements. + */ + +void SWToggleSwitch::setTrackAndThumbRadius( int trackRadius, int thumbRadius ) +{ + _trackRadius = trackRadius; + _thumbRadius = thumbRadius; +} + + +/** + * @brief Zeichnet das Widget. + */ + +void SWToggleSwitch::paintEvent( QPaintEvent* ) +{ + + QPainter painter( this ); + + QPainter::RenderHints m_paintFlags = QPainter::RenderHints(QPainter::Antialiasing | + QPainter::TextAntialiasing); + painter.setRenderHints(m_paintFlags, true); + painter.setPen(Qt::NoPen); + bool check = isChecked(); + + qreal trackOpacity = _opacity; + + qreal thumbOpacity = 1.0; + QBrush trackBrush; + QBrush thumbBrush; + + if( isEnabled() ) + { + + trackBrush = _trackColor[check]; + thumbBrush = _thumbColor[check]; + + } + else + { + trackOpacity *= 0.8; + trackBrush = this->palette().shadow(); + thumbBrush = this->palette().mid(); + + } + + painter.setBrush(trackBrush); + painter.setOpacity(trackOpacity); + painter.drawRoundedRect( _margin, _margin, width() - 2 * _margin, height() - 2 * _margin, _trackRadius, _trackRadius ); + + painter.setBrush( thumbBrush ); + painter.setOpacity( thumbOpacity ); + painter.drawEllipse( _offset - _thumbRadius, _baseOffset - _thumbRadius, 2 * _thumbRadius, 2 * _thumbRadius ); + + drawMark( this ); + +} + + +void SWToggleSwitch::resizeEvent( QResizeEvent* event ) +{ + QAbstractButton::resizeEvent( event ); + _offset = _endOffset.value(isChecked() ); +} + + +void SWToggleSwitch::mouseReleaseEvent( QMouseEvent* event ) +{ + QAbstractButton::mouseReleaseEvent( event ); + if( event->button() == Qt::LeftButton) + { + _animation->setDuration(120); + _animation->setPropertyName("_offset"); + _animation->setStartValue(_offset); + _animation->setEndValue(_endOffset[isChecked()]); + _animation->start(); + } +} + + +void SWToggleSwitch::enterEvent( QEvent* event ) +{ + setCursor(Qt::PointingHandCursor); + QAbstractButton::enterEvent(event); +} + + +void SWToggleSwitch::setChecked( bool checked ) +{ + QAbstractButton::setChecked( checked ); + _offset = _endOffset.value ( checked ); +} + + +int SWToggleSwitch::offset() +{ + return _offset; +} + +void SWToggleSwitch::setOffset(int value) +{ + _offset = value; + update(); +} diff --git a/swtoggleswitch.h b/swtoggleswitch.h new file mode 100644 index 0000000..e3df53a --- /dev/null +++ b/swtoggleswitch.h @@ -0,0 +1,96 @@ +/*************************************************************************** + + source::worx libWidgets + Copyright © 2021 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + +// +// https://stackoverflow.com/questions/14780517/toggle-switch-in-qt +// Abbas Perçin +// Computer Engineer + + +#ifndef SWTOGGLESWITCH_H +#define SWTOGGLESWITCH_H + +#include +#include +#include + +#include + + +class QPropertyAnimation; +class SWDialAdapter; + +/** + * @brief Widget, das einen Schalter im Android-Style darstellt. + * gefunden auf StackOverflow: + * https://stackoverflow.com/questions/14780517/toggle-switch-in-qt/51023362 + */ + +class SWToggleSwitch : public QAbstractButton, public SWDialWidget +{ + + Q_OBJECT + Q_PROPERTY( int _offset READ offset WRITE setOffset NOTIFY onOffsetChanged ) + +public: + + explicit SWToggleSwitch( QWidget* parent = nullptr, int trackRadius=16, int thumbRadius=20 ); + //explicit SWToggleSwitch( int trackRadius, int thumbRadius, QWidget* parent = nullptr ); + virtual ~SWToggleSwitch(); + + void setTrackAndThumbRadius( int trackRadius, int thumbRadius ); + QSize sizeHint() const override; + +public slots: + + void onOffsetChanged() + {} + //void onDialPushed() override; + void setChecked( bool checked ); + +signals: + + void idActivated( int ); + void widgetClicked( SWDialWidget* ); + +protected: + + void paintEvent(QPaintEvent *) override; + void resizeEvent(QResizeEvent*) override; + void mouseReleaseEvent(QMouseEvent *) override; + void enterEvent(QEvent *event) override; + + int offset(); + void setOffset(int value); + + +private: + + qreal _offset; + qreal _baseOffset; + qreal _margin; + qreal _trackRadius; + qreal _thumbRadius; + qreal _opacity; + QPropertyAnimation* _animation; + + QHash _endOffset; + QHash _trackColor; + QHash _thumbColor; + QHash _textColor; + QHash _thumbText; + +}; + + +#endif // SWTOGGLESWITCH_H diff --git a/swurl.cpp b/swurl.cpp new file mode 100644 index 0000000..fabc37e --- /dev/null +++ b/swurl.cpp @@ -0,0 +1,61 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include + +#include +#include + + +/** + * @brief Kontruktor für Stream-Urls aus CSV-Dateien. + * + * @param srcstrg Quellstring im Format ; + * @param defvolume Vorgabewert für die Abspiellautstärke dieses Eintrags. + */ + +SWUrl::SWUrl( const QString srcstrg, int defvolume ) +{ + + QStringList entry = srcstrg.split( ';'); + if( entry.size() == 2 ) + { + title = entry.at( 0 ); + urlText = entry.at( 1 ); + } + if( defvolume < 0 ) + defvolume = raDIYo::DefaultVolume; + volume = defvolume; +} + + +/** + * @brief einfacher Konstruktror + * @param atitle Der Titel des Eintrags. + * @param atext Der Link des Eintrags. + */ + +SWUrl::SWUrl( const QString& atitle, const QString& atext ) + : title( atitle ), urlText( atext ) +{ + volume = raDIYo::DefaultVolume; +} + + + + + + + + diff --git a/swurl.h b/swurl.h new file mode 100644 index 0000000..bda5867 --- /dev/null +++ b/swurl.h @@ -0,0 +1,48 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWURL_H +#define SWURL_H + +#include + +/** + * @brief Eine einfache Datenstruktur zum Speichern der abspielbaren + * Play- bzw. Sender-Listeneinträgen. + */ + +struct SWUrl +{ + + enum Type + { + None = 0, + LocalFile, + UsbFile, + WebStream, + BlueTooth + }; + + QString title; + QString urlText; + int volume = -1; + + SWUrl() = default; + SWUrl( const QString srcstrg, int defvolume = -1 ); + SWUrl( const QString& atitle, const QString& atext ); + +}; + + +#endif // SWURL_H diff --git a/swusbcontrol.cpp b/swusbcontrol.cpp new file mode 100644 index 0000000..2018d75 --- /dev/null +++ b/swusbcontrol.cpp @@ -0,0 +1,204 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include + +#include +#include + +#ifdef Q_OS_LINUX + +#include +#include +#include + +#endif + +SWUSBControl::SWUSBControl( QWidget* parent, QSettings* settings ) + : SWSongsControl( parent, settings ) +{ + + setHeaderText( "USB Source" ); + + +#ifdef Q_OS_WIN + _mountDir = "F:/"; + //_mediaDirs = { "D:/", "E:/", "G:/" }; + _mediaDirs << "D:/" << "E:/" << "G:/" << "I:/"; +#endif + +#ifdef Q_OS_LINUX + // uid ermitteln, für den standard mountpoint + // /media/ + uid_t uid = ::getuid(); + struct passwd * pstruct = getpwuid( uid ); + QString uname( pstruct->pw_name ); + _mountDir = raDIYo::MountDir + uname; + + fetchDirs(); + +#endif + _watcher.addPath( _mountDir ); + connect( &_watcher, SIGNAL( directoryChanged(QString) ), this, SLOT( onUSBMount(QString) ) ); + +} + +/** + * @brief Zeigt die gemounteten USB-Laufwerke oder das aktuelle Verzeichnis an. + * Wird beim Einblenden aufgerufen. + */ + +void SWUSBControl::onShow() +{ + + if( _currentDir.isEmpty() ) + showDirs(); + else + loadFiles( _currentDir ); + +} + + +/** + * @brief SLOT, der ein USB-Laufwerks beim mounten automatisch einbindet. + * @param path + */ + +void SWUSBControl::onUSBMount( const QString& ) +{ + _currentDir = ""; + fetchDirs(); + emit driveMounted( RaDIYo::USB ); +} + + +/** + * @brief Aktivieren eines Listeneintrags. + * Wird zur Navigation innerhalb des Vertzeichnisbaums verwendet. + * @param item + */ + +void SWUSBControl::onItemActivated( QListWidgetItem* item ) +{ + + QString urlText = item->data( SWListControlRole ).toString(); + if( !urlText.startsWith( "dir:") ) + { + if( urlText.startsWith( "root:") ) + return showDirs(); + return SWListControl::onItemActivated( item ); + } + loadFiles( urlText.mid(4) ); + +} + + +/** + * @brief Interne Hilfsfunktion, die potentiellen USB-Laufwerke auflistet. + */ + +void SWUSBControl::fetchDirs() +{ + // alle drives, 'die wo' Sticks sein könnten, also + // auf 'media/' gemountet sind + _mediaDirs.clear(); + for( auto& storage : QStorageInfo::mountedVolumes() ) + { + if( storage.isValid() && storage.isReady() ) + { + QString path = storage.rootPath(); + if( path.startsWith( _mountDir ) ) + { + _mediaDirs.append( path ); + } + + } + } +} + + +/** + * @brief Ziegt alle potentiellen USB-Laufwerke an. + */ + +void SWUSBControl::showDirs() +{ + _contentView->clear(); + setHeaderText( "USB Source: root" ); + + QString tpl( "[%1]" ); + for( auto& dir : _mediaDirs ) + { + QListWidgetItem* item = new QListWidgetItem( tpl.arg( dir) ); + item->setData( SWListControlRole, "dir:" + dir ); + _contentView->addItem( item ); + } +} + + +/** + * @brief SWUSBControl::loadFiles + * @param fullPath + * - mounts anzeigen + */ + +void SWUSBControl::loadFiles( const QString& fullPath ) +{ + + _contentView->clear(); + setHeaderText( "USB Source: " + fullPath ); + _currentDir = fullPath; + + bool isRoot = QFileInfo( fullPath ).isRoot(); + if( isRoot ) + { + QListWidgetItem* item = new QListWidgetItem( "[..]" ); + item->setData( SWListControlRole, "root:" + fullPath ); + _contentView->addItem( item ); + } + + QString tpl( "[%1]" ); + QDirIterator it( fullPath, QDir::Files | QDir::Dirs ); + + while ( it.hasNext() ) + { + const QFileInfo& entry = it.next(); + QString fname = entry.fileName(); + + if( fname == "." ) + continue; + + QString prefix, dname; + if( entry.isFile() ) + { + if( !fname.endsWith( ".mp3") && !fname.endsWith( ".wav") ) + continue; + dname = fname; + prefix = "file:"; + } + else + { + dname = tpl.arg( fname ); + prefix = "dir:"; + } + + QListWidgetItem* item = new QListWidgetItem( dname ); + item->setData( SWListControlRole, prefix + entry.absoluteFilePath() ); + _contentView->addItem( item ); + + } + +} + diff --git a/swusbcontrol.h b/swusbcontrol.h new file mode 100644 index 0000000..dc66978 --- /dev/null +++ b/swusbcontrol.h @@ -0,0 +1,65 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWUSBControlCONTROL_H +#define SWUSBControlCONTROL_H + + +#include +#include +#include + +#include + + +/** + * @brief Control, das PlayLists von USB-Speichern darstellt. + */ + +class SWUSBControl : public SWSongsControl +{ + + Q_OBJECT + +public: + + explicit SWUSBControl( QWidget* parent, QSettings* settings ); + virtual ~SWUSBControl() = default; + +signals: + + void driveMounted(int); + +public slots: + + void onItemActivated( QListWidgetItem* item ) override; + void onShow() override; + void onUSBMount( const QString& path ); + +protected: + + void showDirs(); + void fetchDirs(); + void loadFiles( const QString& fullPath ); + + QStringList _mediaDirs; + QString _mountDir; + QString _currentDir; + + QFileSystemWatcher _watcher; + +}; + + +#endif // SWUSBControlCONTROL_H diff --git a/swvolumewidget.cpp b/swvolumewidget.cpp new file mode 100644 index 0000000..1227b47 --- /dev/null +++ b/swvolumewidget.cpp @@ -0,0 +1,167 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include +#include +#include +#include + +#include +#include + + +/** + * @brief Standardkonstruktor. Block- und Balkenanzahl auf 32 + * @see setNumblocks + * @see setNumBars + */ + +SWVolumeWidget::SWVolumeWidget( QWidget* parent ) + : SWBarWidget( parent ) +{ + setNumBlocks( 32 ); + setNumBars( 32 ); + +} + + +/** + * @brief Wird aufgerufen, wenn das (externe) Dial gedreht wurde. + * + * Hier wird _ein_ Wert gesetzt, zum Beispiel Lautstärke, Bässe, + * Höhen etc. + */ + +void SWVolumeWidget::onDialDeltaChanged( int delta ) +{ + + // gültigkeit sicherstellen + int newval = _value + delta; + newval = qBound( _rangeFrom, newval, _rangeTo ); + + if( _value == newval ) + return; + + setValue( newval ); + update(); + + +} + + +/** + * @brief Teil der Maussteuerung. + * @param event + */ + +void SWVolumeWidget::mousePressEvent( QMouseEvent* event ) +{ + if( event->button() == Qt::LeftButton ) + _moving = true; +} + + +/** + * @brief Zieht bei gedrücktem Mousebutton die Lautstärke hoch bzw. runter + * @param event + */ + +void SWVolumeWidget::mouseMoveEvent( QMouseEvent* event ) +{ + + if( ( event->buttons() & Qt::LeftButton ) && _moving ) + { + double newX = (double) _rangeTo * (double) event->pos().x() / ( rect().width() - _frameOffset ); + int lstVal = _value; + _value = qRound( newX ); + int delta = _value - lstVal; + if( !delta ) + return; + update(); + emit deltaChanged( delta > 0 ? 1 : -1 ); + + } + +} + + +/** + * @brief Teil der Maussteuerung. + * @param event + */ + +void SWVolumeWidget::mouseReleaseEvent( QMouseEvent* event ) +{ + if( event->button() == Qt::LeftButton && _moving ) + _moving = false; +} + + +/** + * @brief Zeichnet das Balkendiagramm. + * @param event + */ + +void SWVolumeWidget::paintEvent( QPaintEvent* event ) +{ + + Q_UNUSED( event ) + + + QPainter painter( this ); + + // wir malen ein dunkles Rähmchen um eine graue Fläche + QPen pen( QColor( 66,66,66 ) ); + pen.setWidth( 2 ); + painter.setPen( pen ); + QRect frame = rect(); + frame.adjust( _frameOffset, _frameOffset, -_frameOffset, -_frameOffset ); + painter.fillRect( frame, QColor( 44,44,44 ) ); + painter.drawRoundedRect( frame, 2, 2 ); + + double sizeX = frame.width(); + double sizeY = frame.height(); + + int blockWidth = qRound( sizeX / _numBars ); + int blockHeight = qRound( sizeY / _numBlocks ); + + //_padding = 2; + + int numColors = _colors.size(); + double factorColors = (double) numColors / (double) _numBlocks; + int blockPosX = _frameOffset + _padding; + int maxX = qRound( (double) _value / double( _rangeTo ) * sizeX ); + int maxBlocks = (double) sizeY / blockHeight - 3; + + for( ; blockPosX < maxX; blockPosX += blockWidth ) + { + // hack + int numBlocks = qMin( 1 + qRound( (double) blockPosX / sizeX * maxBlocks ), maxBlocks ); + int blockPosY = sizeY - blockHeight;// + _padding; + for( int j = 0; j < numBlocks; ++j ) + { + QRect blockRect = QRect( blockPosX, blockPosY, blockWidth - _padding, blockHeight - _padding ); + int colorIndex = numColors - 1 - factorColors * (double) j; + //int colorIndex = 2 + factorColors * (double) j; + painter.fillRect( blockRect, _colors[ colorIndex ] ); + blockPosY -= blockHeight; + } + + + } + + +} + + diff --git a/swvolumewidget.h b/swvolumewidget.h new file mode 100644 index 0000000..071fb7d --- /dev/null +++ b/swvolumewidget.h @@ -0,0 +1,58 @@ +/*************************************************************************** + + source::worx raDIYo + Copyright © 2020-2022 c.holzheuer + chris@sourceworx.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef SWVOLUMEWIDGET_H +#define SWVOLUMEWIDGET_H + +//#include +#include + + +/** + * @brief Widget zur Darstellung der Lautstärke + */ + +class SWVolumeWidget : public SWBarWidget +{ + Q_OBJECT + +public: + + explicit SWVolumeWidget( QWidget* parent = nullptr ); + virtual ~SWVolumeWidget() = default; + + void paintEvent( QPaintEvent* event ) override; + +signals: + + void deltaChanged( int newValue ); + +public slots: + + void onDialDeltaChanged( int delta ) override; + +protected: + + void mousePressEvent( QMouseEvent* event ) override; + void mouseMoveEvent( QMouseEvent* event ) override; + void mouseReleaseEvent( QMouseEvent* event ) override; + + + const int _frameOffset = 2; + bool _moving = false; + +}; + + +#endif // SWVOLUMEWIDGET_H