diff --git a/LICENSES/GPL-2.0-only.txt b/LICENSES/GPL-2.0-only.txt new file mode 100644 index 0000000..0f3d641 --- /dev/null +++ b/LICENSES/GPL-2.0-only.txt @@ -0,0 +1,319 @@ +GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. + +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to +most of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software +is covered by the GNU Lesser General Public License instead.) You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish), that you receive source code or can get it if you want it, that you +can change the software or use pieces of it in new free programs; and that +you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to +deny you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or +for a fee, you must give the recipients all the rights that you have. You +must make sure that they, too, receive or can get the source code. And you +must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) +offer you this license which gives you legal permission to copy, distribute +and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If +the software is modified by someone else and passed on, we want its recipients +to know that what they have is not the original, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms +of this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or translated +into another language. (Hereinafter, translation is included without limitation +in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running the Program +is not restricted, and the output from the Program is covered only if its +contents constitute a work based on the Program (independent of having been +made by running the Program). Whether that is true depends on what the Program +does. + +1. You may copy and distribute verbatim copies of the Program's source code +as you receive it, in any medium, provided that you conspicuously and appropriately +publish on each copy an appropriate copyright notice and disclaimer of warranty; +keep intact all the notices that refer to this License and to the absence +of any warranty; and give any other recipients of the Program a copy of this +License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, +thus forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + +a) You must cause the modified files to carry prominent notices stating that +you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in whole or +in part contains or is derived from the Program or any part thereof, to be +licensed as a whole at no charge to all third parties under the terms of this +License. + +c) If the modified program normally reads commands interactively when run, +you must cause it, when started running for such interactive use in the most +ordinary way, to print or display an announcement including an appropriate +copyright notice and a notice that there is no warranty (or else, saying that +you provide a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this License. +(Exception: if the Program itself is interactive but does not normally print +such an announcement, your work based on the Program is not required to print +an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Program, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Program. + +In addition, mere aggregation of another work not based on the Program with +the Program (or with a work based on the Program) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under Section +2) in object code or executable form under the terms of Sections 1 and 2 above +provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable source code, +which must be distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, to give +any third party, for a charge no more than your cost of physically performing +source distribution, a complete machine-readable copy of the corresponding +source code, to be distributed under the terms of Sections 1 and 2 above on +a medium customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer to distribute +corresponding source code. (This alternative is allowed only for noncommercial +distribution and only if you received the program in object code or executable +form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all +the source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +If distribution of executable or object code is made by offering access to +copy from a designated place, then offering equivalent access to copy the +source code from the same place counts as distribution of the source code, +even though third parties are not compelled to copy the source along with +the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except +as expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses terminated +so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Program or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Program +(or any work based on the Program), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor +to copy, distribute or modify the Program subject to these terms and conditions. +You may not impose any further restrictions on the recipients' exercise of +the rights granted herein. You are not responsible for enforcing compliance +by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Program at all. For example, if a +patent license would not permit royalty-free redistribution of the Program +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system, which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Program under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of +the General Public License from time to time. Such new versions will be similar +in spirit to the present version, but may differ in detail to address new +problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Program does not specify a version number of this License, you may choose +any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing and reuse +of software generally. + + NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion +of warranty; and each file should have at least the "copyright" line and a +pointer to where the full notice is found. + + + +Copyright (C)< yyyy> + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 51 Franklin +Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when +it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author Gnomovision comes +with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, +and you are welcome to redistribute it under certain conditions; type `show +c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may be +called something other than `show w' and `show c'; they could even be mouse-clicks +or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' +(which makes passes at compilers) written by James Hacker. + +, 1 April 1989 Ty Coon, President of Vice This General +Public License does not permit incorporating your program into proprietary +programs. If your program is a subroutine library, you may consider it more +useful to permit linking proprietary applications with the library. If this +is what you want to do, use the GNU Lesser General Public License instead +of this License. diff --git a/LICENSES/GPL-2.0-or-later.txt b/LICENSES/GPL-2.0-or-later.txt new file mode 100644 index 0000000..1d80ac3 --- /dev/null +++ b/LICENSES/GPL-2.0-or-later.txt @@ -0,0 +1,319 @@ +GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. + +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public License is intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. This General Public License applies to +most of the Free Software Foundation's software and to any other program whose +authors commit to using it. (Some other Free Software Foundation software +is covered by the GNU Lesser General Public License instead.) You can apply +it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish), that you receive source code or can get it if you want it, that you +can change the software or use pieces of it in new free programs; and that +you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to +deny you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or +for a fee, you must give the recipients all the rights that you have. You +must make sure that they, too, receive or can get the source code. And you +must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) +offer you this license which gives you legal permission to copy, distribute +and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that +everyone understands that there is no warranty for this free software. If +the software is modified by someone else and passed on, we want its recipients +to know that what they have is not the original, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that redistributors of a free program will individually +obtain patent licenses, in effect making the program proprietary. To prevent +this, we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification +follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice +placed by the copyright holder saying it may be distributed under the terms +of this General Public License. The "Program", below, refers to any such program +or work, and a "work based on the Program" means either the Program or any +derivative work under copyright law: that is to say, a work containing the +Program or a portion of it, either verbatim or with modifications and/or translated +into another language. (Hereinafter, translation is included without limitation +in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running the Program +is not restricted, and the output from the Program is covered only if its +contents constitute a work based on the Program (independent of having been +made by running the Program). Whether that is true depends on what the Program +does. + +1. You may copy and distribute verbatim copies of the Program's source code +as you receive it, in any medium, provided that you conspicuously and appropriately +publish on each copy an appropriate copyright notice and disclaimer of warranty; +keep intact all the notices that refer to this License and to the absence +of any warranty; and give any other recipients of the Program a copy of this +License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, +thus forming a work based on the Program, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + +a) You must cause the modified files to carry prominent notices stating that +you changed the files and the date of any change. + +b) You must cause any work that you distribute or publish, that in whole or +in part contains or is derived from the Program or any part thereof, to be +licensed as a whole at no charge to all third parties under the terms of this +License. + +c) If the modified program normally reads commands interactively when run, +you must cause it, when started running for such interactive use in the most +ordinary way, to print or display an announcement including an appropriate +copyright notice and a notice that there is no warranty (or else, saying that +you provide a warranty) and that users may redistribute the program under +these conditions, and telling the user how to view a copy of this License. +(Exception: if the Program itself is interactive but does not normally print +such an announcement, your work based on the Program is not required to print +an announcement.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Program, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Program, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Program. + +In addition, mere aggregation of another work not based on the Program with +the Program (or with a work based on the Program) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may copy and distribute the Program (or a work based on it, under Section +2) in object code or executable form under the terms of Sections 1 and 2 above +provided that you also do one of the following: + +a) Accompany it with the complete corresponding machine-readable source code, +which must be distributed under the terms of Sections 1 and 2 above on a medium +customarily used for software interchange; or, + +b) Accompany it with a written offer, valid for at least three years, to give +any third party, for a charge no more than your cost of physically performing +source distribution, a complete machine-readable copy of the corresponding +source code, to be distributed under the terms of Sections 1 and 2 above on +a medium customarily used for software interchange; or, + +c) Accompany it with the information you received as to the offer to distribute +corresponding source code. (This alternative is allowed only for noncommercial +distribution and only if you received the program in object code or executable +form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making +modifications to it. For an executable work, complete source code means all +the source code for all modules it contains, plus any associated interface +definition files, plus the scripts used to control compilation and installation +of the executable. However, as a special exception, the source code distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +If distribution of executable or object code is made by offering access to +copy from a designated place, then offering equivalent access to copy the +source code from the same place counts as distribution of the source code, +even though third parties are not compelled to copy the source along with +the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except +as expressly provided under this License. Any attempt otherwise to copy, modify, +sublicense or distribute the Program is void, and will automatically terminate +your rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses terminated +so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Program or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Program +(or any work based on the Program), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), +the recipient automatically receives a license from the original licensor +to copy, distribute or modify the Program subject to these terms and conditions. +You may not impose any further restrictions on the recipients' exercise of +the rights granted herein. You are not responsible for enforcing compliance +by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Program at all. For example, if a +patent license would not permit royalty-free redistribution of the Program +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply and +the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system, which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Program under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of +the General Public License from time to time. Such new versions will be similar +in spirit to the present version, but may differ in detail to address new +problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Program does not specify a version number of this License, you may choose +any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs +whose distribution conditions are different, write to the author to ask for +permission. For software which is copyrighted by the Free Software Foundation, +write to the Free Software Foundation; we sometimes make exceptions for this. +Our decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing and reuse +of software generally. + + NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible +use to the public, the best way to achieve this is to make it free software +which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach +them to the start of each source file to most effectively convey the exclusion +of warranty; and each file should have at least the "copyright" line and a +pointer to where the full notice is found. + + + +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 2 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with +this program; if not, write to the Free Software Foundation, Inc., 51 Franklin +Street, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when +it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author Gnomovision comes +with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, +and you are welcome to redistribute it under certain conditions; type `show +c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may be +called something other than `show w' and `show c'; they could even be mouse-clicks +or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the program, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' +(which makes passes at compilers) written by James Hacker. + +, 1 April 1989 Ty Coon, President of Vice This General +Public License does not permit incorporating your program into proprietary +programs. If your program is a subroutine library, you may consider it more +useful to permit linking proprietary applications with the library. If this +is what you want to do, use the GNU Lesser General Public License instead +of this License. diff --git a/LICENSES/GPL-3.0-only.txt b/LICENSES/GPL-3.0-only.txt new file mode 100644 index 0000000..e142a52 --- /dev/null +++ b/LICENSES/GPL-3.0-only.txt @@ -0,0 +1,625 @@ +GNU GENERAL PUBLIC LICENSE + +Version 3, 29 June 2007 + +Copyright © 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/LICENSES/LGPL-2.0-only.txt b/LICENSES/LGPL-2.0-only.txt new file mode 100644 index 0000000..5c96471 --- /dev/null +++ b/LICENSES/LGPL-2.0-only.txt @@ -0,0 +1,446 @@ +GNU LIBRARY GENERAL PUBLIC LICENSE + +Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. + +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is numbered 2 because +it goes with version 2 of the ordinary GPL.] + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Library General Public License, applies to some specially +designated Free Software Foundation software, and to any other libraries whose +authors decide to use it. You can use it for your libraries, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish), that you receive source code or can get it if you want it, that you +can change the software or use pieces of it in new free programs; and that +you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to +deny you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the library, or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source code. If you link +a program with the library, you must provide complete object files to the +recipients so that they can relink them with the library, after making changes +to the library and recompiling it. And you must show them these terms so they +know their rights. + +Our method of protecting your rights has two steps: (1) copyright the library, +and (2) offer you this license which gives you legal permission to copy, distribute +and/or modify the library. + +Also, for each distributor's protection, we want to make certain that everyone +understands that there is no warranty for this free library. If the library +is modified by someone else and passed on, we want its recipients to know +that what they have is not the original version, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that companies distributing free software will individually +obtain patent licenses, thus in effect transforming the program into proprietary +software. To prevent this, we have made it clear that any patent must be licensed +for everyone's free use or not licensed at all. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License, which was designed for utility programs. This license, +the GNU Library General Public License, applies to certain designated libraries. +This license is quite different from the ordinary one; be sure to read it +in full, and don't assume that anything in it is the same as in the ordinary +license. + +The reason we have a separate public license for some libraries is that they +blur the distinction we usually make between modifying or adding to a program +and simply using it. Linking a program with a library, without changing the +library, is in some sense simply using the library, and is analogous to running +a utility program or application program. However, in a textual and legal +sense, the linked executable is a combined work, a derivative of the original +library, and the ordinary General Public License treats it as such. + +Because of this blurred distinction, using the ordinary General Public License +for libraries did not effectively promote software sharing, because most developers +did not use the libraries. We concluded that weaker conditions might promote +sharing better. + +However, unrestricted linking of non-free programs would deprive the users +of those programs of all benefit from the free status of the libraries themselves. +This Library General Public License is intended to permit developers of non-free +programs to use free libraries, while preserving your freedom as a user of +such programs to change the free libraries that are incorporated in them. +(We have not seen how to achieve this as regards changes in header files, +but we have achieved it as regards changes in the actual functions of the +Library.) The hope is that this will lead to faster development of free libraries. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, while the latter only works together with the library. + +Note that it is possible for a library to be covered by the ordinary General +Public License rather than by this special one. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library which contains a +notice placed by the copyright holder or other authorized party saying it +may be distributed under the terms of this Library General Public License +(also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared +so as to be conveniently linked with application programs (which use some +of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a +work containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, translation +is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications +to it. For a library, complete source code means all the source code for all +modules it contains, plus any associated interface definition files, plus +the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to +the absence of any warranty; and distribute a copy of this License along with +the Library. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + + a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices stating that +you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a table of +data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make +a good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose +that is entirely well-defined independent of the application. Therefore, Subsection +2d requires that any application-supplied function or table used by this function +must be optional: if the application does not supply it, the square root function +must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. +(If a newer version than version 2 of the ordinary GNU General Public License +has appeared, then you can specify that version instead if you wish.) Do not +make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated +place, then offering equivalent access to copy the source code from the same +place satisfies the requirement to distribute the source code, even though +third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, +is called a "work that uses the Library". Such a work, in isolation, is not +a derivative work of the Library, and therefore falls outside the scope of +this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable +is therefore covered by this License. Section 6 states terms for distribution +of such executables. + +When a "work that uses the Library" uses material from a header file that +is part of the Library, the object code for the work may be a derivative work +of the Library even though the source code is not. Whether this is true is +especially significant if the work can be linked without the Library, or if +the work is itself a library. The threshold for this to be true is not precisely +defined by law. + +If such an object file uses only numerical parameters, data structure layouts +and accessors, and small macros and small inline functions (ten lines or less +in length), then the use of the object file is unrestricted, regardless of +whether it is legally a derivative work. (Executables containing this object +code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + +6. As an exception to the Sections above, you may also compile or link a "work +that uses the Library" with the Library to produce a work containing portions +of the Library, and distribute that work under terms of your choice, provided +that the terms permit modification of the work for the customer's own use +and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source +code for the Library including whatever changes were used in the work (which +must be distributed under Sections 1 and 2 above); and, if the work is an +executable linked with the Library, with the complete machine-readable "work +that uses the Library", as object code and/or source code, so that the user +can modify the Library and then relink to produce a modified executable containing +the modified Library. (It is understood that the user who changes the contents +of definitions files in the Library will not necessarily be able to recompile +the application to use the modified definitions.) + +b) Accompany the work with a written offer, valid for at least three years, +to give the same user the materials specified in Subsection 6a, above, for +a charge no more than the cost of performing this distribution. + +c) If distribution of the work is made by offering access to copy from a designated +place, offer equivalent access to copy the above specified materials from +the same place. + +d) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable +from it. However, as a special exception, the source code distributed need +not include anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the operating +system on which the executable runs, unless that component itself accompanies +the executable. + +It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating system. +Such a contradiction means you cannot use both them and the Library together +in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side +in a single library together with other library facilities not covered by +this License, and distribute such a combined library, provided that the separate +distribution of the work based on the Library and of the other library facilities +is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities. This must be distributed +under the terms of the Sections above. + +b) Give prominent notice with the combined library of the fact that part of +it is a work based on the Library, and explaining where to find the accompanying +uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to +copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor +to copy, distribute, link with or modify the Library subject to these terms +and conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties to this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Library at all. For example, if a +patent license would not permit royalty-free redistribution of the Library +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of +the Library General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Library does not specify a license version number, you may choose any version +ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible +use to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under +these terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the "copyright" +line and a pointer to where the full notice is found. + +one line to give the library's name and an idea of what it does. + +Copyright (C) year name of author + +This library is free software; you can redistribute it and/or modify it under +the terms of the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more +details. + +You should have received a copy of the GNU Library General Public License +along with this library; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in + +the library `Frob' (a library for tweaking knobs) written + +by James Random Hacker. + +signature of Ty Coon, 1 April 1990 + +Ty Coon, President of Vice + +That's all there is to it! diff --git a/LICENSES/LGPL-2.0-or-later.txt b/LICENSES/LGPL-2.0-or-later.txt new file mode 100644 index 0000000..5c96471 --- /dev/null +++ b/LICENSES/LGPL-2.0-or-later.txt @@ -0,0 +1,446 @@ +GNU LIBRARY GENERAL PUBLIC LICENSE + +Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. + +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is numbered 2 because +it goes with version 2 of the ordinary GPL.] + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Library General Public License, applies to some specially +designated Free Software Foundation software, and to any other libraries whose +authors decide to use it. You can use it for your libraries, too. + +When we speak of free software, we are referring to freedom, not price. Our +General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish), that you receive source code or can get it if you want it, that you +can change the software or use pieces of it in new free programs; and that +you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to +deny you these rights or to ask you to surrender the rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the library, or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source code. If you link +a program with the library, you must provide complete object files to the +recipients so that they can relink them with the library, after making changes +to the library and recompiling it. And you must show them these terms so they +know their rights. + +Our method of protecting your rights has two steps: (1) copyright the library, +and (2) offer you this license which gives you legal permission to copy, distribute +and/or modify the library. + +Also, for each distributor's protection, we want to make certain that everyone +understands that there is no warranty for this free library. If the library +is modified by someone else and passed on, we want its recipients to know +that what they have is not the original version, so that any problems introduced +by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We +wish to avoid the danger that companies distributing free software will individually +obtain patent licenses, thus in effect transforming the program into proprietary +software. To prevent this, we have made it clear that any patent must be licensed +for everyone's free use or not licensed at all. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License, which was designed for utility programs. This license, +the GNU Library General Public License, applies to certain designated libraries. +This license is quite different from the ordinary one; be sure to read it +in full, and don't assume that anything in it is the same as in the ordinary +license. + +The reason we have a separate public license for some libraries is that they +blur the distinction we usually make between modifying or adding to a program +and simply using it. Linking a program with a library, without changing the +library, is in some sense simply using the library, and is analogous to running +a utility program or application program. However, in a textual and legal +sense, the linked executable is a combined work, a derivative of the original +library, and the ordinary General Public License treats it as such. + +Because of this blurred distinction, using the ordinary General Public License +for libraries did not effectively promote software sharing, because most developers +did not use the libraries. We concluded that weaker conditions might promote +sharing better. + +However, unrestricted linking of non-free programs would deprive the users +of those programs of all benefit from the free status of the libraries themselves. +This Library General Public License is intended to permit developers of non-free +programs to use free libraries, while preserving your freedom as a user of +such programs to change the free libraries that are incorporated in them. +(We have not seen how to achieve this as regards changes in header files, +but we have achieved it as regards changes in the actual functions of the +Library.) The hope is that this will lead to faster development of free libraries. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, while the latter only works together with the library. + +Note that it is possible for a library to be covered by the ordinary General +Public License rather than by this special one. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library which contains a +notice placed by the copyright holder or other authorized party saying it +may be distributed under the terms of this Library General Public License +(also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared +so as to be conveniently linked with application programs (which use some +of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a +work containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, translation +is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications +to it. For a library, complete source code means all the source code for all +modules it contains, plus any associated interface definition files, plus +the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to +the absence of any warranty; and distribute a copy of this License along with +the Library. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + + a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices stating that +you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a table of +data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make +a good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose +that is entirely well-defined independent of the application. Therefore, Subsection +2d requires that any application-supplied function or table used by this function +must be optional: if the application does not supply it, the square root function +must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. +(If a newer version than version 2 of the ordinary GNU General Public License +has appeared, then you can specify that version instead if you wish.) Do not +make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated +place, then offering equivalent access to copy the source code from the same +place satisfies the requirement to distribute the source code, even though +third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, +is called a "work that uses the Library". Such a work, in isolation, is not +a derivative work of the Library, and therefore falls outside the scope of +this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable +is therefore covered by this License. Section 6 states terms for distribution +of such executables. + +When a "work that uses the Library" uses material from a header file that +is part of the Library, the object code for the work may be a derivative work +of the Library even though the source code is not. Whether this is true is +especially significant if the work can be linked without the Library, or if +the work is itself a library. The threshold for this to be true is not precisely +defined by law. + +If such an object file uses only numerical parameters, data structure layouts +and accessors, and small macros and small inline functions (ten lines or less +in length), then the use of the object file is unrestricted, regardless of +whether it is legally a derivative work. (Executables containing this object +code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + +6. As an exception to the Sections above, you may also compile or link a "work +that uses the Library" with the Library to produce a work containing portions +of the Library, and distribute that work under terms of your choice, provided +that the terms permit modification of the work for the customer's own use +and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source +code for the Library including whatever changes were used in the work (which +must be distributed under Sections 1 and 2 above); and, if the work is an +executable linked with the Library, with the complete machine-readable "work +that uses the Library", as object code and/or source code, so that the user +can modify the Library and then relink to produce a modified executable containing +the modified Library. (It is understood that the user who changes the contents +of definitions files in the Library will not necessarily be able to recompile +the application to use the modified definitions.) + +b) Accompany the work with a written offer, valid for at least three years, +to give the same user the materials specified in Subsection 6a, above, for +a charge no more than the cost of performing this distribution. + +c) If distribution of the work is made by offering access to copy from a designated +place, offer equivalent access to copy the above specified materials from +the same place. + +d) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable +from it. However, as a special exception, the source code distributed need +not include anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the operating +system on which the executable runs, unless that component itself accompanies +the executable. + +It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating system. +Such a contradiction means you cannot use both them and the Library together +in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side +in a single library together with other library facilities not covered by +this License, and distribute such a combined library, provided that the separate +distribution of the work based on the Library and of the other library facilities +is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities. This must be distributed +under the terms of the Sections above. + +b) Give prominent notice with the combined library of the fact that part of +it is a work based on the Library, and explaining where to find the accompanying +uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to +copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor +to copy, distribute, link with or modify the Library subject to these terms +and conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties to this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Library at all. For example, if a +patent license would not permit royalty-free redistribution of the Library +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of +the Library General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Library does not specify a license version number, you may choose any version +ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible +use to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under +these terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the "copyright" +line and a pointer to where the full notice is found. + +one line to give the library's name and an idea of what it does. + +Copyright (C) year name of author + +This library is free software; you can redistribute it and/or modify it under +the terms of the GNU Library General Public License as published by the Free +Software Foundation; either version 2 of the License, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more +details. + +You should have received a copy of the GNU Library General Public License +along with this library; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in + +the library `Frob' (a library for tweaking knobs) written + +by James Random Hacker. + +signature of Ty Coon, 1 April 1990 + +Ty Coon, President of Vice + +That's all there is to it! diff --git a/LICENSES/LGPL-3.0-only.txt b/LICENSES/LGPL-3.0-only.txt new file mode 100644 index 0000000..bd405af --- /dev/null +++ b/LICENSES/LGPL-3.0-only.txt @@ -0,0 +1,163 @@ +GNU LESSER 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. + +This version of the GNU Lesser General Public License incorporates the terms +and conditions of version 3 of the GNU General Public License, supplemented +by the additional permissions listed below. + + 0. Additional Definitions. + + + +As used herein, "this License" refers to version 3 of the GNU Lesser General +Public License, and the "GNU GPL" refers to version 3 of the GNU General Public +License. + + + +"The Library" refers to a covered work governed by this License, other than +an Application or a Combined Work as defined below. + + + +An "Application" is any work that makes use of an interface provided by the +Library, but which is not otherwise based on the Library. Defining a subclass +of a class defined by the Library is deemed a mode of using an interface provided +by the Library. + + + +A "Combined Work" is a work produced by combining or linking an Application +with the Library. The particular version of the Library with which the Combined +Work was made is also called the "Linked Version". + + + +The "Minimal Corresponding Source" for a Combined Work means the Corresponding +Source for the Combined Work, excluding any source code for portions of the +Combined Work that, considered in isolation, are based on the Application, +and not on the Linked Version. + + + +The "Corresponding Application Code" for a Combined Work means the object +code and/or source code for the Application, including any data and utility +programs needed for reproducing the Combined Work from the Application, but +excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License without +being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a facility +refers to a function or data to be supplied by an Application that uses the +facility (other than as an argument passed when the facility is invoked), +then you may convey a copy of the modified version: + +a) under this License, provided that you make a good faith effort to ensure +that, in the event an Application does not supply the function or data, the +facility still operates, and performs whatever part of its purpose remains +meaningful, or + +b) under the GNU GPL, with none of the additional permissions of this License +applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from a header +file that is part of the Library. You may convey such object code under terms +of your choice, provided that, if the incorporated material is not limited +to numerical parameters, data structure layouts and accessors, or small macros, +inline functions and templates (ten or fewer lines in length), you do both +of the following: + +a) Give prominent notice with each copy of the object code that the Library +is used in it and that the Library and its use are covered by this License. + +b) Accompany the object code with a copy of the GNU GPL and this license document. + + 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, taken together, +effectively do not restrict modification of the portions of the Library contained +in the Combined Work and reverse engineering for debugging such modifications, +if you also do each of the following: + +a) Give prominent notice with each copy of the Combined Work that the Library +is used in it and that the Library and its use are covered by this License. + +b) Accompany the Combined Work with a copy of the GNU GPL and this license +document. + +c) For a Combined Work that displays copyright notices during execution, include +the copyright notice for the Library among these notices, as well as a reference +directing the user to the copies of the GNU GPL and this license document. + + d) Do one of the following: + +0) Convey the Minimal Corresponding Source under the terms of this License, +and the Corresponding Application Code in a form suitable for, and under terms +that permit, the user to recombine or relink the Application with a modified +version of the Linked Version to produce a modified Combined Work, in the +manner specified by section 6 of the GNU GPL for conveying Corresponding Source. + +1) Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (a) uses at run time a copy of the Library +already present on the user's computer system, and (b) will operate properly +with a modified version of the Library that is interface-compatible with the +Linked Version. + +e) Provide Installation Information, but only if you would otherwise be required +to provide such information under section 6 of the GNU GPL, and only to the +extent that such information is necessary to install and execute a modified +version of the Combined Work produced by recombining or relinking the Application +with a modified version of the Linked Version. (If you use option 4d0, the +Installation Information must accompany the Minimal Corresponding Source and +Corresponding Application Code. If you use option 4d1, you must provide the +Installation Information in the manner specified by section 6 of the GNU GPL +for conveying Corresponding Source.) + + 5. Combined Libraries. + +You may place library facilities that are a work based on the Library side +by side in a single library together with other library facilities that are +not Applications and are not covered by this License, and convey such a combined +library under terms of your choice, if you do both of the following: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities, conveyed under the +terms of this License. + +b) Give prominent notice with the combined library that part of it is a work +based on the Library, and explaining where to find the accompanying uncombined +form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions of the +GNU Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library as you +received it specifies that a certain numbered version of the GNU Lesser General +Public License "or any later version" applies to it, you have the option of +following the terms and conditions either of that published version or of +any later version published by the Free Software Foundation. If the Library +as you received it does not specify a version number of the GNU Lesser General +Public License, you may choose any version of the GNU Lesser General Public +License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide whether +future versions of the GNU Lesser General Public License shall apply, that +proxy's public statement of acceptance of any version is permanent authorization +for you to choose that version for the Library. diff --git a/LICENSES/LicenseRef-KDE-Accepted-LGPL.txt b/LICENSES/LicenseRef-KDE-Accepted-LGPL.txt new file mode 100644 index 0000000..232b3c5 --- /dev/null +++ b/LICENSES/LicenseRef-KDE-Accepted-LGPL.txt @@ -0,0 +1,12 @@ +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 3 of the license or (at your option) any later version +that is accepted by the membership of KDE e.V. (or its successor +approved by the membership of KDE e.V.), which shall act as a +proxy as defined in Section 6 of version 3 of the license. + +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. diff --git a/LICENSES/LicenseRef-KFQF-Accepted-GPL.txt b/LICENSES/LicenseRef-KFQF-Accepted-GPL.txt new file mode 100644 index 0000000..b352631 --- /dev/null +++ b/LICENSES/LicenseRef-KFQF-Accepted-GPL.txt @@ -0,0 +1,9 @@ +Alternatively, this file may be used under the terms of the GNU +General Public License version 2.0 or (at your option) the GNU General +Public license version 3 or any later version approved by the KDE Free +Qt Foundation. The licenses are as published by the Free Software +Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +included in the packaging of this file. Please review the following +information to ensure the GNU General Public License requirements will +be met: https://www.gnu.org/licenses/gpl-2.0.html and +https://www.gnu.org/licenses/gpl-3.0.html. diff --git a/LICENSES/LicenseRef-Qt-Commercial.txt b/LICENSES/LicenseRef-Qt-Commercial.txt new file mode 100644 index 0000000..11e00c7 --- /dev/null +++ b/LICENSES/LicenseRef-Qt-Commercial.txt @@ -0,0 +1,7 @@ +Commercial License Usage +Licensees holding valid commercial Qt licenses may use this file in +accordance with the commercial license agreement provided with the +Software or, alternatively, in accordance with the terms contained in +a written agreement between you and The Qt Company. For licensing terms +and conditions see https://www.qt.io/terms-conditions. For further +information use the contact form at https://www.qt.io/contact-us. diff --git a/Mainpage.dox b/Mainpage.dox index 70375c5..f7dc7f0 100644 --- a/Mainpage.dox +++ b/Mainpage.dox @@ -1,55 +1,42 @@ /* - This file is part of QQC2-Desktop-Style - Copyright (C) 2017 Marco Martin - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + This file is part of QQC2-Desktop-Style + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later */ /** \mainpage QQC2-Desktop-Style \section overview Introduction This is a style for QtQuicControls2 which is using QStyle to paint the controls in order to give it a native look and feel. It has no api, applications shouldn't (and can't) use it directly, but they can depend from this framework in their desktop version if they want to impose an integrated look when running on the desktop. It will be used when the environment variable QT_QUICK_CONTROLS_STYLE=org.kde.desktop is exported, or from the following C++ code: @code #include ... int main(int argc, char *argv[]) { ... QQuickStyle::setStyle("org.kde.desktop"); ... } @endcode @authors Marco Martin \
@maintainers Marco Martin \ @licenses @lgpl */ // DOXYGEN_SET_RECURSIVE = YES // DOXYGEN_SET_EXCLUDE_PATTERNS += *_p.h */private/* */examples/* // DOXYGEN_SET_PROJECT_NAME = Kirigami // vim:ts=4:sw=4:expandtab:filetype=doxygen diff --git a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp index 06976ab..f8697f0 100644 --- a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp +++ b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.cpp @@ -1,36 +1,23 @@ /* -* Copyright (C) 2017 by Marco Martin -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details -* -* You should have received a copy of the GNU Library General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later */ #include "kirigamiplasmafactory.h" #include "plasmadesktoptheme.h" KirigamiPlasmaFactory::KirigamiPlasmaFactory(QObject *parent) : Kirigami::KirigamiPluginFactory(parent) { } KirigamiPlasmaFactory::~KirigamiPlasmaFactory() = default; Kirigami::PlatformTheme *KirigamiPlasmaFactory::createPlatformTheme(QObject *parent) { Q_ASSERT(parent); return new PlasmaDesktopTheme(parent); } #include "moc_kirigamiplasmafactory.cpp" diff --git a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h index 3b49e92..ed4ea70 100644 --- a/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h +++ b/kirigami-plasmadesktop-integration/kirigamiplasmafactory.h @@ -1,43 +1,30 @@ /* -* Copyright (C) 2017 by Marco Martin -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details -* -* You should have received a copy of the GNU Library General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later */ #ifndef KIRIGAMIPLASMAFACTORY_H #define KIRIGAMIPLASMAFACTORY_H #include #include class KirigamiPlasmaFactory : public Kirigami::KirigamiPluginFactory { Q_OBJECT Q_PLUGIN_METADATA(IID "org.kde.kirigami.KirigamiPluginFactory" FILE "kirigamiplasmaintegration.json") Q_INTERFACES(Kirigami::KirigamiPluginFactory) public: explicit KirigamiPlasmaFactory(QObject *parent = nullptr); ~KirigamiPlasmaFactory() override; Kirigami::PlatformTheme *createPlatformTheme(QObject *parent) override; }; #endif // KIRIGAMIPLASMAFACTORY_H diff --git a/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp b/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp index be4ea2f..d3fc854 100644 --- a/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp +++ b/kirigami-plasmadesktop-integration/plasmadesktoptheme.cpp @@ -1,310 +1,297 @@ /* -* Copyright (C) 2017 by Marco Martin -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details -* -* You should have received a copy of the GNU Library General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later */ #include "plasmadesktoptheme.h" #include #include #include #include #include #include #include #include class IconLoaderSingleton { public: IconLoaderSingleton() = default; KIconLoader self; }; Q_GLOBAL_STATIC(IconLoaderSingleton, privateIconLoaderSelf) class StyleSingleton : public QObject { Q_OBJECT public: struct Colors { QPalette palette; KColorScheme selectionScheme; KColorScheme scheme; }; explicit StyleSingleton() : QObject() , buttonScheme(QPalette::Active, KColorScheme::ColorSet::Button) , viewScheme(QPalette::Active, KColorScheme::ColorSet::View) { connect(qGuiApp, &QGuiApplication::paletteChanged, this, &StyleSingleton::refresh); } void refresh() { m_cache.clear(); buttonScheme = KColorScheme(QPalette::Active, KColorScheme::ColorSet::Button); viewScheme = KColorScheme(QPalette::Active, KColorScheme::ColorSet::View); Q_EMIT paletteChanged(); } Colors loadColors(Kirigami::PlatformTheme::ColorSet cs, QPalette::ColorGroup group) { const auto key = qMakePair(cs, group); auto it = m_cache.constFind(key); if (it != m_cache.constEnd()) return *it; using Kirigami::PlatformTheme; KColorScheme::ColorSet set; switch (cs) { case PlatformTheme::Button: set = KColorScheme::ColorSet::Button; break; case PlatformTheme::Selection: set = KColorScheme::ColorSet::Selection; break; case PlatformTheme::Tooltip: set = KColorScheme::ColorSet::Tooltip; break; case PlatformTheme::View: set = KColorScheme::ColorSet::View; break; case PlatformTheme::Complementary: set = KColorScheme::ColorSet::Complementary; break; case PlatformTheme::Window: default: set = KColorScheme::ColorSet::Window; } Colors ret = {{}, KColorScheme(group, KColorScheme::ColorSet::Selection), KColorScheme(group, set)}; QPalette pal; for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { pal.setBrush(state, QPalette::WindowText, ret.scheme.foreground()); pal.setBrush(state, QPalette::Window, ret.scheme.background()); pal.setBrush(state, QPalette::Base, ret.scheme.background()); pal.setBrush(state, QPalette::Text, ret.scheme.foreground()); pal.setBrush(state, QPalette::Button, ret.scheme.background()); pal.setBrush(state, QPalette::ButtonText, ret.scheme.foreground()); pal.setBrush(state, QPalette::Highlight, ret.selectionScheme.background()); pal.setBrush(state, QPalette::HighlightedText, ret.selectionScheme.foreground()); pal.setBrush(state, QPalette::ToolTipBase, ret.scheme.background()); pal.setBrush(state, QPalette::ToolTipText, ret.scheme.foreground()); pal.setColor(state, QPalette::Light, ret.scheme.shade(KColorScheme::LightShade)); pal.setColor(state, QPalette::Midlight, ret.scheme.shade(KColorScheme::MidlightShade)); pal.setColor(state, QPalette::Mid, ret.scheme.shade(KColorScheme::MidShade)); pal.setColor(state, QPalette::Dark, ret.scheme.shade(KColorScheme::DarkShade)); pal.setColor(state, QPalette::Shadow, ret.scheme.shade(KColorScheme::ShadowShade)); pal.setBrush(state, QPalette::AlternateBase, ret.scheme.background(KColorScheme::AlternateBackground)); pal.setBrush(state, QPalette::Link, ret.scheme.foreground(KColorScheme::LinkText)); pal.setBrush(state, QPalette::LinkVisited, ret.scheme.foreground(KColorScheme::VisitedText)); } ret.palette = pal; m_cache.insert(key, ret); return ret; } KColorScheme buttonScheme; KColorScheme viewScheme; Q_SIGNALS: void paletteChanged(); private: QHash, Colors> m_cache; }; Q_GLOBAL_STATIC_WITH_ARGS(QScopedPointer, s_style, (new StyleSingleton)) PlasmaDesktopTheme::PlasmaDesktopTheme(QObject *parent) : PlatformTheme(parent) { setSupportsIconColoring(true); m_parentItem = qobject_cast(parent); //null in case parent is a normal QObject if (m_parentItem) { connect(m_parentItem.data(), &QQuickItem::enabledChanged, this, &PlasmaDesktopTheme::syncColors); if (m_parentItem && m_parentItem->window()) { connect(m_parentItem->window(), &QWindow::activeChanged, this, &PlasmaDesktopTheme::syncColors); m_window = m_parentItem->window(); } connect(m_parentItem.data(), &QQuickItem::windowChanged, this, [this]() { if (m_window) { disconnect(m_window.data(), &QWindow::activeChanged, this, &PlasmaDesktopTheme::syncColors); } if (m_parentItem && m_parentItem->window()) { connect(m_parentItem->window(), &QWindow::activeChanged, this, &PlasmaDesktopTheme::syncColors); } syncColors(); }); } //TODO: correct? depends from https://codereview.qt-project.org/206889 connect(qGuiApp, &QGuiApplication::fontDatabaseChanged, this, [this]() {setDefaultFont(qApp->font());}); connect(this, &PlasmaDesktopTheme::colorSetChanged, this, &PlasmaDesktopTheme::syncColors); connect(this, &PlasmaDesktopTheme::colorGroupChanged, this, &PlasmaDesktopTheme::syncColors); connect(s_style->data(), &StyleSingleton::paletteChanged, this, &PlasmaDesktopTheme::syncColors); syncColors(); } PlasmaDesktopTheme::~PlasmaDesktopTheme() = default; QIcon PlasmaDesktopTheme::iconFromTheme(const QString &name, const QColor &customColor) { QPalette pal = palette(); if (customColor != Qt::transparent) { for (auto state : { QPalette::Active, QPalette::Inactive, QPalette::Disabled }) { pal.setBrush(state, QPalette::WindowText, customColor); } } privateIconLoaderSelf->self.setCustomPalette(pal); return KDE::icon(name, &privateIconLoaderSelf->self); } void PlasmaDesktopTheme::syncColors() { QPalette::ColorGroup group = (QPalette::ColorGroup)colorGroup(); if (m_parentItem) { if (!m_parentItem->isEnabled()) { group = QPalette::Disabled; //Why also checking the window is exposed? //in the case of QQuickWidget the window() will never be active //and the widgets will always have the inactive palette. // better to always show it active than always show it inactive } else if (m_parentItem->window() && !m_parentItem->window()->isActive() && m_parentItem->window()->isExposed()) { group = QPalette::Inactive; } } const auto colors = (*s_style)->loadColors(colorSet(), group); setPalette(colors.palette); //foreground setTextColor(colors.scheme.foreground(KColorScheme::NormalText).color()); setDisabledTextColor(colors.scheme.foreground(KColorScheme::InactiveText).color()); setHighlightedTextColor(colors.selectionScheme.foreground(KColorScheme::NormalText).color()); setActiveTextColor(colors.scheme.foreground(KColorScheme::ActiveText).color()); setLinkColor(colors.scheme.foreground(KColorScheme::LinkText).color()); setVisitedLinkColor(colors.scheme.foreground(KColorScheme::VisitedText).color()); setNegativeTextColor(colors.scheme.foreground(KColorScheme::NegativeText).color()); setNeutralTextColor(colors.scheme.foreground(KColorScheme::NeutralText).color()); setPositiveTextColor(colors.scheme.foreground(KColorScheme::PositiveText).color()); //background setBackgroundColor(colors.scheme.background(KColorScheme::NormalBackground).color()); setAlternateBackgroundColor(colors.scheme.background(KColorScheme::AlternateBackground).color()); setHighlightColor(colors.selectionScheme.background(KColorScheme::NormalBackground).color()); setActiveBackgroundColor(colors.scheme.background(KColorScheme::ActiveBackground).color()); setLinkBackgroundColor(colors.scheme.background(KColorScheme::LinkBackground).color()); setVisitedLinkBackgroundColor(colors.scheme.background(KColorScheme::VisitedBackground).color()); setNegativeBackgroundColor(colors.scheme.background(KColorScheme::NegativeBackground).color()); setNeutralBackgroundColor(colors.scheme.background(KColorScheme::NeutralBackground).color()); setPositiveBackgroundColor(colors.scheme.background(KColorScheme::PositiveBackground).color()); //decoration setHoverColor(colors.scheme.decoration(KColorScheme::HoverColor).color()); setFocusColor(colors.scheme.decoration(KColorScheme::FocusColor).color()); //legacy stuff m_buttonTextColor = (*s_style)->buttonScheme.foreground(KColorScheme::NormalText).color(); m_buttonBackgroundColor = (*s_style)->buttonScheme.background(KColorScheme::NormalBackground).color(); m_buttonHoverColor = (*s_style)->buttonScheme.decoration(KColorScheme::HoverColor).color(); m_buttonFocusColor = (*s_style)->buttonScheme.decoration(KColorScheme::FocusColor).color(); m_viewTextColor = (*s_style)->viewScheme.foreground(KColorScheme::NormalText).color(); m_viewBackgroundColor = (*s_style)->viewScheme.background(KColorScheme::NormalBackground).color(); m_viewHoverColor = (*s_style)->viewScheme.decoration(KColorScheme::HoverColor).color(); m_viewFocusColor = (*s_style)->viewScheme.decoration(KColorScheme::FocusColor).color(); emit colorsChanged(); } QColor PlasmaDesktopTheme::buttonTextColor() const { qWarning() << "WARNING: buttonTextColor is deprecated, use textColor with colorSet: Theme.Button instead"; return m_buttonTextColor; } QColor PlasmaDesktopTheme::buttonBackgroundColor() const { qWarning() << "WARNING: buttonBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; return m_buttonBackgroundColor; } QColor PlasmaDesktopTheme::buttonHoverColor() const { qWarning() << "WARNING: buttonHoverColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; return m_buttonHoverColor; } QColor PlasmaDesktopTheme::buttonFocusColor() const { qWarning() << "WARNING: buttonFocusColor is deprecated, use backgroundColor with colorSet: Theme.Button instead"; return m_buttonFocusColor; } QColor PlasmaDesktopTheme::viewTextColor() const { qWarning()<<"WARNING: viewTextColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewTextColor; } QColor PlasmaDesktopTheme::viewBackgroundColor() const { qWarning() << "WARNING: viewBackgroundColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewBackgroundColor; } QColor PlasmaDesktopTheme::viewHoverColor() const { qWarning() << "WARNING: viewHoverColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewHoverColor; } QColor PlasmaDesktopTheme::viewFocusColor() const { qWarning() << "WARNING: viewFocusColor is deprecated, use backgroundColor with colorSet: Theme.View instead"; return m_viewFocusColor; } #include "plasmadesktoptheme.moc" diff --git a/kirigami-plasmadesktop-integration/plasmadesktoptheme.h b/kirigami-plasmadesktop-integration/plasmadesktoptheme.h index 406ba27..d6182fc 100644 --- a/kirigami-plasmadesktop-integration/plasmadesktoptheme.h +++ b/kirigami-plasmadesktop-integration/plasmadesktoptheme.h @@ -1,84 +1,71 @@ /* -* Copyright (C) 2017 by Marco Martin -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU Library General Public License as -* published by the Free Software Foundation; either version 2, 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 Library General Public License for more details -* -* You should have received a copy of the GNU Library General Public -* License along with this program; if not, write to the -* Free Software Foundation, Inc., -* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later */ #ifndef KIRIGAMIPLASMATHEME_H #define KIRIGAMIPLASMATHEME_H #include #include #include #include #include #include class PlasmaDesktopTheme; class KIconLoader; class PlasmaDesktopTheme : public Kirigami::PlatformTheme { Q_OBJECT // colors Q_PROPERTY(QColor buttonTextColor READ buttonTextColor NOTIFY colorsChanged) Q_PROPERTY(QColor buttonBackgroundColor READ buttonBackgroundColor NOTIFY colorsChanged) Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY colorsChanged) Q_PROPERTY(QColor buttonFocusColor READ buttonFocusColor NOTIFY colorsChanged) Q_PROPERTY(QColor viewTextColor READ viewTextColor NOTIFY colorsChanged) Q_PROPERTY(QColor viewBackgroundColor READ viewBackgroundColor NOTIFY colorsChanged) Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY colorsChanged) Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY colorsChanged) public: explicit PlasmaDesktopTheme(QObject *parent = nullptr); ~PlasmaDesktopTheme() override; Q_INVOKABLE QIcon iconFromTheme(const QString &name, const QColor &customColor = Qt::transparent) override; void syncColors(); QColor buttonTextColor() const; QColor buttonBackgroundColor() const; QColor buttonHoverColor() const; QColor buttonFocusColor() const; QColor viewTextColor() const; QColor viewBackgroundColor() const; QColor viewHoverColor() const; QColor viewFocusColor() const; Q_SIGNALS: void colorsChanged(); private: QPointer m_parentItem; QPointer m_window; //legacy colors QColor m_buttonTextColor; QColor m_buttonBackgroundColor; QColor m_buttonHoverColor; QColor m_buttonFocusColor; QColor m_viewTextColor; QColor m_viewBackgroundColor; QColor m_viewHoverColor; QColor m_viewFocusColor; }; #endif // KIRIGAMIPLASMATHEME_H diff --git a/org.kde.desktop/BusyIndicator.qml b/org.kde.desktop/BusyIndicator.qml index b45afb9..3b39f5a 100644 --- a/org.kde.desktop/BusyIndicator.qml +++ b/org.kde.desktop/BusyIndicator.qml @@ -1,59 +1,45 @@ /* - * Copyright 2018 Oleg Chernovskiy - * Copyright 2018 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2018 Oleg Chernovskiy + SPDX-FileCopyrightText: 2018 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.kirigami 2.4 as Kirigami import QtQuick.Templates @QQC2_VERSION@ as T T.BusyIndicator { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding padding: 6 spacing: Kirigami.Units.smallSpacing hoverEnabled: true contentItem: Kirigami.Icon { source: "view-refresh" opacity: controlRoot.running ? 1 : 0 smooth: true // appearing/fading opacity change Behavior on opacity { OpacityAnimator { duration: 250 } } // rotating loading icon RotationAnimator { target: controlRoot.contentItem running: controlRoot.visible && controlRoot.running from: 0 to: 360 loops: Animation.Infinite duration: 2000 } } } diff --git a/org.kde.desktop/Button.qml b/org.kde.desktop/Button.qml index 5a8a2c4..46c7736 100644 --- a/org.kde.desktop/Button.qml +++ b/org.kde.desktop/Button.qml @@ -1,68 +1,54 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.4 as Kirigami T.Button { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.Button Kirigami.Theme.inherit: false implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? contentItem: Item {} Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.ActionElement Kirigami.MnemonicData.label: controlRoot.display !== T.AbstractButton.IconOnly ? controlRoot.text : "" Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: controlRoot.clicked() } background: StylePrivate.StyleItem { id: styleitem anchors.fill: parent control: controlRoot elementType: "button" sunken: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked) raised: !(controlRoot.pressed || (controlRoot.checkable && controlRoot.checked)) hover: controlRoot.hovered text: controlRoot.Kirigami.MnemonicData.mnemonicLabel hasFocus: controlRoot.activeFocus activeControl: controlRoot.isDefault ? "default" : "f" properties: { "icon": controlRoot.icon && controlRoot.display !== T.AbstractButton.TextOnly ? (controlRoot.icon.name || controlRoot.icon.source) : "", "iconColor": controlRoot.icon && controlRoot.icon.color.a > 0? controlRoot.icon.color : Kirigami.Theme.textColor, "iconWidth": controlRoot.icon && controlRoot.icon.width ? controlRoot.icon.width : 0, "iconHeight": controlRoot.icon && controlRoot.icon.height ? controlRoot.icon.height : 0, "flat": controlRoot.flat } } } diff --git a/org.kde.desktop/CheckBox.qml b/org.kde.desktop/CheckBox.qml index 5374e39..0223a88 100644 --- a/org.kde.desktop/CheckBox.qml +++ b/org.kde.desktop/CheckBox.qml @@ -1,82 +1,68 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import QtQuick.Controls @QQC2_VERSION@ import org.kde.kirigami 2.4 as Kirigami import "private" T.CheckBox { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset spacing: indicator && typeof indicator.pixelMetric === "function" ? indicator.pixelMetric("checkboxlabelspacing") : Kirigami.Units.smallSpacing hoverEnabled: true indicator: CheckIndicator { LayoutMirroring.enabled: controlRoot.mirrored LayoutMirroring.childrenInherit: true anchors { left: parent.left verticalCenter: parent.verticalCenter } control: controlRoot } Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.ActionElement Kirigami.MnemonicData.label: controlRoot.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: controlRoot.toggle(); } contentItem: Label { readonly property int indicatorEffectiveWidth: controlRoot.indicator && typeof controlRoot.indicator.pixelMetric === "function" ? controlRoot.indicator.pixelMetric("indicatorwidth") : controlRoot.indicator.width leftPadding: controlRoot.indicator && !controlRoot.mirrored ? indicatorEffectiveWidth + controlRoot.spacing : 0 rightPadding: controlRoot.indicator && controlRoot.mirrored ? indicatorEffectiveWidth + controlRoot.spacing : 0 opacity: controlRoot.enabled ? 1 : 0.6 text: controlRoot.Kirigami.MnemonicData.richTextLabel font: controlRoot.font elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter FocusRect { control: controlRoot } } } diff --git a/org.kde.desktop/CheckDelegate.qml b/org.kde.desktop/CheckDelegate.qml index e5ee483..df4ec14 100644 --- a/org.kde.desktop/CheckDelegate.qml +++ b/org.kde.desktop/CheckDelegate.qml @@ -1,66 +1,52 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.5 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import "private" T.CheckDelegate { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true padding: Kirigami.Settings.tabletMode ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing leftPadding: padding*2 topPadding: padding rightPadding: padding*2 bottomPadding: padding contentItem: Label { leftPadding: controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 rightPadding: !controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 text: controlRoot.text font: controlRoot.font color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: CheckIndicator { x: controlRoot.mirrored ? controlRoot.leftPadding : controlRoot.width - width - controlRoot.rightPadding y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 control: controlRoot } background: DefaultListItemBackground {} } diff --git a/org.kde.desktop/CheckIndicator.qml b/org.kde.desktop/CheckIndicator.qml index b5bcc27..63a0eb8 100644 --- a/org.kde.desktop/CheckIndicator.qml +++ b/org.kde.desktop/CheckIndicator.qml @@ -1,34 +1,20 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate StylePrivate.StyleItem { id: styleitem elementType: control.autoExclusive ? "radiobutton" : "checkbox" sunken: control.pressed on: control.checked || control.pressed hover: control.hovered enabled: control.enabled properties: {"partiallyChecked": (control.checkState === Qt.PartiallyChecked) } } diff --git a/org.kde.desktop/ComboBox.qml b/org.kde.desktop/ComboBox.qml index bc9404d..b1d7592 100644 --- a/org.kde.desktop/ComboBox.qml +++ b/org.kde.desktop/ComboBox.qml @@ -1,251 +1,237 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Window 2.2 import QtQuick.Templates @QQC2_VERSION@ as T import QtQuick.Controls @QQC2_VERSION@ as Controls import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.12 as Kirigami import "private" as Private T.ComboBox { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette //NOTE: typeof necessary to not have warnings on Qt 5.7 Kirigami.Theme.colorSet: typeof(editable) != "undefined" && editable ? Kirigami.Theme.View : Kirigami.Theme.Button Kirigami.Theme.inherit: false implicitWidth: Math.max(200, background.implicitWidth + leftPadding + rightPadding) implicitHeight: background.implicitHeight baselineOffset: contentItem.y + contentItem.baselineOffset hoverEnabled: true padding: 5 leftPadding: controlRoot.editable && controlRoot.mirrored ? 24 : padding rightPadding: controlRoot.editable && !controlRoot.mirrored ? 24 : padding delegate: ItemDelegate { width: controlRoot.popup.width text: controlRoot.textRole ? (Array.isArray(controlRoot.model) ? modelData[controlRoot.textRole] : model[controlRoot.textRole]) : modelData highlighted: mouseArea.pressed ? listView.currentIndex == index : controlRoot.highlightedIndex == index property bool separatorVisible: false Kirigami.Theme.colorSet: controlRoot.Kirigami.Theme.inherit ? controlRoot.Kirigami.Theme.colorSet : Kirigami.Theme.View Kirigami.Theme.inherit: controlRoot.Kirigami.Theme.inherit } indicator: Item {} StylePrivate.PropertyWriter { id: controlRootWriter target: controlRoot propertyName: 'currentIndex' } contentItem: MouseArea { id: mouseArea anchors.fill: parent acceptedButtons: Qt.LeftButton preventStealing: true property int indexUnderMouse: -1 onWheel: { if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { controlRoot.incrementCurrentIndex(); } else { controlRoot.decrementCurrentIndex(); } } onPressed: { if (controlRoot.focusPolicy & Qt.ClickFocus) { controlRoot.forceActiveFocus(); } indexUnderMouse = -1; listView.currentIndex = controlRoot.highlightedIndex controlRoot.down = true; controlRoot.pressed = true; controlRoot.popup.visible = !controlRoot.popup.visible; } onReleased: { if (!containsMouse) { controlRoot.down = false; controlRoot.pressed = false; controlRoot.popup.visible = false; } if (indexUnderMouse > -1) { controlRootWriter.writeProperty(indexUnderMouse); controlRoot.activated(indexUnderMouse); } } onCanceled: { controlRoot.down = false; controlRoot.pressed = false; } onPositionChanged: { var pos = listView.mapFromItem(this, mouse.x, mouse.y); indexUnderMouse = listView.indexAt(pos.x, pos.y); listView.currentIndex = indexUnderMouse; } Connections { target: popup onClosed: { controlRoot.down = false; controlRoot.pressed = false; } } T.TextField { id: textField padding: 0 anchors { fill:parent leftMargin: controlRoot.leftPadding rightMargin: controlRoot.rightPadding topMargin: controlRoot.topPadding bottomMargin: controlRoot.bottomPadding } text: controlRoot.editable ? controlRoot.editText : controlRoot.displayText enabled: controlRoot.editable autoScroll: controlRoot.editable readOnly: controlRoot.down - + visible: typeof(controlRoot.editable) != "undefined" && controlRoot.editable inputMethodHints: controlRoot.inputMethodHints validator: controlRoot.validator // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering color: controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor selectionColor: Kirigami.Theme.highlightColor selectedTextColor: Kirigami.Theme.highlightedTextColor selectByMouse: !Kirigami.Settings.tabletMode cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : null font: controlRoot.font horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter opacity: controlRoot.enabled ? 1 : 0.3 onFocusChanged: { if (focus) { Private.MobileTextActionsToolBar.controlRoot = textField; } } onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; } forceActiveFocus(); cursorPosition = positionAt(event.x, event.y); selectWord(); } } } Component { id: mobileCursor Private.MobileCursor { target: textField } } Private.MobileCursor { target: textField selectionStartHandle: true property var rect: target.positionToRectangle(target.selectionStart) x: rect.x + 5 y: rect.y + 6 } background: StylePrivate.StyleItem { id: styleitem control: controlRoot elementType: "combobox" anchors.fill: parent hover: controlRoot.hovered || controlRoot.pressed on: controlRoot.pressed hasFocus: controlRoot.activeFocus && !controlRoot.popup.visible enabled: controlRoot.enabled // contentHeight as in QComboBox magic numbers taken from QQC1 style contentHeight: Math.max(Math.ceil(textHeight("")), 14) + 2 text: controlRoot.displayText properties: { "editable" : control.editable } } popup: T.Popup { y: controlRoot.height width: Math.max(controlRoot.width, 150) implicitHeight: contentItem.implicitHeight topMargin: 6 bottomMargin: 6 Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: controlRoot.Kirigami.Theme.inherit modal: true dim: false closePolicy: Controls.Popup.CloseOnEscape | Controls.Popup.CloseOnPressOutside contentItem: ListView { id: listView // this causes us to load at least one delegate // this is essential in guessing the contentHeight // which is needed to initially resize the popup cacheBuffer: 1 implicitHeight: contentHeight model: controlRoot.delegateModel delegate: controlRoot.delegate currentIndex: controlRoot.highlightedIndex highlightRangeMode: ListView.ApplyRange highlightMoveDuration: 0 boundsBehavior: Flickable.StopAtBounds T.ScrollBar.vertical: Controls.ScrollBar { } } background: Kirigami.ShadowedRectangle { anchors { fill: parent margins: -1 } radius: 2 color: Kirigami.Theme.backgroundColor property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) border.width: 1 shadow.xOffset: 0 shadow.yOffset: 2 shadow.color: Qt.rgba(0, 0, 0, 0.3) shadow.size: 8 } } } diff --git a/org.kde.desktop/Container.qml b/org.kde.desktop/Container.qml index 51befa4..6b34de0 100644 --- a/org.kde.desktop/Container.qml +++ b/org.kde.desktop/Container.qml @@ -1,35 +1,21 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.Container { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding) } diff --git a/org.kde.desktop/Control.qml b/org.kde.desktop/Control.qml index 3cdf0d8..aa1b6f3 100644 --- a/org.kde.desktop/Control.qml +++ b/org.kde.desktop/Control.qml @@ -1,45 +1,31 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.4 as Kirigami T.Control { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding) leftPadding: styleItem.pixelMetric("layoutleftmargin") topPadding: styleItem.pixelMetric("layouttopmargin") rightPadding: styleItem.pixelMetric("layoutrightmargin") bottomPadding: styleItem.pixelMetric("layoutbottommargin") property Item __style: StylePrivate.StyleItem { id: styleItem } } diff --git a/org.kde.desktop/DelayButton.qml b/org.kde.desktop/DelayButton.qml index 897aa6c..f18244f 100644 --- a/org.kde.desktop/DelayButton.qml +++ b/org.kde.desktop/DelayButton.qml @@ -1,74 +1,60 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.4 as Kirigami T.DelayButton { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.Button Kirigami.Theme.inherit: false implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight hoverEnabled: !Kirigami.Settings.isMobile transition: Transition { NumberAnimation { duration: control.delay * (control.pressed ? 1.0 - control.progress : 0.3 * control.progress) } } contentItem: Item {} background: StylePrivate.StyleItem { id: styleitem control: controlRoot elementType: "button" sunken: controlRoot.down || controlRoot.checked raised: !(controlRoot.down || controlRoot.checked) hover: controlRoot.hovered text: controlRoot.text hasFocus: controlRoot.activeFocus activeControl: controlRoot.isDefault ? "default" : "f" StylePrivate.StyleItem { anchors { bottom: parent.bottom left: parent.left right: parent.right margins: 3 } elementType: "progressbar" control: controlRoot maximum: 100 minimum: 0 value: controlRoot.progress * 100 horizontal: true enabled: controlRoot.enabled } } } diff --git a/org.kde.desktop/Dial.qml b/org.kde.desktop/Dial.qml index 2992244..c6ad73d 100644 --- a/org.kde.desktop/Dial.qml +++ b/org.kde.desktop/Dial.qml @@ -1,51 +1,37 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.Dial { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: 128 implicitHeight: 128 background: StylePrivate.StyleItem { id: style control: controlRoot visible: true elementType: "dial" horizontal: false maximum: controlRoot.to*100 minimum: controlRoot.from*100 step: controlRoot.stepSize*100 value: controlRoot.value*100 hasFocus: controlRoot.activeFocus hover: controlRoot.hovered } } diff --git a/org.kde.desktop/Dialog.qml b/org.kde.desktop/Dialog.qml index 158bf4d..304a5c3 100644 --- a/org.kde.desktop/Dialog.qml +++ b/org.kde.desktop/Dialog.qml @@ -1,88 +1,74 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.12 as Kirigami T.Dialog { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) + header.implicitHeight + footer.implicitHeight padding: Kirigami.Units.gridUnit enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 250 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 250 } } contentItem: Item {} background: Kirigami.ShadowedRectangle { radius: 2 color: Kirigami.Theme.backgroundColor property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) border.width: 1 shadow.xOffset: 0 shadow.yOffset: 4 shadow.color: Qt.rgba(0, 0, 0, 0.3) shadow.size: 16 } header: Kirigami.Heading { text: control.title level: 2 visible: control.title elide: Label.ElideRight padding: Kirigami.Units.gridUnit bottomPadding: 0 } footer: DialogButtonBox { visible: count > 0 } } diff --git a/org.kde.desktop/DialogButtonBox.qml b/org.kde.desktop/DialogButtonBox.qml index 4ad25da..26b1329 100644 --- a/org.kde.desktop/DialogButtonBox.qml +++ b/org.kde.desktop/DialogButtonBox.qml @@ -1,55 +1,41 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.DialogButtonBox { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding spacing: Kirigami.Units.smallSpacing padding: Kirigami.Units.smallSpacing alignment: Qt.AlignRight delegate: Button { width: Math.min(implicitWidth, control.width / control.count - control.padding - control.spacing * control.count) Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.DialogButton } contentItem: ListView { implicitWidth: contentWidth implicitHeight: 32 model: control.contentModel spacing: control.spacing orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds snapMode: ListView.SnapToItem } background: Item {} } diff --git a/org.kde.desktop/Drawer.qml b/org.kde.desktop/Drawer.qml index 315fb70..b41e7a0 100644 --- a/org.kde.desktop/Drawer.qml +++ b/org.kde.desktop/Drawer.qml @@ -1,72 +1,58 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.Drawer { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette parent: T.ApplicationWindow.overlay implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) topPadding: control.edge === Qt.BottomEdge ? 1 : 0 leftPadding: control.edge === Qt.RightEdge ? 1 : 0 rightPadding: control.edge === Qt.LeftEdge ? 1 : 0 bottomPadding: control.edge === Qt.TopEdge ? 1 : 0 background: Rectangle { color: Kirigami.Theme.backgroundColor Rectangle { readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge anchors { left: control.edge !== Qt.LeftEdge ? parent.left : undefined right: control.edge !== Qt.RightEdge ? parent.right : undefined top: control.edge !== Qt.TopEdge ? parent.top : undefined bottom: control.edge !== Qt.BottomEdge ? parent.bottom : undefined } color: Kirigami.Theme.textColor opacity: 0.3 width: 1 height: 1 } } enter: Transition { SmoothedAnimation { velocity: 5 } } exit: Transition { SmoothedAnimation { velocity: 5 } } } diff --git a/org.kde.desktop/Frame.qml b/org.kde.desktop/Frame.qml index eae7842..ce117ca 100644 --- a/org.kde.desktop/Frame.qml +++ b/org.kde.desktop/Frame.qml @@ -1,45 +1,31 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.Frame { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentWidth + leftPadding + rightPadding implicitHeight: contentHeight + topPadding + bottomPadding contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) padding: 6 background: Rectangle { color: "transparent" property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) } } diff --git a/org.kde.desktop/GroupBox.qml b/org.kde.desktop/GroupBox.qml index 5150ea9..594630f 100644 --- a/org.kde.desktop/GroupBox.qml +++ b/org.kde.desktop/GroupBox.qml @@ -1,58 +1,44 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.GroupBox { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentWidth + leftPadding + rightPadding implicitHeight: contentHeight + topPadding + bottomPadding contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) padding: 6 topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0) label: Label { x: control.leftPadding width: control.availableWidth text: control.title font: control.font color: Kirigami.Theme.textColor elide: Text.ElideRight horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } background: Rectangle { color: "transparent" property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) } } diff --git a/org.kde.desktop/ItemDelegate.qml b/org.kde.desktop/ItemDelegate.qml index b5eadd5..933faca 100644 --- a/org.kde.desktop/ItemDelegate.qml +++ b/org.kde.desktop/ItemDelegate.qml @@ -1,59 +1,45 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.5 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import "private" T.ItemDelegate { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true padding: Kirigami.Settings.tabletMode ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing leftPadding: padding*2 topPadding: padding rightPadding: padding*2 bottomPadding: padding contentItem: Label { leftPadding: controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 rightPadding: !controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 text: controlRoot.text font: controlRoot.font color: controlRoot.highlighted || controlRoot.checked || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : (controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor) elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } background: DefaultListItemBackground {} } diff --git a/org.kde.desktop/Label.qml b/org.kde.desktop/Label.qml index db3677f..9c82f24 100644 --- a/org.kde.desktop/Label.qml +++ b/org.kde.desktop/Label.qml @@ -1,67 +1,53 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.1 import QtQuick.Window 2.2 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.4 as Kirigami T.Label { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette verticalAlignment: lineCount > 1 ? Text.AlignTop : Text.AlignVCenter activeFocusOnTab: false // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering // Since Text (and Label) lack cursor-changing abilities of their own, // as suggested by QTBUG-30804, use a MouseAra to do our dirty work. // See comment https://bugreports.qt.io/browse/QTBUG-30804?#comment-206287 // TODO: Once HoverHandler and friends are able to change cursor shapes, this will want changing to that method MouseArea { anchors.fill: parent cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor acceptedButtons: Qt.NoButton // Not actually accepting clicks, just changing the cursor } font.capitalization: Kirigami.Theme.defaultFont.capitalization font.family: Kirigami.Theme.defaultFont.family font.italic: Kirigami.Theme.defaultFont.italic font.letterSpacing: Kirigami.Theme.defaultFont.letterSpacing font.pointSize: Kirigami.Theme.defaultFont.pointSize font.strikeout: Kirigami.Theme.defaultFont.strikeout font.underline: Kirigami.Theme.defaultFont.underline font.weight: Kirigami.Theme.defaultFont.weight font.wordSpacing: Kirigami.Theme.defaultFont.wordSpacing color: Kirigami.Theme.textColor linkColor: Kirigami.Theme.linkColor opacity: enabled? 1 : 0.6 Accessible.role: Accessible.StaticText Accessible.name: text } diff --git a/org.kde.desktop/Menu.qml b/org.kde.desktop/Menu.qml index 98a2a90..ea26fcd 100644 --- a/org.kde.desktop/Menu.qml +++ b/org.kde.desktop/Menu.qml @@ -1,113 +1,99 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.7 import QtQuick.Layouts 1.2 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.12 as Kirigami T.Menu { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding margins: 0 @DISABLE_UNDER_QQC2_2_3@ delegate: MenuItem { onImplicitWidthChanged: control.contentItem.contentItem.childrenChanged() } contentItem: ListView { implicitHeight: contentHeight property bool hasCheckables: false property bool hasIcons: false model: control.contentModel implicitWidth: { var maxWidth = 0; for (var i = 0; i < contentItem.children.length; ++i) { maxWidth = Math.max(maxWidth, contentItem.children[i].implicitWidth); } return maxWidth; } interactive: ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false clip: true currentIndex: control.currentIndex || 0 keyNavigationEnabled: true keyNavigationWraps: true ScrollBar.vertical: ScrollBar {} } Connections { target: control.contentItem.contentItem onChildrenChanged: { for (var i in control.contentItem.contentItem.children) { var child = control.contentItem.contentItem.children[i]; if (child.checkable) { control.contentItem.hasCheckables = true; } if (child.icon && child.icon.hasOwnProperty("name") && (child.icon.name.length > 0 || child.icon.source.length > 0)) { control.contentItem.hasIcons = true; } } } } enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 150 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 150 } } background: Kirigami.ShadowedRectangle { radius: 2 implicitWidth: Kirigami.Units.gridUnit * 8 color: Kirigami.Theme.backgroundColor property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) border.width: 1 shadow.xOffset: 0 shadow.yOffset: 2 shadow.color: Qt.rgba(0, 0, 0, 0.3) shadow.size: 8 } } diff --git a/org.kde.desktop/MenuBarItem.qml b/org.kde.desktop/MenuBarItem.qml index 97819c9..d1f2aa3 100644 --- a/org.kde.desktop/MenuBarItem.qml +++ b/org.kde.desktop/MenuBarItem.qml @@ -1,75 +1,61 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.MenuBarItem { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding baselineOffset: contentItem.y + contentItem.baselineOffset Layout.fillWidth: true leftPadding: Kirigami.Units.largeSpacing rightPadding: Kirigami.Units.largeSpacing topPadding: Kirigami.Units.smallSpacing bottomPadding: Kirigami.Units.smallSpacing hoverEnabled: true Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.MenuItem Kirigami.MnemonicData.label: controlRoot.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: controlRoot.clicked(); } contentItem: Label { text: controlRoot.Kirigami.MnemonicData.richTextLabel font: controlRoot.font color: controlRoot.hovered && !controlRoot.pressed ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } background: Item { anchors.fill: parent implicitWidth: Kirigami.Units.gridUnit * 8 Rectangle { anchors.fill: parent color: Kirigami.Theme.highlightColor opacity: controlRoot.down || controlRoot.highlighted ? 0.7 : 0 Behavior on opacity { NumberAnimation { duration: 150 } } } } } diff --git a/org.kde.desktop/MenuItem.qml b/org.kde.desktop/MenuItem.qml index efc8b8d..d01a3ae 100644 --- a/org.kde.desktop/MenuItem.qml +++ b/org.kde.desktop/MenuItem.qml @@ -1,136 +1,122 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.MenuItem { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding + (arrow ? arrow.implicitWidth : 0)) implicitHeight: visible ? Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) : 0 baselineOffset: contentItem.y + contentItem.baselineOffset width: parent ? parent.width : implicitWidth Layout.fillWidth: true padding: Kirigami.Units.smallSpacing leftPadding: Kirigami.Units.largeSpacing rightPadding: Kirigami.Units.largeSpacing hoverEnabled: !Kirigami.Settings.isMobile Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.MenuItem Kirigami.MnemonicData.label: controlRoot.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: { if (controlRoot.checkable) { controlRoot.toggle(); } else { controlRoot.clicked(); } } } contentItem: RowLayout { Item { Layout.preferredWidth: (controlRoot.ListView.view && controlRoot.ListView.view.hasCheckables) || controlRoot.checkable ? controlRoot.indicator.width : Kirigami.Units.smallSpacing } Kirigami.Icon { Layout.alignment: Qt.AlignVCenter visible: (controlRoot.ListView.view && controlRoot.ListView.view.hasIcons) || (controlRoot.icon != undefined && (controlRoot.icon.name.length > 0 || controlRoot.icon.source.length > 0)) source: controlRoot.icon ? (controlRoot.icon.name || controlRoot.icon.source) : "" color: controlRoot.icon ? controlRoot.icon.color : "transparent" //hovered is for retrocompatibility selected: (controlRoot.highlighted || controlRoot.hovered) Layout.preferredHeight: Math.max(label.height, Kirigami.Units.iconSizes.small) Layout.preferredWidth: Layout.preferredHeight } Label { id: label Layout.alignment: Qt.AlignVCenter Layout.fillWidth: true text: controlRoot.Kirigami.MnemonicData.richTextLabel font: controlRoot.font color: (controlRoot.highlighted || controlRoot.hovered) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } Label { id: shortcut Layout.alignment: Qt.AlignVCenter visible: controlRoot.action && controlRoot.action.hasOwnProperty("shortcut") && controlRoot.action.shortcut !== undefined text: visible ? controlRoot.action.shortcut : "" font: controlRoot.font color: label.color horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter } Item { Layout.preferredWidth: Kirigami.Units.smallSpacing } } //we can't use arrow: on old qqc2 releases @DISABLE_UNDER_QQC2_2_3@ arrow: Kirigami.Icon { @DISABLE_UNDER_QQC2_2_3@ x: controlRoot.mirrored ? controlRoot.padding : controlRoot.width - width - controlRoot.padding @DISABLE_UNDER_QQC2_2_3@ y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 @DISABLE_UNDER_QQC2_2_3@ source: controlRoot.mirrored ? "go-next-symbolic-rtl" : "go-next-symbolic" @DISABLE_UNDER_QQC2_2_3@ selected: controlRoot.highlighted @DISABLE_UNDER_QQC2_2_3@ width: Math.max(label.height, Kirigami.Units.iconSizes.small) @DISABLE_UNDER_QQC2_2_3@ height: width @DISABLE_UNDER_QQC2_2_3@ visible: controlRoot.subMenu @DISABLE_UNDER_QQC2_2_3@ } indicator: CheckIndicator { x: controlRoot.mirrored ? controlRoot.width - width - controlRoot.rightPadding : controlRoot.leftPadding y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 visible: controlRoot.checkable on: controlRoot.checked control: controlRoot } background: Item { anchors.fill: parent implicitWidth: Kirigami.Units.gridUnit * 8 Rectangle { anchors.fill: parent color: Kirigami.Theme.highlightColor opacity: (controlRoot.highlighted || controlRoot.hovered) ? 1 : 0 } } } diff --git a/org.kde.desktop/MenuSeparator.qml b/org.kde.desktop/MenuSeparator.qml index 4bafc54..7ba568b 100644 --- a/org.kde.desktop/MenuSeparator.qml +++ b/org.kde.desktop/MenuSeparator.qml @@ -1,38 +1,24 @@ /* - * Copyright 2019 Alexander Stippich - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2019 Alexander Stippich + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.MenuSeparator { id: controlRoot implicitHeight: Kirigami.Units.smallSpacing + separator.height width: parent.width background: Kirigami.Separator { id: separator anchors.centerIn: controlRoot width: controlRoot.width } } diff --git a/org.kde.desktop/Popup.qml b/org.kde.desktop/Popup.qml index 969815e..b85bd2b 100644 --- a/org.kde.desktop/Popup.qml +++ b/org.kde.desktop/Popup.qml @@ -1,77 +1,63 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.12 as Kirigami T.Popup { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentWidth > 0 ? contentHeight + topPadding + bottomPadding : 0) contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0) contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0) padding: 12 clip: true enter: Transition { NumberAnimation { property: "opacity" from: 0 to: 1 easing.type: Easing.InOutQuad duration: 250 } } exit: Transition { NumberAnimation { property: "opacity" from: 1 to: 0 easing.type: Easing.InOutQuad duration: 250 } } contentItem: Item { } background: Kirigami.ShadowedRectangle { radius: 2 color: Kirigami.Theme.backgroundColor property color borderColor: Kirigami.Theme.textColor border.color: Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) border.width: 1 shadow.xOffset: 0 shadow.yOffset: 4 shadow.color: Qt.rgba(0, 0, 0, 0.3) shadow.size: 8 } } diff --git a/org.kde.desktop/ProgressBar.qml b/org.kde.desktop/ProgressBar.qml index 4754a69..a147a80 100644 --- a/org.kde.desktop/ProgressBar.qml +++ b/org.kde.desktop/ProgressBar.qml @@ -1,55 +1,41 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.ProgressBar { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: 250 implicitHeight: 22 hoverEnabled: true contentItem: Item {} - + background: StylePrivate.StyleItem { elementType: "progressbar" control: controlRoot maximum: indeterminate ? 0 : controlRoot.to*100 minimum: indeterminate ? 0 : controlRoot.from*100 value: indeterminate ? 0 : ((!controlRoot.inverted ? controlRoot.visualPosition : 1 - controlRoot.visualPosition)*controlRoot.to*100) horizontal: true enabled: controlRoot.enabled Timer { interval: 50 running: controlRoot.indeterminate repeat: true onTriggered: parent.updateItem(); } } } diff --git a/org.kde.desktop/RadioButton.qml b/org.kde.desktop/RadioButton.qml index c7d63e8..f8d788d 100644 --- a/org.kde.desktop/RadioButton.qml +++ b/org.kde.desktop/RadioButton.qml @@ -1,82 +1,68 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import QtQuick.Controls @QQC2_VERSION@ import org.kde.kirigami 2.4 as Kirigami import "private" T.RadioButton { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset spacing: indicator && typeof indicator.pixelMetric === "function" ? indicator.pixelMetric("ratiobuttonlabelspacing") : Kirigami.Units.smallSpacing hoverEnabled: true indicator: CheckIndicator { LayoutMirroring.enabled: controlRoot.mirrored LayoutMirroring.childrenInherit: true anchors { left: parent.left verticalCenter: parent.verticalCenter } control: controlRoot } Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.ActionElement Kirigami.MnemonicData.label: controlRoot.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: controlRoot.checked = true } contentItem: Label { readonly property int indicatorEffectiveWidth: controlRoot.indicator && typeof controlRoot.indicator.pixelMetric === "function" ? controlRoot.indicator.pixelMetric("exclusiveindicatorwidth") : controlRoot.indicator.width leftPadding: controlRoot.indicator && !controlRoot.mirrored ? indicatorEffectiveWidth + controlRoot.spacing : 0 rightPadding: controlRoot.indicator && controlRoot.mirrored ? indicatorEffectiveWidth + controlRoot.spacing : 0 opacity: controlRoot.enabled ? 1 : 0.6 text: controlRoot.Kirigami.MnemonicData.richTextLabel font: controlRoot.font elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter FocusRect { control: controlRoot } } } diff --git a/org.kde.desktop/RadioDelegate.qml b/org.kde.desktop/RadioDelegate.qml index 50e8c67..ea4aea1 100644 --- a/org.kde.desktop/RadioDelegate.qml +++ b/org.kde.desktop/RadioDelegate.qml @@ -1,66 +1,52 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.5 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import "private" T.RadioDelegate { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true padding: Kirigami.Settings.tabletMode ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing leftPadding: padding*2 topPadding: padding rightPadding: padding*2 bottomPadding: padding contentItem: Label { leftPadding: controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 rightPadding: !controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 text: controlRoot.text font: controlRoot.font color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: CheckIndicator { x: controlRoot.mirrored ? controlRoot.leftPadding : controlRoot.width - width - controlRoot.rightPadding y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 control: controlRoot } background: DefaultListItemBackground {} } diff --git a/org.kde.desktop/RangeSlider.qml b/org.kde.desktop/RangeSlider.qml index 7f7e449..cb17706 100644 --- a/org.kde.desktop/RangeSlider.qml +++ b/org.kde.desktop/RangeSlider.qml @@ -1,102 +1,88 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.RangeSlider { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, Math.max(first.handle ? first.handle.implicitWidth : 0, second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, Math.max(first.handle ? first.handle.implicitHeight : 0, second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding) padding: 6 first.handle: Rectangle { property bool horizontal: control.orientation === Qt.Horizontal x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)) implicitWidth: 18 implicitHeight: 18 radius: width / 2 property color borderColor: Kirigami.Theme.textColor border.color: control.activeFocus ? Kirigami.Theme.highlightColor : Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) color: Kirigami.Theme.backgroundColor Rectangle { z: -1 x: 1 y: 1 width: parent.width height: parent.height radius: width / 2 color: Qt.rgba(0, 0, 0, 0.15) } } second.handle: Rectangle { property bool horizontal: control.orientation === Qt.Horizontal x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2) y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height)) implicitWidth: 18 implicitHeight: 18 radius: width / 2 property color borderColor: Kirigami.Theme.textColor border.color: control.activeFocus ? Kirigami.Theme.highlightColor : Qt.rgba(borderColor.r, borderColor.g, borderColor.b, 0.3) color: Kirigami.Theme.backgroundColor Rectangle { z: -1 x: 1 y: 1 width: parent.width height: parent.height radius: width / 2 color: Qt.rgba(0, 0, 0, 0.15) } } background: Rectangle { readonly property bool horizontal: control.orientation === Qt.Horizontal implicitWidth: horizontal ? 200 : 6 implicitHeight: horizontal ? 6 : 200 width: horizontal ? control.availableWidth : implicitWidth height: horizontal ? implicitHeight : control.availableHeight radius: Math.round(Math.min(width/2, height/2)) property color bgColor: Kirigami.Theme.textColor color: Qt.rgba(bgColor.r, bgColor.g, bgColor.b, 0.3) anchors.centerIn: parent Rectangle { x: parent.horizontal ? control.first.position * parent.width : 0 y: parent.horizontal ? 0 : control.second.visualPosition * parent.height + 6 width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width - 6 : 6 height: parent.horizontal ? 6 : control.second.position * parent.height - control.first.position * parent.height - 6 color: Kirigami.Theme.highlightColor } } } diff --git a/org.kde.desktop/RoundButton.qml b/org.kde.desktop/RoundButton.qml index e9a5cdb..1b06f28 100644 --- a/org.kde.desktop/RoundButton.qml +++ b/org.kde.desktop/RoundButton.qml @@ -1,99 +1,85 @@ /* - * Copyright 2018 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2018 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Templates @QQC2_VERSION@ as T import QtQuick.Controls @QQC2_VERSION@ as Controls import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.4 as Kirigami T.RoundButton { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: !flat && controlRoot.activeFocus ? Kirigami.Theme.Selection : Kirigami.Theme.Button Kirigami.Theme.inherit: false implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding) baselineOffset: contentItem.y + contentItem.baselineOffset hoverEnabled: !Kirigami.Settings.isMobile transform: Translate { x: controlRoot.down || controlRoot.checked ? 1 : 0 y: controlRoot.down || controlRoot.checked ? 1 : 0 } contentItem: Item { implicitWidth: mainLayout.implicitWidth implicitHeight: mainLayout.implicitHeight RowLayout { id: mainLayout anchors.centerIn: parent Kirigami.Icon { Layout.preferredWidth: Kirigami.Units.iconSizes.smallMedium Layout.preferredHeight: Kirigami.Units.iconSizes.smallMedium Layout.fillWidth: true Layout.fillHeight: true visible: source.length > 0 source: controlRoot.icon ? (controlRoot.icon.name || controlRoot.icon.source) : "" } Controls.Label { text: controlRoot.text visible: text.length > 0 } } } background: Rectangle { property color borderColor: Qt.tint(Kirigami.Theme.textColor, Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.7)) implicitWidth: Kirigami.Units.iconSizes.large implicitHeight: Kirigami.Units.iconSizes.large radius: controlRoot.radius color: (controlRoot.activeFocus && (controlRoot.hovered || controlRoot.highlighted)) || controlRoot.down || controlRoot.checked ? Qt.lighter(borderColor, 1.1) : Kirigami.Theme.backgroundColor border.color: (controlRoot.hovered || controlRoot.highlighted) ? Qt.lighter(Kirigami.Theme.highlightColor, 1.2) : borderColor border.width: 1 Rectangle { radius: controlRoot.radius anchors.fill: parent visible: !controlRoot.flat gradient: Gradient { GradientStop { position: 0.0; color: Qt.rgba(1, 1, 1, 0.13) } GradientStop { position: 1.0; color: Qt.rgba(0, 0, 0, 0.03) } } } Rectangle { z: -1 radius: controlRoot.radius visible: !controlRoot.down && !controlRoot.checked && !controlRoot.flat anchors { topMargin: 1 bottomMargin: -1 fill: parent } color: Qt.rgba(0, 0, 0, 0.15) } } } diff --git a/org.kde.desktop/ScrollBar.qml b/org.kde.desktop/ScrollBar.qml index e5c65e5..13c00fd 100644 --- a/org.kde.desktop/ScrollBar.qml +++ b/org.kde.desktop/ScrollBar.qml @@ -1,240 +1,226 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.11 as Kirigami T.ScrollBar { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: background.implicitWidth implicitHeight: background.implicitHeight hoverEnabled: true visible: controlRoot.size < 1.0 && controlRoot.policy !== T.ScrollBar.AlwaysOff stepSize: 0.02 interactive: !Kirigami.Settings.hasTransientTouchInput onPositionChanged: { disappearTimer.restart(); handleGraphics.handleState = Math.min(1, handleGraphics.handleState + 0.1) } contentItem: Item { visible: !controlRoot.interactive Rectangle { id: handleGraphics property real handleState: 0 x: Math.round(controlRoot.orientation == Qt.Vertical ? (parent.width - width) - (parent.width/2 - width/2) * handleState : 0) - + y: Math.round(controlRoot.orientation == Qt.Horizontal ? (parent.height - height) - (parent.height/2 - height/2) * handleState : 0) NumberAnimation { id: resetAnim target: handleGraphics property: "handleState" from: handleGraphics.handleState to: 0 duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } width: Math.round(controlRoot.orientation == Qt.Vertical ? Math.max(2, Kirigami.Units.smallSpacing * handleState) : parent.width) height: Math.round(controlRoot.orientation == Qt.Horizontal ? Math.max(2, Kirigami.Units.smallSpacing * handleState) : parent.height) radius: Math.min(width, height) color: Kirigami.Theme.textColor opacity: 0.3 Timer { id: disappearTimer interval: 1000 onTriggered: { resetAnim.restart(); handleGraphics.handleState = 0; } } } } background: MouseArea { id: mouseArea anchors.fill: parent visible: controlRoot.size < 1.0 && interactive hoverEnabled: true state: "inactive" acceptedButtons: Qt.LeftButton | Qt.MiddleButton onExited: style.activeControl = "groove"; onPressed: { if (mouse.buttons & Qt.MiddleButton) { style.activeControl = "handle"; controlRoot.position = Math.min(1 - controlRoot.size, Math.max(0, mouse.y/(controlRoot.orientation == Qt.Vertical ? height: width) - controlRoot.size/2)); mouse.accepted = true; } else if (style.activeControl == "down") { buttonTimer.increment = 1; buttonTimer.running = true; mouse.accepted = true } else if (style.activeControl == "up") { buttonTimer.increment = -1; buttonTimer.running = true; mouse.accepted = true } else if (style.activeControl == "downPage") { buttonTimer.increment = controlRoot.size; buttonTimer.running = true; mouse.accepted = true } else if (style.activeControl == "upPage") { buttonTimer.increment = -controlRoot.size; buttonTimer.running = true; mouse.accepted = true } else { mouse.accepted = false } } onPositionChanged: { style.activeControl = style.hitTest(mouse.x, mouse.y) if (mouse.buttons & Qt.MiddleButton) { style.activeControl = "handle"; controlRoot.position = Math.min(1 - controlRoot.size, Math.max(0, mouse.y/style.length - controlRoot.size/2)); mouse.accepted = true; } } onReleased: { buttonTimer.running = false; mouse.accepted = false } onCanceled: buttonTimer.running = false; implicitWidth: style.horizontal ? 200 : style.pixelMetric("scrollbarExtent") implicitHeight: style.horizontal ? style.pixelMetric("scrollbarExtent") : 200 StylePrivate.StyleItem { id: style readonly property real length: (controlRoot.orientation == Qt.Vertical ? height : width) control: controlRoot anchors.fill: parent elementType: "scrollbar" hover: activeControl != "none" activeControl: "none" sunken: controlRoot.pressed minimum: 0 maximum: style.length/controlRoot.size - style.length value: controlRoot.position * (style.length/controlRoot.size) horizontal: controlRoot.orientation == Qt.Horizontal enabled: controlRoot.enabled visible: controlRoot.size < 1.0 opacity: 1 Timer { id: buttonTimer property real increment repeat: true interval: 150 triggeredOnStart: true onTriggered: { if (increment == 1) { controlRoot.increase(); } else if (increment == -1) { controlRoot.decrease(); } else { controlRoot.position = Math.min(1 - controlRoot.size, Math.max(0, controlRoot.position + increment)); } } } } StylePrivate.StyleItem { id: inactiveStyle anchors.fill: parent control: controlRoot elementType: "scrollbar" activeControl: "none" sunken: false minimum: 0 maximum: style.maximum value: style.value horizontal: style.horizontal enabled: controlRoot.enabled visible: controlRoot.size < 1.0 opacity: 1 } states: [ State { name: "hover" when: mouseArea.containsMouse PropertyChanges { target: style opacity: 1 } PropertyChanges { target: inactiveStyle opacity: 0 } }, State { name: "inactive" when: !mouseArea.containsMouse PropertyChanges { target: style opacity: 0 } PropertyChanges { target: inactiveStyle opacity: 1 } } ] transitions: [ Transition { ParallelAnimation { NumberAnimation { target: style property: "opacity" duration: Kirigami.Units.shortDuration easing.type: Easing.InOutQuad } NumberAnimation { target: inactiveStyle property: "opacity" duration: Kirigami.Units.shortDuration easing.type: Easing.InOutQuad } } } ] } } diff --git a/org.kde.desktop/ScrollView.qml b/org.kde.desktop/ScrollView.qml index 38bc8ed..3e7bec3 100644 --- a/org.kde.desktop/ScrollView.qml +++ b/org.kde.desktop/ScrollView.qml @@ -1,124 +1,110 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.9 import QtQuick.Controls @QQC2_VERSION@ import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.9 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.ScrollView { id: controlRoot clip: true @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: !background || !background.visible //size in pixel to accomodate the border drawn by qstyle leftPadding: (internal.backgroundVisible && background.hasOwnProperty("leftPadding") ? background.leftPadding : 0) + (LayoutMirroring.enabled ? internal.verticalScrollBarWidth : 0) topPadding: internal.backgroundVisible && background.hasOwnProperty("topPadding") ? background.topPadding : 0 rightPadding: (internal.backgroundVisible && background.hasOwnProperty("rightPadding") ? background.rightPadding : 0) + (!LayoutMirroring.enabled ? internal.verticalScrollBarWidth : 0) bottomPadding: (internal.backgroundVisible && background.hasOwnProperty("bottomPadding") ? background.bottomPadding : 0) + internal.horizontalScrollBarHeight //create a background only after Component.onCompleted, see on the component creation below for explanation Component.onCompleted: { if (!controlRoot.background) { controlRoot.background = backgroundComponent.createObject(controlRoot); } } data: [ Kirigami.WheelHandler { target: controlRoot.contentItem }, /*create a background only after Component.onCompleted because: * implementations can set their own background in a declarative way * ScrollView {background.visible: true} must *not* work, because all upstream styles don't have a background so applications using this would break with other styles * This is child of scrollHelper as it would break native scrollview finding of the flickable if it was a direct child */ Component { id: backgroundComponent StylePrivate.StyleItem { control: controlRoot.contentItem elementType: "edit" property int leftPadding: frame.leftPadding property int topPadding: frame.topPadding property int rightPadding: frame.rightPadding property int bottomPadding: frame.bottomPadding visible: false sunken: true raised: false enabled: controlRoot.contentItem.enabled hasFocus: controlRoot.activeFocus || controlRoot.contentItem.activeFocus hover: controlRoot.hovered //This is just for the proper margin metrics StylePrivate.StyleItem { id: frame anchors.fill:parent control: controlRoot elementType: "frame" visible: false sunken: true hasFocus: controlRoot.activeFocus || controlRoot.contentItem.activeFocus hover: controlRoot.hovered } } }, QtObject { id: internal readonly property bool backgroundVisible: controlRoot.background && controlRoot.background.visible readonly property real verticalScrollBarWidth: controlRoot.ScrollBar.vertical.visible && !Kirigami.Settings.tabletMode ? controlRoot.ScrollBar.vertical.width : 0 readonly property real horizontalScrollBarHeight: controlRoot.ScrollBar.horizontal.visible && !Kirigami.Settings.tabletMode ? controlRoot.ScrollBar.horizontal.height : 0 } ] ScrollBar.vertical: ScrollBar { id: verticalScrollBar parent: controlRoot enabled: controlRoot.contentItem.enabled x: controlRoot.mirrored ? (internal.backgroundVisible && controlRoot.background.hasOwnProperty("leftPadding") ? controlRoot.background.leftPadding : 0) : controlRoot.width - width - (internal.backgroundVisible && controlRoot.background.hasOwnProperty("rightPadding") ? controlRoot.background.rightPadding: 0) y: controlRoot.topPadding height: controlRoot.availableHeight active: controlRoot.ScrollBar.horizontal || controlRoot.ScrollBar.horizontal.active } ScrollBar.horizontal: ScrollBar { parent: controlRoot enabled: controlRoot.contentItem.enabled x: controlRoot.leftPadding y: controlRoot.height - height - (internal.backgroundVisible && controlRoot.background.hasOwnProperty("bottomPadding") ? controlRoot.background.bottomPadding : 0) width: controlRoot.availableWidth active: controlRoot.ScrollBar.vertical || controlRoot.ScrollBar.vertical.active } } diff --git a/org.kde.desktop/Slider.qml b/org.kde.desktop/Slider.qml index 1307d20..2858452 100644 --- a/org.kde.desktop/Slider.qml +++ b/org.kde.desktop/Slider.qml @@ -1,61 +1,47 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.Slider { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.Button implicitWidth: Kirigami.Units.gridUnit * 12 implicitHeight: background.implicitHeight hoverEnabled: true LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft handle: Item {} snapMode: T.Slider.SnapOnRelease background: StylePrivate.StyleItem { control: controlRoot elementType: "slider" sunken: controlRoot.pressed implicitWidth: 200 contentHeight: horizontal ? 22 : implicitWidth contentWidth: horizontal ? implicitWidth : 22 maximum: controlRoot.to*100 minimum: controlRoot.from*100 step: controlRoot.stepSize*100 value: controlRoot.value*100 horizontal: controlRoot.orientation === Qt.Horizontal enabled: controlRoot.enabled hasFocus: controlRoot.activeFocus hover: controlRoot.hovered activeControl: controlRoot.stepSize > 0 ? "ticks" : "" } } diff --git a/org.kde.desktop/SpinBox.qml b/org.kde.desktop/SpinBox.qml index 4a9ecfa..c715f40 100644 --- a/org.kde.desktop/SpinBox.qml +++ b/org.kde.desktop/SpinBox.qml @@ -1,130 +1,116 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Window 2.1 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.SpinBox { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false implicitWidth: Math.max(48, contentItem.implicitWidth + 2 * padding + up.indicator.implicitWidth) implicitHeight: Math.max(background.implicitHeight, contentItem.implicitHeight + topPadding + bottomPadding) padding: 6 leftPadding: padding + (controlRoot.mirrored ? (up.indicator ? up.indicator.width : 0) : 0) rightPadding: padding + (controlRoot.mirrored ? 0 : (up.indicator ? up.indicator.width : 0)) hoverEnabled: true validator: IntValidator { locale: controlRoot.locale.name bottom: Math.min(controlRoot.from, controlRoot.to) top: Math.max(controlRoot.from, controlRoot.to) } contentItem: TextInput { z: 2 text: controlRoot.textFromValue(controlRoot.value, controlRoot.locale) opacity: controlRoot.enabled ? 1 : 0.3 font: controlRoot.font color: Kirigami.Theme.textColor selectionColor: Kirigami.Theme.highlightColor selectedTextColor: Kirigami.Theme.highlightedTextColor horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter readOnly: !controlRoot.editable validator: controlRoot.validator inputMethodHints: Qt.ImhFormattedNumbersOnly // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering MouseArea { anchors.fill: parent onPressed: mouse.accepted = false; property int wheelDelta: 0 onExited: wheelDelta = 0 onWheel: { wheelDelta += wheel.angleDelta.y; // magic number 120 for common "one click" // See: http://qt-project.org/doc/qt-5/qml-qtquick-wheelevent.html#angleDelta-prop while (wheelDelta >= 120) { wheelDelta -= 120; controlRoot.increase(); controlRoot.valueModified(); } while (wheelDelta <= -120) { wheelDelta += 120; controlRoot.decrease(); controlRoot.valueModified(); } } // Normally the TextInput does this automatically, but the MouseArea on // top of it blocks that behavior, so we need to explicitly do it here cursorShape: Qt.IBeamCursor } } up.indicator: Item { implicitWidth: parent.height/2 implicitHeight: implicitWidth x: controlRoot.mirrored ? 0 : parent.width - width } down.indicator: Item { implicitWidth: parent.height/2 implicitHeight: implicitWidth - + x: controlRoot.mirrored ? 0 : parent.width - width y: parent.height - height } background: StylePrivate.StyleItem { id: styleitem control: controlRoot elementType: "spinbox" anchors.fill: parent hover: controlRoot.hovered hasFocus: controlRoot.activeFocus enabled: controlRoot.enabled value: (controlRoot.up.pressed ? 1 : 0) | (controlRoot.down.pressed ? 1<<1 : 0) | ( controlRoot.value != controlRoot.to ? (1<<2) : 0) | (controlRoot.value != controlRoot.from ? (1<<3) : 0) | (controlRoot.up.hovered ? 0x1 : 0) | (controlRoot.down.hovered ? (1<<1) : 0) } } diff --git a/org.kde.desktop/Switch.qml b/org.kde.desktop/Switch.qml index ca14c4c..a13649c 100644 --- a/org.kde.desktop/Switch.qml +++ b/org.kde.desktop/Switch.qml @@ -1,74 +1,60 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.CheckBox { id: control @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding baselineOffset: contentItem.y + contentItem.baselineOffset padding: 1 spacing: Kirigami.Units.smallSpacing hoverEnabled: true indicator: SwitchIndicator { LayoutMirroring.enabled: control.mirrored LayoutMirroring.childrenInherit: true height: 22 anchors { left: parent.left verticalCenter: parent.verticalCenter } control: control } Kirigami.MnemonicData.enabled: control.enabled && control.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.ActionElement Kirigami.MnemonicData.label: control.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(control.text)) sequence: control.Kirigami.MnemonicData.sequence onActivated: control.toggle(); } contentItem: Label { leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0 rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0 opacity: control.enabled ? 1 : 0.6 text: control.Kirigami.MnemonicData.richTextLabel font: control.font color: Kirigami.Theme.textColor elide: Text.ElideRight visible: control.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/org.kde.desktop/SwitchDelegate.qml b/org.kde.desktop/SwitchDelegate.qml index bdc9669..636c854 100644 --- a/org.kde.desktop/SwitchDelegate.qml +++ b/org.kde.desktop/SwitchDelegate.qml @@ -1,66 +1,52 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.5 import org.kde.kirigami 2.4 as Kirigami import QtQuick.Templates @QQC2_VERSION@ as T import "private" T.SwitchDelegate { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: Math.max(contentItem.implicitHeight, indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding hoverEnabled: true padding: Kirigami.Settings.tabletMode ? Kirigami.Units.largeSpacing : Kirigami.Units.smallSpacing leftPadding: padding*2 topPadding: padding rightPadding: padding*2 bottomPadding: padding contentItem: Label { leftPadding: controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 rightPadding: !controlRoot.mirrored ? (controlRoot.indicator ? controlRoot.indicator.width : 0) + controlRoot.spacing : 0 text: controlRoot.text font: controlRoot.font color: (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightedTextColor : Kirigami.Theme.textColor elide: Text.ElideRight visible: controlRoot.text horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } indicator: SwitchIndicator { x: controlRoot.mirrored ? controlRoot.leftPadding : controlRoot.width - width - controlRoot.rightPadding y: controlRoot.topPadding + (controlRoot.availableHeight - height) / 2 control: controlRoot } background: DefaultListItemBackground {} } diff --git a/org.kde.desktop/SwitchIndicator.qml b/org.kde.desktop/SwitchIndicator.qml index bf2a832..5ef2acc 100644 --- a/org.kde.desktop/SwitchIndicator.qml +++ b/org.kde.desktop/SwitchIndicator.qml @@ -1,44 +1,30 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate Item { property alias control: slider.control implicitWidth: 32 implicitHeight : 22 StylePrivate.StyleItem { id: slider anchors.fill: parent elementType: "slider" sunken: control.pressed value: control.checked || control.pressed ? 1 : 0 minimum: 0 maximum: 1 hover: control.hovered enabled: control.enabled } } diff --git a/org.kde.desktop/TabBar.qml b/org.kde.desktop/TabBar.qml index 80b1bc8..2f06c6b 100644 --- a/org.kde.desktop/TabBar.qml +++ b/org.kde.desktop/TabBar.qml @@ -1,81 +1,67 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import org.kde.kirigami 2.4 as Kirigami import QtQuick.Templates @QQC2_VERSION@ as T T.TabBar { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.Window Kirigami.Theme.inherit: false //Some QStyles seem to not return sensible pixelmetrics here implicitWidth: Math.max(Kirigami.Units.gridUnit * 6, contentItem.implicitWidth) implicitHeight: contentItem.implicitHeight spacing: 0 contentItem: ListView { implicitWidth: contentWidth // The binding to contentModel.count is so it updates when the TabBar is populated on demand implicitHeight: controlRoot.contentModel.get(controlRoot.contentModel.count * 0).height model: controlRoot.contentModel currentIndex: controlRoot.currentIndex spacing: -styleItem.pixelMetric("tabOverlap")-1 orientation: ListView.Horizontal boundsBehavior: Flickable.StopAtBounds flickableDirection: Flickable.AutoFlickIfNeeded snapMode: ListView.SnapToItem highlightMoveDuration: 0 highlightRangeMode: ListView.ApplyRange preferredHighlightBegin: 40 preferredHighlightEnd: width - 40 } StylePrivate.StyleItem { id: styleItem control: controlRoot visible: false elementType: "tabframe" properties: { "orientation" : controlRoot.position == T.TabBar.Header ? "Top" : "Bottom" } } background: MouseArea { acceptedButtons: Qt.NoButton onWheel: { if (wheel.pixelDelta.y < 0 || wheel.angleDelta.y < 0) { controlRoot.currentIndex = Math.min(controlRoot.currentIndex + 1, controlRoot.contentModel.count -1); } else { controlRoot.currentIndex = Math.max(controlRoot.currentIndex - 1, 0); } } } } diff --git a/org.kde.desktop/TabButton.qml b/org.kde.desktop/TabButton.qml index 5cc932e..cfb6d69 100644 --- a/org.kde.desktop/TabButton.qml +++ b/org.kde.desktop/TabButton.qml @@ -1,101 +1,87 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQml.Models 2.1 //for TabBar.* import QtQuick.Controls @QQC2_VERSION@ import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.TabButton { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette //Some qstyles like fusion don't have correct pixel metrics here and just return 0 implicitWidth: Math.max(styleitem.implicitWidth, textMetrics.width + Kirigami.Units.gridUnit * 2) implicitHeight: styleitem.implicitHeight || Kirigami.Units.gridUnit * 2 baselineOffset: contentItem.y + contentItem.baselineOffset //This width: is important to make the tabbar internals not assume //all tabs have the same width width: implicitWidth padding: 0 hoverEnabled: true contentItem: Item {} Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl Kirigami.MnemonicData.label: controlRoot.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: controlRoot.checked = true; } background: StylePrivate.StyleItem { id: styleitem TextMetrics { id: textMetrics font.capitalization: Kirigami.Theme.defaultFont.capitalization font.family: Kirigami.Theme.defaultFont.family font.italic: Kirigami.Theme.defaultFont.italic font.letterSpacing: Kirigami.Theme.defaultFont.letterSpacing font.pointSize: Kirigami.Theme.defaultFont.pointSize font.strikeout: Kirigami.Theme.defaultFont.strikeout font.underline: Kirigami.Theme.defaultFont.underline font.weight: Kirigami.Theme.defaultFont.weight font.wordSpacing: Kirigami.Theme.defaultFont.wordSpacing text: controlRoot.text } control: controlRoot anchors.fill: parent elementType: "tab" paintMargins: 0 property Item tabBar: controlRoot.parent.parent.parent property string orientation: tabBar.position == TabBar.Header ? "Top" : "Bottom" property string selectedpos: tabBar.currentIndex == controlRoot.ObjectModel.index + 1 ? "next" : tabBar.currentIndex == controlRoot.ObjectModel.index - 1 ? "previous" : "" property string tabpos: tabBar.count === 1 ? "only" : controlRoot.ObjectModel.index === 0 ? "beginning" : controlRoot.ObjectModel.index === tabBar.count - 1 ? "end" : "middle" properties: { "hasFrame" : true, "orientation": orientation, "tabpos": tabpos, "selectedpos": selectedpos, "icon": control.icon ? (control.icon.name || control.icon.source) : "", "iconColor": controlRoot.icon && controlRoot.icon.color.a > 0? controlRoot.icon.color : Kirigami.Theme.textColor } enabled: controlRoot.enabled selected: controlRoot.checked text: controlRoot.Kirigami.MnemonicData.mnemonicLabel hover: controlRoot.hovered hasFocus: controlRoot.activeFocus } } diff --git a/org.kde.desktop/TextArea.qml b/org.kde.desktop/TextArea.qml index 628037a..d3a7630 100644 --- a/org.kde.desktop/TextArea.qml +++ b/org.kde.desktop/TextArea.qml @@ -1,119 +1,105 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Window 2.1 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import "private" as Private T.TextArea { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, background ? background.implicitWidth : 0, placeholder.implicitWidth + leftPadding + rightPadding) implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, background ? background.implicitHeight : 0, placeholder.implicitHeight + topPadding + bottomPadding) padding: 6 color: Kirigami.Theme.textColor selectionColor: Kirigami.Theme.highlightColor selectedTextColor: Kirigami.Theme.highlightedTextColor wrapMode: Text.WordWrap hoverEnabled: !Kirigami.Settings.tabletMode verticalAlignment: TextEdit.AlignTop // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering selectByMouse: !Kirigami.Settings.tabletMode cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : null Component { id: mobileCursor Private.MobileCursor { target: controlRoot } } onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; } forceActiveFocus(); cursorPosition = positionAt(event.x, event.y); selectWord(); } Private.MobileCursor { target: controlRoot selectionStartHandle: true property var rect: target.positionToRectangle(target.selectionStart) x: rect.x y: rect.y } onFocusChanged: { if (focus) { Private.MobileTextActionsToolBar.controlRoot = controlRoot; } } Label { id: placeholder x: controlRoot.leftPadding y: controlRoot.topPadding width: controlRoot.width - (controlRoot.leftPadding + controlRoot.rightPadding) height: controlRoot.height - (controlRoot.topPadding + controlRoot.bottomPadding) text: controlRoot.placeholderText font: controlRoot.font color: Kirigami.Theme.disabledTextColor horizontalAlignment: controlRoot.horizontalAlignment verticalAlignment: controlRoot.verticalAlignment visible: !controlRoot.length && !controlRoot.preeditText && (!controlRoot.activeFocus || controlRoot.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight } background: StylePrivate.StyleItem { id: style control: controlRoot elementType: "edit" implicitWidth: 200 implicitHeight: 22 sunken: true hasFocus: controlRoot.activeFocus hover: controlRoot.hovered } } diff --git a/org.kde.desktop/TextField.qml b/org.kde.desktop/TextField.qml index dbd1af3..6fc5dd6 100644 --- a/org.kde.desktop/TextField.qml +++ b/org.kde.desktop/TextField.qml @@ -1,119 +1,105 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Window 2.1 import QtQuick.Controls @QQC2_VERSION@ as Controls import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate import "private" as Private T.TextField { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false implicitWidth: Math.max(200, placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) || contentWidth + leftPadding + rightPadding implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, background ? background.implicitHeight : 0, placeholder.implicitHeight + topPadding + bottomPadding) padding: 6 color: controlRoot.enabled ? Kirigami.Theme.textColor : Kirigami.Theme.disabledTextColor selectionColor: Kirigami.Theme.highlightColor selectedTextColor: Kirigami.Theme.highlightedTextColor verticalAlignment: TextInput.AlignVCenter hoverEnabled: !Kirigami.Settings.tabletMode // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering selectByMouse: !Kirigami.Settings.tabletMode cursorDelegate: Kirigami.Settings.tabletMode ? mobileCursor : null Component { id: mobileCursor Private.MobileCursor { target: controlRoot } } onFocusChanged: { if (focus) { Private.MobileTextActionsToolBar.controlRoot = controlRoot; } } onTextChanged: Private.MobileTextActionsToolBar.shouldBeVisible = false; onPressed: Private.MobileTextActionsToolBar.shouldBeVisible = true; onPressAndHold: { if (!Kirigami.Settings.tabletMode) { return; } forceActiveFocus(); cursorPosition = positionAt(event.x, event.y); selectWord(); } Private.MobileCursor { target: controlRoot selectionStartHandle: true property var rect: controlRoot.positionToRectangle(controlRoot.selectionStart) x: rect.x + target.padding y: rect.y + target.padding } Text { id: placeholder x: controlRoot.leftPadding y: controlRoot.topPadding width: controlRoot.width - (controlRoot.leftPadding + controlRoot.rightPadding) height: controlRoot.height - (controlRoot.topPadding + controlRoot.bottomPadding) // Work around Qt bug where NativeRendering breaks for non-integer scale factors // https://bugreports.qt.io/browse/QTBUG-67007 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering text: controlRoot.placeholderText font: controlRoot.font color: Kirigami.Theme.disabledTextColor horizontalAlignment: controlRoot.horizontalAlignment verticalAlignment: controlRoot.verticalAlignment visible: !controlRoot.length && !controlRoot.preeditText && (!controlRoot.activeFocus || controlRoot.horizontalAlignment !== Qt.AlignHCenter) elide: Text.ElideRight } background: StylePrivate.StyleItem { id: style control: controlRoot elementType: "edit" sunken: true hasFocus: controlRoot.activeFocus hover: controlRoot.hovered } } diff --git a/org.kde.desktop/ToolBar.qml b/org.kde.desktop/ToolBar.qml index 1f7cd3d..c44e2b8 100644 --- a/org.kde.desktop/ToolBar.qml +++ b/org.kde.desktop/ToolBar.qml @@ -1,52 +1,38 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami T.ToolBar { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding) implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding) contentWidth: contentChildren[0].implicitWidth contentHeight: contentChildren[0].implicitHeight padding: Kirigami.Units.smallSpacing contentItem: Item {} position: controlRoot.parent.footer == controlRoot ? ToolBar.Footer : ToolBar.Header background: Rectangle { implicitHeight: 40 color: Kirigami.Theme.backgroundColor Kirigami.Separator { anchors { left: parent.left right: parent.right top: controlRoot.position == T.ToolBar.Footer || (controlRoot.parent.footer && controlRoot.parent.footer == controlRoot) ? parent.top : undefined bottom: controlRoot.position == T.ToolBar.Footer || (controlRoot.parent.footer && controlRoot.parent.footer == controlRoot) ? undefined : parent.bottom } } } } diff --git a/org.kde.desktop/ToolButton.qml b/org.kde.desktop/ToolButton.qml index af0e112..a79de50 100644 --- a/org.kde.desktop/ToolButton.qml +++ b/org.kde.desktop/ToolButton.qml @@ -1,76 +1,62 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.4 as Kirigami import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate T.ToolButton { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: flat ? Kirigami.Theme.Window : Kirigami.Theme.Button Kirigami.Theme.inherit: flat implicitWidth: text.length > 0 ? background.implicitWidth : implicitHeight implicitHeight: background.implicitHeight hoverEnabled: true //Qt.styleHints.useHoverEffects TODO: how to make this work in 5.7? flat: true contentItem: Item {} Kirigami.MnemonicData.enabled: controlRoot.enabled && controlRoot.visible Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl Kirigami.MnemonicData.label: controlRoot.text Shortcut { //in case of explicit & the button manages it by itself enabled: !(RegExp(/\&[^\&]/).test(controlRoot.text)) sequence: controlRoot.Kirigami.MnemonicData.sequence onActivated: controlRoot.clicked() } background: StylePrivate.StyleItem { id: styleitem anchors.fill:parent control: controlRoot elementType: controlRoot.flat ? "toolbutton" : "button" on: controlRoot.pressed || (controlRoot.checkable && controlRoot.checked) hover: controlRoot.hovered text: controlRoot.Kirigami.MnemonicData.mnemonicLabel hasFocus: false activeControl: controlRoot.isDefault ? "default" : "f" properties: { "icon": controlRoot.icon ? (controlRoot.icon.name || controlRoot.icon.source) : "", "iconColor": controlRoot.icon && controlRoot.icon.color.a > 0? controlRoot.icon.color : Kirigami.Theme.textColor, "iconWidth": controlRoot.icon ? controlRoot.icon.width : 0, "iconHeight": controlRoot.icon ? controlRoot.icon.height : 0, "toolButtonStyle": controlRoot.display == T.ToolButton.IconOnly ? Qt.ToolButtonIconOnly : controlRoot.display == T.ToolButton.TextOnly ? Qt.ToolButtonTextOnly : controlRoot.display == T.ToolButton.TextBesideIcon ? Qt.ToolButtonTextBesideIcon : controlRoot.display == T.ToolButton.TextUnderIcon ? Qt.ToolButtonTextUnderIcon : Qt.ToolButtonFollowStyle } } } diff --git a/org.kde.desktop/ToolTip.qml b/org.kde.desktop/ToolTip.qml index 6f8eeac..7c646e9 100644 --- a/org.kde.desktop/ToolTip.qml +++ b/org.kde.desktop/ToolTip.qml @@ -1,73 +1,59 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Controls @QQC2_VERSION@ as Controls import QtQuick.Templates @QQC2_VERSION@ as T import org.kde.kirigami 2.12 as Kirigami T.ToolTip { id: controlRoot @DISABLE_UNDER_QQC2_2_4@ palette: Kirigami.Theme.palette Kirigami.Theme.colorSet: Kirigami.Theme.Tooltip Kirigami.Theme.inherit: false x: parent ? Math.round((parent.width - implicitWidth) / 2) : 0 y: -implicitHeight - 3 // Always show the tooltip on top of everything else z: 999 implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding margins: 6 padding: 6 visible: parent && (Kirigami.Settings.tabletMode ? parent.pressed : (parent.hasOwnProperty("hovered") ? parent.hovered : parent.hasOwnProperty("containsMouse") && parent.containsMouse)) delay: Kirigami.Settings.tabletMode ? Qt.styleHints.mousePressAndHoldInterval : Kirigami.Units.toolTipDelay // Timeout based on text length, from QTipLabel::restartExpireTimer timeout: 10000 + 40 * Math.max(0, text.length - 100) closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent contentItem: Controls.Label { text: controlRoot.text wrapMode: Text.WordWrap font: controlRoot.font Kirigami.Theme.colorSet: Kirigami.Theme.Tooltip color: Kirigami.Theme.textColor } background: Kirigami.ShadowedRectangle { radius: 3 opacity: 0.95 color: Kirigami.Theme.backgroundColor Kirigami.Theme.colorSet: Kirigami.Theme.Tooltip shadow.xOffset: 0 shadow.yOffset: 2 shadow.size: 4 shadow.color: Qt.rgba(0, 0, 0, 0.3) } } diff --git a/org.kde.desktop/private/DefaultListItemBackground.qml b/org.kde.desktop/private/DefaultListItemBackground.qml index fcfd655..0e555a9 100644 --- a/org.kde.desktop/private/DefaultListItemBackground.qml +++ b/org.kde.desktop/private/DefaultListItemBackground.qml @@ -1,37 +1,23 @@ /* - * Copyright 2017 Marco Martin - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.1 import org.kde.kirigami 2.4 as Kirigami Rectangle { id: background color: highlighted || (controlRoot.pressed && !controlRoot.checked && !controlRoot.sectionDelegate) ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor visible: controlRoot.ListView.view ? controlRoot.ListView.view.highlight === null : true Rectangle { anchors.fill: parent color: Kirigami.Theme.highlightColor opacity: controlRoot.hovered && !controlRoot.pressed ? 0.2 : 0 } } diff --git a/org.kde.desktop/private/FocusRect.qml b/org.kde.desktop/private/FocusRect.qml index 2a05c87..53fafb8 100644 --- a/org.kde.desktop/private/FocusRect.qml +++ b/org.kde.desktop/private/FocusRect.qml @@ -1,40 +1,26 @@ /* - * Copyright 2018 Kai Uwe Broulik - * Copyright 2017 The Qt Company Ltd. - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2018 Kai Uwe Broulik + SPDX-FileCopyrightText: 2017 The Qt Company Ltd. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate StylePrivate.StyleItem { elementType: "focusrect" // those random numbers come from QQC1 desktop style anchors { top: parent.top bottom: parent.bottom topMargin: parent.topPadding - 1 bottomMargin: parent.bottomPadding - 1 } // this is explicitly not using left anchor for auto mirroring // since the label's leftPadding/rightPadding already accounts for that x: parent.leftPadding - 2 width: parent.implicitWidth - parent.leftPadding - parent.rightPadding + 3 visible: control.activeFocus } diff --git a/org.kde.desktop/private/MobileCursor.qml b/org.kde.desktop/private/MobileCursor.qml index 93c8565..9c459d1 100644 --- a/org.kde.desktop/private/MobileCursor.qml +++ b/org.kde.desktop/private/MobileCursor.qml @@ -1,77 +1,64 @@ /* - * Copyright (C) 2018 by Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. - */ + SPDX-FileCopyrightText: 2018 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ import QtQuick 2.1 import org.kde.kirigami 2.5 as Kirigami Item { id: root width: 1 //<-important that this is actually a single device pixel height: Kirigami.Units.gridUnit property Item target property bool selectionStartHandle: false - + visible: Kirigami.Settings.tabletMode && ((target.activeFocus && !selectionStartHandle) || target.selectedText.length > 0) Rectangle { width: Math.round(Kirigami.Units.devicePixelRatio * 3) anchors { horizontalCenter: parent.horizontalCenter top: parent.top bottom: parent.bottom } color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4)) radius: width Rectangle { width: Math.round(Kirigami.Units.gridUnit/1.5) height: width visible: MobileTextActionsToolBar.shouldBeVisible anchors { horizontalCenter: parent.horizontalCenter verticalCenter: parent.bottom } radius: width color: Qt.tint(Kirigami.Theme.highlightColor, Qt.rgba(1,1,1,0.4)) } MouseArea { anchors { fill: parent margins: -Kirigami.Units.gridUnit } preventStealing: true onPositionChanged: { var pos = mapToItem(target, mouse.x, mouse.y); pos = target.positionAt(pos.x, pos.y); if (target.selectedText.length > 0) { if (selectionStartHandle) { target.select(Math.min(pos, target.selectionEnd - 1), target.selectionEnd); } else { target.select(target.selectionStart, Math.max(pos, target.selectionStart + 1)); } } else { target.cursorPosition = pos; } } } } } - + diff --git a/org.kde.desktop/private/MobileTextActionsToolBar.qml b/org.kde.desktop/private/MobileTextActionsToolBar.qml index 36758c5..8fdcbe6 100644 --- a/org.kde.desktop/private/MobileTextActionsToolBar.qml +++ b/org.kde.desktop/private/MobileTextActionsToolBar.qml @@ -1,90 +1,77 @@ /* - * Copyright (C) 2018 by Marco Martin - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. - */ + SPDX-FileCopyrightText: 2018 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ pragma Singleton import QtQuick 2.1 import QtQuick.Layouts 1.2 import QtQuick.Window 2.2 import QtQuick.Controls @QQC2_VERSION@ import org.kde.kirigami 2.5 as Kirigami Popup { id: root property Item controlRoot parent: controlRoot ? controlRoot.Window.contentItem : undefined modal: false focus: false closePolicy: Popup.NoAutoClose property bool shouldBeVisible: false x: { if (!controlRoot || !controlRoot.Window.contentItem) { return 0; } return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, controlRoot.positionToRectangle(controlRoot.selectionStart).x, 0).x - root.width/2), controlRoot.Window.contentItem.width - root.width); } y: { if (!controlRoot || !controlRoot.Window.contentItem) { return 0; } var desiredY = controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionStart).y).y - root.height; if (desiredY >= 0) { return Math.min(desiredY, controlRoot.Window.contentItem.height - root.height); } else { return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(Kirigami.Units.gridUnit*1.5)).y), controlRoot.Window.contentItem.height - root.height); } } visible: controlRoot ? shouldBeVisible && Kirigami.Settings.tabletMode && (controlRoot.selectedText.length > 0 || controlRoot.canPaste) : false width: contentItem.implicitWidth + leftPadding + rightPadding contentItem: RowLayout { ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-cut" visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.cut(); } } ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-copy" visible: controlRoot && controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) onClicked: { controlRoot.copy(); } } ToolButton { focusPolicy: Qt.NoFocus icon.name: "edit-paste" visible: controlRoot && controlRoot.canPaste onClicked: { controlRoot.paste(); } } } } - + diff --git a/plugin/kpropertywriter.cpp b/plugin/kpropertywriter.cpp index 43913b4..b32e078 100644 --- a/plugin/kpropertywriter.cpp +++ b/plugin/kpropertywriter.cpp @@ -1,61 +1,48 @@ /* - * Copyright (C) 2019 Cyril Rossi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2019 Cyril Rossi + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ #include "kpropertywriter_p.h" QObject *KPropertyWriter::target() const { return m_target; } QString KPropertyWriter::propertyName() const { return m_propertyName; } bool KPropertyWriter::writeProperty(const QVariant &value) { if (!m_target) { return false; } return m_target->setProperty(qUtf8Printable(m_propertyName), value); } void KPropertyWriter::setTarget(QObject *target) { if (m_target == target) { return; } m_target = target; emit targetChanged(m_target); } void KPropertyWriter::setPropertyName(const QString &propertyName) { if (m_propertyName == propertyName) { return; } m_propertyName = propertyName; emit propertyNameChanged(m_propertyName); } #include "moc_kpropertywriter_p.cpp" diff --git a/plugin/kpropertywriter_p.h b/plugin/kpropertywriter_p.h index 041e22f..c2d99d9 100644 --- a/plugin/kpropertywriter_p.h +++ b/plugin/kpropertywriter_p.h @@ -1,54 +1,41 @@ /* - * Copyright (C) 2019 Cyril Rossi - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2019 Cyril Rossi + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ #ifndef KPROPERTYWRITER_H #define KPROPERTYWRITER_H #include #include class KPropertyWriter : public QObject { Q_OBJECT Q_PROPERTY(QObject *target READ target WRITE setTarget NOTIFY targetChanged) Q_PROPERTY(QString propertyName READ propertyName WRITE setPropertyName NOTIFY propertyNameChanged) public: using QObject::QObject; QObject *target() const; QString propertyName() const; Q_INVOKABLE bool writeProperty(const QVariant &value); public Q_SLOTS: void setTarget(QObject *target); void setPropertyName(const QString &propertyName); Q_SIGNALS: void targetChanged(QObject *target); void propertyNameChanged(const QString &propertyName); private: QObject *m_target = nullptr; QString m_propertyName; }; #endif // KPROPERTYWRITER_H diff --git a/plugin/kquickpadding_p.h b/plugin/kquickpadding_p.h index c3cd290..e2da617 100644 --- a/plugin/kquickpadding_p.h +++ b/plugin/kquickpadding_p.h @@ -1,88 +1,57 @@ -/**************************************************************************** -** -** Copyright 2017 by Marco Martin -** Copyright 2017 by David Edmundson -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 David Edmundson + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the Qt Quick Controls module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #ifndef KQUICKPADDING_H #define KQUICKPADDING_H #include class KQuickPadding : public QObject { Q_OBJECT Q_PROPERTY(int left READ left WRITE setLeft NOTIFY leftChanged) Q_PROPERTY(int top READ top WRITE setTop NOTIFY topChanged) Q_PROPERTY(int right READ right WRITE setRight NOTIFY rightChanged) Q_PROPERTY(int bottom READ bottom WRITE setBottom NOTIFY bottomChanged) int m_left; int m_top; int m_right; int m_bottom; public: KQuickPadding(QObject *parent = nullptr) : QObject(parent), m_left(0), m_top(0), m_right(0), m_bottom(0) {} int left() const { return m_left; } int top() const { return m_top; } int right() const { return m_right; } int bottom() const { return m_bottom; } public Q_SLOTS: void setLeft(int arg) { if (m_left != arg) {m_left = arg; emit leftChanged();}} void setTop(int arg) { if (m_top != arg) {m_top = arg; emit topChanged();}} void setRight(int arg) { if (m_right != arg) {m_right = arg; emit rightChanged();}} void setBottom(int arg) {if (m_bottom != arg) {m_bottom = arg; emit bottomChanged();}} Q_SIGNALS: void leftChanged(); void topChanged(); void rightChanged(); void bottomChanged(); }; #endif // QQUICKPADDING_H diff --git a/plugin/kquickstyleitem.cpp b/plugin/kquickstyleitem.cpp index 9d3e5a8..e9d4d8e 100644 --- a/plugin/kquickstyleitem.cpp +++ b/plugin/kquickstyleitem.cpp @@ -1,1884 +1,1853 @@ -/**************************************************************************** -** -** Copyright 2017 by Marco Martin -** Copyright 2017 by David Edmundson -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 David Edmundson + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the Qt Quick Controls module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #include "kquickstyleitem_p.h" #include #include #include #include #include #include #include #include #include #include #include #include QStyle *KQuickStyleItem::s_style = nullptr; QStyle *KQuickStyleItem::style() { auto style = qApp->style(); return style ? style : s_style; } KQuickStyleItem::KQuickStyleItem(QQuickItem *parent) : QQuickItem(parent), m_styleoption(nullptr), m_itemType(Undefined), m_sunken(false), m_raised(false), m_active(true), m_selected(false), m_focus(false), m_hover(false), m_on(false), m_horizontal(true), m_transient(false), m_sharedWidget(false), m_minimum(0), m_maximum(100), m_value(0), m_step(0), m_paintMargins(0), m_contentWidth(0), m_contentHeight(0), m_textureWidth(0), m_textureHeight(0), m_lastFocusReason(Qt::NoFocusReason) { // There is no styleChanged signal and QApplication sends QEvent::StyleChange only to all QWidgets if (qApp->style()) { connect(qApp->style(), &QObject::destroyed, this, &KQuickStyleItem::styleChanged); } else { KSharedConfig::Ptr kdeglobals = KSharedConfig::openConfig(); KConfigGroup cg(kdeglobals, "KDE"); auto style = s_style; s_style = QStyleFactory::create(cg.readEntry("widgetStyle", QStringLiteral("Fusion"))); if (style) { delete style; } } m_font = qApp->font(); setFlag(QQuickItem::ItemHasContents, true); setSmooth(false); connect(this, &KQuickStyleItem::visibleChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::widthChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::heightChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::enabledChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::infoChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::onChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::selectedChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::activeChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::textChanged, this, &KQuickStyleItem::updateSizeHint); connect(this, &KQuickStyleItem::textChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::activeChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::raisedChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::sunkenChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::hoverChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::maximumChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::minimumChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::valueChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::horizontalChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::transientChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::activeControlChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::hasFocusChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::activeControlChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::hintChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::propertiesChanged, this, &KQuickStyleItem::updateSizeHint); connect(this, &KQuickStyleItem::propertiesChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::elementTypeChanged, this, &KQuickStyleItem::updateItem); connect(this, &KQuickStyleItem::contentWidthChanged, this, &KQuickStyleItem::updateSizeHint); connect(this, &KQuickStyleItem::contentHeightChanged, this, &KQuickStyleItem::updateSizeHint); connect(this, &KQuickStyleItem::widthChanged, this, &KQuickStyleItem::updateRect); connect(this, &KQuickStyleItem::heightChanged, this, &KQuickStyleItem::updateRect); connect(this, &KQuickStyleItem::heightChanged, this, &KQuickStyleItem::updateBaselineOffset); connect(this, &KQuickStyleItem::contentHeightChanged, this, &KQuickStyleItem::updateBaselineOffset); connect(qApp, &QApplication::fontChanged, this, &KQuickStyleItem::updateSizeHint, Qt::QueuedConnection); } KQuickStyleItem::~KQuickStyleItem() { if (const QStyleOptionButton *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionViewItem *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionHeader *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionToolButton *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionToolBar *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionTab *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionFrame *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionFocusRect *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionTabWidgetFrame *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionMenuItem *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionComboBox *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionSpinBox *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionSlider *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionProgressBar *aux = qstyleoption_cast(m_styleoption)) delete aux; else if (const QStyleOptionGroupBox *aux = qstyleoption_cast(m_styleoption)) delete aux; else delete m_styleoption; m_styleoption = nullptr; } void KQuickStyleItem::initStyleOption() { if (!m_theme) { m_theme = static_cast(qmlAttachedPropertiesObject(this, true)); Q_ASSERT(m_theme); connect(m_theme, &Kirigami::PlatformTheme::colorsChanged, this, [this]() { //we need to reset the palette event if Qt::AA_SetPalette attribute has been set m_styleoption->palette = m_theme->palette(); updateItem(); }); } Q_ASSERT(m_theme); if (m_styleoption) m_styleoption->state = {}; QString sizeHint = m_hints.value(QStringLiteral("size")).toString(); bool needsResolvePalette = true; switch (m_itemType) { case Button: { if (!m_styleoption) m_styleoption = new QStyleOptionButton(); QStyleOptionButton *opt = qstyleoption_cast(m_styleoption); opt->text = text(); const QVariant icon = m_properties[QStringLiteral("icon")]; if (icon.canConvert()) { opt->icon = icon.value(); } else if (icon.canConvert() && icon.value().isLocalFile()) { opt->icon = QIcon(icon.value().toLocalFile()); } else if (icon.canConvert()) { opt->icon = m_theme->iconFromTheme(icon.value(), m_properties[QStringLiteral("iconColor")].value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; opt->features = activeControl() == QLatin1String("default") ? QStyleOptionButton::DefaultButton : QStyleOptionButton::None; if (m_properties[QStringLiteral("flat")].toBool()) { opt->features |= QStyleOptionButton::Flat; } const QFont font = qApp->font("QPushButton"); opt->fontMetrics = QFontMetrics(font); QObject * menu = m_properties[QStringLiteral("menu")].value(); if (menu) { opt->features |= QStyleOptionButton::HasMenu; } } break; case ItemRow: { if (!m_styleoption) m_styleoption = new QStyleOptionViewItem(); QStyleOptionViewItem *opt = qstyleoption_cast(m_styleoption); opt->features = {}; if (activeControl() == QLatin1String("alternate")) opt->features |= QStyleOptionViewItem::Alternate; } break; case Splitter: { if (!m_styleoption) { m_styleoption = new QStyleOption; } } break; case Item: { if (!m_styleoption) { m_styleoption = new QStyleOptionViewItem(); } QStyleOptionViewItem *opt = qstyleoption_cast(m_styleoption); opt->features = QStyleOptionViewItem::HasDisplay; opt->text = text(); opt->textElideMode = Qt::ElideRight; opt->displayAlignment = Qt::AlignLeft | Qt::AlignVCenter; opt->decorationAlignment = Qt::AlignCenter; resolvePalette(); needsResolvePalette = false; QPalette pal = m_styleoption->palette; pal.setBrush(QPalette::Base, Qt::NoBrush); m_styleoption->palette = pal; const QFont font = qApp->font("QAbstractItemView"); opt->font = font; opt->fontMetrics = QFontMetrics(font); break; } case ItemBranchIndicator: { if (!m_styleoption) m_styleoption = new QStyleOption; m_styleoption->state = QStyle::State_Item; // We don't want to fully support Win 95 if (m_properties.value(QStringLiteral("hasChildren")).toBool()) m_styleoption->state |= QStyle::State_Children; if (m_properties.value(QStringLiteral("hasSibling")).toBool()) // Even this one could go away m_styleoption->state |= QStyle::State_Sibling; if (m_on) m_styleoption->state |= QStyle::State_Open; } break; case Header: { if (!m_styleoption) m_styleoption = new QStyleOptionHeader(); QStyleOptionHeader *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->textAlignment = static_cast(m_properties.value(QStringLiteral("textalignment")).toInt()); opt->sortIndicator = activeControl() == QLatin1String("down") ? QStyleOptionHeader::SortDown : activeControl() == QLatin1String("up") ? QStyleOptionHeader::SortUp : QStyleOptionHeader::None; QString headerpos = m_properties.value(QStringLiteral("headerpos")).toString(); if (headerpos == QLatin1String("beginning")) opt->position = QStyleOptionHeader::Beginning; else if (headerpos == QLatin1String("end")) opt->position = QStyleOptionHeader::End; else if (headerpos == QLatin1String("only")) opt->position = QStyleOptionHeader::OnlyOneSection; else opt->position = QStyleOptionHeader::Middle; const QFont font = qApp->font("QHeaderView"); opt->fontMetrics = QFontMetrics(font); } break; case ToolButton: { if (!m_styleoption) m_styleoption = new QStyleOptionToolButton(); QStyleOptionToolButton *opt = qstyleoption_cast(m_styleoption); opt->subControls = QStyle::SC_ToolButton; opt->state |= QStyle::State_AutoRaise; opt->activeSubControls = QStyle::SC_ToolButton; opt->text = text(); const QVariant icon = m_properties[QStringLiteral("icon")]; if (icon.canConvert()) { opt->icon = icon.value(); } else if (icon.canConvert()) { opt->icon = m_theme->iconFromTheme(icon.value(), m_properties[QStringLiteral("iconColor")].value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ToolBarIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; if (m_properties.value(QStringLiteral("menu")).toBool()) { opt->subControls |= QStyle::SC_ToolButtonMenu; opt->features = QStyleOptionToolButton::HasMenu; } const int toolButtonStyle = m_properties.value(QStringLiteral("toolButtonStyle")).toInt(); switch (toolButtonStyle) { case Qt::ToolButtonIconOnly: case Qt::ToolButtonTextOnly: case Qt::ToolButtonTextBesideIcon: case Qt::ToolButtonTextUnderIcon: case Qt::ToolButtonFollowStyle: opt->toolButtonStyle = (Qt::ToolButtonStyle)toolButtonStyle; break; default: opt->toolButtonStyle = Qt::ToolButtonFollowStyle; } const QFont font = qApp->font("QToolButton"); opt->font = font; opt->fontMetrics = QFontMetrics(font); } break; case ToolBar: { if (!m_styleoption) m_styleoption = new QStyleOptionToolBar(); } break; case Tab: { if (!m_styleoption) m_styleoption = new QStyleOptionTab(); QStyleOptionTab *opt = qstyleoption_cast(m_styleoption); opt->text = text(); if (m_properties.value(QStringLiteral("hasFrame")).toBool()) opt->features |= QStyleOptionTab::HasFrame; QString orientation = m_properties.value(QStringLiteral("orientation")).toString(); QString position = m_properties.value(QStringLiteral("tabpos")).toString(); QString selectedPosition = m_properties.value(QStringLiteral("selectedpos")).toString(); opt->shape = orientation == QLatin1String("Bottom") ? QTabBar::RoundedSouth : QTabBar::RoundedNorth; if (position == QLatin1String("beginning")) opt->position = QStyleOptionTab::Beginning; else if (position == QLatin1String("end")) opt->position = QStyleOptionTab::End; else if (position == QLatin1String("only")) opt->position = QStyleOptionTab::OnlyOneTab; else opt->position = QStyleOptionTab::Middle; if (selectedPosition == QLatin1String("next")) opt->selectedPosition = QStyleOptionTab::NextIsSelected; else if (selectedPosition == QLatin1String("previous")) opt->selectedPosition = QStyleOptionTab::PreviousIsSelected; else opt->selectedPosition = QStyleOptionTab::NotAdjacent; } break; case Frame: { if (!m_styleoption) m_styleoption = new QStyleOptionFrame(); QStyleOptionFrame *opt = qstyleoption_cast(m_styleoption); opt->frameShape = QFrame::StyledPanel; opt->lineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); opt->midLineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); } break; case FocusRect: { if (!m_styleoption) m_styleoption = new QStyleOptionFocusRect(); // Needed on windows m_styleoption->state |= QStyle::State_KeyboardFocusChange; } break; case TabFrame: { if (!m_styleoption) m_styleoption = new QStyleOptionTabWidgetFrame(); QStyleOptionTabWidgetFrame *opt = qstyleoption_cast(m_styleoption); opt->selectedTabRect = m_properties[QStringLiteral("selectedTabRect")].toRect(); opt->shape = m_properties[QStringLiteral("orientation")] == Qt::BottomEdge ? QTabBar::RoundedSouth : QTabBar::RoundedNorth; if (minimum()) opt->selectedTabRect = QRect(value(), 0, minimum(), height()); opt->tabBarSize = QSize(minimum() , height()); // oxygen style needs this hack opt->leftCornerWidgetSize = QSize(value(), 0); } break; case MenuBar: if (!m_styleoption) { QStyleOptionMenuItem *menuOpt = new QStyleOptionMenuItem(); menuOpt->menuItemType = QStyleOptionMenuItem::EmptyArea; m_styleoption = menuOpt; } break; case MenuBarItem: { if (!m_styleoption) m_styleoption = new QStyleOptionMenuItem(); QStyleOptionMenuItem *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->menuItemType = QStyleOptionMenuItem::Normal; setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool()); const QFont font = qApp->font("QMenuBar"); opt->font = font; opt->fontMetrics = QFontMetrics(font); m_font = opt->font; } break; case Menu: { if (!m_styleoption) m_styleoption = new QStyleOptionMenuItem(); } break; case MenuItem: case ComboBoxItem: { if (!m_styleoption) m_styleoption = new QStyleOptionMenuItem(); QStyleOptionMenuItem *opt = qstyleoption_cast(m_styleoption); // For GTK style. See below, in setElementType() setProperty("_q_isComboBoxPopupItem", m_itemType == ComboBoxItem); KQuickStyleItem::MenuItemType type = static_cast(m_properties[QStringLiteral("type")].toInt()); if (type == KQuickStyleItem::ScrollIndicatorType) { int scrollerDirection = m_properties[QStringLiteral("scrollerDirection")].toInt(); opt->menuItemType = QStyleOptionMenuItem::Scroller; opt->state |= scrollerDirection == Qt::UpArrow ? QStyle::State_UpArrow : QStyle::State_DownArrow; } else if (type == KQuickStyleItem::SeparatorType) { opt->menuItemType = QStyleOptionMenuItem::Separator; } else { opt->text = text(); if (type == KQuickStyleItem::MenuType) { opt->menuItemType = QStyleOptionMenuItem::SubMenu; } else { opt->menuItemType = QStyleOptionMenuItem::Normal; QString shortcut = m_properties[QStringLiteral("shortcut")].toString(); if (!shortcut.isEmpty()) { opt->text += QLatin1Char('\t') + shortcut; opt->tabWidth = qMax(opt->tabWidth, qRound(textWidth(shortcut))); } if (m_properties[QStringLiteral("checkable")].toBool()) { opt->checked = on(); QVariant exclusive = m_properties[QStringLiteral("exclusive")]; opt->checkType = exclusive.toBool() ? QStyleOptionMenuItem::Exclusive : QStyleOptionMenuItem::NonExclusive; } } if (m_properties[QStringLiteral("icon")].canConvert()) opt->icon = m_properties[QStringLiteral("icon")].value(); setProperty("_q_showUnderlined", m_hints[QStringLiteral("showUnderlined")].toBool()); const QFont font = qApp->font(m_itemType == ComboBoxItem ?"QComboMenuItem" : "QMenu"); opt->font = font; opt->fontMetrics = QFontMetrics(font); m_font = opt->font; } } break; case CheckBox: case RadioButton: { if (!m_styleoption) m_styleoption = new QStyleOptionButton(); QStyleOptionButton *opt = qstyleoption_cast(m_styleoption); if (!on()) opt->state |= QStyle::State_Off; if (m_properties.value(QStringLiteral("partiallyChecked")).toBool()) opt->state |= QStyle::State_NoChange; opt->text = text(); } break; case Edit: { if (!m_styleoption) m_styleoption = new QStyleOptionFrame(); QStyleOptionFrame *opt = qstyleoption_cast(m_styleoption); opt->lineWidth = qMax(1, KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr)); //this must be non zero } break; case ComboBox :{ if (!m_styleoption) m_styleoption = new QStyleOptionComboBox(); QStyleOptionComboBox *opt = qstyleoption_cast(m_styleoption); const QFont font = qApp->font("QPushButton"); //DAVE - QQC1 code does this, but if you look at QComboBox this doesn't make sense opt->fontMetrics = QFontMetrics(font); opt->currentText = text(); opt->editable = m_properties[QStringLiteral("editable")].toBool(); const QVariant icon = m_properties[QStringLiteral("currentIcon")]; if (icon.canConvert()) { opt->currentIcon = icon.value(); } else if (icon.canConvert()) { opt->currentIcon = m_theme->iconFromTheme(icon.value(), m_properties[QStringLiteral("iconColor")].value()); } auto iconSize = QSize(m_properties[QStringLiteral("iconWidth")].toInt(), m_properties[QStringLiteral("iconHeight")].toInt()); if (iconSize.isEmpty()) { int e = KQuickStyleItem::style()->pixelMetric(QStyle::PM_ButtonIconSize, m_styleoption, nullptr); if (iconSize.width() <= 0) { iconSize.setWidth(e); } if (iconSize.height() <= 0) { iconSize.setHeight(e); } } opt->iconSize = iconSize; } break; case SpinBox: { if (!m_styleoption) m_styleoption = new QStyleOptionSpinBox(); QStyleOptionSpinBox *opt = qstyleoption_cast(m_styleoption); opt->frame = true; opt->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; if (value() & 0x1) opt->activeSubControls = QStyle::SC_SpinBoxUp; else if (value() & (1<<1)) opt->activeSubControls = QStyle::SC_SpinBoxDown; opt->subControls = QStyle::SC_All; opt->stepEnabled = {}; if (value() & (1<<2)) opt->stepEnabled |= QAbstractSpinBox::StepUpEnabled; if (value() & (1<<3)) opt->stepEnabled |= QAbstractSpinBox::StepDownEnabled; } break; case Slider: case Dial: { if (!m_styleoption) m_styleoption = new QStyleOptionSlider(); QStyleOptionSlider *opt = qstyleoption_cast(m_styleoption); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; opt->upsideDown = !horizontal(); int min = minimum(); int max = std::max(min, maximum()); opt->minimum = min; opt->maximum = max; opt->sliderPosition = value(); opt->singleStep = step(); if (opt->singleStep) { qreal numOfSteps = (opt->maximum - opt->minimum) / opt->singleStep; // at least 5 pixels between tick marks qreal extent = horizontal() ? width() : height(); if (numOfSteps && (extent / numOfSteps < 5)) opt->tickInterval = qRound((5 * numOfSteps / extent) + 0.5) * step(); else opt->tickInterval = opt->singleStep; } else // default Qt-components implementation opt->tickInterval = opt->maximum != opt->minimum ? 1200 / (opt->maximum - opt->minimum) : 0; opt->sliderValue = value(); opt->subControls = QStyle::SC_SliderGroove | QStyle::SC_SliderHandle; opt->tickPosition = activeControl() == QLatin1String("ticks") ? QSlider::TicksBelow : QSlider::NoTicks; if (opt->tickPosition != QSlider::NoTicks) opt->subControls |= QStyle::SC_SliderTickmarks; opt->activeSubControls = QStyle::SC_SliderHandle; } break; case ProgressBar: { if (!m_styleoption) m_styleoption = new QStyleOptionProgressBar(); QStyleOptionProgressBar *opt = qstyleoption_cast(m_styleoption); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; opt->minimum = qMax(0, minimum()); opt->maximum = qMax(0, maximum()); opt->progress = value(); } break; case GroupBox: { if (!m_styleoption) m_styleoption = new QStyleOptionGroupBox(); QStyleOptionGroupBox *opt = qstyleoption_cast(m_styleoption); opt->text = text(); opt->lineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); opt->subControls = QStyle::SC_GroupBoxLabel; opt->features = {}; if (m_properties[QStringLiteral("sunken")].toBool()) { // Qt draws an ugly line here so I ignore it opt->subControls |= QStyle::SC_GroupBoxFrame; } else { opt->features |= QStyleOptionFrame::Flat; } if (m_properties[QStringLiteral("checkable")].toBool()) opt->subControls |= QStyle::SC_GroupBoxCheckBox; } break; case ScrollBar: { if (!m_styleoption) m_styleoption = new QStyleOptionSlider(); QStyleOptionSlider *opt = qstyleoption_cast(m_styleoption); opt->minimum = qMax(0, minimum()); opt->maximum = qMax(0, maximum()); opt->pageStep = qMax(0, int(horizontal() ? width() : height())); opt->orientation = horizontal() ? Qt::Horizontal : Qt::Vertical; opt->sliderPosition = value(); opt->sliderValue = value(); opt->activeSubControls = (activeControl() == QLatin1String("up")) ? QStyle::SC_ScrollBarSubLine : (activeControl() == QLatin1String("down")) ? QStyle::SC_ScrollBarAddLine : (activeControl() == QLatin1String("handle")) ? QStyle::SC_ScrollBarSlider : hover() ? QStyle::SC_ScrollBarGroove : QStyle::SC_None; if (raised()) opt->state |= QStyle::State_On; opt->sliderValue = value(); opt->subControls = QStyle::SC_All; setTransient(KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_Transient, m_styleoption)); break; } default: break; } if (!m_styleoption) m_styleoption = new QStyleOption(); if (needsResolvePalette) resolvePalette(); m_styleoption->styleObject = this; m_styleoption->direction = qApp->layoutDirection(); int w = m_textureWidth > 0 ? m_textureWidth : width(); int h = m_textureHeight > 0 ? m_textureHeight : height(); m_styleoption->rect = QRect(m_paintMargins, 0, w - 2* m_paintMargins, h); if (isEnabled()) { m_styleoption->state |= QStyle::State_Enabled; m_styleoption->palette.setCurrentColorGroup(QPalette::Active); } else { m_styleoption->palette.setCurrentColorGroup(QPalette::Disabled); } if (m_active) m_styleoption->state |= QStyle::State_Active; else m_styleoption->palette.setCurrentColorGroup(QPalette::Inactive); if (m_sunken) m_styleoption->state |= QStyle::State_Sunken; if (m_raised) m_styleoption->state |= QStyle::State_Raised; if (m_selected) m_styleoption->state |= QStyle::State_Selected; if (m_focus) m_styleoption->state |= QStyle::State_HasFocus; if (m_on) m_styleoption->state |= QStyle::State_On; if (m_hover) m_styleoption->state |= QStyle::State_MouseOver; if (m_horizontal) m_styleoption->state |= QStyle::State_Horizontal; // some styles don't draw a focus rectangle if // QStyle::State_KeyboardFocusChange is not set if (window()) { if (m_lastFocusReason == Qt::TabFocusReason || m_lastFocusReason == Qt::BacktabFocusReason) { m_styleoption->state |= QStyle::State_KeyboardFocusChange; } } if (sizeHint == QLatin1String("mini")) { m_styleoption->state |= QStyle::State_Mini; } else if (sizeHint == QLatin1String("small")) { m_styleoption->state |= QStyle::State_Small; } } const char* KQuickStyleItem::classNameForItem() const { switch(m_itemType) { case Button: return "QPushButton"; case RadioButton: return "QRadioButton"; case CheckBox: return "QCheckBox"; case ComboBox: return "QComboBox"; case ComboBoxItem: return "QComboMenuItem"; case ToolBar: return ""; case ToolButton: return "QToolButton"; case Tab: return "QTabButton"; case TabFrame: return "QTabBar"; case Edit: return "QTextEdit"; case GroupBox: return "QGroupBox"; case Header: return "QHeaderView"; case Item: case ItemRow: return "QAbstractItemView"; case Menu: case MenuItem: return "QMenu"; case MenuBar: case MenuBarItem: return "QMenuBar"; default: return ""; } Q_UNREACHABLE(); } void KQuickStyleItem::resolvePalette() { if (QCoreApplication::testAttribute(Qt::AA_SetPalette)) return; const QVariant controlPalette = m_control ? m_control->property("palette") : QVariant(); if (controlPalette.isValid()) { m_styleoption->palette = controlPalette.value(); } else { m_styleoption->palette = m_theme->palette(); } } int KQuickStyleItem::leftPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return cr.left() - m_styleoption->rect.left(); } default: return 0; } } int KQuickStyleItem::topPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return cr.top() - m_styleoption->rect.top(); } default: return 0; } } int KQuickStyleItem::rightPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return m_styleoption->rect.right() - cr.right(); } default: return 0; } } int KQuickStyleItem::bottomPadding() const { switch (m_itemType) { case Frame: { const QRect cr = KQuickStyleItem::style()->subElementRect(QStyle::SE_ShapedFrameContents, m_styleoption); return m_styleoption->rect.bottom() - cr.bottom(); } default: return 0; } } /* * Property style * * Returns a simplified style name. * * QMacStyle = "mac" * QWindowsXPStyle = "windowsxp" * QFusionStyle = "fusion" */ QString KQuickStyleItem::styleName() const { QString style = QString::fromLatin1(KQuickStyleItem::style()->metaObject()->className()); style = style.toLower(); if (style.startsWith(QLatin1Char('q'))) style = style.right(style.length() - 1); if (style.endsWith(QLatin1String("style"))) style = style.left(style.length() - 5); return style; } QString KQuickStyleItem::hitTest(int px, int py) { QStyle::SubControl subcontrol = QStyle::SC_All; switch (m_itemType) { case SpinBox :{ subcontrol = KQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SpinBoxUp) return QStringLiteral("up"); else if (subcontrol == QStyle::SC_SpinBoxDown) return QStringLiteral("down"); } break; case Slider: { subcontrol = KQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_Slider, qstyleoption_cast(m_styleoption), QPoint(px,py), nullptr); if (subcontrol == QStyle::SC_SliderHandle) return QStringLiteral("handle"); } break; case ScrollBar: { subcontrol = KQuickStyleItem::style()->hitTestComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast(m_styleoption), QPoint(px,py), nullptr); switch (subcontrol) { case QStyle::SC_ScrollBarSlider: return QStringLiteral("handle"); case QStyle::SC_ScrollBarSubLine: return QStringLiteral("up"); case QStyle::SC_ScrollBarSubPage: return QStringLiteral("upPage"); case QStyle::SC_ScrollBarAddLine: return QStringLiteral("down"); case QStyle::SC_ScrollBarAddPage: return QStringLiteral("downPage"); default: break; } } break; default: break; } return QStringLiteral("none"); } QSize KQuickStyleItem::sizeFromContents(int width, int height) { initStyleOption(); QSize size; switch (m_itemType) { case RadioButton: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_RadioButton, m_styleoption, QSize(width,height)); break; case CheckBox: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_CheckBox, m_styleoption, QSize(width,height)); break; case ToolBar: size = QSize(200, styleName().contains(QLatin1String("windows")) ? 30 : 42); break; case ToolButton: { QStyleOptionToolButton *btn = qstyleoption_cast(m_styleoption); int w = 0; int h = 0; if (btn->toolButtonStyle != Qt::ToolButtonTextOnly) { QSize icon = btn->iconSize; w = icon.width(); h = icon.height(); } if (btn->toolButtonStyle != Qt::ToolButtonIconOnly) { QSize textSize = btn->fontMetrics.size(Qt::TextShowMnemonic, btn->text); textSize.setWidth(textSize.width() + btn->fontMetrics.horizontalAdvance(QLatin1Char(' '))*2); if (btn->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { h += 4 + textSize.height(); if (textSize.width() > w) w = textSize.width(); } else if (btn->toolButtonStyle == Qt::ToolButtonTextBesideIcon) { w += 4 + textSize.width(); if (textSize.height() > h) h = textSize.height(); } else { // TextOnly w = textSize.width(); h = textSize.height(); } } btn->rect.setSize(QSize(w, h)); size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ToolButton, m_styleoption, QSize(w, h)); } break; case Button: { QStyleOptionButton *btn = qstyleoption_cast(m_styleoption); int contentWidth = btn->fontMetrics.boundingRect(btn->text).width(); int contentHeight = btn->fontMetrics.height(); if (!btn->icon.isNull()) { //+4 matches a hardcoded value in QStyle and acts as a margin between the icon and the text. contentWidth += btn->iconSize.width() + 4; contentHeight = qMax(btn->fontMetrics.height(), btn->iconSize.height()); } int newWidth = qMax(width, contentWidth); int newHeight = qMax(height, contentHeight); size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_PushButton, m_styleoption, QSize(newWidth, newHeight)); } break; case ComboBox: { QStyleOptionComboBox *btn = qstyleoption_cast(m_styleoption); int newWidth = qMax(width, btn->fontMetrics.boundingRect(btn->currentText).width()); int newHeight = qMax(height, btn->fontMetrics.height()); size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ComboBox, m_styleoption, QSize(newWidth, newHeight)); } break; case Tab: { QStyleOptionTab *tab = qstyleoption_cast(m_styleoption); int contentWidth = tab->fontMetrics.boundingRect(tab->text).width(); int contentHeight = tab->fontMetrics.height(); if (!tab->icon.isNull()) { //+4 matches a hardcoded value in QStyle and acts as a margin between the icon and the text. contentWidth += tab->iconSize.width() + 4; contentHeight = qMax(contentHeight, tab->iconSize.height()); } contentWidth += KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabHSpace, tab); contentHeight += KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabVSpace, tab); const int newWidth = qMax(width, contentWidth); const int newHeight = qMax(height, contentHeight); size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_TabBarTab, m_styleoption, QSize(newWidth, newHeight)); break; } case Slider: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_Slider, m_styleoption, QSize(width,height)); break; case ProgressBar: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ProgressBar, m_styleoption, QSize(width,height)); break; case SpinBox: case Edit: { // We have to create a new style option since we might be calling with a QStyleOptionSpinBox QStyleOptionFrame frame; //+2 to be consistent with the hardcoded verticalmargin in QLineEdit int contentHeight = frame.fontMetrics.height() + 2; frame.state = m_styleoption->state | QStyle::State_Sunken; frame.lineWidth = KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption, nullptr); frame.rect = m_styleoption->rect; frame.styleObject = this; size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_LineEdit, &frame, QSize(width, qMax(height, contentHeight)).expandedTo(QApplication::globalStrut())); if (m_itemType == SpinBox) { size.setWidth(KQuickStyleItem::style()->sizeFromContents(QStyle::CT_SpinBox, m_styleoption, QSize(width + 2, height)).width()); } } break; case GroupBox: { QStyleOptionGroupBox *box = qstyleoption_cast(m_styleoption); QFontMetrics metrics(box->fontMetrics); int baseWidth = metrics.boundingRect(box->text + QLatin1Char(' ')).width(); int baseHeight = metrics.height() + m_contentHeight; if (box->subControls & QStyle::SC_GroupBoxCheckBox) { baseWidth += KQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorWidth); baseWidth += KQuickStyleItem::style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing); baseHeight = qMax(baseHeight, KQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorHeight)); } size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_GroupBox, m_styleoption, QSize(qMax(baseWidth, m_contentWidth), baseHeight)); } break; case Header: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_HeaderSection, m_styleoption, QSize(width,height)); break; case ItemRow: case Item: //fall through size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_ItemViewItem, m_styleoption, QSize(width,height)); break; case MenuBarItem: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuBarItem, m_styleoption, QSize(width,height)); break; case MenuBar: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuBar, m_styleoption, QSize(width,height)); break; case Menu: size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_Menu, m_styleoption, QSize(width,height)); break; case MenuItem: case ComboBoxItem: if (static_cast(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller) { size.setHeight(qMax(QApplication::globalStrut().height(), KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, nullptr))); } else { size = KQuickStyleItem::style()->sizeFromContents(QStyle::CT_MenuItem, m_styleoption, QSize(width,height)); } break; default: break; } return size.expandedTo(QSize(m_contentWidth, m_contentHeight)); } qreal KQuickStyleItem::baselineOffset() { QRect r; bool ceilResult = true; // By default baseline offset rounding is done upwards switch (m_itemType) { case RadioButton: r = KQuickStyleItem::style()->subElementRect(QStyle::SE_RadioButtonContents, m_styleoption); break; case Button: r = KQuickStyleItem::style()->subElementRect(QStyle::SE_PushButtonContents, m_styleoption); break; case CheckBox: r = KQuickStyleItem::style()->subElementRect(QStyle::SE_CheckBoxContents, m_styleoption); break; case Edit: r = KQuickStyleItem::style()->subElementRect(QStyle::SE_LineEditContents, m_styleoption); break; case ComboBox: if (const QStyleOptionComboBox *combo = qstyleoption_cast(m_styleoption)) { r = KQuickStyleItem::style()->subControlRect(QStyle::CC_ComboBox, combo, QStyle::SC_ComboBoxEditField); if (styleName() != QLatin1String("mac")) r.adjust(0,0,0,1); } break; case SpinBox: if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast(m_styleoption)) { r = KQuickStyleItem::style()->subControlRect(QStyle::CC_SpinBox, spinbox, QStyle::SC_SpinBoxEditField); ceilResult = false; } break; default: break; } if (r.height() > 0) { const QFontMetrics &fm = m_styleoption->fontMetrics; int surplus = r.height() - fm.height(); if ((surplus & 1) && ceilResult) surplus++; int result = r.top() + surplus/2 + fm.ascent(); return result; } return 0.; } void KQuickStyleItem::updateBaselineOffset() { const qreal baseline = baselineOffset(); if (baseline > 0) setBaselineOffset(baseline); } void KQuickStyleItem::setContentWidth(int arg) { if (m_contentWidth != arg) { m_contentWidth = arg; emit contentWidthChanged(arg); } } void KQuickStyleItem::setContentHeight(int arg) { if (m_contentHeight != arg) { m_contentHeight = arg; emit contentHeightChanged(arg); } } void KQuickStyleItem::updateSizeHint() { QSize implicitSize = sizeFromContents(m_contentWidth, m_contentHeight); setImplicitSize(implicitSize.width(), implicitSize.height()); } void KQuickStyleItem::updateRect() { initStyleOption(); m_styleoption->rect.setWidth(width()); m_styleoption->rect.setHeight(height()); } int KQuickStyleItem::pixelMetric(const QString &metric) { if (metric == QLatin1String("scrollbarExtent")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollBarExtent, nullptr); else if (metric == QLatin1String("defaultframewidth")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, m_styleoption); else if (metric == QLatin1String("taboverlap")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabOverlap, nullptr); else if (metric == QLatin1String("tabbaseoverlap")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseOverlap, m_styleoption); else if (metric == QLatin1String("tabhspace")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabHSpace, nullptr); else if (metric == QLatin1String("indicatorwidth")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_IndicatorWidth, nullptr); else if (metric == QLatin1String("exclusiveindicatorwidth")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorWidth, nullptr); else if (metric == QLatin1String("checkboxlabelspacing")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_CheckBoxLabelSpacing, nullptr); else if (metric == QLatin1String("ratiobuttonlabelspacing")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_RadioButtonLabelSpacing, nullptr); else if (metric == QLatin1String("tabvspace")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabVSpace, nullptr); else if (metric == QLatin1String("tabbaseheight")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarBaseHeight, nullptr); else if (metric == QLatin1String("tabvshift")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TabBarTabShiftVertical, nullptr); else if (metric == QLatin1String("menubarhmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarHMargin, nullptr); else if (metric == QLatin1String("menubarvmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarVMargin, nullptr); else if (metric == QLatin1String("menubarpanelwidth")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarPanelWidth, nullptr); else if (metric == QLatin1String("menubaritemspacing")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuBarItemSpacing, nullptr); else if (metric == QLatin1String("spacebelowmenubar")) return KQuickStyleItem::style()->styleHint(QStyle::SH_MainWindow_SpaceBelowMenuBar, m_styleoption); else if (metric == QLatin1String("menuhmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuHMargin, nullptr); else if (metric == QLatin1String("menuvmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuVMargin, nullptr); else if (metric == QLatin1String("menupanelwidth")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth, nullptr); else if (metric == QLatin1String("submenuoverlap")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_SubMenuOverlap, nullptr); else if (metric == QLatin1String("splitterwidth")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_SplitterWidth, nullptr); else if (metric == QLatin1String("scrollbarspacing")) return abs(KQuickStyleItem::style()->pixelMetric(QStyle::PM_ScrollView_ScrollBarSpacing, nullptr)); else if (metric == QLatin1String("treeviewindentation")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_TreeViewIndentation, nullptr); else if (metric == QLatin1String("layouthorizontalspacing")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutHorizontalSpacing, nullptr); else if (metric == QLatin1String("layoutverticalspacing")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutVerticalSpacing, nullptr); else if (metric == QLatin1String("layoutleftmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutLeftMargin, nullptr); else if (metric == QLatin1String("layouttopmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutTopMargin, nullptr); else if (metric == QLatin1String("layoutrightmargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutRightMargin, nullptr); else if (metric == QLatin1String("layoutbottommargin")) return KQuickStyleItem::style()->pixelMetric(QStyle::PM_LayoutBottomMargin, nullptr); return 0; } QVariant KQuickStyleItem::styleHint(const QString &metric) { initStyleOption(); if (metric == QLatin1String("comboboxpopup")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_ComboBox_Popup, m_styleoption); } else if (metric == QLatin1String("highlightedTextColor")) { return m_styleoption->palette.highlightedText().color().name(); } else if (metric == QLatin1String("textColor")) { QPalette pal = m_styleoption->palette; pal.setCurrentColorGroup(active()? QPalette::Active : QPalette::Inactive); return pal.text().color().name(); } else if (metric == QLatin1String("focuswidget")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_FocusFrame_AboveWidget); } else if (metric == QLatin1String("tabbaralignment")) { int result = KQuickStyleItem::style()->styleHint(QStyle::SH_TabBar_Alignment); if (result == Qt::AlignCenter) return QStringLiteral("center"); return QStringLiteral("left"); } else if (metric == QLatin1String("externalScrollBars")) { return KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents); } else if (metric == QLatin1String("scrollToClickPosition")) return KQuickStyleItem::style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition); else if (metric == QLatin1String("activateItemOnSingleClick")) return KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick); else if (metric == QLatin1String("submenupopupdelay")) return KQuickStyleItem::style()->styleHint(QStyle::SH_Menu_SubMenuPopupDelay, m_styleoption); else if (metric == QLatin1String("wheelScrollLines")) return qApp->wheelScrollLines(); return 0; // Add SH_Menu_SpaceActivatesItem } void KQuickStyleItem::setHints(const QVariantMap &str) { if (m_hints != str) { m_hints = str; initStyleOption(); updateSizeHint(); if (m_styleoption->state & QStyle::State_Mini) { m_font.setPointSize(9.); emit fontChanged(); } else if (m_styleoption->state & QStyle::State_Small) { m_font.setPointSize(11.); emit fontChanged(); } else { emit hintChanged(); } } } void KQuickStyleItem::resetHints() { m_hints.clear(); } void KQuickStyleItem::setElementType(const QString &str) { if (m_type == str) return; m_type = str; emit elementTypeChanged(); if (m_styleoption) { delete m_styleoption; m_styleoption = nullptr; } // Only enable visible if the widget can animate if (str == QLatin1String("menu")) { m_itemType = Menu; } else if (str == QLatin1String("menuitem")) { m_itemType = MenuItem; } else if (str == QLatin1String("item") || str == QLatin1String("itemrow") || str == QLatin1String("header")) { if (str == QLatin1String("header")) { m_itemType = Header; } else { m_itemType = str == QLatin1String("item") ? Item : ItemRow; } } else if (str == QLatin1String("itembranchindicator")) { m_itemType = ItemBranchIndicator; } else if (str == QLatin1String("groupbox")) { m_itemType = GroupBox; } else if (str == QLatin1String("tab")) { m_itemType = Tab; } else if (str == QLatin1String("tabframe")) { m_itemType = TabFrame; } else if (str == QLatin1String("comboboxitem")) { // Gtk uses qobject cast, hence we need to separate this from menuitem // On mac, we temporarily use the menu item because it has more accurate // palette. m_itemType = ComboBoxItem; } else if (str == QLatin1String("toolbar")) { m_itemType = ToolBar; } else if (str == QLatin1String("toolbutton")) { m_itemType = ToolButton; } else if (str == QLatin1String("slider")) { m_itemType = Slider; } else if (str == QLatin1String("frame")) { m_itemType = Frame; } else if (str == QLatin1String("combobox")) { m_itemType = ComboBox; } else if (str == QLatin1String("splitter")) { m_itemType = Splitter; } else if (str == QLatin1String("progressbar")) { m_itemType = ProgressBar; } else if (str == QLatin1String("button")) { m_itemType = Button; } else if (str == QLatin1String("checkbox")) { m_itemType = CheckBox; } else if (str == QLatin1String("radiobutton")) { m_itemType = RadioButton; } else if (str == QLatin1String("edit")) { m_itemType = Edit; } else if (str == QLatin1String("spinbox")) { m_itemType = SpinBox; } else if (str == QLatin1String("scrollbar")) { m_itemType = ScrollBar; } else if (str == QLatin1String("widget")) { m_itemType = Widget; } else if (str == QLatin1String("focusframe")) { m_itemType = FocusFrame; } else if (str == QLatin1String("focusrect")) { m_itemType = FocusRect; } else if (str == QLatin1String("dial")) { m_itemType = Dial; } else if (str == QLatin1String("statusbar")) { m_itemType = StatusBar; } else if (str == QLatin1String("machelpbutton")) { m_itemType = MacHelpButton; } else if (str == QLatin1String("scrollareacorner")) { m_itemType = ScrollAreaCorner; } else if (str == QLatin1String("menubar")) { m_itemType = MenuBar; } else if (str == QLatin1String("menubaritem")) { m_itemType = MenuBarItem; } else { m_itemType = Undefined; } emit leftPaddingChanged(); emit rightPaddingChanged(); emit topPaddingChanged(); emit bottomPaddingChanged(); updateSizeHint(); } QRectF KQuickStyleItem::subControlRect(const QString &subcontrolString) { QStyle::SubControl subcontrol = QStyle::SC_None; initStyleOption(); switch (m_itemType) { case SpinBox: { QStyle::ComplexControl control = QStyle::CC_SpinBox; if (subcontrolString == QLatin1String("down")) subcontrol = QStyle::SC_SpinBoxDown; else if (subcontrolString == QLatin1String("up")) subcontrol = QStyle::SC_SpinBoxUp; else if (subcontrolString == QLatin1String("edit")){ subcontrol = QStyle::SC_SpinBoxEditField; } return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast(m_styleoption), subcontrol); } break; case Slider: { QStyle::ComplexControl control = QStyle::CC_Slider; if (subcontrolString == QLatin1String("handle")) subcontrol = QStyle::SC_SliderHandle; else if (subcontrolString == QLatin1String("groove")) subcontrol = QStyle::SC_SliderGroove; return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast(m_styleoption), subcontrol); } break; case ScrollBar: { QStyle::ComplexControl control = QStyle::CC_ScrollBar; if (subcontrolString == QLatin1String("slider")) subcontrol = QStyle::SC_ScrollBarSlider; if (subcontrolString == QLatin1String("groove")) subcontrol = QStyle::SC_ScrollBarGroove; else if (subcontrolString == QLatin1String("handle")) subcontrol = QStyle::SC_ScrollBarSlider; else if (subcontrolString == QLatin1String("add")) subcontrol = QStyle::SC_ScrollBarAddPage; else if (subcontrolString == QLatin1String("sub")) subcontrol = QStyle::SC_ScrollBarSubPage; return KQuickStyleItem::style()->subControlRect(control, qstyleoption_cast(m_styleoption), subcontrol); } break; case ItemBranchIndicator: { QStyleOption opt; opt.rect = QRect(0, 0, implicitWidth(), implicitHeight()); return KQuickStyleItem::style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, nullptr); } default: break; } return QRectF(); } namespace { class QHighDpiPixmapsEnabler1 { public: QHighDpiPixmapsEnabler1() :wasEnabled(false) { if (!qApp->testAttribute(Qt::AA_UseHighDpiPixmaps)) { qApp->setAttribute(Qt::AA_UseHighDpiPixmaps); wasEnabled = true; } } ~QHighDpiPixmapsEnabler1() { if (wasEnabled) qApp->setAttribute(Qt::AA_UseHighDpiPixmaps, false); } private: bool wasEnabled; }; } void KQuickStyleItem::paint(QPainter *painter) { initStyleOption(); if (QStyleOptionMenuItem *opt = qstyleoption_cast(m_styleoption)) painter->setFont(opt->font); else { QFont font; if (m_styleoption->state & QStyle::State_Mini) { font = qApp->font("QMiniFont"); } else if (m_styleoption->state & QStyle::State_Small) { font = qApp->font("QSmallFont"); } painter->setFont(font); } // Set AA_UseHighDpiPixmaps when calling style code to make QIcon return // "retina" pixmaps. The flag is controlled by the application so we can't // set it unconditinally. QHighDpiPixmapsEnabler1 enabler; switch (m_itemType) { case Button: KQuickStyleItem::style()->drawControl(QStyle::CE_PushButton, m_styleoption, painter); break; case ItemRow :{ QPixmap pixmap; // Only draw through style once const QString pmKey = QLatin1String("itemrow") % QString::number(m_styleoption->state,16) % activeControl(); if (!QPixmapCache::find(pmKey, &pixmap) || pixmap.width() < width() || height() != pixmap.height()) { int newSize = width(); pixmap = QPixmap(newSize, height()); pixmap.fill(Qt::transparent); QPainter pixpainter(&pixmap); KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelItemViewRow, m_styleoption, &pixpainter); if ((styleName() == QLatin1String("mac") || !KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected)) && selected()) { QPalette pal = QApplication::palette("QAbstractItemView"); pal.setCurrentColorGroup(m_styleoption->palette.currentColorGroup()); pixpainter.fillRect(m_styleoption->rect, pal.highlight()); } QPixmapCache::insert(pmKey, pixmap); } painter->drawPixmap(0, 0, pixmap); } break; case Item: KQuickStyleItem::style()->drawControl(QStyle::CE_ItemViewItem, m_styleoption, painter); break; case ItemBranchIndicator: KQuickStyleItem::style()->drawPrimitive(QStyle::PE_IndicatorBranch, m_styleoption, painter); break; case Header: KQuickStyleItem::style()->drawControl(QStyle::CE_Header, m_styleoption, painter); break; case ToolButton: KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ToolButton, qstyleoption_cast(m_styleoption), painter); break; case Tab: { if (m_lastFocusReason != Qt::TabFocusReason && m_lastFocusReason != Qt::BacktabFocusReason) { m_styleoption->state &= ~QStyle::State_HasFocus; } KQuickStyleItem::style()->drawControl(QStyle::CE_TabBarTab, m_styleoption, painter); } break; case Frame: m_styleoption->state |= QStyle::State_Sunken; m_styleoption->state &= ~QStyle::State_Raised; KQuickStyleItem::style()->drawControl(QStyle::CE_ShapedFrame, m_styleoption, painter); break; case FocusFrame: KQuickStyleItem::style()->drawControl(QStyle::CE_FocusFrame, m_styleoption, painter); break; case FocusRect: KQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameFocusRect, m_styleoption, painter); break; case TabFrame: KQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameTabWidget, m_styleoption, painter); break; case MenuBar: KQuickStyleItem::style()->drawControl(QStyle::CE_MenuBarEmptyArea, m_styleoption, painter); break; case MenuBarItem: KQuickStyleItem::style()->drawControl(QStyle::CE_MenuBarItem, m_styleoption, painter); break; case MenuItem: case ComboBoxItem: { // fall through QStyle::ControlElement menuElement = static_cast(m_styleoption)->menuItemType == QStyleOptionMenuItem::Scroller ? QStyle::CE_MenuScroller : QStyle::CE_MenuItem; KQuickStyleItem::style()->drawControl(menuElement, m_styleoption, painter); } break; case CheckBox: KQuickStyleItem::style()->drawControl(QStyle::CE_CheckBox, m_styleoption, painter); break; case RadioButton: KQuickStyleItem::style()->drawControl(QStyle::CE_RadioButton, m_styleoption, painter); break; case Edit: KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelLineEdit, m_styleoption, painter); break; case MacHelpButton: //Not managed as mac is not supported break; case Widget: KQuickStyleItem::style()->drawPrimitive(QStyle::PE_Widget, m_styleoption, painter); break; case ScrollAreaCorner: KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelScrollAreaCorner, m_styleoption, painter); break; case Splitter: if (m_styleoption->rect.width() == 1) painter->fillRect(0, 0, width(), height(), m_styleoption->palette.dark().color()); else KQuickStyleItem::style()->drawControl(QStyle::CE_Splitter, m_styleoption, painter); break; case ComboBox: { KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ComboBox, qstyleoption_cast(m_styleoption), painter); // This is needed on mac as it will use the painter color and ignore the palette QPen pen = painter->pen(); painter->setPen(m_styleoption->palette.text().color()); KQuickStyleItem::style()->drawControl(QStyle::CE_ComboBoxLabel, m_styleoption, painter); painter->setPen(pen); } break; case SpinBox: #ifdef Q_OS_MAC // macstyle depends on the embedded qlineedit to fill the editfield background if (styleName() == QLatin1String("mac")) { QRect editRect = KQuickStyleItem::style()->subControlRect(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), QStyle::SC_SpinBoxEditField); painter->fillRect(editRect.adjusted(-1, -1, 1, 1), m_styleoption->palette.base()); } #endif KQuickStyleItem::style()->drawComplexControl(QStyle::CC_SpinBox, qstyleoption_cast(m_styleoption), painter); break; case Slider: KQuickStyleItem::style()->drawComplexControl(QStyle::CC_Slider, qstyleoption_cast(m_styleoption), painter); break; case Dial: KQuickStyleItem::style()->drawComplexControl(QStyle::CC_Dial, qstyleoption_cast(m_styleoption), painter); break; case ProgressBar: KQuickStyleItem::style()->drawControl(QStyle::CE_ProgressBar, m_styleoption, painter); break; case ToolBar: painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color()); KQuickStyleItem::style()->drawControl(QStyle::CE_ToolBar, m_styleoption, painter); painter->save(); painter->setPen(styleName() != QLatin1String("fusion") ? m_styleoption->palette.dark().color().darker(120) : m_styleoption->palette.window().color().lighter(107)); painter->drawLine(m_styleoption->rect.bottomLeft(), m_styleoption->rect.bottomRight()); painter->restore(); break; case StatusBar: { painter->fillRect(m_styleoption->rect, m_styleoption->palette.window().color()); painter->setPen(m_styleoption->palette.dark().color().darker(120)); painter->drawLine(m_styleoption->rect.topLeft(), m_styleoption->rect.topRight()); KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelStatusBar, m_styleoption, painter); } break; case GroupBox: KQuickStyleItem::style()->drawComplexControl(QStyle::CC_GroupBox, qstyleoption_cast(m_styleoption), painter); break; case ScrollBar: KQuickStyleItem::style()->drawComplexControl(QStyle::CC_ScrollBar, qstyleoption_cast(m_styleoption), painter); break; case Menu: { QStyleHintReturnMask val; KQuickStyleItem::style()->styleHint(QStyle::SH_Menu_Mask, m_styleoption, nullptr, &val); painter->save(); painter->setClipRegion(val.region); painter->fillRect(m_styleoption->rect, m_styleoption->palette.window()); painter->restore(); KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelMenu, m_styleoption, painter); if (int fw = KQuickStyleItem::style()->pixelMetric(QStyle::PM_MenuPanelWidth)) { QStyleOptionFrame frame; frame.state = QStyle::State_None; frame.lineWidth = fw; frame.midLineWidth = 0; frame.rect = m_styleoption->rect; frame.styleObject = this; frame.palette = m_styleoption->palette; KQuickStyleItem::style()->drawPrimitive(QStyle::PE_FrameMenu, &frame, painter); } } break; default: break; } } qreal KQuickStyleItem::textWidth(const QString &text) { QFontMetricsF fm = QFontMetricsF(m_styleoption->fontMetrics); return fm.boundingRect(text).width(); } qreal KQuickStyleItem::textHeight(const QString &text) { QFontMetricsF fm = QFontMetricsF(m_styleoption->fontMetrics); return text.isEmpty() ? fm.height() : fm.boundingRect(text).height(); } QString KQuickStyleItem::elidedText(const QString &text, int elideMode, int width) { return m_styleoption->fontMetrics.elidedText(text, Qt::TextElideMode(elideMode), width); } bool KQuickStyleItem::hasThemeIcon(const QString &icon) const { return QIcon::hasThemeIcon(icon); } bool KQuickStyleItem::event(QEvent *ev) { if (ev->type() == QEvent::StyleAnimationUpdate) { if (isVisible()) { ev->accept(); polish(); } return true; } return QQuickItem::event(ev); } void KQuickStyleItem::setTextureWidth(int w) { if (m_textureWidth == w) return; m_textureWidth = w; emit textureWidthChanged(m_textureWidth); update(); } void KQuickStyleItem::setTextureHeight(int h) { if (m_textureHeight == h) return; m_textureHeight = h; emit textureHeightChanged(m_textureHeight); update(); } QQuickItem *KQuickStyleItem::control() const { return m_control; } void KQuickStyleItem::setControl(QQuickItem *control) { if (control == m_control) { return; } if (m_control) { m_control->removeEventFilter(this); disconnect(m_control, nullptr, this, nullptr); } m_control = control; if (m_control) { m_control->installEventFilter(this); - + if (m_control->window()) { m_window = m_control->window(); m_window->installEventFilter(this); } connect(m_control, &QQuickItem::windowChanged, this, [this](QQuickWindow *window) { if (m_window) { m_window->removeEventFilter(this); } m_window = window; if (m_window) { m_window->installEventFilter(this); } }); } emit controlChanged(); } QSGNode *KQuickStyleItem::updatePaintNode(QSGNode *node, UpdatePaintNodeData *) { if (m_image.isNull()) { delete node; return nullptr; } QSGNinePatchNode *styleNode = static_cast(node); if (!styleNode) styleNode = window()->createNinePatchNode(); #ifdef QSG_RUNTIME_DESCRIPTION qsgnode_set_description(styleNode, QString::fromLatin1("%1:%2, '%3'") .arg(styleName()) .arg(elementType()) .arg(text())); #endif styleNode->setTexture(window()->createTextureFromImage(m_image, QQuickWindow::TextureCanUseAtlas)); styleNode->setBounds(boundingRect()); styleNode->setDevicePixelRatio(window()->devicePixelRatio()); styleNode->setPadding(m_border.left(), m_border.top(), m_border.right(), m_border.bottom()); styleNode->update(); return styleNode; } void KQuickStyleItem::updatePolish() { if (width() >= 1 && height() >= 1) { // Note these are reals so 1 pixel is minimum float devicePixelRatio = window() ? window()->devicePixelRatio() : qApp->devicePixelRatio(); int w = m_textureWidth > 0 ? m_textureWidth : width(); int h = m_textureHeight > 0 ? m_textureHeight : height(); m_image = QImage(w * devicePixelRatio, h * devicePixelRatio, QImage::Format_ARGB32_Premultiplied); m_image.setDevicePixelRatio(devicePixelRatio); m_image.fill(Qt::transparent); QPainter painter(&m_image); painter.setLayoutDirection(qApp->layoutDirection()); paint(&painter); QQuickItem::update(); } else if (!m_image.isNull()) { m_image = QImage(); QQuickItem::update(); } } bool KQuickStyleItem::eventFilter(QObject *watched, QEvent *event) { if (watched == m_control) { if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) { QFocusEvent *fe = static_cast(event); m_lastFocusReason = fe->reason(); } } else if (watched == m_window.data()) { if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { QKeyEvent *ke = static_cast(event); if (ke->key() == Qt::Key_Alt) { updateItem(); } } } return QQuickItem::eventFilter(watched, event); } void KQuickStyleItem::styleChanged() { if (!qApp->style() || QApplication::closingDown()) { return; } Q_ASSERT(qApp->style() != sender()); connect(qApp->style(), &QObject::destroyed, this, &KQuickStyleItem::styleChanged); updateSizeHint(); updateItem(); } QPixmap QQuickTableRowImageProvider1::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) { Q_UNUSED (requestedSize); int width = 16; int height = 16; if (size) *size = QSize(width, height); QPixmap pixmap(width, height); QStyleOptionViewItem opt; opt.state |= QStyle::State_Enabled; opt.rect = QRect(0, 0, width, height); QString style = QString::fromLatin1(KQuickStyleItem::style()->metaObject()->className()); opt.features = {}; if (id.contains(QLatin1String("selected"))) opt.state |= QStyle::State_Selected; if (id.contains(QLatin1String("active"))) { opt.state |= QStyle::State_Active; opt.palette.setCurrentColorGroup(QPalette::Active); } else opt.palette.setCurrentColorGroup(QPalette::Inactive); if (id.contains(QLatin1String("alternate"))) opt.features |= QStyleOptionViewItem::Alternate; QPalette pal = QApplication::palette("QAbstractItemView"); if (opt.state & QStyle::State_Selected && (style.contains(QLatin1String("Mac")) || !KQuickStyleItem::style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected))) { pal.setCurrentColorGroup(opt.palette.currentColorGroup()); pixmap.fill(pal.highlight().color()); } else { pixmap.fill(pal.base().color()); QPainter pixpainter(&pixmap); KQuickStyleItem::style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, &pixpainter); } return pixmap; } #include "moc_kquickstyleitem_p.cpp" #include "moc_kquickpadding_p.cpp" diff --git a/plugin/kquickstyleitem_p.h b/plugin/kquickstyleitem_p.h index 45d6ae3..5dbfebf 100644 --- a/plugin/kquickstyleitem_p.h +++ b/plugin/kquickstyleitem_p.h @@ -1,341 +1,310 @@ -/**************************************************************************** -** -** Copyright 2017 by Marco Martin -** Copyright 2017 by David Edmundson -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2017 by Marco Martin + SPDX-FileCopyrightText: 2017 by David Edmundson + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the Qt Quick Controls module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #ifndef KQUICKSTYLEITEM_P_H #define KQUICKSTYLEITEM_P_H #include #include #include #include "kquickpadding_p.h" #include class QWidget; class QStyleOption; class QStyle; namespace Kirigami { class PlatformTheme; } class QQuickTableRowImageProvider1 : public QQuickImageProvider { public: QQuickTableRowImageProvider1() : QQuickImageProvider(QQuickImageProvider::Pixmap) {} QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) override; }; class KQuickStyleItem: public QQuickItem { Q_OBJECT Q_PROPERTY(KQuickPadding* border READ border CONSTANT) Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged) Q_PROPERTY( bool raised READ raised WRITE setRaised NOTIFY raisedChanged) Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged) Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged) Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged) Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged) Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged) Q_PROPERTY( bool horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged) Q_PROPERTY( bool isTransient READ isTransient WRITE setTransient NOTIFY transientChanged) Q_PROPERTY( QString elementType READ elementType WRITE setElementType NOTIFY elementTypeChanged) Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY( QString activeControl READ activeControl WRITE setActiveControl NOTIFY activeControlChanged) Q_PROPERTY( QString styleName READ styleName NOTIFY styleNameChanged) Q_PROPERTY( QVariantMap hints READ hints WRITE setHints NOTIFY hintChanged RESET resetHints) Q_PROPERTY( QVariantMap properties READ properties WRITE setProperties NOTIFY propertiesChanged) Q_PROPERTY( QFont font READ font NOTIFY fontChanged) // For range controls Q_PROPERTY( int minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) Q_PROPERTY( int maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY( int step READ step WRITE setStep NOTIFY stepChanged) Q_PROPERTY( int paintMargins READ paintMargins WRITE setPaintMargins NOTIFY paintMarginsChanged) Q_PROPERTY( int contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged) Q_PROPERTY( int contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged) Q_PROPERTY( int textureWidth READ textureWidth WRITE setTextureWidth NOTIFY textureWidthChanged) Q_PROPERTY( int textureHeight READ textureHeight WRITE setTextureHeight NOTIFY textureHeightChanged) Q_PROPERTY( int leftPadding READ leftPadding NOTIFY leftPaddingChanged) Q_PROPERTY( int topPadding READ topPadding NOTIFY topPaddingChanged) Q_PROPERTY( int rightPadding READ rightPadding NOTIFY rightPaddingChanged) Q_PROPERTY( int bottomPadding READ bottomPadding NOTIFY bottomPaddingChanged) Q_PROPERTY( QQuickItem *control READ control WRITE setControl NOTIFY controlChanged) KQuickPadding* border() { return &m_border; } public: KQuickStyleItem(QQuickItem *parent = nullptr); ~KQuickStyleItem() override; enum MenuItemType { SeparatorType = 0, ItemType, MenuType, ScrollIndicatorType }; enum Type { Undefined, Button, RadioButton, CheckBox, ComboBox, ComboBoxItem, Dial, ToolBar, ToolButton, Tab, TabFrame, Frame, FocusFrame, FocusRect, SpinBox, Slider, ScrollBar, ProgressBar, Edit, GroupBox, Header, Item, ItemRow, ItemBranchIndicator, Splitter, Menu, MenuItem, Widget, StatusBar, ScrollAreaCorner, MacHelpButton, MenuBar, MenuBarItem }; void paint(QPainter *); bool sunken() const { return m_sunken; } bool raised() const { return m_raised; } bool active() const { return m_active; } bool selected() const { return m_selected; } bool hasFocus() const { return m_focus; } bool on() const { return m_on; } bool hover() const { return m_hover; } bool horizontal() const { return m_horizontal; } bool isTransient() const { return m_transient; } int minimum() const { return m_minimum; } int maximum() const { return m_maximum; } int step() const { return m_step; } int value() const { return m_value; } int paintMargins() const { return m_paintMargins; } QString elementType() const { return m_type; } QString text() const { return m_text; } QString activeControl() const { return m_activeControl; } QVariantMap hints() const { return m_hints; } QVariantMap properties() const { return m_properties; } QFont font() const { return m_font;} QString styleName() const; void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}} void setRaised(bool raised) { if (m_raised!= raised) {m_raised = raised; emit raisedChanged();}} void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}} void setSelected(bool selected) { if (m_selected!= selected) {m_selected = selected; emit selectedChanged();}} void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}} void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}} void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}} void setHorizontal(bool horizontal) { if (m_horizontal != horizontal) {m_horizontal = horizontal; emit horizontalChanged();}} void setTransient(bool transient) { if (m_transient != transient) {m_transient = transient; emit transientChanged();}} void setMinimum(int minimum) { if (m_minimum!= minimum) {m_minimum = minimum; emit minimumChanged();}} void setMaximum(int maximum) { if (m_maximum != maximum) {m_maximum = maximum; emit maximumChanged();}} void setValue(int value) { if (m_value!= value) {m_value = value; emit valueChanged();}} void setStep(int step) { if (m_step != step) { m_step = step; emit stepChanged(); }} void setPaintMargins(int value) { if (m_paintMargins!= value) {m_paintMargins = value; emit paintMarginsChanged(); } } void setElementType(const QString &str); void setText(const QString &str) { if (m_text != str) {m_text = str; emit textChanged();}} void setActiveControl(const QString &str) { if (m_activeControl != str) {m_activeControl = str; emit activeControlChanged();}} void setHints(const QVariantMap &str); void setProperties(const QVariantMap &props) { if (m_properties != props) { m_properties = props; emit propertiesChanged(); } } void resetHints(); int contentWidth() const { return m_contentWidth; } void setContentWidth(int arg); int contentHeight() const { return m_contentHeight; } void setContentHeight(int arg); virtual void initStyleOption (); void resolvePalette(); int leftPadding() const; int topPadding() const; int rightPadding() const; int bottomPadding() const; Q_INVOKABLE qreal textWidth(const QString &); Q_INVOKABLE qreal textHeight(const QString &); int textureWidth() const { return m_textureWidth; } void setTextureWidth(int w); int textureHeight() const { return m_textureHeight; } void setTextureHeight(int h); QQuickItem *control() const; void setControl(QQuickItem *control); static QStyle *style(); public Q_SLOTS: int pixelMetric(const QString&); QVariant styleHint(const QString&); void updateSizeHint(); void updateRect(); void updateBaselineOffset(); void updateItem(){polish();} QString hitTest(int x, int y); QRectF subControlRect(const QString &subcontrolString); QString elidedText(const QString &text, int elideMode, int width); bool hasThemeIcon(const QString &) const; Q_SIGNALS: void elementTypeChanged(); void textChanged(); void sunkenChanged(); void raisedChanged(); void activeChanged(); void selectedChanged(); void hasFocusChanged(); void onChanged(); void hoverChanged(); void horizontalChanged(); void transientChanged(); void minimumChanged(); void maximumChanged(); void stepChanged(); void valueChanged(); void activeControlChanged(); void infoChanged(); void styleNameChanged(); void paintMarginsChanged(); void hintChanged(); void propertiesChanged(); void fontChanged(); void controlChanged(); void contentWidthChanged(int arg); void contentHeightChanged(int arg); void textureWidthChanged(int w); void textureHeightChanged(int h); void leftPaddingChanged(); void topPaddingChanged(); void rightPaddingChanged(); void bottomPaddingChanged(); protected: bool event(QEvent *) override; QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override; void updatePolish() override; bool eventFilter(QObject *watched, QEvent *event) override; private: const char* classNameForItem() const; QSize sizeFromContents(int width, int height); qreal baselineOffset(); void styleChanged(); protected: Kirigami::PlatformTheme *m_theme = nullptr; QStyleOption *m_styleoption; QPointer m_control; QPointer m_window; Type m_itemType; QString m_type; QString m_text; QString m_activeControl; QVariantMap m_hints; QVariantMap m_properties; QFont m_font; bool m_sunken; bool m_raised; bool m_active; bool m_selected; bool m_focus; bool m_hover; bool m_on; bool m_horizontal; bool m_transient; bool m_sharedWidget; int m_minimum; int m_maximum; int m_value; int m_step; int m_paintMargins; int m_contentWidth; int m_contentHeight; int m_textureWidth; int m_textureHeight; Qt::FocusReason m_lastFocusReason; QImage m_image; KQuickPadding m_border; static QStyle *s_style; }; #endif // QQUICKSTYLEITEM_P_H diff --git a/plugin/qqc2desktopstyleplugin.cpp b/plugin/qqc2desktopstyleplugin.cpp index 6a4064c..69ade7e 100644 --- a/plugin/qqc2desktopstyleplugin.cpp +++ b/plugin/qqc2desktopstyleplugin.cpp @@ -1,44 +1,31 @@ /* - * Copyright 2017 by Marco Martin - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ #include "qqc2desktopstyleplugin.h" #include "kquickstyleitem_p.h" #include "kpropertywriter_p.h" #include #include #include void QQc2DesktopStylePlugin::registerTypes(const char *uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.qqc2desktopstyle.private")); - + qmlRegisterType(uri, 1, 0, "StyleItem"); qmlRegisterType(uri, 1, 0, "PropertyWriter"); #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) qmlRegisterType(); #else qmlRegisterAnonymousType(uri, 1); #endif qmlProtectModule(uri, 2); } #include "moc_qqc2desktopstyleplugin.cpp" diff --git a/plugin/qqc2desktopstyleplugin.h b/plugin/qqc2desktopstyleplugin.h index a08e071..466722e 100644 --- a/plugin/qqc2desktopstyleplugin.h +++ b/plugin/qqc2desktopstyleplugin.h @@ -1,37 +1,24 @@ /* - * Copyright 2017 by Marco Martin - * Copyright 2017 by David Edmundson - - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Library General Public License as - * published by the Free Software Foundation; either version 2, 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 Library General Public License for more details - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + SPDX-FileCopyrightText: 2017 David Edmundson + + SPDX-License-Identifier: LGPL-2.0-or-later +*/ #ifndef QQC2DESKTOPSTYLEPLUGIN_H #define QQC2DESKTOPSTYLEPLUGIN_H #include class QQc2DesktopStylePlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri) override; }; #endif diff --git a/plugin/qsgdefaultninepatchnode.cpp b/plugin/qsgdefaultninepatchnode.cpp index ff85b53..edba485 100644 --- a/plugin/qsgdefaultninepatchnode.cpp +++ b/plugin/qsgdefaultninepatchnode.cpp @@ -1,84 +1,53 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the QtQuick module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #include "qsgdefaultninepatchnode_p.h" QT_BEGIN_NAMESPACE QSGDefaultNinePatchNode::QSGDefaultNinePatchNode() : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) { setGeometry(&m_geometry); setMaterial(&m_material); } QSGDefaultNinePatchNode::~QSGDefaultNinePatchNode() { delete m_material.texture(); } void QSGDefaultNinePatchNode::setTexture(QSGTexture *texture) { delete m_material.texture(); m_material.setTexture(texture); } void QSGDefaultNinePatchNode::setBounds(const QRectF &bounds) { m_bounds = bounds; } void QSGDefaultNinePatchNode::setDevicePixelRatio(qreal ratio) { m_devicePixelRatio = ratio; } void QSGDefaultNinePatchNode::setPadding(qreal left, qreal top, qreal right, qreal bottom) { m_padding = QVector4D(left, top, right, bottom); } void QSGDefaultNinePatchNode::update() { rebuildGeometry(m_material.texture(), &m_geometry, m_padding, m_bounds, m_devicePixelRatio); markDirty(QSGNode::DirtyGeometry | QSGNode::DirtyMaterial); } QT_END_NAMESPACE diff --git a/plugin/qsgdefaultninepatchnode_p.h b/plugin/qsgdefaultninepatchnode_p.h index 7bed75e..277e168 100644 --- a/plugin/qsgdefaultninepatchnode_p.h +++ b/plugin/qsgdefaultninepatchnode_p.h @@ -1,83 +1,52 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the QtQuick module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #ifndef QSGDEFAULTNINEPATCHNODE_P_H #define QSGDEFAULTNINEPATCHNODE_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // //#include #include "qsgninepatchnode.h" #include #include QT_BEGIN_NAMESPACE class QSGDefaultNinePatchNode : public QSGNinePatchNode { public: QSGDefaultNinePatchNode(); ~QSGDefaultNinePatchNode() override; void setTexture(QSGTexture *texture) override; void setBounds(const QRectF &bounds) override; void setDevicePixelRatio(qreal ratio) override; void setPadding(qreal left, qreal top, qreal right, qreal bottom) override; void update() override; private: QRectF m_bounds; qreal m_devicePixelRatio; QVector4D m_padding; QSGGeometry m_geometry; QSGTextureMaterial m_material; }; QT_END_NAMESPACE #endif // QSGDEFAULTNINEPATCHNODE_P_H diff --git a/plugin/qsgninepatchnode.cpp b/plugin/qsgninepatchnode.cpp index 33568b5..b298132 100644 --- a/plugin/qsgninepatchnode.cpp +++ b/plugin/qsgninepatchnode.cpp @@ -1,129 +1,98 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the QtQuick module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #include "qsgninepatchnode.h" QT_BEGIN_NAMESPACE /*! \class QSGNinePatchNode \inmodule QtQuick \since 5.8 \internal */ /*! \fn void QSGNinePatchNode::setTexture(QSGTexture *texture) \internal */ /*! \fn void QSGNinePatchNode::setBounds(const QRectF &bounds) \internal */ /*! \fn void QSGNinePatchNode::setDevicePixelRatio(qreal ratio) \internal */ /*! \fn void QSGNinePatchNode::setPadding(qreal left, qreal top, qreal right, qreal bottom) \internal */ /*! \fn void QSGNinePatchNode::update() \internal */ void QSGNinePatchNode::rebuildGeometry(QSGTexture *texture, QSGGeometry *geometry, const QVector4D &padding, const QRectF &bounds, qreal dpr) { if (padding.x() <= 0 && padding.y() <= 0 && padding.z() <= 0 && padding.w() <= 0) { geometry->allocate(4, 0); QSGGeometry::updateTexturedRectGeometry(geometry, bounds, texture->normalizedTextureSubRect()); return; } QRectF tc = texture->normalizedTextureSubRect(); QSize ts = texture->textureSize(); ts.setHeight(ts.height() / dpr); ts.setWidth(ts.width() / dpr); qreal invtw = tc.width() / ts.width(); qreal invth = tc.height() / ts.height(); struct Coord { qreal p; qreal t; }; Coord cx[4] = { { bounds.left(), tc.left() }, { bounds.left() + padding.x(), tc.left() + padding.x() * invtw }, { bounds.right() - padding.z(), tc.right() - padding.z() * invtw }, { bounds.right(), tc.right() } }; Coord cy[4] = { { bounds.top(), tc.top() }, { bounds.top() + padding.y(), tc.top() + padding.y() * invth }, { bounds.bottom() - padding.w(), tc.bottom() - padding.w() * invth }, { bounds.bottom(), tc.bottom() } }; geometry->allocate(16, 28); QSGGeometry::TexturedPoint2D *v = geometry->vertexDataAsTexturedPoint2D(); for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) { v->set(cx[x].p, cy[y].p, cx[x].t, cy[y].t); ++v; } } quint16 *i = geometry->indexDataAsUShort(); for (int r = 0; r < 3; ++r) { if (r > 0) *i++ = 4 * r; for (int c = 0; c < 4; ++c) { i[0] = 4 * r + c; i[1] = 4 * r + c + 4; i += 2; } if (r < 2) *i++ = 4 * r + 3 + 4; } } QT_END_NAMESPACE diff --git a/plugin/qsgninepatchnode.h b/plugin/qsgninepatchnode.h index 8509cbd..49f4fcb 100644 --- a/plugin/qsgninepatchnode.h +++ b/plugin/qsgninepatchnode.h @@ -1,66 +1,35 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +/* + SPDX-FileCopyrightText: 2016 The Qt Company Ltd. + + This file is part of the QtQuick module of the Qt Toolkit. + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KFQF-Accepted-GPL OR LicenseRef-Qt-Commercial +*/ #ifndef QSGNINEPATCHNODE_H #define QSGNINEPATCHNODE_H #include #include QT_BEGIN_NAMESPACE class Q_QUICK_EXPORT QSGNinePatchNode : public QSGGeometryNode { public: virtual ~QSGNinePatchNode() { } virtual void setTexture(QSGTexture *texture) = 0; virtual void setBounds(const QRectF &bounds) = 0; virtual void setDevicePixelRatio(qreal ratio) = 0; virtual void setPadding(qreal left, qreal top, qreal right, qreal bottom) = 0; virtual void update() = 0; static void rebuildGeometry(QSGTexture *texture, QSGGeometry *geometry, const QVector4D &padding, const QRectF &bounds, qreal dpr); }; QT_END_NAMESPACE #endif // QSGNINEPATCHNODE_H diff --git a/tests/LineEditWithClearButton.qml b/tests/LineEditWithClearButton.qml index c2eb0fe..3b427d5 100644 --- a/tests/LineEditWithClearButton.qml +++ b/tests/LineEditWithClearButton.qml @@ -1,35 +1,21 @@ /* - Copyright (c) 2019 Montel Laurent + SPDX-FileCopyrightText: 2019 Montel Laurent - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2 of the License or - ( at your option ) version 3 or, at the discretion of KDE e.V. - ( which shall act as a proxy as in section 14 of the GPLv3 ), any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import org.kde.kirigami 2.7 as Kirigami Kirigami.ActionTextField { id: __searchField focus: true rightActions: [ Kirigami.Action { iconName: "edit-clear" visible: __searchField.text !== "" onTriggered: { __searchField.text = "" __searchField.accepted() } } ] } diff --git a/tests/buttonIcons.qml b/tests/buttonIcons.qml index f5a9e91..8b751b0 100644 --- a/tests/buttonIcons.qml +++ b/tests/buttonIcons.qml @@ -1,150 +1,136 @@ /* - * Copyright 2017 Marco Martin - * - * GNU Lesser General Public License Usage - * Alternatively, this file may be used under the terms of the GNU Lesser - * General Public License version 3 as published by the Free Software - * Foundation and appearing in the file LICENSE.LGPLv3 included in the - * packaging of this file. Please review the following information to - * ensure the GNU Lesser General Public License version 3 requirements - * will be met: https://www.gnu.org/licenses/lgpl.html. - * - * GNU General Public License Usage - * Alternatively, this file may be used under the terms of the GNU - * General Public License version 2.0 or later as published by the Free - * Software Foundation and appearing in the file LICENSE.GPL included in - * the packaging of this file. Please review the following information to - * ensure the GNU General Public License version 2.0 requirements will be - * met: http://www.gnu.org/licenses/gpl-2.0.html. - */ + SPDX-FileCopyrightText: 2017 Marco Martin + + SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later +*/ import QtQuick 2.6 import QtQuick.Layouts 1.2 import QtQuick.Controls 2.3 as Controls import org.kde.kirigami 2.2 as Kirigami Kirigami.ApplicationWindow { id: root width: 600 height: 600 Kirigami.Theme.inherit: false Kirigami.Theme.colorSet: Kirigami.Theme.Complementary header: Controls.MenuBar { Controls.Menu { title: "&File" Controls.MenuItem { checkable: true text: "Item1" icon.name: "go-next" icon.color: "red" } Controls.MenuItem { text: "Item2" icon.name: "folder-video" } Controls.MenuSeparator { } Controls.MenuItem { checkable: true text: "Item3" } Controls.Menu { title: "Submenu" Controls.MenuItem { checkable: true text: "Item1" icon.name: "go-next" icon.color: "red" } Controls.MenuItem { text: "Item2" icon.name: "folder-video" } Controls.MenuItem { text: "Item3" } } } Controls.Menu { title: "Edit" Controls.MenuItem { text: "Item1" icon.name: "go-next" } Controls.MenuItem { text: "Item2" icon.name: "go-next" } } } Rectangle { id: background anchors.centerIn: parent Kirigami.Theme.inherit: false Kirigami.Theme.colorSet: Kirigami.Theme.Complementary width: childrenRect.width height: childrenRect.height color: Kirigami.Theme.backgroundColor ColumnLayout { Controls.ComboBox { Kirigami.Theme.inherit: true currentIndex: 1 model: ["View", "Window", "Button", "Selection", "Tooltip", "Complementary"] onCurrentTextChanged: background.Kirigami.Theme.colorSet = currentText } Controls.Button { - + Kirigami.Theme.inherit: true text: "text" icon.name: "go-previous" } Controls.Button { id: coloredIconButton text: "text" icon.name: "go-previous" } RowLayout { Controls.Label { text: "RGB color for icon:" } Controls.SpinBox{ id: red editable: true from: 0 to: 255 onValueModified: { coloredIconButton.icon.color = Qt.rgba(red.value/255, green.value/255, blue.value/255, 1); } } Controls.SpinBox{ id: green Kirigami.Theme.inherit: true editable: true from: 0 to: 255 onValueModified: { coloredIconButton.icon.color = Qt.rgba(red.value/255, green.value/255, blue.value/255, 1); } } Controls.SpinBox{ id: blue editable: true from: 0 to: 255 onValueModified: { coloredIconButton.icon.color = Qt.rgba(red.value/255, green.value/255, blue.value/255, 1); } } } Controls.ToolButton { text: "text" icon.name: "go-previous" } } } }