diff --git a/COPYING b/COPYING deleted file mode 100644 index d159169..0000000 --- a/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - 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/COPYING.LIB b/COPYING.LIB deleted file mode 100644 index 4362b49..0000000 --- a/COPYING.LIB +++ /dev/null @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! 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-2.1-only.txt b/LICENSES/LGPL-2.1-only.txt new file mode 100644 index 0000000..130dffb --- /dev/null +++ b/LICENSES/LGPL-2.1-only.txt @@ -0,0 +1,467 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. + +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts as the +successor of the GNU Library Public License, version 2, hence the version +number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Lesser General Public License, applies to some specially +designated software packages--typically libraries--of the Free Software Foundation +and other authors who decide to use it. You can use it too, but we suggest +you first think carefully about whether this license or the ordinary General +Public License is the better strategy to use in any particular case, based +on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. +Our General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish); that you receive source code or can get it if you want it; that you +can change the software and use pieces of it in new free programs; and that +you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors +to deny you these rights or to ask you to surrender these rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source code. If you link +other code with the library, you must provide complete object files to the +recipients, so that they can relink them with the library after making changes +to the library and recompiling it. And you must show them these terms so they +know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, +and (2) we offer you this license, which gives you legal permission to copy, +distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no +warranty for the free library. Also, if the library is modified by someone +else and passed on, the recipients should know that what they have is not +the original version, so that the original author's reputation will not be +affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free +program. We wish to make sure that a company cannot effectively restrict the +users of a free program by obtaining a restrictive license from a patent holder. +Therefore, we insist that any patent license obtained for a version of the +library must be consistent with the full freedom of use specified in this +license. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License. This license, the GNU Lesser General Public License, +applies to certain designated libraries, and is quite different from the ordinary +General Public License. We use this license for certain libraries in order +to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared +library, the combination of the two is legally speaking a combined work, a +derivative of the original library. The ordinary General Public License therefore +permits such linking only if the entire combination fits its criteria of freedom. +The Lesser General Public License permits more lax criteria for linking other +code with the library. + +We call this license the "Lesser" General Public License because it does Less +to protect the user's freedom than the ordinary General Public License. It +also provides other free software developers Less of an advantage over competing +non-free programs. These disadvantages are the reason we use the ordinary +General Public License for many libraries. However, the Lesser license provides +advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the +widest possible use of a certain library, so that it becomes a de-facto standard. +To achieve this, non-free programs must be allowed to use the library. A more +frequent case is that a free library does the same job as widely used non-free +libraries. In this case, there is little to gain by limiting the free library +to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs +enables a greater number of people to use a large body of free software. For +example, permission to use the GNU C Library in non-free programs enables +many more people to use the whole GNU operating system, as well as its variant, +the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' +freedom, it does ensure that the user of a program that is linked with the +Library has the freedom and the wherewithal to run that program using a modified +version of the Library. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, whereas the latter must be combined with the library in +order to run. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other program +which contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Lesser General +Public License (also called "this License"). Each licensee is addressed as +"you". + +A "library" means a collection of software functions and/or data prepared +so as to be conveniently linked with application programs (which use some +of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a +work containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, translation +is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications +to it. For a library, complete source code means all the source code for all +modules it contains, plus any associated interface definition files, plus +the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to +the absence of any warranty; and distribute a copy of this License along with +the Library. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + + a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices stating that +you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a table of +data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make +a good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose +that is entirely well-defined independent of the application. Therefore, Subsection +2d requires that any application-supplied function or table used by this function +must be optional: if the application does not supply it, the square root function +must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. +(If a newer version than version 2 of the ordinary GNU General Public License +has appeared, then you can specify that version instead if you wish.) Do not +make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated +place, then offering equivalent access to copy the source code from the same +place satisfies the requirement to distribute the source code, even though +third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, +is called a "work that uses the Library". Such a work, in isolation, is not +a derivative work of the Library, and therefore falls outside the scope of +this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable +is therefore covered by this License. Section 6 states terms for distribution +of such executables. + +When a "work that uses the Library" uses material from a header file that +is part of the Library, the object code for the work may be a derivative work +of the Library even though the source code is not. Whether this is true is +especially significant if the work can be linked without the Library, or if +the work is itself a library. The threshold for this to be true is not precisely +defined by law. + +If such an object file uses only numerical parameters, data structure layouts +and accessors, and small macros and small inline functions (ten lines or less +in length), then the use of the object file is unrestricted, regardless of +whether it is legally a derivative work. (Executables containing this object +code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work +that uses the Library" with the Library to produce a work containing portions +of the Library, and distribute that work under terms of your choice, provided +that the terms permit modification of the work for the customer's own use +and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source +code for the Library including whatever changes were used in the work (which +must be distributed under Sections 1 and 2 above); and, if the work is an +executable linked with the Library, with the complete machine-readable "work +that uses the Library", as object code and/or source code, so that the user +can modify the Library and then relink to produce a modified executable containing +the modified Library. (It is understood that the user who changes the contents +of definitions files in the Library will not necessarily be able to recompile +the application to use the modified definitions.) + +b) Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (1) uses at run time a copy of the library +already present on the user's computer system, rather than copying library +functions into the executable, and (2) will operate properly with a modified +version of the library, if the user installs one, as long as the modified +version is interface-compatible with the version that the work was made with. + +c) Accompany the work with a written offer, valid for at least three years, +to give the same user the materials specified in Subsection 6a, above, for +a charge no more than the cost of performing this distribution. + +d) If distribution of the work is made by offering access to copy from a designated +place, offer equivalent access to copy the above specified materials from +the same place. + +e) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable +from it. However, as a special exception, the materials to be distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating system. +Such a contradiction means you cannot use both them and the Library together +in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side +in a single library together with other library facilities not covered by +this License, and distribute such a combined library, provided that the separate +distribution of the work based on the Library and of the other library facilities +is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities. This must be distributed +under the terms of the Sections above. + +b) Give prominent notice with the combined library of the fact that part of +it is a work based on the Library, and explaining where to find the accompanying +uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to +copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor +to copy, distribute, link with or modify the Library subject to these terms +and conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Library at all. For example, if a +patent license would not permit royalty-free redistribution of the Library +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of +the Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Library does not specify a license version number, you may choose any version +ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible +use to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under +these terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the "copyright" +line and a pointer to where the full notice is found. + +< 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 Lesser General Public License as published by the Free +Software Foundation; either version 2.1 of the License, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with this library; if not, write to the Free Software Foundation, Inc., 51 +Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information +on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in + +the library `Frob' (a library for tweaking knobs) written + +by James Random Hacker. + +< 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.1-or-later.txt b/LICENSES/LGPL-2.1-or-later.txt new file mode 100644 index 0000000..04bb156 --- /dev/null +++ b/LICENSES/LGPL-2.1-or-later.txt @@ -0,0 +1,468 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. + +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license +document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts as the +successor of the GNU Library Public License, version 2, hence the version +number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to share +and change it. By contrast, the GNU General Public Licenses are intended to +guarantee your freedom to share and change free software--to make sure the +software is free for all its users. + +This license, the Lesser General Public License, applies to some specially +designated software packages--typically libraries--of the Free Software Foundation +and other authors who decide to use it. You can use it too, but we suggest +you first think carefully about whether this license or the ordinary General +Public License is the better strategy to use in any particular case, based +on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. +Our General Public Licenses are designed to make sure that you have the freedom +to distribute copies of free software (and charge for this service if you +wish); that you receive source code or can get it if you want it; that you +can change the software and use pieces of it in new free programs; and that +you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors +to deny you these rights or to ask you to surrender these rights. These restrictions +translate to certain responsibilities for you if you distribute copies of +the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for +a fee, you must give the recipients all the rights that we gave you. You must +make sure that they, too, receive or can get the source code. If you link +other code with the library, you must provide complete object files to the +recipients, so that they can relink them with the library after making changes +to the library and recompiling it. And you must show them these terms so they +know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, +and (2) we offer you this license, which gives you legal permission to copy, +distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no +warranty for the free library. Also, if the library is modified by someone +else and passed on, the recipients should know that what they have is not +the original version, so that the original author's reputation will not be +affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free +program. We wish to make sure that a company cannot effectively restrict the +users of a free program by obtaining a restrictive license from a patent holder. +Therefore, we insist that any patent license obtained for a version of the +library must be consistent with the full freedom of use specified in this +license. + +Most GNU software, including some libraries, is covered by the ordinary GNU +General Public License. This license, the GNU Lesser General Public License, +applies to certain designated libraries, and is quite different from the ordinary +General Public License. We use this license for certain libraries in order +to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared +library, the combination of the two is legally speaking a combined work, a +derivative of the original library. The ordinary General Public License therefore +permits such linking only if the entire combination fits its criteria of freedom. +The Lesser General Public License permits more lax criteria for linking other +code with the library. + +We call this license the "Lesser" General Public License because it does Less +to protect the user's freedom than the ordinary General Public License. It +also provides other free software developers Less of an advantage over competing +non-free programs. These disadvantages are the reason we use the ordinary +General Public License for many libraries. However, the Lesser license provides +advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the +widest possible use of a certain library, so that it becomes a de-facto standard. +To achieve this, non-free programs must be allowed to use the library. A more +frequent case is that a free library does the same job as widely used non-free +libraries. In this case, there is little to gain by limiting the free library +to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs +enables a greater number of people to use a large body of free software. For +example, permission to use the GNU C Library in non-free programs enables +many more people to use the whole GNU operating system, as well as its variant, +the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' +freedom, it does ensure that the user of a program that is linked with the +Library has the freedom and the wherewithal to run that program using a modified +version of the Library. + +The precise terms and conditions for copying, distribution and modification +follow. Pay close attention to the difference between a "work based on the +library" and a "work that uses the library". The former contains code derived +from the library, whereas the latter must be combined with the library in +order to run. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other program +which contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Lesser General +Public License (also called "this License"). Each licensee is addressed as +"you". + +A "library" means a collection of software functions and/or data prepared +so as to be conveniently linked with application programs (which use some +of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has +been distributed under these terms. A "work based on the Library" means either +the Library or any derivative work under copyright law: that is to say, a +work containing the Library or a portion of it, either verbatim or with modifications +and/or translated straightforwardly into another language. (Hereinafter, translation +is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications +to it. For a library, complete source code means all the source code for all +modules it contains, plus any associated interface definition files, plus +the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered +by this License; they are outside its scope. The act of running a program +using the Library is not restricted, and output from such a program is covered +only if its contents constitute a work based on the Library (independent of +the use of the Library in a tool for writing it). Whether that is true depends +on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source +code as you receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice and disclaimer +of warranty; keep intact all the notices that refer to this License and to +the absence of any warranty; and distribute a copy of this License along with +the Library. + +You may charge a fee for the physical act of transferring a copy, and you +may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, +thus forming a work based on the Library, and copy and distribute such modifications +or work under the terms of Section 1 above, provided that you also meet all +of these conditions: + + a) The modified work must itself be a software library. + +b) You must cause the files modified to carry prominent notices stating that +you changed the files and the date of any change. + +c) You must cause the whole of the work to be licensed at no charge to all +third parties under the terms of this License. + +d) If a facility in the modified Library refers to a function or a table of +data to be supplied by an application program that uses the facility, other +than as an argument passed when the facility is invoked, then you must make +a good faith effort to ensure that, in the event an application does not supply +such function or table, the facility still operates, and performs whatever +part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose +that is entirely well-defined independent of the application. Therefore, Subsection +2d requires that any application-supplied function or table used by this function +must be optional: if the application does not supply it, the square root function +must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable +sections of that work are not derived from the Library, and can be reasonably +considered independent and separate works in themselves, then this License, +and its terms, do not apply to those sections when you distribute them as +separate works. But when you distribute the same sections as part of a whole +which is a work based on the Library, the distribution of the whole must be +on the terms of this License, whose permissions for other licensees extend +to the entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest your +rights to work written entirely by you; rather, the intent is to exercise +the right to control the distribution of derivative or collective works based +on the Library. + +In addition, mere aggregation of another work not based on the Library with +the Library (or with a work based on the Library) on a volume of a storage +or distribution medium does not bring the other work under the scope of this +License. + +3. You may opt to apply the terms of the ordinary GNU General Public License +instead of this License to a given copy of the Library. To do this, you must +alter all the notices that refer to this License, so that they refer to the +ordinary GNU General Public License, version 2, instead of to this License. +(If a newer version than version 2 of the ordinary GNU General Public License +has appeared, then you can specify that version instead if you wish.) Do not +make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, +so the ordinary GNU General Public License applies to all subsequent copies +and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library +into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of +it, under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you accompany it with the complete corresponding +machine-readable source code, which must be distributed under the terms of +Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated +place, then offering equivalent access to copy the source code from the same +place satisfies the requirement to distribute the source code, even though +third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but +is designed to work with the Library by being compiled or linked with it, +is called a "work that uses the Library". Such a work, in isolation, is not +a derivative work of the Library, and therefore falls outside the scope of +this License. + +However, linking a "work that uses the Library" with the Library creates an +executable that is a derivative of the Library (because it contains portions +of the Library), rather than a "work that uses the library". The executable +is therefore covered by this License. Section 6 states terms for distribution +of such executables. + +When a "work that uses the Library" uses material from a header file that +is part of the Library, the object code for the work may be a derivative work +of the Library even though the source code is not. Whether this is true is +especially significant if the work can be linked without the Library, or if +the work is itself a library. The threshold for this to be true is not precisely +defined by law. + +If such an object file uses only numerical parameters, data structure layouts +and accessors, and small macros and small inline functions (ten lines or less +in length), then the use of the object file is unrestricted, regardless of +whether it is legally a derivative work. (Executables containing this object +code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute +the object code for the work under the terms of Section 6. Any executables +containing that work also fall under Section 6, whether or not they are linked +directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work +that uses the Library" with the Library to produce a work containing portions +of the Library, and distribute that work under terms of your choice, provided +that the terms permit modification of the work for the customer's own use +and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library +is used in it and that the Library and its use are covered by this License. +You must supply a copy of this License. If the work during execution displays +copyright notices, you must include the copyright notice for the Library among +them, as well as a reference directing the user to the copy of this License. +Also, you must do one of these things: + +a) Accompany the work with the complete corresponding machine-readable source +code for the Library including whatever changes were used in the work (which +must be distributed under Sections 1 and 2 above); and, if the work is an +executable linked with the Library, with the complete machine-readable "work +that uses the Library", as object code and/or source code, so that the user +can modify the Library and then relink to produce a modified executable containing +the modified Library. (It is understood that the user who changes the contents +of definitions files in the Library will not necessarily be able to recompile +the application to use the modified definitions.) + +b) Use a suitable shared library mechanism for linking with the Library. A +suitable mechanism is one that (1) uses at run time a copy of the library +already present on the user's computer system, rather than copying library +functions into the executable, and (2) will operate properly with a modified +version of the library, if the user installs one, as long as the modified +version is interface-compatible with the version that the work was made with. + +c) Accompany the work with a written offer, valid for at least three years, +to give the same user the materials specified in Subsection 6a, above, for +a charge no more than the cost of performing this distribution. + +d) If distribution of the work is made by offering access to copy from a designated +place, offer equivalent access to copy the above specified materials from +the same place. + +e) Verify that the user has already received a copy of these materials or +that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must +include any data and utility programs needed for reproducing the executable +from it. However, as a special exception, the materials to be distributed +need not include anything that is normally distributed (in either source or +binary form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component itself +accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of +other proprietary libraries that do not normally accompany the operating system. +Such a contradiction means you cannot use both them and the Library together +in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side +in a single library together with other library facilities not covered by +this License, and distribute such a combined library, provided that the separate +distribution of the work based on the Library and of the other library facilities +is otherwise permitted, and provided that you do these two things: + +a) Accompany the combined library with a copy of the same work based on the +Library, uncombined with any other library facilities. This must be distributed +under the terms of the Sections above. + +b) Give prominent notice with the combined library of the fact that part of +it is a work based on the Library, and explaining where to find the accompanying +uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library +except as expressly provided under this License. Any attempt otherwise to +copy, modify, sublicense, link with, or distribute the Library is void, and +will automatically terminate your rights under this License. However, parties +who have received copies, or rights, from you under this License will not +have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed +it. However, nothing else grants you permission to modify or distribute the +Library or its derivative works. These actions are prohibited by law if you +do not accept this License. Therefore, by modifying or distributing the Library +(or any work based on the Library), you indicate your acceptance of this License +to do so, and all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), +the recipient automatically receives a license from the original licensor +to copy, distribute, link with or modify the Library subject to these terms +and conditions. You may not impose any further restrictions on the recipients' +exercise of the rights granted herein. You are not responsible for enforcing +compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement +or for any other reason (not limited to patent issues), conditions are imposed +on you (whether by court order, agreement or otherwise) that contradict the +conditions of this License, they do not excuse you from the conditions of +this License. If you cannot distribute so as to satisfy simultaneously your +obligations under this License and any other pertinent obligations, then as +a consequence you may not distribute the Library at all. For example, if a +patent license would not permit royalty-free redistribution of the Library +by all those who receive copies directly or indirectly through you, then the +only way you could satisfy both it and this License would be to refrain entirely +from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents +or other property right claims or to contest validity of any such claims; +this section has the sole purpose of protecting the integrity of the free +software distribution system which is implemented by public license practices. +Many people have made generous contributions to the wide range of software +distributed through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing to +distribute software through any other system and a licensee cannot impose +that choice. + +This section is intended to make thoroughly clear what is believed to be a +consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain +countries either by patents or by copyrighted interfaces, the original copyright +holder who places the Library under this License may add an explicit geographical +distribution limitation excluding those countries, so that distribution is +permitted only in or among countries not thus excluded. In such case, this +License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of +the Lesser General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to address +new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies +a version number of this License which applies to it and "any later version", +you have the option of following the terms and conditions either of that version +or of any later version published by the Free Software Foundation. If the +Library does not specify a license version number, you may choose any version +ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs +whose distribution conditions are incompatible with these, write to the author +to ask for permission. For software which is copyrighted by the Free Software +Foundation, write to the Free Software Foundation; we sometimes make exceptions +for this. Our decision will be guided by the two goals of preserving the free +status of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR +THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE +STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY +"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE +OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE +THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE +OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA +OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES +OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH +HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible +use to the public, we recommend making it free software that everyone can +redistribute and change. You can do so by permitting redistribution under +these terms (or, alternatively, under the terms of the ordinary General Public +License). + +To apply these terms, attach the following notices to the library. It is safest +to attach them to the start of each source file to most effectively convey +the exclusion of warranty; and each file should have at least the "copyright" +line and a pointer to where the full notice is found. + + + +Copyright (C) + +This library is free software; you can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License as published by the Free +Software Foundation; either version 2.1 of the License, or (at your option) +any later version. + +This library is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +details. + +You should have received a copy of the GNU Lesser General Public License along +with this library; if not, write to the Free Software Foundation, Inc., 51 +Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, +if any, to sign a "copyright disclaimer" for the library, if necessary. Here +is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in + +the library `Frob' (a library for tweaking knobs) written + +by James Random Hacker. + +< 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/autotests/reversegeocodertest.cpp b/autotests/reversegeocodertest.cpp index 6ab2d01..6745802 100644 --- a/autotests/reversegeocodertest.cpp +++ b/autotests/reversegeocodertest.cpp @@ -1,59 +1,46 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include #include #include #include #include #include "reversegeocoder.h" class ReverseGeoCoderTest : public QObject { Q_OBJECT private slots: void testSimple(); }; using namespace Koko; void ReverseGeoCoderTest::testSimple() { QCoreApplication::instance()->setApplicationName("koko"); ReverseGeoCoder coder; QCOMPARE(coder.initialized(), false); coder.init(); QCOMPARE(coder.initialized(), true); double lat = 52.54877605; double lon = -1.81627023283164; QVariantMap data = coder.lookup(lat, lon); QCOMPARE(data.value("country").toString(), QString("United Kingdom")); QCOMPARE(data.value("admin1").toString(), QString("England")); QCOMPARE(data.value("admin2").toString(), QString("City and Borough of Birmingham")); } QTEST_MAIN(ReverseGeoCoderTest) #include "reversegeocodertest.moc" diff --git a/src/allimagesmodel.cpp b/src/allimagesmodel.cpp index 645e94b..428783d 100644 --- a/src/allimagesmodel.cpp +++ b/src/allimagesmodel.cpp @@ -1,74 +1,61 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "allimagesmodel.h" #include "imagestorage.h" AllImagesModel::AllImagesModel(QObject* parent) : QAbstractListModel(parent) { m_images = ImageStorage::instance()->allImages(); connect(ImageStorage::instance(), SIGNAL(storageModified()), this, SLOT(slotPopulate())); } void AllImagesModel::slotPopulate() { beginResetModel(); m_images = ImageStorage::instance()->allImages(); endResetModel(); } QHash AllImagesModel::roleNames() const { auto hash = QAbstractItemModel::roleNames(); hash.insert(FilePathRole, "filePath"); hash.insert(FilePathRole, "modelData"); return hash; } QVariant AllImagesModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { return QVariant(); } QString filePath = m_images.at(index.row()); switch (role) { case Qt::DisplayRole: { QString fileName = filePath.mid(filePath.lastIndexOf('/') + 1); return fileName; } case FilePathRole: return filePath; } return QVariant(); } int AllImagesModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) { return 0; } return m_images.size(); } diff --git a/src/allimagesmodel.h b/src/allimagesmodel.h index 5af8d3c..75e8013 100644 --- a/src/allimagesmodel.h +++ b/src/allimagesmodel.h @@ -1,46 +1,33 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef KOKO_ALLIMAGESMODEL_H #define KOKO_ALLIMAGESMODEL_H #include class AllImagesModel : public QAbstractListModel { Q_OBJECT public: explicit AllImagesModel(QObject* parent = 0); enum Roles { FilePathRole = Qt::UserRole + 1 }; QHash roleNames() const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; private Q_SLOTS: void slotPopulate(); private: QStringList m_images; }; #endif diff --git a/src/committimer.cpp b/src/committimer.cpp index e93736f..0582509 100644 --- a/src/committimer.cpp +++ b/src/committimer.cpp @@ -1,52 +1,39 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "committimer.h" using namespace Koko; CommitTimer::CommitTimer(QObject* parent) : QObject(parent) { m_smallTimer.setInterval(200); m_smallTimer.setSingleShot(true); connect(&m_smallTimer, &QTimer::timeout, this, &CommitTimer::slotTimeout); m_largeTimer.setSingleShot(true); m_largeTimer.setInterval(10000); connect(&m_largeTimer, &QTimer::timeout, this, &CommitTimer::slotTimeout); } void CommitTimer::start() { m_smallTimer.start(); if (!m_largeTimer.isActive()) { m_largeTimer.start(); } } void CommitTimer::slotTimeout() { m_smallTimer.stop(); m_largeTimer.stop(); Q_EMIT timeout(); } diff --git a/src/committimer.h b/src/committimer.h index 0203a8b..e51f19a 100644 --- a/src/committimer.h +++ b/src/committimer.h @@ -1,49 +1,36 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef KOKO_COMMITTIMER_H #define KOKO_COMMITTIMER_H #include #include namespace Koko { class CommitTimer : public QObject { Q_OBJECT public: explicit CommitTimer(QObject* parent = 0); public slots: void start(); signals: void timeout(); private slots: void slotTimeout(); private: QTimer m_smallTimer; QTimer m_largeTimer; }; } #endif // KOKO_COMMITTIMER_H diff --git a/src/exiv2extractor.cpp b/src/exiv2extractor.cpp index 7c3d8a6..4960364 100644 --- a/src/exiv2extractor.cpp +++ b/src/exiv2extractor.cpp @@ -1,242 +1,229 @@ /* - Copyright (C) 2012-15 Vishesh Handa - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - + * SPDX-FileCopyrightText: (C) 2012-2015 Vishesh Handa + * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later + */ #include "exiv2extractor.h" #include #include Exiv2Extractor::Exiv2Extractor() : m_latitude(0) , m_longitude(0) , m_error(true) { } static QDateTime dateTimeFromString(const QString& dateString) { QDateTime dateTime; if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yyyy-MM-dd")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("dd-MM-yyyy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yyyy-MM")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("MM-yyyy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yyyy.MM.dd")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("dd.MM.yyyy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("dd MMMM yyyy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("MM.yyyy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yyyy.MM")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yyyy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yy")); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, Qt::ISODate); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("dddd d MMM yyyy h':'mm':'ss AP")); dateTime.setTimeSpec(Qt::LocalTime); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, QStringLiteral("yyyy:MM:dd hh:mm:ss")); dateTime.setTimeSpec(Qt::LocalTime); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, Qt::SystemLocaleDate); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, Qt::SystemLocaleShortDate); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { dateTime = QDateTime::fromString(dateString, Qt::SystemLocaleLongDate); dateTime.setTimeSpec(Qt::UTC); } if (!dateTime.isValid()) { qWarning() << "Could not determine correct datetime format from:" << dateString; return QDateTime(); } return dateTime; } static QDateTime toDateTime(const Exiv2::Value& value) { if (value.typeId() == Exiv2::asciiString) { QDateTime val = dateTimeFromString(value.toString().c_str()); if (val.isValid()) { // Datetime is stored in exif as local time. val.setOffsetFromUtc(0); return val; } } return QDateTime(); } void Exiv2Extractor::extract(const QString& filePath) { QByteArray arr = QFile::encodeName(filePath); std::string fileString(arr.data(), arr.length()); Exiv2::LogMsg::setLevel(Exiv2::LogMsg::mute); #if EXIV2_TEST_VERSION(0, 27, 99) Exiv2::Image::UniquePtr image; #else Exiv2::Image::AutoPtr image; #endif try { image = Exiv2::ImageFactory::open(fileString); } catch (const std::exception&) { return; } if (!image.get()) { return; } if (!image->good()) { return; } try { image->readMetadata(); } catch (const std::exception&) { return; } const Exiv2::ExifData& data = image->exifData(); Exiv2::ExifData::const_iterator it = data.findKey(Exiv2::ExifKey("Exif.Photo.DateTimeOriginal")); if (it != data.end()) { m_dateTime = toDateTime(it->value()); } if (m_dateTime.isNull()) { it = data.findKey(Exiv2::ExifKey("Exif.Image.DateTime")); if (it != data.end()) { m_dateTime = toDateTime(it->value()); } } m_latitude = fetchGpsDouble(data, "Exif.GPSInfo.GPSLatitude"); m_longitude = fetchGpsDouble(data, "Exif.GPSInfo.GPSLongitude"); QByteArray latRef = fetchByteArray(data, "Exif.GPSInfo.GPSLatitudeRef"); if (!latRef.isEmpty() && latRef[0] == 'S') m_latitude *= -1; QByteArray longRef = fetchByteArray(data, "Exif.GPSInfo.GPSLongitudeRef"); if (!longRef.isEmpty() && longRef[0] == 'W') m_longitude *= -1; m_error = false; } double Exiv2Extractor::fetchGpsDouble(const Exiv2::ExifData& data, const char* name) { Exiv2::ExifData::const_iterator it = data.findKey(Exiv2::ExifKey(name)); if (it != data.end() && it->count() == 3) { double n = 0.0; double d = 0.0; n = (*it).toRational(0).first; d = (*it).toRational(0).second; if (d == 0) { return 0.0; } double deg = n / d; n = (*it).toRational(1).first; d = (*it).toRational(1).second; if (d == 0) { return deg; } double min = n / d; if (min != -1.0) { deg += min / 60.0; } n = (*it).toRational(2).first; d = (*it).toRational(2).second; if (d == 0) { return deg; } double sec = n / d; if (sec != -1.0) { deg += sec / 3600.0; } return deg; } return 0.0; } QByteArray Exiv2Extractor::fetchByteArray(const Exiv2::ExifData& data, const char* name) { Exiv2::ExifData::const_iterator it = data.findKey(Exiv2::ExifKey(name)); if (it != data.end()) { std::string str = it->value().toString(); return QByteArray(str.c_str(), str.size()); } return QByteArray(); } bool Exiv2Extractor::error() const { return m_error; } diff --git a/src/exiv2extractor.h b/src/exiv2extractor.h index da4199b..47c7222 100644 --- a/src/exiv2extractor.h +++ b/src/exiv2extractor.h @@ -1,52 +1,39 @@ /* - Copyright (C) 2012-15 Vishesh Handa - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - + * SPDX-FileCopyrightText: (C) 2012-2015 Vishesh Handa + * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later + */ #ifndef EXIV2EXTRACTOR_H #define EXIV2EXTRACTOR_H #include #include #include class Exiv2Extractor { public: Exiv2Extractor(); void extract(const QString& filePath); double gpsLatitude() { return m_latitude; } double gpsLongitude() { return m_longitude; } QDateTime dateTime() { return m_dateTime; } bool error() const; private: double fetchGpsDouble(const Exiv2::ExifData& data, const char* name); QByteArray fetchByteArray(const Exiv2::ExifData& data, const char* name); double m_latitude; double m_longitude; QDateTime m_dateTime; bool m_error; }; #endif // EXIV2EXTRACTOR_H diff --git a/src/filesystemimagefetcher.cpp b/src/filesystemimagefetcher.cpp index 1d52229..135b005 100644 --- a/src/filesystemimagefetcher.cpp +++ b/src/filesystemimagefetcher.cpp @@ -1,53 +1,40 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "filesystemimagefetcher.h" #include #include #include FileSystemImageFetcher::FileSystemImageFetcher(const QString& folder, QObject* parent) : QObject(parent) , m_folder(folder) { } void FileSystemImageFetcher::fetch() { QTimer::singleShot(0, this, SLOT(slotProcess())); } void FileSystemImageFetcher::slotProcess() { QMimeDatabase mimeDb; QDirIterator it(m_folder, QDirIterator::Subdirectories); while (it.hasNext()) { QString filePath = it.next(); QString mimetype = mimeDb.mimeTypeForFile(filePath, QMimeDatabase::MatchExtension).name(); if (!mimetype.startsWith("image/")) continue; Q_EMIT imageResult(filePath); } Q_EMIT finished(); } diff --git a/src/filesystemimagefetcher.h b/src/filesystemimagefetcher.h index 8cf94c7..8e9c5ea 100644 --- a/src/filesystemimagefetcher.h +++ b/src/filesystemimagefetcher.h @@ -1,44 +1,31 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2012-2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef FILESYSTEMIMAGEFETCHER_H #define FILESYSTEMIMAGEFETCHER_H #include #include "koko_export.h" class KOKO_EXPORT FileSystemImageFetcher : public QObject { Q_OBJECT public: explicit FileSystemImageFetcher(const QString& folder, QObject* parent = 0); void fetch(); signals: void imageResult(const QString& filePath); void finished(); private slots: void slotProcess(); private: QString m_folder; }; #endif // FILESYSTEMIMAGEFETCHER_H diff --git a/src/filesystemtracker.cpp b/src/filesystemtracker.cpp index 30094f3..657e197 100644 --- a/src/filesystemtracker.cpp +++ b/src/filesystemtracker.cpp @@ -1,235 +1,222 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "filesystemtracker.h" #include "filesystemimagefetcher.h" #include #include #include #include #include #include #include #include #include #include FileSystemTracker::FileSystemTracker(QObject* parent) : QObject(parent) { QObject::connect(KDirWatch::self(), &KDirWatch::dirty, this, &FileSystemTracker::setSubFolder); org::kde::KDirNotify *kdirnotify = new org::kde::KDirNotify(QString(), QString(), QDBusConnection::sessionBus(), this); connect(kdirnotify, &org::kde::KDirNotify::FilesRemoved, this, [this](const QStringList &files) { for (const QString & filePath : files) { removeFile(filePath); } }); connect(kdirnotify, &org::kde::KDirNotify::FilesAdded, this, &FileSystemTracker::setSubFolder); connect(kdirnotify, &org::kde::KDirNotify::FileRenamedWithLocalPath, this, [this](const QString &src, const QString &dst, const QString &) { removeFile(src); slotNewFiles({dst}); }); // // Real time updates // QDBusConnection con = QDBusConnection::sessionBus(); con.connect(QString(), QLatin1String("/files"), QLatin1String("org.kde"), QLatin1String("changed"), this, SLOT(slotNewFiles(QStringList))); connect( this, &FileSystemTracker::subFolderChanged, this, &FileSystemTracker::reindexSubFolder); } void FileSystemTracker::setupDb() { static QString dir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/koko/"; QDir().mkpath(dir); QSqlDatabase db = QSqlDatabase::addDatabase(QStringLiteral("QSQLITE"), QStringLiteral("fstracker")); db.setDatabaseName(dir + "/fstracker.sqlite3"); if (!db.open()) { qWarning() << "Failed to open db" << db.lastError().text(); return; } if (db.tables().contains("files")) { return; } QSqlQuery query(db); bool ret = query.exec(QLatin1String("CREATE TABLE files(" "id INTEGER PRIMARY KEY, " "url TEXT NOT NULL UNIQUE)")); if (!ret) { qWarning() << "Could not create files table" << query.lastError().text(); return; } ret = query.exec(QLatin1String("CREATE INDEX fileUrl_index ON files (url)")); if (!ret) { qWarning() << "Could not create tags index" << query.lastError().text(); return; } // // WAL Journaling mode has much lower io writes than the traditional journal // based indexing. // ret = query.exec(QLatin1String("PRAGMA journal_mode = WAL")); if (!ret) { qWarning() << "Could not set WAL journaling mode" << query.lastError().text(); return; } } FileSystemTracker::~FileSystemTracker() { QSqlDatabase::removeDatabase(QStringLiteral("fstracker")); } void FileSystemTracker::slotImageResult(const QString& filePath) { QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("SELECT id from files where url = ?"); query.addBindValue(filePath); if (!query.exec()) { qDebug() << query.lastError(); return; } if (!query.next()) { QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("INSERT into files(url) VALUES (?)"); query.addBindValue(filePath); if (!query.exec()) { qDebug() << query.lastError(); return; } qDebug() << "ADDED" << filePath; emit imageAdded(filePath); } m_filePaths << filePath; } void FileSystemTracker::slotFetchFinished() { QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("SELECT url from files"); if (!query.exec()) { qDebug() << query.lastError(); return; } while (query.next()) { QString filePath = query.value(0).toString(); if (filePath.contains(m_subFolder) && !m_filePaths.contains(filePath)) { removeFile(filePath); } } QSqlDatabase::database("fstracker").commit(); m_filePaths.clear(); emit initialScanComplete(); } void FileSystemTracker::removeFile(const QString &filePath) { qDebug() << "REMOVED" << filePath; emit imageRemoved(filePath); QSqlQuery query(QSqlDatabase::database("fstracker")); query.prepare("DELETE from files where url = ?"); query.addBindValue(filePath); if (!query.exec()) { qWarning() << query.lastError(); } } void FileSystemTracker::slotNewFiles(const QStringList& files) { if (!m_filePaths.isEmpty()) { // A scan is already going on. No point interrupting it. return; } QMimeDatabase db; for (const QString& file: files) { QMimeType mimetype = db.mimeTypeForFile(file); if (mimetype.name().startsWith("image/")) { slotImageResult(file); } } m_filePaths.clear(); } void FileSystemTracker::setFolder(const QString &folder) { if (m_folder == folder) { return; } KDirWatch::self()->removeDir(m_folder); m_folder = folder; KDirWatch::self()->addDir(m_folder, KDirWatch::WatchSubDirs); } QString FileSystemTracker::folder() const { return m_folder; } void FileSystemTracker::setSubFolder(const QString& folder) { if(QFileInfo(folder).isDir()) { m_subFolder = folder; emit subFolderChanged(); } } void FileSystemTracker::reindexSubFolder() { FileSystemImageFetcher* fetcher = new FileSystemImageFetcher(m_subFolder); connect(fetcher, &FileSystemImageFetcher::imageResult, this, &FileSystemTracker::slotImageResult, Qt::QueuedConnection); connect(fetcher, &FileSystemImageFetcher::finished, this, &FileSystemTracker::slotFetchFinished, Qt::QueuedConnection); fetcher->fetch(); QSqlDatabase::database("fstracker").transaction(); } diff --git a/src/filesystemtracker.h b/src/filesystemtracker.h index cd97174..07bdda1 100644 --- a/src/filesystemtracker.h +++ b/src/filesystemtracker.h @@ -1,63 +1,50 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef FILESYSTEMTRACKER_H #define FILESYSTEMTRACKER_H #include #include class FileSystemTracker : public QObject { Q_OBJECT public: explicit FileSystemTracker(QObject* parent = 0); virtual ~FileSystemTracker(); void setFolder(const QString& folder); QString folder() const; void setSubFolder(const QString& folder); void reindexSubFolder(); void setupDb(); signals: void imageAdded(const QString& filePath); void imageRemoved(const QString& filePath); void initialScanComplete(); void subFolderChanged(); protected: void removeFile(const QString &filePath); private slots: void slotNewFiles(const QStringList& files); void slotImageResult(const QString& filePath); void slotFetchFinished(); private: QString m_folder; QString m_subFolder; QSet m_filePaths; }; #endif diff --git a/src/imagedocument.cpp b/src/imagedocument.cpp index b4a1357..56e7e0e 100644 --- a/src/imagedocument.cpp +++ b/src/imagedocument.cpp @@ -1,104 +1,91 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #include "imagedocument.h" #include #include #include ImageDocument::ImageDocument() { m_image = new QImage(); connect( this, &ImageDocument::pathChanged, this, [this] (const QString &url) { emit resetHandle(); /** Since the url passed by the model in the ImageViewer.qml contains 'file://' prefix */ QString location = QUrl( url).path(); m_image->load( location); m_edited = false; emit editedChanged(); emit visualImageChanged(); }); } ImageDocument::~ImageDocument() { } QString ImageDocument::path() { return m_path; } void ImageDocument::setPath(QString& url) { m_path = url; emit pathChanged( url); } QImage ImageDocument::visualImage() { return *m_image; } bool ImageDocument::edited() { return m_edited; } void ImageDocument::setEdited(bool value) { m_edited = value; emit editedChanged(); } void ImageDocument::rotate(int angle) { QMatrix matrix; matrix.rotate( angle); *m_image = m_image->transformed( matrix); QString location = QUrl( m_path).path(); if (QFileInfo( location).isWritable()) { m_image->save( location); } emit visualImageChanged(); } void ImageDocument::save( QImage image) { QString location = QUrl( m_path).path(); *m_image = image; if( QFileInfo( location).isWritable()) { m_image->save( location); emit resetHandle(); m_edited = false; emit editedChanged(); } m_image->load( location); emit visualImageChanged(); } void ImageDocument::cancel() { emit resetHandle(); m_edited = false; emit editedChanged(); } #include "moc_imagedocument.cpp" diff --git a/src/imagedocument.h b/src/imagedocument.h index c5a4c44..ad03a0c 100644 --- a/src/imagedocument.h +++ b/src/imagedocument.h @@ -1,59 +1,46 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #ifndef IMAGEDOCUMENT_H #define IMAGEDOCUMENT_H #include class ImageDocument : public QObject { Q_OBJECT Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged) Q_PROPERTY(QImage visualImage READ visualImage NOTIFY visualImageChanged) Q_PROPERTY(bool edited READ edited WRITE setEdited NOTIFY editedChanged) public: ImageDocument(); ~ImageDocument(); QString path(); void setPath( QString &url); QImage visualImage(); bool edited(); void setEdited( bool value); Q_INVOKABLE void rotate( int angle); Q_INVOKABLE void save( QImage image); Q_INVOKABLE void cancel(); signals: void pathChanged(const QString &url); void visualImageChanged(); void editedChanged(); void resetHandle(); private: QString m_path; QImage *m_image; bool m_edited; }; #endif diff --git a/src/imagefoldermodel.cpp b/src/imagefoldermodel.cpp index 49477f6..2ac0528 100644 --- a/src/imagefoldermodel.cpp +++ b/src/imagefoldermodel.cpp @@ -1,159 +1,146 @@ /* - * Copyright 2017 by Marco Martin - * Copyright (C) 2017 Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma + * SPDX-FileCopyrightText: (C) 2017 by Marco Martin * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #include "imagefoldermodel.h" #include "types.h" #include "roles.h" #include #include #include #include #include #include #include #include #include ImageFolderModel::ImageFolderModel(QObject *parent) : KDirModel(parent) { QMimeDatabase db; QList mimeList = db.allMimeTypes(); m_mimeTypes << "inode/directory"; foreach (const QMimeType &mime, mimeList) { if (mime.name().startsWith(QStringLiteral("image/"))) { m_mimeTypes << mime.name(); } } dirLister()->setMimeFilter(m_mimeTypes); connect(this, &QAbstractItemModel::rowsInserted, this, &ImageFolderModel::countChanged); connect(this, &QAbstractItemModel::rowsRemoved, this, &ImageFolderModel::countChanged); connect(this, &QAbstractItemModel::modelReset, this, &ImageFolderModel::countChanged); } ImageFolderModel::~ImageFolderModel() { } QHash ImageFolderModel::roleNames() const { return { { Qt::DisplayRole, "display" }, { Qt::DecorationRole, "decoration" }, { Roles::ImageUrlRole, "imageurl" }, { Roles::MimeTypeRole, "mimeType" }, { Roles::ItemTypeRole, "itemType"} }; } QString ImageFolderModel::url() const { return dirLister()->url().toString(); } void ImageFolderModel::setUrl(QString& url) { url = QUrl(url).path(); if (url.isEmpty()) { QStringList locations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); Q_ASSERT(locations.size() >= 1); url = locations.first().append("/"); } url = QUrl::fromLocalFile(url).toString(); Q_ASSERT( QUrl(url).isLocalFile()); if (dirLister()->url().path() == QUrl(url).path()) { dirLister()->updateDirectory(QUrl(url)); return; } beginResetModel(); dirLister()->openUrl(QUrl(url)); endResetModel(); emit urlChanged(); } int ImageFolderModel::indexForUrl(const QString &url) const { QModelIndex index = KDirModel::indexForUrl(QUrl(url)); return index.row(); } QVariantMap ImageFolderModel::get(int i) const { QModelIndex modelIndex = index(i, 0); KFileItem item = itemForIndex(modelIndex); QString url = item.url().toString(); QString mimeType = item.mimetype(); QVariantMap ret; ret.insert(QStringLiteral("url"), QVariant(url)); ret.insert(QStringLiteral("mimeType"), QVariant(mimeType)); return ret; } void ImageFolderModel::emptyTrash() { KIO::emptyTrash(); } QVariant ImageFolderModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) { return QVariant(); } switch (role) { case Roles::ImageUrlRole: { KFileItem item = itemForIndex(index); return item.url().toString(); } case Roles::MimeTypeRole: { KFileItem item = itemForIndex(index); return item.mimetype(); } case Roles::ItemTypeRole: { KFileItem item = itemForIndex(index); if( item.isDir()) { return Types::Folder; } else { return Types::Image; } } default: return KDirModel::data(index, role); } } #include "moc_imagefoldermodel.cpp" diff --git a/src/imagefoldermodel.h b/src/imagefoldermodel.h index bd3cef8..287a375 100644 --- a/src/imagefoldermodel.h +++ b/src/imagefoldermodel.h @@ -1,80 +1,67 @@ /* - * Copyright 2017 by Marco Martin - * Copyright (C) 2017 Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma + * SPDX-FileCopyrightText: (C) 2017 by Marco Martin * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #ifndef IMAGEFOLDERMODEL_H #define IMAGEFOLDERMODEL_H #include #include #include class QTimer; /** * This class provides a QML binding to KDirModel * Provides an easy way to navigate a filesystem from within QML * * @author Marco Martin */ class ImageFolderModel : public KDirModel { Q_OBJECT /** * @property string The url we want to browse. it may be an absolute path or a correct url of any protocol KIO supports */ Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged) /** * @property count Total number of rows */ Q_PROPERTY(int count READ count NOTIFY countChanged) public: ImageFolderModel(QObject* parent=0); virtual ~ImageFolderModel(); QHash roleNames() const override; void setUrl(QString& url); QString url() const; QVariant data(const QModelIndex &index, int role) const override; int count() const {return rowCount();} Q_INVOKABLE int indexForUrl(const QString &url) const; Q_INVOKABLE QVariantMap get(int index) const; /** * Helper method to empty the trash */ Q_INVOKABLE void emptyTrash(); Q_SIGNALS: void countChanged(); void urlChanged(); private: QStringList m_mimeTypes; QString m_imagePath; }; #endif // IMAGEFOLDERMODEL_H diff --git a/src/imagelistmodel.cpp b/src/imagelistmodel.cpp index ab78688..7a56bf9 100644 --- a/src/imagelistmodel.cpp +++ b/src/imagelistmodel.cpp @@ -1,169 +1,156 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #include "imagelistmodel.h" #include "roles.h" #include "imagestorage.h" #include #include ImageListModel::ImageListModel(QObject* parent) : QAbstractListModel(parent) { connect(this, &ImageListModel::locationGroupChanged, this, &ImageListModel::slotLocationGroupChanged); connect(this, &ImageListModel::timeGroupChanged, this, &ImageListModel::slotTimeGroupChanged); connect(this, &ImageListModel::queryChanged, this, &ImageListModel::slotResetModel); connect(ImageStorage::instance(), &ImageStorage::storageModified, this, &ImageListModel::slotResetModel); } ImageListModel::~ImageListModel() { } QHash ImageListModel::roleNames() const { QHash hash = QAbstractListModel::roleNames(); hash.insert( Roles::ImageUrlRole, "imageurl"); hash.insert( Roles::ItemTypeRole, "itemType"); hash.insert( Roles::MimeTypeRole, "mimeType"); return hash; } QVariant ImageListModel::data(const QModelIndex& index, int role) const { if( !index.isValid()) { return QVariant(); } int indexValue = index.row(); switch( role) { case Qt::DisplayRole: //TODO: return the filename component return m_images.at(indexValue); case Roles::ImageUrlRole: return m_images.at(indexValue); case Roles::ItemTypeRole: return Types::Image; case Roles::MimeTypeRole: { QMimeDatabase db; QMimeType type = db.mimeTypeForFile( m_images.at(indexValue)); return type.name(); } } return QVariant(); } int ImageListModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) return m_images.size(); } void ImageListModel::slotLocationGroupChanged() { if( m_locationGroup != -1) { m_locations = ImageStorage::instance()->locations( static_cast(m_locationGroup)); m_queryType = Types::LocationQuery; } } void ImageListModel::slotTimeGroupChanged() { if( m_timeGroup != -1) { m_times = ImageStorage::instance()->timeTypes( static_cast(m_timeGroup)); m_queryType = Types::TimeQuery; } } void ImageListModel::slotResetModel() { beginResetModel(); if(m_queryType == Types::LocationQuery) { m_images = ImageStorage::instance()->imagesForLocation( m_query, static_cast(m_locationGroup)); } else if (m_queryType == Types::TimeQuery) { m_images = ImageStorage::instance()->imagesForTime( m_query, static_cast(m_timeGroup)); } endResetModel(); } Types::LocationGroup ImageListModel::locationGroup() const { return m_locationGroup; } void ImageListModel::setLocationGroup(const Types::LocationGroup &group) { m_locationGroup = group; emit locationGroupChanged(); } Types::TimeGroup ImageListModel::timeGroup() const { return m_timeGroup; } void ImageListModel::setTimeGroup(const Types::TimeGroup &group) { m_timeGroup = group; emit timeGroupChanged(); } Types::QueryType ImageListModel::queryType() const { return m_queryType; } void ImageListModel::setQueryType(const Types::QueryType& type) { m_queryType = type; } QByteArray ImageListModel::query() const { return m_query; } void ImageListModel::setQuery(const QByteArray &statement) { m_query = statement; emit queryChanged(); } QByteArray ImageListModel::queryForIndex(const int& index) { if(m_queryType == Types::LocationQuery) { return m_locations.at( index).first; } else if( m_queryType == Types::TimeQuery) { return m_times.at( index).first; } return QByteArray(); } #include "moc_imagelistmodel.cpp" diff --git a/src/imagelistmodel.h b/src/imagelistmodel.h index eeea919..992f043 100644 --- a/src/imagelistmodel.h +++ b/src/imagelistmodel.h @@ -1,79 +1,66 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #ifndef IMAGELISTMODEL_H #define IMAGELISTMODEL_H #include #include "types.h" class ImageListModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(Types::LocationGroup locationGroup READ locationGroup WRITE setLocationGroup NOTIFY locationGroupChanged) Q_PROPERTY(Types::TimeGroup timeGroup READ timeGroup WRITE setTimeGroup NOTIFY timeGroupChanged) Q_PROPERTY(Types::QueryType queryType READ queryType WRITE setQueryType) Q_PROPERTY(QByteArray query READ query WRITE setQuery NOTIFY queryChanged) public: explicit ImageListModel(QObject* parent = 0); ~ImageListModel(); QHash< int, QByteArray > roleNames() const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; Types::LocationGroup locationGroup() const; void setLocationGroup(const Types::LocationGroup &group); Types::TimeGroup timeGroup() const; void setTimeGroup(const Types::TimeGroup &group); Types::QueryType queryType() const; void setQueryType( const Types::QueryType &type); QByteArray query() const; void setQuery(const QByteArray &statement); Q_INVOKABLE QByteArray queryForIndex(const int &index); void slotLocationGroupChanged(); void slotTimeGroupChanged(); void slotResetModel(); Q_SIGNALS: void imageListChanged(); void locationGroupChanged(); void timeGroupChanged(); void queryChanged(); private: QStringList m_images; Types::LocationGroup m_locationGroup; Types::TimeGroup m_timeGroup; Types::QueryType m_queryType; QByteArray m_query; QList< QPair > m_times; QList< QPair > m_locations; }; #endif diff --git a/src/imagelocationmodel.cpp b/src/imagelocationmodel.cpp index 3622618..382304e 100644 --- a/src/imagelocationmodel.cpp +++ b/src/imagelocationmodel.cpp @@ -1,113 +1,100 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "imagelocationmodel.h" #include "imagestorage.h" #include "roles.h" #include #include ImageLocationModel::ImageLocationModel(QObject* parent) : QAbstractListModel(parent) , m_group(Types::LocationGroup::City) { connect(ImageStorage::instance(), SIGNAL(storageModified()), this, SLOT(slotPopulate())); } void ImageLocationModel::slotPopulate() { beginResetModel(); m_locations = ImageStorage::instance()->locations(static_cast(m_group)); endResetModel(); } QHash ImageLocationModel::roleNames() const { auto hash = QAbstractItemModel::roleNames(); hash.insert( Roles::FilesRole, "files"); hash.insert( Roles::FileCountRole, "fileCount"); //the url role returns the url of the cover image of the collection hash.insert( Roles::ImageUrlRole, "imageurl"); hash.insert( Roles::ItemTypeRole, "itemType"); return hash; } QVariant ImageLocationModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { return QVariant(); } QByteArray key = m_locations.at(index.row()).first; QString display = m_locations.at(index.row()).second; switch (role) { case Qt::DisplayRole: return display; case Roles::FilesRole: { auto group = static_cast(m_group); return ImageStorage::instance()->imagesForLocation(key, group); } case Roles::FileCountRole: { auto group = static_cast(m_group); return ImageStorage::instance()->imagesForLocation(key, group).size(); } case Roles::ImageUrlRole: { auto group = static_cast(m_group); return ImageStorage::instance()->imageForLocation(key, group); } case Roles::ItemTypeRole: { return Types::Album; } } return QVariant(); } int ImageLocationModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) { return 0; } return m_locations.size(); } void ImageLocationModel::setGroup(Types::LocationGroup group) { beginResetModel(); m_group = group; m_locations = ImageStorage::instance()->locations(static_cast(group)); endResetModel(); emit groupChanged(); } Types::LocationGroup ImageLocationModel::group() const { return m_group; } diff --git a/src/imagelocationmodel.h b/src/imagelocationmodel.h index 0847bfe..22d6565 100644 --- a/src/imagelocationmodel.h +++ b/src/imagelocationmodel.h @@ -1,55 +1,42 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef IMAGELOCATIONMODEL_H #define IMAGELOCATIONMODEL_H #include #include #include #include "types.h" class ImageLocationModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(Types::LocationGroup group READ group WRITE setGroup NOTIFY groupChanged) public: explicit ImageLocationModel(QObject* parent = 0); QHash< int, QByteArray > roleNames() const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; Types::LocationGroup group() const; void setGroup(Types::LocationGroup group); signals: void groupChanged(); private slots: void slotPopulate(); private: Types::LocationGroup m_group; QList > m_locations; }; #endif // IMAGELOCATIONMODEL_H diff --git a/src/imageprocessorrunnable.cpp b/src/imageprocessorrunnable.cpp index 4f28037..6929e32 100644 --- a/src/imageprocessorrunnable.cpp +++ b/src/imageprocessorrunnable.cpp @@ -1,74 +1,61 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "imageprocessorrunnable.h" #include #include "reversegeocoder.h" #include "imagestorage.h" #include "exiv2extractor.h" using namespace Koko; ImageProcessorRunnable::ImageProcessorRunnable(QString& filePath, ReverseGeoCoder* geoCoder) : QObject() , m_path(filePath) , m_geoCoder(geoCoder) { } void ImageProcessorRunnable::run() { ImageInfo ii; ii.path = m_path; Exiv2Extractor extractor; extractor.extract(m_path); if (extractor.error()) { emit finished(); return; } double latitude = extractor.gpsLatitude(); double longitude = extractor.gpsLongitude(); if (latitude != 0.0 && longitude != 0.0) { if (!m_geoCoder->initialized()) { m_geoCoder->init(); } QVariantMap map = m_geoCoder->lookup(latitude, longitude); QGeoAddress addr; addr.setCountry(map.value("country").toString()); addr.setState(map.value("admin1").toString()); addr.setCity(map.value("admin2").toString()); ii.location.setAddress(addr); } ii.dateTime = extractor.dateTime(); if (ii.dateTime.isNull()) { ii.dateTime = QFileInfo(m_path).birthTime(); } QMetaObject::invokeMethod(ImageStorage::instance(), "addImage", Qt::AutoConnection, Q_ARG(const ImageInfo&, ii)); emit finished(); } diff --git a/src/imageprocessorrunnable.h b/src/imageprocessorrunnable.h index 3a71e53..fe2246f 100644 --- a/src/imageprocessorrunnable.h +++ b/src/imageprocessorrunnable.h @@ -1,46 +1,33 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef KOKO_IMAGEPROCESSORRUNNABLE_H #define KOKO_IMAGEPROCESSORRUNNABLE_H #include #include namespace Koko { class ReverseGeoCoder; class ImageProcessorRunnable : public QObject, public QRunnable { Q_OBJECT public: ImageProcessorRunnable(QString& filePath, ReverseGeoCoder* coder); void run() override; signals: void finished(); private: QString m_path; ReverseGeoCoder* m_geoCoder; }; } #endif // KOKO_IMAGEPROCESSORRUNNABLE_H diff --git a/src/imagetimemodel.cpp b/src/imagetimemodel.cpp index eac9507..babb30c 100644 --- a/src/imagetimemodel.cpp +++ b/src/imagetimemodel.cpp @@ -1,122 +1,109 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "imagetimemodel.h" #include "imagestorage.h" #include "roles.h" #include #include ImageTimeModel::ImageTimeModel(QObject* parent) : QAbstractListModel(parent) , m_group(Types::TimeGroup::Day) { connect(ImageStorage::instance(), SIGNAL(storageModified()), this, SLOT(slotPopulate())); } void ImageTimeModel::slotPopulate() { beginResetModel(); auto tg = static_cast(m_group); m_times = ImageStorage::instance()->timeTypes(tg); endResetModel(); } QHash ImageTimeModel::roleNames() const { auto hash = QAbstractItemModel::roleNames(); hash.insert( Roles::FilesRole, "files"); hash.insert( Roles::FileCountRole, "fileCount"); //the url role returns the url of the cover image of the collection hash.insert( Roles::ImageUrlRole, "imageurl"); hash.insert( Roles::DateRole, "date"); hash.insert( Roles::ItemTypeRole, "itemType"); return hash; } QVariant ImageTimeModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { return QVariant(); } QByteArray key = m_times.at(index.row()).first; QString display = m_times.at(index.row()).second; switch (role) { case Qt::DisplayRole: return display; case Roles::FilesRole: { auto tg = static_cast(m_group); return ImageStorage::instance()->imagesForTime(key, tg); } case Roles::FileCountRole: { auto tg = static_cast(m_group); return ImageStorage::instance()->imagesForTime(key, tg).size(); } case Roles::ImageUrlRole: { auto tg = static_cast(m_group); return ImageStorage::instance()->imageForTime(key, tg); } case Roles::DateRole: { auto tg = static_cast(m_group); return ImageStorage::instance()->dateForKey(key, tg); } case Roles::ItemTypeRole: { return Types::Album; } } return QVariant(); } int ImageTimeModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) { return 0; } return m_times.size(); } Types::TimeGroup ImageTimeModel::group() const { return m_group; } void ImageTimeModel::setGroup(Types::TimeGroup group) { beginResetModel(); m_group = group; auto tg = static_cast(m_group); m_times = ImageStorage::instance()->timeTypes(tg); endResetModel(); emit groupChanged(); } diff --git a/src/imagetimemodel.h b/src/imagetimemodel.h index 551e199..93536a4 100644 --- a/src/imagetimemodel.h +++ b/src/imagetimemodel.h @@ -1,54 +1,41 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef IMAGETIMEMODEL_H #define IMAGETIMEMODEL_H #include #include #include "types.h" class ImageTimeModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(Types::TimeGroup group READ group WRITE setGroup NOTIFY groupChanged) public: explicit ImageTimeModel(QObject* parent = 0); QHash< int, QByteArray > roleNames() const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; Types::TimeGroup group() const; void setGroup(Types::TimeGroup group); signals: void groupChanged(); private slots: void slotPopulate(); private: Types::TimeGroup m_group; QList< QPair > m_times; }; #endif diff --git a/src/kdtree.c b/src/kdtree.c index 8b84ed4..5466fd7 100644 --- a/src/kdtree.c +++ b/src/kdtree.c @@ -1,836 +1,815 @@ /* -This file is part of ``kdtree'', a library for working with kd-trees. -Copyright (C) 2007-2011 John Tsiombikas - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ + * SPDX-FileCopyrightText: (C) 2007-2011 John Tsiombikas + * + * SPDX-LicenseIdentifier: BSD-3-Clause + */ /* single nearest neighbor search written by Tamas Nepusz */ #include #include #include #include #include "kdtree.h" #if defined(WIN32) || defined(__WIN32__) #include #endif #ifdef USE_LIST_NODE_ALLOCATOR #ifndef NO_PTHREADS #include #else #ifndef I_WANT_THREAD_BUGS #error "You are compiling with the fast list node allocator, with pthreads disabled! This WILL break if used from multiple threads." #endif /* I want thread bugs */ #endif /* pthread support */ #endif /* use list node allocator */ struct kdhyperrect { int dim; double *min, *max; /* minimum/maximum coords */ }; struct kdnode { double *pos; int dir; void *data; struct kdnode *left, *right; /* negative/positive side */ }; struct res_node { struct kdnode *item; double dist_sq; struct res_node *next; }; struct kdtree { int dim; struct kdnode *root; struct kdhyperrect *rect; void (*destr)(void*); }; struct kdres { struct kdtree *tree; struct res_node *rlist, *riter; int size; }; #define SQ(x) ((x) * (x)) static void clear_rec(struct kdnode *node, void (*destr)(void*)); static int insert_rec(struct kdnode **node, const double *pos, void *data, int dir, int dim); static int rlist_insert(struct res_node *list, struct kdnode *item, double dist_sq); static void clear_results(struct kdres *set); static struct kdhyperrect* hyperrect_create(int dim, const double *min, const double *max); static void hyperrect_free(struct kdhyperrect *rect); static struct kdhyperrect* hyperrect_duplicate(const struct kdhyperrect *rect); static void hyperrect_extend(struct kdhyperrect *rect, const double *pos); static double hyperrect_dist_sq(struct kdhyperrect *rect, const double *pos); #ifdef USE_LIST_NODE_ALLOCATOR static struct res_node *alloc_resnode(void); static void free_resnode(struct res_node*); #else #define alloc_resnode() malloc(sizeof(struct res_node)) #define free_resnode(n) free(n) #endif struct kdtree *kd_create(int k) { struct kdtree *tree; if(!(tree = malloc(sizeof *tree))) { return 0; } tree->dim = k; tree->root = 0; tree->destr = 0; tree->rect = 0; return tree; } void kd_free(struct kdtree *tree) { if(tree) { kd_clear(tree); free(tree); } } static void clear_rec(struct kdnode *node, void (*destr)(void*)) { if(!node) return; clear_rec(node->left, destr); clear_rec(node->right, destr); if(destr) { destr(node->data); } free(node->pos); free(node); } void kd_clear(struct kdtree *tree) { clear_rec(tree->root, tree->destr); tree->root = 0; if (tree->rect) { hyperrect_free(tree->rect); tree->rect = 0; } } void kd_data_destructor(struct kdtree *tree, void (*destr)(void*)) { tree->destr = destr; } static int insert_rec(struct kdnode **nptr, const double *pos, void *data, int dir, int dim) { int new_dir; struct kdnode *node; if(!*nptr) { if(!(node = malloc(sizeof *node))) { return -1; } if(!(node->pos = malloc(dim * sizeof *node->pos))) { free(node); return -1; } memcpy(node->pos, pos, dim * sizeof *node->pos); node->data = data; node->dir = dir; node->left = node->right = 0; *nptr = node; return 0; } node = *nptr; new_dir = (node->dir + 1) % dim; if(pos[node->dir] < node->pos[node->dir]) { return insert_rec(&(*nptr)->left, pos, data, new_dir, dim); } return insert_rec(&(*nptr)->right, pos, data, new_dir, dim); } int kd_insert(struct kdtree *tree, const double *pos, void *data) { if (insert_rec(&tree->root, pos, data, 0, tree->dim)) { return -1; } if (tree->rect == 0) { tree->rect = hyperrect_create(tree->dim, pos, pos); } else { hyperrect_extend(tree->rect, pos); } return 0; } int kd_insertf(struct kdtree *tree, const float *pos, void *data) { static double sbuf[16]; double *bptr, *buf = 0; int res, dim = tree->dim; if(dim > 16) { #ifndef NO_ALLOCA if(dim <= 256) bptr = buf = alloca(dim * sizeof *bptr); else #endif if(!(bptr = buf = malloc(dim * sizeof *bptr))) { return -1; } } else { bptr = buf = sbuf; } while(dim-- > 0) { *bptr++ = *pos++; } res = kd_insert(tree, buf, data); #ifndef NO_ALLOCA if(tree->dim > 256) #else if(tree->dim > 16) #endif free(buf); return res; } int kd_insert3(struct kdtree *tree, double x, double y, double z, void *data) { double buf[3]; buf[0] = x; buf[1] = y; buf[2] = z; return kd_insert(tree, buf, data); } int kd_insert3f(struct kdtree *tree, float x, float y, float z, void *data) { double buf[3]; buf[0] = x; buf[1] = y; buf[2] = z; return kd_insert(tree, buf, data); } static int find_nearest(struct kdnode *node, const double *pos, double range, struct res_node *list, int ordered, int dim) { double dist_sq, dx; int i, ret, added_res = 0; if(!node) return 0; dist_sq = 0; for(i=0; ipos[i] - pos[i]); } if(dist_sq <= SQ(range)) { if(rlist_insert(list, node, ordered ? dist_sq : -1.0) == -1) { return -1; } added_res = 1; } dx = pos[node->dir] - node->pos[node->dir]; ret = find_nearest(dx <= 0.0 ? node->left : node->right, pos, range, list, ordered, dim); if(ret >= 0 && fabs(dx) < range) { added_res += ret; ret = find_nearest(dx <= 0.0 ? node->right : node->left, pos, range, list, ordered, dim); } if(ret == -1) { return -1; } added_res += ret; return added_res; } #if 0 static int find_nearest_n(struct kdnode *node, const double *pos, double range, int num, struct rheap *heap, int dim) { double dist_sq, dx; int i, ret, added_res = 0; if(!node) return 0; /* if the photon is close enough, add it to the result heap */ dist_sq = 0; for(i=0; ipos[i] - pos[i]); } if(dist_sq <= range_sq) { if(heap->size >= num) { /* get furthest element */ struct res_node *maxelem = rheap_get_max(heap); /* and check if the new one is closer than that */ if(maxelem->dist_sq > dist_sq) { rheap_remove_max(heap); if(rheap_insert(heap, node, dist_sq) == -1) { return -1; } added_res = 1; range_sq = dist_sq; } } else { if(rheap_insert(heap, node, dist_sq) == -1) { return =1; } added_res = 1; } } /* find signed distance from the splitting plane */ dx = pos[node->dir] - node->pos[node->dir]; ret = find_nearest_n(dx <= 0.0 ? node->left : node->right, pos, range, num, heap, dim); if(ret >= 0 && fabs(dx) < range) { added_res += ret; ret = find_nearest_n(dx <= 0.0 ? node->right : node->left, pos, range, num, heap, dim); } } #endif static void kd_nearest_i(struct kdnode *node, const double *pos, struct kdnode **result, double *result_dist_sq, struct kdhyperrect* rect) { int dir = node->dir; int i; double dummy, dist_sq; struct kdnode *nearer_subtree, *farther_subtree; double *nearer_hyperrect_coord, *farther_hyperrect_coord; /* Decide whether to go left or right in the tree */ dummy = pos[dir] - node->pos[dir]; if (dummy <= 0) { nearer_subtree = node->left; farther_subtree = node->right; nearer_hyperrect_coord = rect->max + dir; farther_hyperrect_coord = rect->min + dir; } else { nearer_subtree = node->right; farther_subtree = node->left; nearer_hyperrect_coord = rect->min + dir; farther_hyperrect_coord = rect->max + dir; } if (nearer_subtree) { /* Slice the hyperrect to get the hyperrect of the nearer subtree */ dummy = *nearer_hyperrect_coord; *nearer_hyperrect_coord = node->pos[dir]; /* Recurse down into nearer subtree */ kd_nearest_i(nearer_subtree, pos, result, result_dist_sq, rect); /* Undo the slice */ *nearer_hyperrect_coord = dummy; } /* Check the distance of the point at the current node, compare it * with our best so far */ dist_sq = 0; for(i=0; i < rect->dim; i++) { dist_sq += SQ(node->pos[i] - pos[i]); } if (dist_sq < *result_dist_sq) { *result = node; *result_dist_sq = dist_sq; } if (farther_subtree) { /* Get the hyperrect of the farther subtree */ dummy = *farther_hyperrect_coord; *farther_hyperrect_coord = node->pos[dir]; /* Check if we have to recurse down by calculating the closest * point of the hyperrect and see if it's closer than our * minimum distance in result_dist_sq. */ if (hyperrect_dist_sq(rect, pos) < *result_dist_sq) { /* Recurse down into farther subtree */ kd_nearest_i(farther_subtree, pos, result, result_dist_sq, rect); } /* Undo the slice on the hyperrect */ *farther_hyperrect_coord = dummy; } } struct kdres *kd_nearest(struct kdtree *kd, const double *pos) { struct kdhyperrect *rect; struct kdnode *result; struct kdres *rset; double dist_sq; int i; if (!kd) return 0; if (!kd->rect) return 0; /* Allocate result set */ if(!(rset = malloc(sizeof *rset))) { return 0; } if(!(rset->rlist = alloc_resnode())) { free(rset); return 0; } rset->rlist->next = 0; rset->tree = kd; /* Duplicate the bounding hyperrectangle, we will work on the copy */ if (!(rect = hyperrect_duplicate(kd->rect))) { kd_res_free(rset); return 0; } /* Our first guesstimate is the root node */ result = kd->root; dist_sq = 0; for (i = 0; i < kd->dim; i++) dist_sq += SQ(result->pos[i] - pos[i]); /* Search for the nearest neighbour recursively */ kd_nearest_i(kd->root, pos, &result, &dist_sq, rect); /* Free the copy of the hyperrect */ hyperrect_free(rect); /* Store the result */ if (result) { if (rlist_insert(rset->rlist, result, -1.0) == -1) { kd_res_free(rset); return 0; } rset->size = 1; kd_res_rewind(rset); return rset; } else { kd_res_free(rset); return 0; } } struct kdres *kd_nearestf(struct kdtree *tree, const float *pos) { static double sbuf[16]; double *bptr, *buf = 0; int dim = tree->dim; struct kdres *res; if(dim > 16) { #ifndef NO_ALLOCA if(dim <= 256) bptr = buf = alloca(dim * sizeof *bptr); else #endif if(!(bptr = buf = malloc(dim * sizeof *bptr))) { return 0; } } else { bptr = buf = sbuf; } while(dim-- > 0) { *bptr++ = *pos++; } res = kd_nearest(tree, buf); #ifndef NO_ALLOCA if(tree->dim > 256) #else if(tree->dim > 16) #endif free(buf); return res; } struct kdres *kd_nearest3(struct kdtree *tree, double x, double y, double z) { double pos[3]; pos[0] = x; pos[1] = y; pos[2] = z; return kd_nearest(tree, pos); } struct kdres *kd_nearest3f(struct kdtree *tree, float x, float y, float z) { double pos[3]; pos[0] = x; pos[1] = y; pos[2] = z; return kd_nearest(tree, pos); } /* ---- nearest N search ---- */ /* static kdres *kd_nearest_n(struct kdtree *kd, const double *pos, int num) { int ret; struct kdres *rset; if(!(rset = malloc(sizeof *rset))) { return 0; } if(!(rset->rlist = alloc_resnode())) { free(rset); return 0; } rset->rlist->next = 0; rset->tree = kd; if((ret = find_nearest_n(kd->root, pos, range, num, rset->rlist, kd->dim)) == -1) { kd_res_free(rset); return 0; } rset->size = ret; kd_res_rewind(rset); return rset; }*/ struct kdres *kd_nearest_range(struct kdtree *kd, const double *pos, double range) { int ret; struct kdres *rset; if(!(rset = malloc(sizeof *rset))) { return 0; } if(!(rset->rlist = alloc_resnode())) { free(rset); return 0; } rset->rlist->next = 0; rset->tree = kd; if((ret = find_nearest(kd->root, pos, range, rset->rlist, 0, kd->dim)) == -1) { kd_res_free(rset); return 0; } rset->size = ret; kd_res_rewind(rset); return rset; } struct kdres *kd_nearest_rangef(struct kdtree *kd, const float *pos, float range) { static double sbuf[16]; double *bptr, *buf = 0; int dim = kd->dim; struct kdres *res; if(dim > 16) { #ifndef NO_ALLOCA if(dim <= 256) bptr = buf = alloca(dim * sizeof *bptr); else #endif if(!(bptr = buf = malloc(dim * sizeof *bptr))) { return 0; } } else { bptr = buf = sbuf; } while(dim-- > 0) { *bptr++ = *pos++; } res = kd_nearest_range(kd, buf, range); #ifndef NO_ALLOCA if(kd->dim > 256) #else if(kd->dim > 16) #endif free(buf); return res; } struct kdres *kd_nearest_range3(struct kdtree *tree, double x, double y, double z, double range) { double buf[3]; buf[0] = x; buf[1] = y; buf[2] = z; return kd_nearest_range(tree, buf, range); } struct kdres *kd_nearest_range3f(struct kdtree *tree, float x, float y, float z, float range) { double buf[3]; buf[0] = x; buf[1] = y; buf[2] = z; return kd_nearest_range(tree, buf, range); } void kd_res_free(struct kdres *rset) { clear_results(rset); free_resnode(rset->rlist); free(rset); } int kd_res_size(struct kdres *set) { return (set->size); } void kd_res_rewind(struct kdres *rset) { rset->riter = rset->rlist->next; } int kd_res_end(struct kdres *rset) { return rset->riter == 0; } int kd_res_next(struct kdres *rset) { rset->riter = rset->riter->next; return rset->riter != 0; } void *kd_res_item(struct kdres *rset, double *pos) { if(rset->riter) { if(pos) { memcpy(pos, rset->riter->item->pos, rset->tree->dim * sizeof *pos); } return rset->riter->item->data; } return 0; } void *kd_res_itemf(struct kdres *rset, float *pos) { if(rset->riter) { if(pos) { int i; for(i=0; itree->dim; i++) { pos[i] = rset->riter->item->pos[i]; } } return rset->riter->item->data; } return 0; } void *kd_res_item3(struct kdres *rset, double *x, double *y, double *z) { if(rset->riter) { if(*x) *x = rset->riter->item->pos[0]; if(*y) *y = rset->riter->item->pos[1]; if(*z) *z = rset->riter->item->pos[2]; } return 0; } void *kd_res_item3f(struct kdres *rset, float *x, float *y, float *z) { if(rset->riter) { if(*x) *x = rset->riter->item->pos[0]; if(*y) *y = rset->riter->item->pos[1]; if(*z) *z = rset->riter->item->pos[2]; } return 0; } void *kd_res_item_data(struct kdres *set) { return kd_res_item(set, 0); } /* ---- hyperrectangle helpers ---- */ static struct kdhyperrect* hyperrect_create(int dim, const double *min, const double *max) { size_t size = dim * sizeof(double); struct kdhyperrect* rect = 0; if (!(rect = malloc(sizeof(struct kdhyperrect)))) { return 0; } rect->dim = dim; if (!(rect->min = malloc(size))) { free(rect); return 0; } if (!(rect->max = malloc(size))) { free(rect->min); free(rect); return 0; } memcpy(rect->min, min, size); memcpy(rect->max, max, size); return rect; } static void hyperrect_free(struct kdhyperrect *rect) { free(rect->min); free(rect->max); free(rect); } static struct kdhyperrect* hyperrect_duplicate(const struct kdhyperrect *rect) { return hyperrect_create(rect->dim, rect->min, rect->max); } static void hyperrect_extend(struct kdhyperrect *rect, const double *pos) { int i; for (i=0; i < rect->dim; i++) { if (pos[i] < rect->min[i]) { rect->min[i] = pos[i]; } if (pos[i] > rect->max[i]) { rect->max[i] = pos[i]; } } } static double hyperrect_dist_sq(struct kdhyperrect *rect, const double *pos) { int i; double result = 0; for (i=0; i < rect->dim; i++) { if (pos[i] < rect->min[i]) { result += SQ(rect->min[i] - pos[i]); } else if (pos[i] > rect->max[i]) { result += SQ(rect->max[i] - pos[i]); } } return result; } /* ---- static helpers ---- */ #ifdef USE_LIST_NODE_ALLOCATOR /* special list node allocators. */ static struct res_node *free_nodes; #ifndef NO_PTHREADS static pthread_mutex_t alloc_mutex = PTHREAD_MUTEX_INITIALIZER; #endif static struct res_node *alloc_resnode(void) { struct res_node *node; #ifndef NO_PTHREADS pthread_mutex_lock(&alloc_mutex); #endif if(!free_nodes) { node = malloc(sizeof *node); } else { node = free_nodes; free_nodes = free_nodes->next; node->next = 0; } #ifndef NO_PTHREADS pthread_mutex_unlock(&alloc_mutex); #endif return node; } static void free_resnode(struct res_node *node) { #ifndef NO_PTHREADS pthread_mutex_lock(&alloc_mutex); #endif node->next = free_nodes; free_nodes = node; #ifndef NO_PTHREADS pthread_mutex_unlock(&alloc_mutex); #endif } #endif /* list node allocator or not */ /* inserts the item. if dist_sq is >= 0, then do an ordered insert */ /* TODO make the ordering code use heapsort */ static int rlist_insert(struct res_node *list, struct kdnode *item, double dist_sq) { struct res_node *rnode; if(!(rnode = alloc_resnode())) { return -1; } rnode->item = item; rnode->dist_sq = dist_sq; if(dist_sq >= 0.0) { while(list->next && list->next->dist_sq < dist_sq) { list = list->next; } } rnode->next = list->next; list->next = rnode; return 0; } static void clear_results(struct kdres *rset) { struct res_node *tmp, *node = rset->rlist->next; while(node) { tmp = node; node = node->next; free_resnode(tmp); } rset->rlist->next = 0; } diff --git a/src/kdtree.h b/src/kdtree.h index 8849830..f6b07e7 100644 --- a/src/kdtree.h +++ b/src/kdtree.h @@ -1,129 +1,108 @@ /* -This file is part of ``kdtree'', a library for working with kd-trees. -Copyright (C) 2007-2011 John Tsiombikas - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY -OF SUCH DAMAGE. -*/ + * SPDX-FileCopyrightText: (C) 2007-2011 John Tsiombikas + * + * SPDX-LicenseIdentifier: BSD-3-Clause + */ #ifndef KOKO_KDTREE_H_ #define KOKO_KDTREE_H_ #ifdef __cplusplus extern "C" { #endif struct kdtree; struct kdres; /* create a kd-tree for "k"-dimensional data */ struct kdtree *kd_create(int k); /* free the struct kdtree */ void kd_free(struct kdtree *tree); /* remove all the elements from the tree */ void kd_clear(struct kdtree *tree); /* if called with non-null 2nd argument, the function provided * will be called on data pointers (see kd_insert) when nodes * are to be removed from the tree. */ void kd_data_destructor(struct kdtree *tree, void (*destr)(void*)); /* insert a node, specifying its position, and optional data */ int kd_insert(struct kdtree *tree, const double *pos, void *data); int kd_insertf(struct kdtree *tree, const float *pos, void *data); int kd_insert3(struct kdtree *tree, double x, double y, double z, void *data); int kd_insert3f(struct kdtree *tree, float x, float y, float z, void *data); /* Find the nearest node from a given point. * * This function returns a pointer to a result set with at most one element. */ struct kdres *kd_nearest(struct kdtree *tree, const double *pos); struct kdres *kd_nearestf(struct kdtree *tree, const float *pos); struct kdres *kd_nearest3(struct kdtree *tree, double x, double y, double z); struct kdres *kd_nearest3f(struct kdtree *tree, float x, float y, float z); /* Find the N nearest nodes from a given point. * * This function returns a pointer to a result set, with at most N elements, * which can be manipulated with the kd_res_* functions. * The returned pointer can be null as an indication of an error. Otherwise * a valid result set is always returned which may contain 0 or more elements. * The result set must be deallocated with kd_res_free after use. */ /* struct kdres *kd_nearest_n(struct kdtree *tree, const double *pos, int num); struct kdres *kd_nearest_nf(struct kdtree *tree, const float *pos, int num); struct kdres *kd_nearest_n3(struct kdtree *tree, double x, double y, double z); struct kdres *kd_nearest_n3f(struct kdtree *tree, float x, float y, float z); */ /* Find any nearest nodes from a given point within a range. * * This function returns a pointer to a result set, which can be manipulated * by the kd_res_* functions. * The returned pointer can be null as an indication of an error. Otherwise * a valid result set is always returned which may contain 0 or more elements. * The result set must be deallocated with kd_res_free after use. */ struct kdres *kd_nearest_range(struct kdtree *tree, const double *pos, double range); struct kdres *kd_nearest_rangef(struct kdtree *tree, const float *pos, float range); struct kdres *kd_nearest_range3(struct kdtree *tree, double x, double y, double z, double range); struct kdres *kd_nearest_range3f(struct kdtree *tree, float x, float y, float z, float range); /* frees a result set returned by kd_nearest_range() */ void kd_res_free(struct kdres *set); /* returns the size of the result set (in elements) */ int kd_res_size(struct kdres *set); /* rewinds the result set iterator */ void kd_res_rewind(struct kdres *set); /* returns non-zero if the set iterator reached the end after the last element */ int kd_res_end(struct kdres *set); /* advances the result set iterator, returns non-zero on success, zero if * there are no more elements in the result set. */ int kd_res_next(struct kdres *set); /* returns the data pointer (can be null) of the current result set item * and optionally sets its position to the pointers(s) if not null. */ void *kd_res_item(struct kdres *set, double *pos); void *kd_res_itemf(struct kdres *set, float *pos); void *kd_res_item3(struct kdres *set, double *x, double *y, double *z); void *kd_res_item3f(struct kdres *set, float *x, float *y, float *z); /* equivalent to kd_res_item(set, 0) */ void *kd_res_item_data(struct kdres *set); #ifdef __cplusplus } #endif #endif /* KOKO_KDTREE_H_ */ diff --git a/src/kokoconfig.kcfg b/src/kokoconfig.kcfg index 352bbfa..f103900 100644 --- a/src/kokoconfig.kcfg +++ b/src/kokoconfig.kcfg @@ -1,20 +1,25 @@ + true 64 diff --git a/src/kokoconfig.kcfgc b/src/kokoconfig.kcfgc index 1d27603..9f110ff 100644 --- a/src/kokoconfig.kcfgc +++ b/src/kokoconfig.kcfgc @@ -1,6 +1,8 @@ +# SPDX-FileCopyrightText: (C) 2020 Nicolas Fella +# SPDX-LicenseIdentifier: LGPL-2.1-or-later File=kokoconfig.kcfg ClassName=KokoConfig Mutators=true DefaultValueGetters=true GenerateProperties=true ParentInConstructor=true diff --git a/src/main.cpp b/src/main.cpp index 3f0b5f7..4fca8c1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,116 +1,103 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "filesystemtracker.h" #include "processor.h" #include "kokoconfig.h" #include "imagestorage.h" #ifdef Q_OS_ANDROID #include #endif int main(int argc, char** argv) { QApplication app(argc, argv); app.setApplicationDisplayName("Koko"); app.setOrganizationDomain("kde.org"); QCommandLineParser parser; parser.addOption(QCommandLineOption("reset", i18n("Reset the database"))); parser.addPositionalArgument( "image", i18n("path of image you want to open")); parser.addHelpOption(); parser.process(app); if (parser.positionalArguments().size() > 1) { parser.showHelp(1); } if (parser.isSet("reset")) { ImageStorage::reset(); } QThread trackerThread; QStringList locations = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); Q_ASSERT(locations.size() >= 1); qDebug() << locations; #ifdef Q_OS_ANDROID QtAndroid::requestPermissionsSync({"android.permission.WRITE_EXTERNAL_STORAGE"}); #endif FileSystemTracker tracker; tracker.setFolder(locations.first()); tracker.moveToThread(&trackerThread); Koko::Processor processor; QObject::connect(&tracker, &FileSystemTracker::imageAdded, &processor, &Koko::Processor::addFile); QObject::connect(&tracker, &FileSystemTracker::imageRemoved, &processor, &Koko::Processor::removeFile); QObject::connect(&tracker, &FileSystemTracker::initialScanComplete, &processor, &Koko::Processor::initialScanCompleted); QObject::connect(&trackerThread, &QThread::started, &tracker, &FileSystemTracker::setupDb); trackerThread.start(); tracker.setSubFolder(tracker.folder()); KokoConfig config; QObject::connect(&config, &KokoConfig::IconSizeChanged, &config, &KokoConfig::save); QQmlApplicationEngine engine; engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextProperty("kokoProcessor", &processor); engine.rootContext()->setContextProperty("kokoConfig", &config); QString path; //we want different main files on desktop or mobile //very small difference as they as they are subclasses of the same thing if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE") && (QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_MOBILE")) == QStringLiteral("1") || QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_MOBILE")) == QStringLiteral("true"))) { engine.load(QUrl(QStringLiteral("qrc:/qml/mobileMain.qml"))); } else { engine.load(QUrl(QStringLiteral("qrc:/qml/desktopMain.qml"))); } int rt = app.exec(); trackerThread.quit(); return rt; } diff --git a/src/notificationmanager.cpp b/src/notificationmanager.cpp index 1bd7224..dddaecd 100644 --- a/src/notificationmanager.cpp +++ b/src/notificationmanager.cpp @@ -1,48 +1,35 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #include "notificationmanager.h" #include NotificationManager::NotificationManager(QObject* parent) { Q_UNUSED(parent) m_sharingSuccess = new KNotification( "sharingSuccess", KNotification::Persistent); m_sharingFailed = new KNotification( "sharingFailed", KNotification::CloseOnTimeout); m_sharingFailed->setText("Sharing failed"); } NotificationManager::~NotificationManager() { delete m_sharingFailed; delete m_sharingSuccess; } void NotificationManager::showNotification(bool valid, QVariant url) { if (valid) { m_sharingSuccess->setText( i18n("Shared url for image is %1", url.toString())); m_sharingSuccess->sendEvent(); } else { m_sharingFailed->sendEvent(); } } #include "moc_notificationmanager.cpp" diff --git a/src/notificationmanager.h b/src/notificationmanager.h index 73dcd52..d86a874 100644 --- a/src/notificationmanager.h +++ b/src/notificationmanager.h @@ -1,44 +1,31 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #ifndef NOTIFICATION_MANAGER_H #define NOTIFICATION_MANAGER_H #include #include class NotificationManager: public QObject { Q_OBJECT public: explicit NotificationManager(QObject *parent = 0); ~NotificationManager(); /** * @argument valid: to check whether the returned url after sharing is valid or not * @argument url: the valid url returned after sharing the image */ Q_INVOKABLE void showNotification(bool valid, QVariant url = QVariant()); private: KNotification *m_sharingSuccess; KNotification *m_sharingFailed; }; #endif diff --git a/src/processor.cpp b/src/processor.cpp index dad5ecf..4153776 100644 --- a/src/processor.cpp +++ b/src/processor.cpp @@ -1,120 +1,107 @@ /* - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "processor.h" #include "imagestorage.h" #include "imageprocessorrunnable.h" #include #include #include #include using namespace Koko; Processor::Processor(QObject* parent) : QObject(parent) , m_numFiles(0) , m_processing(false) , m_initialScanDone(false) { connect(&m_commitTimer, &CommitTimer::timeout, [&]() { ImageStorage::instance()->commit(); if (m_files.isEmpty()) { m_geoCoder.deinit(); if (m_numFiles && m_initialScanDone) emit finishedChanged(); } }); connect(this, &Processor::numFilesChanged, &m_commitTimer, &CommitTimer::start); } Processor::~Processor() { } void Processor::addFile(const QString& filePath) { m_files << filePath; m_numFiles++; QTimer::singleShot(0, this, SLOT(process())); emit numFilesChanged(); } void Processor::removeFile(const QString& filePath) { ImageStorage::instance()->removeImage(filePath); m_numFiles--; emit numFilesChanged(); } float Processor::initialProgress() const { if (m_numFiles) { return 1.0f - (m_files.size() * 1.0f / m_numFiles); } return 0; } int Processor::numFiles() const { return m_numFiles; } void Processor::process() { if (m_processing) return; if (m_files.isEmpty()) { return; } m_processing = true; QString path = m_files.takeLast(); ImageProcessorRunnable* runnable = new ImageProcessorRunnable(path, &m_geoCoder); connect(runnable, SIGNAL(finished()), this, SLOT(slotFinished())); QThreadPool::globalInstance()->start(runnable); } void Processor::slotFinished() { m_processing = false; QTimer::singleShot(0, this, SLOT(process())); emit initialProgressChanged(); m_commitTimer.start(); } void Processor::initialScanCompleted() { m_initialScanDone = true; if (m_files.isEmpty()) { emit finishedChanged(); } } diff --git a/src/processor.h b/src/processor.h index d696349..1bc5afc 100644 --- a/src/processor.h +++ b/src/processor.h @@ -1,71 +1,58 @@ /* - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef PROCESSOR_H #define PROCESSOR_H #include #include #include "reversegeocoder.h" #include "committimer.h" namespace Koko { class Processor : public QObject { Q_OBJECT Q_PROPERTY(float initialProgress READ initialProgress NOTIFY initialProgressChanged) Q_PROPERTY(int numFiles READ numFiles NOTIFY numFilesChanged) Q_PROPERTY(bool finished READ finished NOTIFY finishedChanged) public: Processor(QObject* parent = 0); ~Processor(); float initialProgress() const; int numFiles() const; bool finished() const { return m_initialScanDone; } signals: void initialProgressChanged(); void numFilesChanged(); void finishedChanged(); public slots: void addFile(const QString& filePath); void removeFile(const QString& filePath); void initialScanCompleted(); private slots: void process(); void slotFinished(); private: QStringList m_files; int m_numFiles; bool m_processing; CommitTimer m_commitTimer; ReverseGeoCoder m_geoCoder; bool m_initialScanDone; }; } #endif // PROCESSOR_H diff --git a/src/qml/AlbumDelegate.qml b/src/qml/AlbumDelegate.qml index c65c553..49fbedb 100644 --- a/src/qml/AlbumDelegate.qml +++ b/src/qml/AlbumDelegate.qml @@ -1,140 +1,125 @@ /* - * Copyright (C) 2017 Atul Sharma - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ import QtQuick 2.7 import QtQuick.Controls 2.1 as Controls import org.kde.kquickcontrolsaddons 2.0 as KQA import org.kde.kirigami 2.12 as Kirigami import org.kde.koko 0.1 as Koko Item { id: albumDelegate width: gridView.cellWidth height: gridView.cellHeight signal clicked(var mouse) signal pressAndHold(var mouse) signal activated property alias containsMouse: albumThumbnailMouseArea.containsMouse property QtObject modelData Rectangle { anchors { fill: image margins: -1 } radius: 2 color: Kirigami.Theme.textColor opacity: 0.2 visible: modelData.itemType != Koko.Types.Folder } KQA.QImageItem { id: image anchors.centerIn: parent width: kokoConfig.iconSize height: width smooth: true image: modelData.thumbnail fillMode: KQA.QImageItem.PreserveAspectCrop } Rectangle { anchors { top: image.top left: image.left right: image.right } visible: textLabel.visible width: image.width height: textLabel.contentHeight + (Kirigami.Units.smallSpacing * 2) Kirigami.Theme.colorSet: Kirigami.Theme.View color: Kirigami.Theme.backgroundColor opacity: 0.8 } Controls.Label { id: textLabel anchors { left: image.left right: image.right top: image.top bottom: countRect.visible ? countRect.top : image.bottom } visible: modelData.itemType == Koko.Types.Folder || modelData.itemType == Koko.Types.Album verticalAlignment: Text.AlignTop padding: Kirigami.Units.smallSpacing elide: Text.ElideRight maximumLineCount: 4 wrapMode: Text.WordWrap color: Kirigami.Theme.textColor text: modelData.display } Rectangle { id: countRect anchors { bottom: image.bottom left: image.left right: image.right } visible: modelData.fileCount && modelData.itemType == Koko.Types.Folder || modelData.itemType == Koko.Types.Album height: countLabel.contentHeight + (Kirigami.Units.smallSpacing * 2) Kirigami.Theme.colorSet: Kirigami.Theme.View color: Kirigami.Theme.backgroundColor opacity: 0.8 Controls.Label { id: countLabel padding: Kirigami.Units.smallSpacing elide: Text.ElideRight maximumLineCount: 4 wrapMode: Text.WordWrap color: Kirigami.Theme.textColor text: i18np("1 Image", "%1 Images", modelData.fileCount) } } SelectionDelegateHighlight { id: selectionHighlight visible: modelData.selected } MouseArea { id: albumThumbnailMouseArea anchors.fill: parent hoverEnabled: true onPressAndHold: albumDelegate.pressAndHold(mouse) onClicked: albumDelegate.clicked(mouse) } Keys.onPressed: { switch (event.key) { case Qt.Key_Enter: case Qt.Key_Return: case Qt.Key_Space: activated(); break; default: break; } } } diff --git a/src/qml/AlbumView.qml b/src/qml/AlbumView.qml index e7a87c4..f30320c 100644 --- a/src/qml/AlbumView.qml +++ b/src/qml/AlbumView.qml @@ -1,234 +1,219 @@ /* - * Copyright (C) 2017 Atul Sharma - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.7 import QtQuick.Controls 2.1 as Controls import org.kde.kirigami 2.12 as Kirigami import org.kde.koko 0.1 as Koko Kirigami.ScrollablePage { id: page property alias model: gridView.model signal collectionSelected(QtObject selectedModel, string cover) signal folderSelected(QtObject selectedModel, string cover) keyboardNavigationEnabled: true focus: true states: [ State { name: "browsing" when: !model.hasSelectedImages }, State { name: "selecting" when: model.hasSelectedImages && Kirigami.Settings.tabletMode } ] actions { main: Kirigami.Action { iconName: "edit-select-none" text: i18n("Deselect All") tooltip: i18n("De-selects all the selected images") enabled: model.hasSelectedImages visible: model.hasSelectedImages && Kirigami.Settings.tabletMode onTriggered: model.clearSelections() } contextualActions: [ Kirigami.Action { iconName: "edit-select-all" text: i18n("Select All") tooltip: i18n("Selects all the images in the current view") enabled: model.containImages onTriggered: model.selectAll() }, Kirigami.Action { iconName: "edit-select-none" text: i18n("Deselect All") tooltip: i18n("De-selects all the selected images") enabled: model.hasSelectedImages onTriggered: model.clearSelections() }, Kirigami.Action { iconName: "emblem-shared-symbolic" text: i18n("Share") tooltip: i18n("Share the selected images") enabled: model.hasSelectedImages onTriggered: { shareMenu.open(); shareMenu.inputData = { "urls": model.selectedImages(), "mimeType": "image/" } } }, Kirigami.Action { iconName: "group-delete" text: i18n("Delete Selection") tooltip: i18n("Move selected items to trash") enabled: model.hasSelectedImages onTriggered: model.deleteSelection() } ] } background: Rectangle { Kirigami.Theme.colorSet: Kirigami.Theme.View color: Kirigami.Theme.backgroundColor } Keys.onPressed: { switch (event.key) { case Qt.Key_Escape: gridView.model.clearSelections() break; default: break; } } ShareDialog { id: shareMenu inputData: { "urls": [], "mimeType": ["image/"] } onFinished: { if (error==0 && output.url !== "") { console.assert(output.url !== undefined); var resultUrl = output.url; console.log("Received", resultUrl) notificationManager.showNotification( true, resultUrl); clipboard.content = resultUrl; } else { notificationManager.showNotification( false); } } } GridView { id: gridView //FIXME: right now if those two objects are out of this, the whole page breaks Koko.SortModel { id: sortedListModel } Koko.ImageFolderModel { id: imageFolderModel } keyNavigationEnabled: true property real widthToApproximate: (applicationWindow().wideScreen ? applicationWindow().pageStack.defaultColumnWidth : page.width) - (1||Kirigami.Settings.tabletMode ? Kirigami.Units.gridUnit : 0) cellWidth: Math.floor(width/Math.floor(width/(kokoConfig.iconSize + Kirigami.Units.largeSpacing * 2))) cellHeight: kokoConfig.iconSize + Kirigami.Units.largeSpacing * 2 topMargin: Kirigami.Units.gridUnit highlightMoveDuration: 0 highlight: Item { Rectangle { anchors.centerIn: parent width: Math.min(parent.width, parent.height) height: width color: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.3) border.color: Kirigami.Theme.highlightColor radius: 2 } } delegate: AlbumDelegate { id: delegate modelData: model onClicked: { if (page.state == "selecting" || (mouse.modifiers & Qt.ControlModifier ) && (model.itemType == Koko.Types.Image)) { gridView.model.toggleSelected(model.index) } else { activated(); } } onPressAndHold: { gridView.model.toggleSelected(model.index) } onActivated: { gridView.model.clearSelections() gridView.currentIndex = model.index; switch( model.itemType) { case Koko.Types.Album: { imageListModel.query = imageListModel.queryForIndex( model.sourceIndex) sortedListModel.sourceModel = imageListModel collectionSelected( sortedListModel, model.display) break; } case Koko.Types.Folder: { imageFolderModel.url = model.imageurl sortedListModel.sourceModel = imageFolderModel folderSelected( sortedListModel, model.display) break; } case Koko.Types.Image: { currentImage.model = page.model.sourceModel currentImage.index = model.index applicationWindow().pageStack.layers.push(Qt.resolvedUrl("ImageViewer.qml"), { startIndex: model.index, imagesModel: page.model }) break; } default: { console.log("Unknown") break; } } } SelectionButton { id: selectionButton opacity: ( delegate.containsMouse || page.state == "selecting") && !(model.itemType == Koko.Types.Folder || model.itemType == Koko.Types.Album) anchors.top: delegate.top anchors.left: delegate.left Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } } } Kirigami.PlaceholderMessage { anchors.centerIn: parent text: i18n("No Images Found") visible: gridView.count == 0 width: parent.width - (Kirigami.Units.largeSpacing * 4) } } onCollectionSelected: pageStack.push( Qt.resolvedUrl("AlbumView.qml"), { "model": selectedModel, "title": i18n(cover)}) onFolderSelected: pageStack.push( Qt.resolvedUrl("AlbumView.qml"), { "model": selectedModel, "title": i18n(cover)}) } diff --git a/src/qml/EditorView.qml b/src/qml/EditorView.qml index 60fcd2d..39a1608 100644 --- a/src/qml/EditorView.qml +++ b/src/qml/EditorView.qml @@ -1,50 +1,37 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.7 import QtQuick.Controls 2.1 as Controls import org.kde.kirigami 2.0 as Kirigami import org.kde.kquickcontrolsaddons 2.0 as KQA import org.kde.koko 0.1 as Koko Kirigami.Page { id: rootEditorView title: i18n("Edit") leftPadding: 0 rightPadding: 0 property string imagePath Koko.ImageDocument { id: imageDoc path: imagePath } contentItem: Flickable { width: rootEditorView.width height: rootEditorView.height KQA.QImageItem { id: editImage width: rootEditorView.width height: rootEditorView.height image: imageDoc.visualImage } } } diff --git a/src/qml/ImageViewer.qml b/src/qml/ImageViewer.qml index a3a2eb2..0b64ac7 100644 --- a/src/qml/ImageViewer.qml +++ b/src/qml/ImageViewer.qml @@ -1,480 +1,465 @@ /* - * Copyright (C) 2017 Marco Martin - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma + * SPDX-FileCopyrightText: (C) 2017 Marco Martin * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.12 import QtQuick.Window 2.2 import QtQuick.Controls 2.10 as Controls import QtGraphicalEffects 1.0 as Effects import QtQuick.Layouts 1.3 import org.kde.kirigami 2.13 as Kirigami import org.kde.koko 0.1 as Koko import org.kde.kquickcontrolsaddons 2.0 as KQA Kirigami.Page { id: root title: listView.currentItem.display property int startIndex: 0 property var imagesModel leftPadding: 0 rightPadding: 0 topPadding: 0 Kirigami.Theme.inherit: false Kirigami.Theme.textColor: imgColors.foreground Kirigami.Theme.backgroundColor: imgColors.background Kirigami.Theme.highlightColor: imgColors.highlight Kirigami.Theme.highlightedTextColor: Kirigami.ColorUtils.brightnessForColor(imgColors.highlight) === Kirigami.ColorUtils.Dark ? imgColors.closestToWhite : imgColors.closestToBlack Kirigami.ImageColors { id: imgColors source: listView.currentItem } KQA.MimeDatabase { id: mimeDB } Kirigami.ContextDrawer { id: contextDrawer title: i18n("Edit image") handleVisible: true } actions { main: Kirigami.Action { id: shareAction iconName: "document-share" tooltip: i18n("Share Image") text: i18nc("verb, share an image", "Share") onTriggered: { shareDialog.open(); shareDialog.inputData = { "urls": [ listView.currentItem.currentImageSource.toString() ], "mimeType": mimeDB.mimeTypeForUrl( listView.currentItem.currentImageSource).name } } } right: Kirigami.Action { id: editingAction iconName: "edit-entry" text: i18nc("verb, edit an image", "Edit") onTriggered: { applicationWindow().pageStack.layers.push(editorComponent) } } } Component.onCompleted: { applicationWindow().controlsVisible = false; listView.forceActiveFocus(); applicationWindow().header.visible = false; applicationWindow().footer.visible = false; applicationWindow().globalDrawer.visible = false; applicationWindow().globalDrawer.enabled = false; } function close() { applicationWindow().controlsVisible = true; if (applicationWindow().footer) { applicationWindow().footer.visible = true; } applicationWindow().globalDrawer.enabled = true; applicationWindow().visibility = Window.Windowed; applicationWindow().pageStack.layers.pop(); } background: Rectangle { color: "black" } Keys.onPressed: { switch(event.key) { case Qt.Key_Escape: root.close(); break; case Qt.Key_F: applicationWindow().visibility = applicationWindow().visibility == Window.FullScreen ? Window.Windowed : Window.FullScreen break; default: break; } } ShareDialog { id: shareDialog inputData: { "urls": [], "mimeType": ["image/"] } onFinished: { if (error==0 && output.url !== "") { console.assert(output.url !== undefined); var resultUrl = output.url; console.log("Received", resultUrl) notificationManager.showNotification( true, resultUrl); clipboard.content = resultUrl; } else { notificationManager.showNotification( false); } } } ListView { id: thumbnailView z: 100 anchors { left: parent.left right: parent.right bottom: parent.bottom } state: applicationWindow().controlsVisible ? "show" : "hidden" states: [ State { name: "show" PropertyChanges { target: thumbnailView; opacity: 1.0 } PropertyChanges { target: thumbnailView; anchors.bottomMargin: 0 } }, State { name: "hidden" PropertyChanges { target: thumbnailView; opacity: 0.0 } PropertyChanges { target: thumbnailView; anchors.bottomMargin: -thumbnailView.height } } ] transitions: [ Transition { from: "*" to: "hidden" SequentialAnimation { PropertyAnimation { properties: "opacity,anchors.bottomMargin"; easing.type: Easing.InCubic duration: Kirigami.Units.longDuration } PropertyAction { target: thumbnailView property: "visible" value: false } } }, Transition { from: "*" to: "show" SequentialAnimation { PropertyAction { target: thumbnailView property: "visible" value: true } PropertyAnimation { properties: "opacity,anchors.bottomMargin"; easing.type: Easing.OutCubic duration: Kirigami.Units.longDuration * 0.75 } } } ] height: kokoConfig.iconSize orientation: Qt.Horizontal snapMode: ListView.SnapOneItem currentIndex: listView.currentIndex highlightRangeMode: ListView.ApplyRange highlightFollowsCurrentItem: true preferredHighlightBegin: height preferredHighlightEnd: width - height highlightMoveVelocity: -1 highlightMoveDuration: Kirigami.Units.longDuration // Filter out directories model: Koko.SortModel { sourceModel: imagesModel filterRole: Koko.Roles.MimeTypeRole filterRegExp: /image\// } delegate: AlbumDelegate { width: kokoConfig.iconSize + Kirigami.Units.largeSpacing height: width onClicked: activated() onActivated: listView.currentIndex = index modelData: model Rectangle { z: -1 anchors.centerIn: parent width: Math.min(parent.width, parent.height) height: width color: Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.3) border.color: Kirigami.Theme.highlightColor radius: 2 opacity: thumbnailView.currentIndex === index ? 1 : 0 Behavior on opacity { OpacityAnimator { duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } } } } ListView { id: listView anchors.fill: parent orientation: Qt.Horizontal snapMode: ListView.SnapOneItem highlightMoveDuration: 0 interactive: true // Filter out directories model: Koko.SortModel { sourceModel: imagesModel filterRole: Koko.Roles.MimeTypeRole filterRegExp: /image\// } currentIndex: model.proxyIndex(root.startIndex) delegate: Flickable { id: flick readonly property string currentImageSource: model.imageurl readonly property string display: model.display property alias image: image width: root.width height: root.height contentWidth: root.width contentHeight: root.height boundsBehavior: Flickable.StopAtBounds boundsMovement: Flickable.StopAtBounds interactive: contentWidth > width || contentHeight > height //onInteractiveChanged: listView.interactive = !interactive; clip: true z: index == listView.currentIndex ? 1000 : 0 Controls.ScrollBar.vertical: Controls.ScrollBar { visible: !applicationWindow().controlsVisible } Controls.ScrollBar.horizontal: Controls.ScrollBar { visible: !applicationWindow().controlsVisible } PinchArea { width: Math.max(flick.contentWidth, flick.width) height: Math.max(flick.contentHeight, flick.height) property real initialWidth property real initialHeight onPinchStarted: { initialWidth = flick.contentWidth initialHeight = flick.contentHeight } onPinchUpdated: { // adjust content pos due to drag flick.contentX += pinch.previousCenter.x - pinch.center.x flick.contentY += pinch.previousCenter.y - pinch.center.y // resize content flick.resizeContent(Math.max(root.width*0.7, initialWidth * pinch.scale), Math.max(root.height*0.7, initialHeight * pinch.scale), pinch.center) } onPinchFinished: { // Move its content within bounds. if (flick.contentWidth < root.width || flick.contentHeight < root.height) { zoomAnim.x = 0; zoomAnim.y = 0; zoomAnim.width = root.width; zoomAnim.height = root.height; zoomAnim.running = true; } else { flick.returnToBounds(); } } ParallelAnimation { id: zoomAnim property real x: 0 property real y: 0 property real width: root.width property real height: root.height NumberAnimation { target: flick property: "contentWidth" from: flick.contentWidth to: zoomAnim.width duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: flick property: "contentHeight" from: flick.contentHeight to: zoomAnim.height duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: flick property: "contentY" from: flick.contentY to: zoomAnim.y duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } NumberAnimation { target: flick property: "contentX" from: flick.contentX to: zoomAnim.x duration: Kirigami.Units.longDuration easing.type: Easing.InOutQuad } } Image { id: image width: flick.contentWidth height: flick.contentHeight fillMode: Image.PreserveAspectFit source: currentImageSource autoTransform: true asynchronous: true onStatusChanged: { if (status === Image.Ready && listView.currentIndex === index) { imgColors.update(); } } Timer { id: doubleClickTimer interval: 150 onTriggered: applicationWindow().controlsVisible = !applicationWindow().controlsVisible } MouseArea { anchors.fill: parent onClicked: { contextDrawer.drawerOpen = false doubleClickTimer.restart(); } onDoubleClicked: { doubleClickTimer.running = false; applicationWindow().controlsVisible = false; if (flick.interactive) { zoomAnim.x = 0; zoomAnim.y = 0; zoomAnim.width = root.width; zoomAnim.height = root.height; zoomAnim.running = true; } else { zoomAnim.x = mouse.x * 2; zoomAnim.y = mouse.y *2; zoomAnim.width = root.width * 3; zoomAnim.height = root.height * 3; zoomAnim.running = true; } } onWheel: { if (wheel.modifiers & Qt.ControlModifier) { if (wheel.angleDelta.y != 0) { var factor = 1 + wheel.angleDelta.y / 600; zoomAnim.running = false; zoomAnim.width = Math.min(Math.max(root.width, zoomAnim.width * factor), root.width * 4); zoomAnim.height = Math.min(Math.max(root.height, zoomAnim.height * factor), root.height * 4); //actual factors, may be less than factor var xFactor = zoomAnim.width / flick.contentWidth; var yFactor = zoomAnim.height / flick.contentHeight; zoomAnim.x = flick.contentX * xFactor + (((wheel.x - flick.contentX) * xFactor) - (wheel.x - flick.contentX)) zoomAnim.y = flick.contentY * yFactor + (((wheel.y - flick.contentY) * yFactor) - (wheel.y - flick.contentY)) zoomAnim.running = true; } else if (wheel.pixelDelta.y != 0) { flick.resizeContent(Math.min(Math.max(root.width, flick.contentWidth + wheel.pixelDelta.y), root.width * 4), Math.min(Math.max(root.height, flick.contentHeight + wheel.pixelDelta.y), root.height * 4), wheel); } } else { flick.contentX += wheel.pixelDelta.x; flick.contentY += wheel.pixelDelta.y; } } } } } } } Controls.RoundButton { anchors { left: parent.left leftMargin: Kirigami.Units.largeSpacing verticalCenter: parent.verticalCenter } width: Kirigami.Units.gridUnit * 2 height: width icon.name: "arrow-left" visible: !Kirigami.Settings.isMobile && applicationWindow().controlsVisible && listView.currentIndex > 0 Keys.forwardTo: [listView] onClicked: { listView.currentIndex -= 1 } } Controls.RoundButton { anchors { right: parent.right rightMargin: Kirigami.Units.largeSpacing verticalCenter: parent.verticalCenter } width: Kirigami.Units.gridUnit * 2 height: width icon.name: "arrow-right" visible: !Kirigami.Settings.isMobile && applicationWindow().controlsVisible && listView.currentIndex < listView.count - 1 Keys.forwardTo: [listView] onClicked: { listView.currentIndex += 1 } } Component { id: editorComponent EditorView { width: root.width height: root.height imagePath: listView.currentItem.currentImageSource } } } diff --git a/src/qml/Main.qml b/src/qml/Main.qml index 6556553..4c4de5f 100644 --- a/src/qml/Main.qml +++ b/src/qml/Main.qml @@ -1,181 +1,166 @@ /* - * Copyright (C) 2017 Atul Sharma - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.1 import QtQuick.Controls 2.0 as Controls import org.kde.kirigami 2.5 as Kirigami import org.kde.kquickcontrolsaddons 2.0 as KQA import org.kde.koko 0.1 as Koko Kirigami.ApplicationWindow { id: root /* * currentImage now stores the information related to the source model */ QtObject { id: currentImage property int index property var model } pageStack.initialPage: AlbumView { id: albumView model: imageFolderModel title: i18n("Folders") } pageStack.layers.onDepthChanged: { sideBar.enabled = pageStack.layers.depth < 2; sideBar.drawerOpen = !Kirigami.Settings.isMobile && pageStack.layers.depth < 2; } globalDrawer: Sidebar { id: sideBar onFilterBy: { pageStack.pop(albumView) albumView.title = i18n(value) previouslySelectedAction.checked = false switch( value){ case "Countries": { albumView.model = imageLocationModelCountry; imageListModel.locationGroup = Koko.Types.Country; break; } case "States": { albumView.model = imageLocationModelState; imageListModel.locationGroup = Koko.Types.State; break; } case "Cities": { albumView.model = imageLocationModelCity; imageListModel.locationGroup = Koko.Types.City; break; } case "Years": { albumView.model = imageTimeModelYear; imageListModel.timeGroup = Koko.Types.Year; break; } case "Months": { albumView.model = imageTimeModelMonth; imageListModel.timeGroup = Koko.Types.Month; break; } case "Weeks": { albumView.model = imageTimeModelWeek; imageListModel.timeGroup = Koko.Types.Week; break; } case "Days": { albumView.model = imageTimeModelDay; imageListModel.timeGroup = Koko.Types.Day; break; } case "Folders": { albumView.model = imageFolderModel; imageListModel.locationGroup = -1; imageListModel.timeGroup = -1; break; } } } } Koko.SortModel { id: imageFolderModel sourceModel: Koko.ImageFolderModel { url: "" } /* * filterRole is an Item property exposed by the QSortFilterProxyModel */ filterRole: Koko.Roles.MimeTypeRole } Koko.SortModel { id: imageTimeModelYear sourceModel: Koko.ImageTimeModel { group: Koko.Types.Year } sortRoleName: "date" } Koko.SortModel { id: imageTimeModelMonth sourceModel: Koko.ImageTimeModel { group: Koko.Types.Month } sortRoleName: "date" } Koko.SortModel { id: imageTimeModelWeek sourceModel: Koko.ImageTimeModel { group: Koko.Types.Week } sortRoleName: "date" } Koko.SortModel { id: imageTimeModelDay sourceModel: Koko.ImageTimeModel { group: Koko.Types.Day } sortRoleName: "date" } Koko.SortModel { id: imageLocationModelCountry sourceModel: Koko.ImageLocationModel { group: Koko.Types.Country } } Koko.SortModel { id: imageLocationModelState sourceModel: Koko.ImageLocationModel { group: Koko.Types.State } } Koko.SortModel { id: imageLocationModelCity sourceModel: Koko.ImageLocationModel { group: Koko.Types.City } } Koko.ImageListModel { id: imageListModel } Koko.NotificationManager { id: notificationManager } KQA.Clipboard { id: clipboard } } diff --git a/src/qml/SelectionButton.qml b/src/qml/SelectionButton.qml index 4f50d66..5daff98 100644 --- a/src/qml/SelectionButton.qml +++ b/src/qml/SelectionButton.qml @@ -1,65 +1,50 @@ /* - * Copyright (C) 2017 Atul Sharma - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.7 import org.kde.kirigami 2.1 as Kirigami import org.kde.koko 0.1 as Koko Kirigami.Icon { id: iconArea property QtObject iconMouseArea: iconMouseArea width: Kirigami.Units.iconSizes.smallMedium height: width z: gridView.z + 2 MouseArea { id: iconMouseArea anchors.fill: parent state: "add" onClicked: { if(iconMouseArea.state == "add") { gridView.model.setSelected(model.index) } else { gridView.model.toggleSelected(model.index) } } states: [ State { name: "add" when: !model.selected PropertyChanges { target: iconArea source: "emblem-added" } }, State { name: "remove" when: model.selected PropertyChanges { target: iconArea source: "emblem-remove" } } ] } } diff --git a/src/qml/SelectionDelegateHighlight.qml b/src/qml/SelectionDelegateHighlight.qml index 4a8478a..3812796 100644 --- a/src/qml/SelectionDelegateHighlight.qml +++ b/src/qml/SelectionDelegateHighlight.qml @@ -1,32 +1,17 @@ /* - * Copyright (C) 2017 Atul Sharma - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.7 import org.kde.kirigami 2.1 as Kirigami Rectangle { anchors.fill: parent z: gridView.z + 1 color: Kirigami.Theme.highlightColor opacity: 0.5 } diff --git a/src/qml/ShareDialog.qml b/src/qml/ShareDialog.qml index 7d077c2..530f473 100644 --- a/src/qml/ShareDialog.qml +++ b/src/qml/ShareDialog.qml @@ -1,64 +1,51 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.7 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.0 as Controls import org.kde.purpose 1.0 as Purpose import org.kde.kirigami 2.1 as Kirigami Kirigami.OverlaySheet { id: window // focus: true property alias inputData: view.inputData property bool running: false signal finished(var output, int error, string message) leftPadding: 0 rightPadding: 0 Controls.BusyIndicator { visible: window.running anchors.fill: parent } header: Kirigami.Heading { text: i18n("Share") leftPadding: Kirigami.Units.largeSpacing } Purpose.AlternativesView { id: view clip: true pluginType: "Export" implicitWidth: Kirigami.Units.gridUnit * 20 implicitHeight: Math.max(Kirigami.Units.gridUnit * 10, initialItem.contentHeight) delegate: Kirigami.BasicListItem { label: model.display icon: "arrow-right" onClicked: view.createJob (model.index) Keys.onReturnPressed: view.createJob (model.index) Keys.onEnterPressed: view.createJob (model.index) } onRunningChanged: window.running = running onFinished: { window.finished(output, error, message) } } } diff --git a/src/qml/Sidebar.qml b/src/qml/Sidebar.qml index c187c67..e8c2795 100644 --- a/src/qml/Sidebar.qml +++ b/src/qml/Sidebar.qml @@ -1,160 +1,145 @@ /* - * Copyright (C) 2017 Atul Sharma - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.1 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.5 as Kirigami Kirigami.GlobalDrawer { signal filterBy(string value) property Kirigami.Action previouslySelectedAction contentItem.implicitWidth: Kirigami.Units.gridUnit * 10 modal: Kirigami.Settings.isMobile collapsible: true collapsed: Kirigami.Settings.isMobile bannerVisible: true header: Kirigami.AbstractApplicationHeader { Kirigami.Heading { anchors.fill: parent anchors.leftMargin: Kirigami.Units.smallSpacing * 2 anchors.rightMargin: Kirigami.Units.smallSpacing * 2 level: 2 text: i18n("Sort by") } } actions: [ Kirigami.Action { text: i18n("Locations") iconName: "tag-places" expandible: true Kirigami.Action { id: countryAction text: i18n("By Country") checkable: true onTriggered: { filterBy("Countries") previouslySelectedAction = countryAction } } Kirigami.Action { id: stateAction text: i18n("By State") checkable: true onTriggered: { filterBy("States") previouslySelectedAction = stateAction } } Kirigami.Action { id: cityAction text: i18n("By City") checkable: true onTriggered: { filterBy("Cities") previouslySelectedAction = cityAction } } }, Kirigami.Action { text: i18n("Time") expandible: true iconName: "view-calendar" Kirigami.Action { id: yearAction text: i18n("By Year") checkable: true onTriggered: { filterBy("Years") previouslySelectedAction = yearAction } } Kirigami.Action { id: monthAction text: i18n("By Month") checkable: true onTriggered: { filterBy("Months") previouslySelectedAction = monthAction } } Kirigami.Action { id: weekAction text: i18n("By Week") checkable: true onTriggered: { filterBy("Weeks") previouslySelectedAction = weekAction } } Kirigami.Action { id: "dayAction" text: i18n("By Day") checkable: true onTriggered: { filterBy("Days") previouslySelectedAction = dayAction } } }, Kirigami.Action { text: i18n("Path") expandible: true iconName: "folder-symbolic" Kirigami.Action { id: folderAction text: i18n("By Folder") checkable: true onTriggered: { filterBy("Folders") previouslySelectedAction = folderAction } } } ] QQC2.Label { text: i18n("Thumbnails size:") Layout.leftMargin: Kirigami.Units.smallSpacing Layout.rightMargin: Kirigami.Units.smallSpacing } QQC2.Slider { Layout.fillWidth: true Layout.leftMargin: Kirigami.Units.smallSpacing Layout.rightMargin: Kirigami.Units.smallSpacing from: Kirigami.Units.iconSizes.medium to: Kirigami.Units.iconSizes.enormous value: kokoConfig.iconSize onMoved: kokoConfig.iconSize = value; } Component.onCompleted: { folderAction.checked = true previouslySelectedAction = folderAction } } diff --git a/src/qml/desktopMain.qml b/src/qml/desktopMain.qml index b6f96f3..d3033b6 100644 --- a/src/qml/desktopMain.qml +++ b/src/qml/desktopMain.qml @@ -1,28 +1,13 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2017 Marco Martin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma + * SPDX-FileCopyrightText: (C) 2017 Marco Martin * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.1 import org.kde.kirigami 2.0 as Kirigami Main { } diff --git a/src/qml/mobileMain.qml b/src/qml/mobileMain.qml index 3c83ae1..8d0837b 100644 --- a/src/qml/mobileMain.qml +++ b/src/qml/mobileMain.qml @@ -1,28 +1,13 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2017 Marco Martin - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma + * SPDX-FileCopyrightText: (C) 2017 Marco Martin * + * SPDX-LicenseIdentifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL */ import QtQuick 2.1 import org.kde.kirigami 2.0 as Kirigami Main { contextDrawer: Kirigami.ContextDrawer {} } diff --git a/src/qmlplugins.cpp b/src/qmlplugins.cpp index 89796a4..9449c83 100644 --- a/src/qmlplugins.cpp +++ b/src/qmlplugins.cpp @@ -1,60 +1,45 @@ /* - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "qmlplugins.h" #include "tagmodel.h" #include "imagelocationmodel.h" #include "imagetimemodel.h" #include "imagefoldermodel.h" #include "sortmodel.h" #include "allimagesmodel.h" #include "imagelistmodel.h" #include "notificationmanager.h" #include "types.h" #include "roles.h" #include "imagedocument.h" #include void QmlPlugins::initializeEngine(QQmlEngine *, const char *) { } void QmlPlugins::registerTypes(const char *uri) { #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) qmlRegisterType (); #else qmlRegisterAnonymousType(uri, 0); #endif qmlRegisterType (uri, 0, 1, "TagModel"); qmlRegisterType (uri, 0, 1, "ImageLocationModel"); qmlRegisterType (uri, 0, 1, "ImageTimeModel"); qmlRegisterType (uri, 0, 1, "ImageFolderModel"); qmlRegisterType (uri, 0, 1, "AllImagesModel"); qmlRegisterType (uri, 0, 1, "SortModel"); qmlRegisterType (uri, 0, 1, "ImageListModel"); qmlRegisterType (uri, 0, 1, "ImageDocument"); qmlRegisterType (uri, 0, 1, "NotificationManager"); qmlRegisterUncreatableType(uri, 0, 1, "Types", "Cannot instantiate the Types class"); qmlRegisterUncreatableType(uri, 0, 1, "Roles", "Cannot instantiate the Roles class"); } diff --git a/src/qmlplugins.h b/src/qmlplugins.h index 5f0d6bb..2c73342 100644 --- a/src/qmlplugins.h +++ b/src/qmlplugins.h @@ -1,37 +1,22 @@ /* - * Copyright (C) 2013 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) version 3, or any - * later version 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 defined in Section 6 of version 3 of the license. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . + * SPDX-FileCopyrightText: (C) 2013 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef _QML_PLUGINS_H #define _QML_PLUGINS_H #include class QmlPlugins : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void initializeEngine(QQmlEngine *engine, const char *uri) override; void registerTypes(const char *uri) override; }; #endif diff --git a/src/reversegeocoder.cpp b/src/reversegeocoder.cpp index af0c06f..29b2426 100644 --- a/src/reversegeocoder.cpp +++ b/src/reversegeocoder.cpp @@ -1,184 +1,171 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "reversegeocoder.h" #include #include #include #include using namespace Koko; ReverseGeoCoder::ReverseGeoCoder() : m_tree(0) { } ReverseGeoCoder::~ReverseGeoCoder() { deinit(); } void ReverseGeoCoder::init() { m_tree = kd_create(2); QString citiesPath = QStandardPaths::locate(QStandardPaths::DataLocation, "cities1000.txt"); Q_ASSERT(!citiesPath.isEmpty()); QFile file(citiesPath); if (!file.open(QIODevice::ReadOnly)) { Q_ASSERT_X(0, "", "Failed to open cities1000.txt file"); } QTextStream fstream(&file); while (!fstream.atEnd()) { QString str = fstream.readLine(); str.remove('\r'); QStringList list = str.split('\t'); //int geoId = list[0].toInt(); //QString name = list[1]; double lat = list[4].toDouble(); double lon = list[5].toDouble(); QString countryCode = list[8]; QString admin1Code = list[10]; QString admin2Code = list[11]; QVariantMap* map = new QVariantMap(); //map->insert("geoId", geoId); //map->insert("name", name); map->insert("countryCode", countryCode); map->insert("admin1Code", admin1Code); map->insert("admin2Code", admin2Code); kd_insert3(m_tree, lat, lon, 0.0, static_cast(map)); } // Country QString countryPath = QStandardPaths::locate(QStandardPaths::DataLocation, "countries.csv"); Q_ASSERT(!countryPath.isEmpty()); QFile cFile(countryPath); if (!cFile.open(QIODevice::ReadOnly)) { Q_ASSERT_X(0, "", "Failed to open countries.csv file"); } QTextStream cstream(&cFile); while (!cstream.atEnd()) { QString str = cstream.readLine(); QStringList list = str.split(','); QString code = list[0]; QString name = list[1]; m_countryMap.insert(code, name); } Q_ASSERT_X(!m_countryMap.isEmpty(), "", "countries.csv file is empty. Packaging issue"); // Admin1 QString admin1Path = QStandardPaths::locate(QStandardPaths::DataLocation, "admin1Codes.txt"); Q_ASSERT(!admin1Path.isEmpty()); QFile admin1File(admin1Path); if (!admin1File.open(QIODevice::ReadOnly)) { Q_ASSERT_X(0, "", "Failed to open admin1Codes.txt file"); } QTextStream a1fstream(&admin1File); while (!a1fstream.atEnd()) { QString str = a1fstream.readLine(); str.remove('\r'); QStringList list = str.split('\t'); QString code = list[0]; QString name = list[1]; m_admin1Map.insert(code, name); } Q_ASSERT_X(!m_admin1Map.isEmpty(), "", "admin1Codes.txt file is empty. Packaging issue"); // Admin2 QString admin2Path = QStandardPaths::locate(QStandardPaths::DataLocation, "admin2Codes.txt"); Q_ASSERT(!admin2Path.isEmpty()); QFile admin2File(admin2Path); if (!admin2File.open(QIODevice::ReadOnly)) { Q_ASSERT_X(0, "", "Failed to open admin2Codes.txt file"); } QTextStream a2fstream(&admin2File); while (!a2fstream.atEnd()) { QString str = a2fstream.readLine(); str.remove('\r'); QStringList list = str.split('\t'); QString code = list[0]; QString name = list[1]; m_admin2Map.insert(code, name); } Q_ASSERT_X(!m_admin2Map.isEmpty(), "", "admin2Codes.txt file is empty. Packaging issue"); } void ReverseGeoCoder::deinit() { if (m_tree) { kd_free(m_tree); m_tree = 0; } m_countryMap.clear(); m_admin1Map.clear(); m_admin2Map.clear(); } bool ReverseGeoCoder::initialized() { return m_tree; } QVariantMap ReverseGeoCoder::lookup(double lat, double lon) const { Q_ASSERT(m_tree); kdres* res = kd_nearest3(m_tree, lat, lon, 0.0); if (!res) { return QVariantMap(); } void* data = kd_res_item_data(res); kd_res_free(res); QVariantMap map = *static_cast(data); QString country = map.value("countryCode").toString(); QString admin1 = country + '.' + map.value("admin1Code").toString(); QString admin2 = admin1 + '.' + map.value("admin2Code").toString(); QVariantMap vMap; vMap.insert("country", m_countryMap.value(country)); vMap.insert("admin1", m_admin1Map.value(admin1)); vMap.insert("admin2", m_admin2Map.value(admin2)); return vMap; } diff --git a/src/reversegeocoder.h b/src/reversegeocoder.h index 8e6fa7f..436f6d6 100644 --- a/src/reversegeocoder.h +++ b/src/reversegeocoder.h @@ -1,53 +1,40 @@ /* - * Copyright (C) 2015 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2015 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef KOKO_REVERSEGEOCODER_H #define KOKO_REVERSEGEOCODER_H #include #include namespace Koko { class ReverseGeoCoder { public: ReverseGeoCoder(); ~ReverseGeoCoder(); void init(); bool initialized(); /** * The ReverseGeoCoder consumes a significant amount of memory (around 100mb). It * makes sense to deinit it when it is not being used. */ void deinit(); QVariantMap lookup(double lat, double lon) const; private: kdtree* m_tree; QMap m_countryMap; QMap m_admin1Map; QMap m_admin2Map; }; } #endif // KOKO_REVERSEGEOCODER_H diff --git a/src/roles.cpp b/src/roles.cpp index 04aef63..f54afe5 100644 --- a/src/roles.cpp +++ b/src/roles.cpp @@ -1,30 +1,17 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #include "roles.h" Roles::Roles(QObject* parent) { } Roles::~Roles() { } #include "moc_roles.cpp" diff --git a/src/roles.h b/src/roles.h index d75b662..e899301 100644 --- a/src/roles.h +++ b/src/roles.h @@ -1,45 +1,32 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #ifndef ROLES_H #define ROLES_H #include class Roles : public QObject { Q_OBJECT Q_ENUMS(RoleNames) public: Roles(QObject* parent); ~Roles(); enum RoleNames { ImageUrlRole = Qt::UserRole + 1, MimeTypeRole, Thumbnail, ItemTypeRole, FilesRole, FileCountRole, DateRole, SelectedRole, SourceIndex }; }; #endif diff --git a/src/sortmodel.cpp b/src/sortmodel.cpp index cf1e462..0847dd5 100644 --- a/src/sortmodel.cpp +++ b/src/sortmodel.cpp @@ -1,341 +1,328 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "sortmodel.h" #include "types.h" #include "roles.h" #include #include #include #include #include #include using namespace Jungle; SortModel::SortModel(QObject* parent) : QSortFilterProxyModel(parent), m_screenshotSize(256, 256), m_containImages(false) { setSortLocaleAware(true); sort(0); m_selectionModel = new QItemSelectionModel(this); m_previewTimer = new QTimer(this); m_previewTimer->setSingleShot(true); connect(m_previewTimer, &QTimer::timeout, this, &SortModel::delayedPreview); connect(this, &SortModel::rowsInserted, this, [this] (const QModelIndex &parent, int first, int last) { Q_UNUSED(parent) for (int i = first; i <= last; i++) { if (Types::Image == data(index(i, 0, QModelIndex()), Roles::ItemTypeRole).toInt() && m_containImages == false) { setContainImages(true); break; } } }); connect(this, &SortModel::sourceModelChanged, this, [this] () { if (!sourceModel()) { return; } for (int i = 0; i <= sourceModel()->rowCount(); i++) { if (Types::Image == sourceModel()->data(sourceModel()->index(i, 0, QModelIndex()), Roles::ItemTypeRole).toInt() && m_containImages == false) { setContainImages(true); break; } } }); //using the same cache of the engine, they index both by url m_imageCache = new KImageCache(QStringLiteral("org.kde.koko"), 10485760); } SortModel::~SortModel() { delete m_imageCache; } void SortModel::setContainImages(bool value) { m_containImages = value; emit containImagesChanged(); } QByteArray SortModel::sortRoleName() const { int role = sortRole(); return roleNames().value(role); } void SortModel::setSortRoleName(const QByteArray& name) { if (!sourceModel()) { m_sortRoleName = name; return; } const QHash roles = sourceModel()->roleNames(); for (auto it = roles.begin(); it != roles.end(); it++) { if (it.value() == name) { setSortRole(it.key()); return; } } qDebug() << "Sort role" << name << "not found"; } QHash SortModel::roleNames() const { QHash hash = sourceModel()->roleNames(); hash.insert( Roles::SelectedRole, "selected"); hash.insert( Roles::Thumbnail, "thumbnail"); hash.insert( Roles::SourceIndex, "sourceIndex"); return hash; } QVariant SortModel::data(const QModelIndex& index, int role) const { if( !index.isValid()) { return QVariant(); } switch( role) { case Roles::SelectedRole: { return m_selectionModel->isSelected(index); } case Roles::Thumbnail: { QUrl thumbnailSource(QString( /*"file://" + */data( index, Roles::ImageUrlRole).toString())); KFileItem item( thumbnailSource, QString() ); QImage preview = QImage(m_screenshotSize, QImage::Format_ARGB32_Premultiplied); if (m_imageCache->findImage(item.url().toString(), &preview)) { return preview; } m_previewTimer->start(100); const_cast(this)->m_filesToPreview[item.url()] = QPersistentModelIndex(index); return {}; } case Roles::SourceIndex: { return mapToSource(index).row(); } } return QSortFilterProxyModel::data(index, role); } bool SortModel::lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const { if(sourceModel()) { if( (sourceModel()->data(source_left, Roles::ItemTypeRole) == Types::Folder && sourceModel()-> data(source_right, Roles::ItemTypeRole) == Types::Folder ) || (sourceModel()->data(source_left, Roles::ItemTypeRole) != Types::Folder && sourceModel()-> data(source_right, Roles::ItemTypeRole) != Types::Folder)) { return QSortFilterProxyModel::lessThan(source_left, source_right); } else if( sourceModel()->data(source_left, Roles::ItemTypeRole) == Types::Folder && sourceModel()->data(source_right, Roles::ItemTypeRole) != Types::Folder) { return true; } else { return false; } } return false; } void SortModel::setSourceModel(QAbstractItemModel* sourceModel) { QSortFilterProxyModel::setSourceModel(sourceModel); if (!m_sortRoleName.isEmpty()) { setSortRoleName(m_sortRoleName); m_sortRoleName.clear(); } } bool SortModel::containImages() { return m_containImages; } bool SortModel::hasSelectedImages() { return m_selectionModel->hasSelection(); } void SortModel::setSelected(int indexValue) { if( indexValue < 0) return; QModelIndex index = QSortFilterProxyModel::index( indexValue, 0); m_selectionModel->select( index, QItemSelectionModel::Select ); emit dataChanged( index, index); emit selectedImagesChanged(); } void SortModel::toggleSelected(int indexValue ) { if( indexValue < 0) return; QModelIndex index = QSortFilterProxyModel::index( indexValue, 0); m_selectionModel->select( index, QItemSelectionModel::Toggle ); emit dataChanged( index, index); emit selectedImagesChanged(); } void SortModel::clearSelections() { if(m_selectionModel->hasSelection()) { QModelIndexList selectedIndex = m_selectionModel->selectedIndexes(); m_selectionModel->clear(); foreach(QModelIndex indexValue, selectedIndex) { emit dataChanged( indexValue, indexValue); } } emit selectedImagesChanged(); } void SortModel::selectAll() { QModelIndexList indexList; for( int row=0; rowhasSelection()) { m_selectionModel->clear(); } foreach(QModelIndex index, indexList) { if( Types::Image == data(index, Roles::ItemTypeRole)) m_selectionModel->select( index, QItemSelectionModel::Select); } emit dataChanged( index( 0, 0, QModelIndex()), index( rowCount()-1, 0, QModelIndex()) ); emit selectedImagesChanged(); } void SortModel::deleteSelection() { QList filesToDelete; foreach(QModelIndex index, m_selectionModel->selectedIndexes()) { filesToDelete << data( index, Roles::ImageUrlRole).toUrl(); } auto trashJob = KIO::trash(filesToDelete); trashJob->exec(); } int SortModel::proxyIndex(const int& indexValue) { if( sourceModel() ) { return mapFromSource( sourceModel()->index( indexValue, 0, QModelIndex())).row(); } return -1; } int SortModel::sourceIndex(const int& indexValue) { return mapToSource( index(indexValue, 0, QModelIndex())).row(); } QJsonArray SortModel::selectedImages() { QJsonArray arr; foreach( QModelIndex index, m_selectionModel->selectedIndexes()) { arr.push_back( QJsonValue (data( index, Roles::ImageUrlRole).toString())); } return arr; } void SortModel::delayedPreview() { QHash::const_iterator i = m_filesToPreview.constBegin(); KFileItemList list; while (i != m_filesToPreview.constEnd()) { QUrl file = i.key(); QPersistentModelIndex index = i.value(); if (!m_previewJobs.contains(file) && file.isValid()) { list.append(KFileItem(file, QString(), 0)); m_previewJobs.insert(file, QPersistentModelIndex(index)); } ++i; } if (list.size() > 0) { KIO::PreviewJob* job = KIO::filePreview(list, m_screenshotSize); job->setIgnoreMaximumSize(true); // qDebug() << "Created job" << job; connect(job, &KIO::PreviewJob::gotPreview, this, &SortModel::showPreview); connect(job, &KIO::PreviewJob::failed, this, &SortModel::previewFailed); } m_filesToPreview.clear(); } void SortModel::showPreview(const KFileItem &item, const QPixmap &preview) { QPersistentModelIndex index = m_previewJobs.value(item.url()); m_previewJobs.remove(item.url()); if (!index.isValid()) { return; } m_imageCache->insertImage(item.url().toString(), preview.toImage()); //qDebug() << "preview size:" << preview.size(); emit dataChanged(index, index); } void SortModel::previewFailed(const KFileItem &item) { // Use folder image instead of displaying nothing then thumbnail generation fails QPersistentModelIndex index = m_previewJobs.value(item.url()); m_previewJobs.remove(item.url()); if (!index.isValid()) { return; } m_imageCache->insertImage(item.url().toString(), QIcon::fromTheme("folder").pixmap(m_screenshotSize).toImage()); Q_EMIT dataChanged(index, index); } diff --git a/src/sortmodel.h b/src/sortmodel.h index 8fefbab..0481e51 100644 --- a/src/sortmodel.h +++ b/src/sortmodel.h @@ -1,88 +1,75 @@ /* - * Copyright (C) 2017 Atul Sharma - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef JUNGLE_SORTMODEL_H #define JUNGLE_SORTMODEL_H #include #include #include #include #include #include #include #include namespace Jungle { class SortModel : public QSortFilterProxyModel { Q_OBJECT Q_PROPERTY(QByteArray sortRoleName READ sortRoleName WRITE setSortRoleName) Q_PROPERTY(bool containImages READ containImages WRITE setContainImages NOTIFY containImagesChanged) Q_PROPERTY(bool hasSelectedImages READ hasSelectedImages NOTIFY selectedImagesChanged) public: explicit SortModel(QObject* parent = 0); virtual ~SortModel(); QByteArray sortRoleName() const; void setSortRoleName(const QByteArray& name); QHash roleNames() const override; QVariant data(const QModelIndex & index, int role) const override; bool lessThan(const QModelIndex & source_left, const QModelIndex & source_right) const override; void setSourceModel(QAbstractItemModel* sourceModel) override; bool containImages(); bool hasSelectedImages(); Q_INVOKABLE void setSelected( int indexValue); Q_INVOKABLE void toggleSelected( int indexValue); Q_INVOKABLE void clearSelections(); Q_INVOKABLE void selectAll(); Q_INVOKABLE void deleteSelection(); Q_INVOKABLE int proxyIndex(const int &indexValue); Q_INVOKABLE int sourceIndex(const int &indexValue); Q_INVOKABLE QJsonArray selectedImages(); protected Q_SLOTS: void setContainImages(bool); void showPreview(const KFileItem &item, const QPixmap &preview); void previewFailed(const KFileItem &item); void delayedPreview(); signals: void containImagesChanged(); void selectedImagesChanged(); private: QByteArray m_sortRoleName; QItemSelectionModel *m_selectionModel; QTimer *m_previewTimer; QHash m_filesToPreview; QSize m_screenshotSize; QHash m_previewJobs; KImageCache* m_imageCache; bool m_containImages; }; } #endif // JUNGLE_SORTMODEL_H diff --git a/src/tagmodel.cpp b/src/tagmodel.cpp index b56a40c..c75a91a 100644 --- a/src/tagmodel.cpp +++ b/src/tagmodel.cpp @@ -1,120 +1,107 @@ /* - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #include "tagmodel.h" static QStringList s_tags = {"green", "blue", "red", "black", "orange", "purple", "yellow", "cyan", "brown"}; TagModel::TagModel(QObject* parent) : QAbstractListModel(parent) { } QHash TagModel::roleNames() const { auto hash = QAbstractItemModel::roleNames(); hash.insert(ColorRole, "color"); return hash; } QVariant TagModel::data(const QModelIndex& index, int role) const { if (!index.isValid() || index.row() >= m_tags.size()) { return QVariant(); } switch (role) { case Qt::DisplayRole: { QString tag = m_tags.at(index.row()); return tag; } case ColorRole: if (index.row() < s_tags.size()) { return s_tags.at(index.row()); } else { return QStringLiteral("maroon"); } } return QVariant(); } int TagModel::rowCount(const QModelIndex& parent) const { if (parent.isValid()) { return 0; } return m_tags.size(); } void TagModel::setTags(const QStringList& tags) { beginResetModel(); m_tags = tags; endResetModel(); emit tagsChanged(); emit colorsChanged(); } QStringList TagModel::tags() const { return m_tags; } void TagModel::addTag(const QString& tag) { if (m_tags.contains(tag)) { return; } beginInsertRows(QModelIndex(), m_tags.size(), m_tags.size()); m_tags << tag; endInsertRows(); emit tagsChanged(); emit colorsChanged(); } bool TagModel::removeRows(int row, int count, const QModelIndex& parent) { if (parent.isValid()) { return false; } beginRemoveRows(parent, row, row + count - 1); while (count) { m_tags.removeAt(row); count--; } endRemoveRows(); emit tagsChanged(); emit colorsChanged(); return QAbstractItemModel::removeRows(row, count, parent); } QStringList TagModel::colors() const { return s_tags.mid(0, m_tags.size()); } diff --git a/src/tagmodel.h b/src/tagmodel.h index ea3fc26..57d1ca2 100644 --- a/src/tagmodel.h +++ b/src/tagmodel.h @@ -1,62 +1,49 @@ /* - * Copyright (C) 2014 Vishesh Handa - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa * + * SPDX-LicenseIdentifier: LGPL-2.1-or-later */ #ifndef TAGMODEL_H #define TAGMODEL_H #include class TagModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QStringList tags READ tags WRITE setTags NOTIFY tagsChanged) Q_PROPERTY(QStringList colors READ colors NOTIFY colorsChanged) public: explicit TagModel(QObject* parent = 0); enum Roles { ColorRole = Qt::UserRole + 1 }; QHash roleNames() const override; QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; int rowCount(const QModelIndex& parent = QModelIndex()) const override; signals: void tagsChanged(); void colorsChanged(); public slots: bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override; QStringList tags() const; void setTags(const QStringList& tags); void addTag(const QString& tag); /** * Return the colors of all the tags */ QStringList colors() const; private: QStringList m_tags; }; #endif // TAGMODEL_H diff --git a/src/types.cpp b/src/types.cpp index 336c885..e3b71bf 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1,30 +1,17 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #include "types.h" Types::Types(QObject* parent) { } Types::~Types() { } #include "moc_types.cpp" diff --git a/src/types.h b/src/types.h index 07e8989..d067b9c 100644 --- a/src/types.h +++ b/src/types.h @@ -1,56 +1,43 @@ /* - * Copyright 2017 by Atul Sharma - * - * 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. + * SPDX-FileCopyrightText: (C) 2017 Atul Sharma * - * 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-LicenseIdentifier: LGPL-2.0-or-later */ #ifndef ITEMTYPES_H #define ITEMTYPES_H #include class Types : public QObject { Q_OBJECT Q_ENUMS(ItemTypes) Q_ENUMS(TimeGroup) Q_ENUMS(LocationGroup) Q_ENUMS(QueryType) public: Types(QObject* parent); ~Types(); enum ItemTypes { Album = 0 , Folder, Image }; enum TimeGroup { Year = 3, Month, Week, Day }; enum LocationGroup { Country = 7, State, City }; enum QueryType { LocationQuery = 10, TimeQuery }; }; #endif