diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..89e08fb002e48e22363b7b3789a5470ffe71fea1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,339 @@ + 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/flameshot-0.6.0/.github/ISSUE_TEMPLATE/Bug_report.md b/flameshot-0.6.0/.github/ISSUE_TEMPLATE/Bug_report.md new file mode 100644 index 0000000000000000000000000000000000000000..b03c5858f1775ace83d42fdec3a77daff2bde750 --- /dev/null +++ b/flameshot-0.6.0/.github/ISSUE_TEMPLATE/Bug_report.md @@ -0,0 +1,18 @@ +--- +name: bug report +about: Create a report to help us improve + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Desktop (please complete the following information):** + - OS: [e.g. Ubuntu 16.14 Mate] + - Version [e.g. 22] diff --git a/flameshot-0.6.0/.github/ISSUE_TEMPLATE/Feature_request.md b/flameshot-0.6.0/.github/ISSUE_TEMPLATE/Feature_request.md new file mode 100644 index 0000000000000000000000000000000000000000..d574e21f010c506cb28b3172d2c9b48bf3932f39 --- /dev/null +++ b/flameshot-0.6.0/.github/ISSUE_TEMPLATE/Feature_request.md @@ -0,0 +1,9 @@ +--- +name: feature request +about: Suggest an idea for this project + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] +Please, a single feature per issue. diff --git a/flameshot-0.6.0/.gitignore b/flameshot-0.6.0/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a886f32cd591b232b66cae17fad31c07fc1850b3 --- /dev/null +++ b/flameshot-0.6.0/.gitignore @@ -0,0 +1,53 @@ +# C++ objects and libs + +*.slo +*.lo +*.o +*.a +*.la +*.lai +*.so +*.dll +*.dylib + +# Qt-es + +/.qmake.cache +/.qmake.stash +*.pro.user +*.pro.user.* +*.qbs.user +*.qbs.user.* +*.moc +moc_*.cpp +qrc_*.cpp +ui_*.h +Makefile* +*build-* +*.qm + +# QtCreator + +*.autosave + +# QtCtreator Qml +*.qmlproject.user +*.qmlproject.user.* + +# QtCtreator CMake +CMakeLists.txt.user + + +# Created by https://www.gitignore.io/api/snapcraft + +### Snapcraft ### +# Snapcraft +parts/ +prime/ +stage/ +*.snap +.snapcraft/ +flameshot*.tar.bz2 + + +# End of https://www.gitignore.io/api/snapcraft diff --git a/flameshot-0.6.0/.travis.yml b/flameshot-0.6.0/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..ff8aa633702637df3c2fc1d1b528d10066efa0ee --- /dev/null +++ b/flameshot-0.6.0/.travis.yml @@ -0,0 +1,87 @@ +dist: trusty +sudo: required + +language: cpp + +branches: + only: + - master + +cache: + directories: + - $HOME/.cache + +env: + global: + # Environment variables for packpack + - PRODUCT=flameshot + - VERSION=0.5.1 + - RELEASE=1 + - ARCH=x86_64 +# - DOCKER_REPO=packpack/packpack +# - DOCKER_REPO=vitzy/packpack + - DOCKER_REPO=vitzy/flameshot + +#The actual list of distribution is available on +#https://hub.docker.com/r/packpack/packpack/tags/ +#https://hub.docker.com/r/vitzy/packpack/tags/ +#https://hub.docker.com/r/vitzy/flameshot/tags/ +matrix: + include: + - os: linux + env: OS=fedora DIST=27 EXTEN=rpm + services: docker + - os: linux + env: OS=fedora DIST=28 EXTEN=rpm + services: docker + - os: linux + # trusty: only for build & test & AppImage + # 14.04 LTS; Qt version is 5.2.1, flameshot not support + env: OS=ubuntu DIST=trusty EXTEN=AppImage + - os: linux + # 16.04 LTS + env: OS=ubuntu DIST=xenial EXTEN=deb + services: docker + - os: linux + # 18.04 + env: OS=ubuntu DIST=bionic EXTEN=deb + services: docker + - os: linux + # 8 + env: OS=debian DIST=jessie EXTEN=deb + services: docker + - os: linux + # 9 + env: OS=debian DIST=stretch EXTEN=deb + services: docker +# - os: osx +# compiler: clang +# osx_image: xcode9.2 + +before_install: + - chmod +x travis/*.sh + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then source travis/linux_before_install.sh; fi + +install: + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then source travis/linux_install.sh; fi + +script: +# - git submodule update --init --recursive +# - git describe --long + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then source travis/linux_script.sh; fi +# - if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then source travis/osx_script.sh; fi + - pwd && ls + +after_success: + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then source travis/linux_after_success.sh; fi + +# deploy: +# # Deploy packages to Github Release +# provider: releases +# api_key: "GITHUB ENCYPTED OAUTH TOKEN" +# file_glob: true +# file: dist/*.{deb,rpm,AppImage,dmg} +# skip_cleanup: true +# on: +# tags: true +# branch: master diff --git a/flameshot-0.6.0/CONTRIBUTING.md b/flameshot-0.6.0/CONTRIBUTING.md new file mode 100644 index 0000000000000000000000000000000000000000..8a3367f8b0427995adc3422386ac72f8badd11e7 --- /dev/null +++ b/flameshot-0.6.0/CONTRIBUTING.md @@ -0,0 +1,61 @@ +# Contributing + +Contributions are welcome! Here's how you can help: + +- [Translating](#translations) +- [Contributing code](#code) +- [Reporting issues](#issues) +- [Donating](#donations) + +## Translations + +Check this nice official documentation from Qt docs as it explains how to translate for a project written with Qt: https://doc.qt.io/qt-5/linguist-translators.html + +#### Status: + +| Language | Code | Status | Contributors | +| --------------------- | ----- | ----------- | ------------ | +| Spanish | es | :bookmark:v0.1.0 | [lupoDharkael](https://github.com/lupoDharkael) | +| Catalan | ca | :bookmark:v0.5.0 | [joamuran](https://github.com/joamuran) | +| Russian | ru | :bookmark:v0.5.1 | [Shatur95](https://github.com/Shatur95) | +| Chinese (Simplified) | zh_CN | :bookmark:v0.5.1 | [copie](https://github.com/copie), [hosiet](https://github.com/hosiet) | +| Chinese (Traditional) | zh_TW | :bookmark:v0.5.1 | [PeterDaveHello](https://github.com/PeterDaveHello) | +| Turkish | tr | :bookmark:v0.5.1 | [oltulu](https://github.com/oltulu) | +| Georgian | ge | :bookmark:v0.5.1 | [giogziro95](https://github.com/giogziro95) | +| French | fr | :bookmark:v0.5.1 | [ld892012](https://github.com/ld892012) | +| Polish | pl | :bookmark:v0.5.1 | [napcok](https://github.com/napcok) | + + +## Code + +1. [Fork](https://help.github.com/articles/fork-a-repo/) the repository and [clone](https://help.github.com/articles/cloning-a-repository/) your fork. + +2. Start coding! + - Implement your feature. + - Check your code works as expected. + +3. Commit your changes to a new branch (not `master`, one change per branch) and push it: + - Commit messages should: + - Header line: explain the commit in one line (use the imperative) + - Be descriptive. + - Have a first line with less than *80 characters* and have a second line that is *empty* if you want to add a description. + +4. Once you are happy with your changes, submit a pull request. + - Open the pull-request. + - Add a short description explaining briefly what you've done (or if it's a work-in-progress - what you need to do) + +## Issues + +1. Do a quick search on GitHub to check if the issue has already been reported. +2. [Open an issue](https://github.com/lupoDharkael/flameshot/issues/new) and describe the issue you are having - you could include: + - Screenshots + - Ways to reproduce the issue. + - Your Flameshot version. + - Your platform (e.g. Windows 10 or Ubuntu 15.04 x64) + +After reporting you should aim to answer questions or clarifications as this helps pinpoint the cause of the issue. + +### Donations + +I improve Flameshot in my free time because I want to create something good for everyone to use. +If you want you can donate some bucks [here](https://www.paypal.me/lupoDharkael). diff --git a/flameshot-0.6.0/LICENSE b/flameshot-0.6.0/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..9cecc1d4669ee8af2ca727a5d8cde10cd8b2d7cc --- /dev/null +++ b/flameshot-0.6.0/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/flameshot-0.6.0/README.md b/flameshot-0.6.0/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6afac6a337319b88a13f6670a768e11efefb4cd9 --- /dev/null +++ b/flameshot-0.6.0/README.md @@ -0,0 +1,261 @@ +# Flameshot +![image](./img/app/flameshot.png) +> Powerful yet simple to use screenshot software. + +[![Build Status](https://img.shields.io/travis/lupoDharkael/flameshot.svg)](https://travis-ci.org/lupoDharkael/flameshot) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/lupoDharkael/flameshot?svg=true)](https://ci.appveyor.com/project/lupoDharkael/flameshot) +[![License](https://img.shields.io/github/license/lupoDharkael/flameshot.svg)](https://github.com/lupoDharkael/flameshot/blob/master/LICENSE) +[![Release](https://img.shields.io/github/release/lupoDharkael/flameshot.svg)](https://github.com/lupoDharkael/flameshot/releases) + +## Usage Preview +![image](./img/preview/animatedUsage.gif) + +## Index +- [Features](#features) +- [Contribute](#contribute) +- [Usage](#usage) +- [Keyboard Shortcuts](#keyboard-shortcuts) +- [Considerations](#considerations) +- [Installation](#installation) +- [Compilation](#compilation) + - [Debian](#debian) + - [Fedora](#fedora) + - [Arch](#arch) + - [Install](#install) +- [Packaging](#packaging) +- [License](#license) +- [Donations](#donations) + +## Features +- Customizable appearance. +- Easy to use. +- In-app screenshot edition. +- DBus interface. +- Upload to Imgur. + +## Contribute +If you want to contribute check the [CONTRIBUTING.md](./CONTRIBUTING.md) + +## Usage +Example commands: +- capture with GUI: + + `flameshot gui` + +- capture with GUI with custom save path: + + `flameshot gui -p ~/myStuff/captures` + +- open GUI with a delay of 2 seconds: + + `flameshot gui -d 2000` + +- fullscreen capture with custom save path (no GUI) and delayed: + + `flameshot full -p ~/myStuff/captures -d 5000` + +- fullscreen capture with custom save path copying to clipboard: + + `flameshot full -c -p ~/myStuff/captures` + +- capture the screen containing the mouse and print the image (bytes) in PNG format: + + `flameshot screen -r` + +- capture the screen number 1 and copy it to the clipboard: + + `flameshot screen -n 1 -c` + +In case of doubt choose the first or the second command as shortcut in your favorite desktop environment. + +A systray icon will be in your system's panel while Flameshot is running. +Do a right click on the tray icon and you'll see some menu items to open the configuration window and the information window. +Check out the information window to see all the available shortcuts in the graphical capture mode. + +### CLI configuration +You can use the graphical menu to configure Flameshot, but alternatively you can use your terminal or scripts to do so. + +- open the configuration menu: + + `flameshot config` + +- show the initial help message in the capture mode: + + `flameshot config --showhelp true` + +- for more information about the available options use the help flag: + + `flameshot config -h` + +## Keyboard shortcuts + +### Local + +These shortcuts are available in GUI mode: + +| Keys | Description | +|--- |--- | +| , , , | Move selection 1px | +| Shift + , , , | Resize selection 1px | +| Esc | Quit capture | +| Ctrl + C | Copy to clipboard | +| Ctrl + S | Save selection as a file | +| Ctrl + Z | Undo the last modification | +| Right Click | Show color picker | +| Mouse Wheel | Change the tool's thickness | + +Shift + drag a handler of the selection area: mirror redimension in the opposite handler. + +### Global + +If you want use Flameshot as a default screenshot utility, chances are you want to launch it using the Prt Sc key. Flameshot doesn't yet offer a fully-automated option to do so, but you can configure your system to do so. + +#### On KDE Plasma desktop + +To make configuration easier, there's a [file](docs/shortcuts-config/flameshot-shortcuts-kde) in the repository that more or less automates this process. This file will assign the following keys to the following actions by default: + +| Keys | Description | +|--- |--- | +| Prt Sc | Start the Flameshot screenshot tool and take a screenshot | +| Ctrl + Prt Sc | Wait for 3 seconds, then start the Flameshot screenshot tool and take a screenshot | +| Shift + Prt Sc | Take a full-screen (all monitors) screenshot and save it | +| Ctrl + Shift + Prt Sc | Take a full-screen (all monitors) screenshot and copy it to the clipboard | + +If you don't like the defaults, you can change them manually later. + +Steps for using the configuration: + +1. The configuration file configures shortcuts so that Flameshot automatically saves (without opening the save dialog) screenshots to _~/Pictures/Screenshots_ folder. Make sure you have that folder by running the following command: + ``` + mkdir -p ~/Pictures/Screenshots + ``` + (If you don't like the default location, you can skip this step and configure your preferred directory later.) + +2. Download the configuration file: + ``` + cd ~/Desktop; wget https://raw.githubusercontent.com/lupoDharkael/flameshot/master/docs/shortcuts-config/flameshot-shortcuts-kde + ``` +3. Go to _System Settings_ → _Shortcuts_ → _Custom Shortcuts_. +4. If there's one, you'll need to disable an entry for Spectacle, the default KDE screenshot utility first because its shortcuts might collide with Flameshot's ones; so, just uncheck the _Spectacle_ entry. +5. Click _Edit_ → _Import..._, navigate to the Desktop folder (or wherever you saved the configuration file) and open the configuration file. +6. Now the Flameshot entry should appear in the list. Click _Apply_ to apply the changes. +7. If you want to change the defaults, you can expand the entry, select the appropriate action and modify it as you wish; the process is pretty mush self-explanatory. + +## Considerations + +- Experimental Gnome Wayland and Plasma Wayland support. + +- If you are using Gnome you need to install the [TopIcons](https://extensions.gnome.org/extension/1031/topicons/) extension in order to see the systemtray icon. + +- In order to speed up the first launch of Flameshot (DBus init of the app can be slow), consider starting the application automatically on boot. + +- Press Enter or Ctrl + C when you are in a capture mode and you don't have an active selection and the whole desktop will be copied to your clipboard! Pressing Ctrl + S will save your capture in a file! Check the [Shortcuts](#shortcuts) for more information. + +- Execute the command `flameshot` without parameters or use the "Launch Flameshot" desktop entry to launch a running instance of the program without taking actions. + +## Installation + +There are packages available for a few distros: +- [Arch](https://www.archlinux.org/packages/community/x86_64/flameshot/) + + Snapshot also available via AUR: [flameshot-git](https://aur.archlinux.org/packages/flameshot-git). +- [Debian 10+](https://tracker.debian.org/pkg/flameshot): `apt install flameshot` + + Package for Debian 9 ("Stretch") also [available via stretch-backports](https://backports.debian.org/). +- [Ubuntu 18.04+](https://launchpad.net/ubuntu/+source/flameshot): `apt install flameshot` +- [openSUSE](https://software.opensuse.org/package/flameshot) +- [Void Linux](https://github.com/voidlinux/void-packages/tree/master/srcpkgs/flameshot) (`xbps-install flameshot`) +- [Docker](https://github.com/ManuelLR/docker-flameshot) +- Fedora: `dnf install flameshot` + +## Compilation +The compilation requires Qt version 5.3 or higher and GCC 4.9.2 or higher. + +### Debian +Compilation Dependencies: +```` +apt install git g++ build-essential qt5-qmake qt5-default qttools5-dev-tools libqt5svg5-dev +```` + +Compilation: run `qmake && make` in the main directory. + +### Fedora +Compilation Dependencies: +```` +dnf install qt5-devel gcc-c++ git qt5-qtbase-devel qt5-linguist qt5-qtsvg-devel +```` + +Compilation: run `qmake-qt5 && make` in the main directory. + +### Arch +Compilation Dependencies: +```` +pacman -S base-devel git qt5-base qt5-tools qt5-svg +```` + +Compilation: run `qmake && make` in the main directory. + +### Install + +Simply use `make install` with privileges. + +## Packaging + +Having `git` installed is required if you want to have precise app version information inside Flameshot after the generation of the makefile with `qmake`. + +In order to generate the makefile installing in `/usr` instead of in `/usr/local` you can use the `packaging` option to generate the proper makefile (`qmake CONFIG+=packaging` instead of just `qmake`). + +If you want to install in a custom directory you can use the `INSTALL_ROOT` variable. + +**Example**: +You want to install Flameshot in ~/myBuilds/test. You would execute the following to do so: +`qmake CONFIG+=packaging && make INSTALL_ROOT=~/myBuilds/test install` + +### Runtime Dependencies + +**Debian**: +```` +libqt5dbus5, libqt5network5, libqt5core5a, libqt5widgets5, libqt5gui5 +```` +Optional: +``` +openssl, ca-certificates +``` + +**Fedora**: +```` +qt5-qtbase +```` +Optional: +``` +openssl, ca-certificates +``` + +**Arch**: +```` +qt5-base +```` +Optional: +``` +openssl, ca-certificates +``` + +## License +- The main code is licensed under [GPLv3](./LICENSE) +- The logo of Flameshot is licensed under [Free Art License v1.3](./img/flameshotLogoLicense.txt) +- The button icons are licensed under Apache License 2.0. See: https://github.com/google/material-design-icons +- The code at capture/capturewidget.cpp is based on https://github.com/ckaiser/Lightscreen/blob/master/dialogs/areadialog.cpp (GPLv2) +- The code at capture/capturewidget.h is based on https://github.com/ckaiser/Lightscreen/blob/master/dialogs/areadialog.h (GPLv2) +- I copied a few lines of code from KSnapshot regiongrabber.cpp revision 796531 (LGPL) +- Qt-Color-Widgets taken and modified from https://github.com/mbasaglia/Qt-Color-Widgets (see their license and exceptions in the project) (LGPL/GPL) + +Info: If I take code from your project and that implies a relicense to GPLv3, you can reuse my changes with the original previous license of your project applied. + +## Donations +I improve Flameshot in my free time because I want to create something good for everyone to use. +If you want you can donate some bucks [here](https://www.paypal.me/lupoDharkael). + +## Acknowledgment +I really appreciate those who have shown interest in the early development process: +- [Cosmo](https://github.com/philpem) +- [XerTheSquirrel](https://github.com/XerTheSquirrel) +- [The members of Sugus GNU/Linux](https://github.com/SUGUS-GNULinux) +- ismatori diff --git a/flameshot-0.6.0/appveyor.yml b/flameshot-0.6.0/appveyor.yml new file mode 100644 index 0000000000000000000000000000000000000000..0f9a24bbe25c688fc9491f5e0424e446b8377603 --- /dev/null +++ b/flameshot-0.6.0/appveyor.yml @@ -0,0 +1,72 @@ +image: Visual Studio 2015 + +version: 0.5.{build}.0 +# Major_Version_Number.Minor_Version_Number.Build_Number.Revision_Number + +branches: + only: + - master + +environment: + COMPILER: msvc + VSVER: 14 + + matrix: + - QT: C:\Qt\5.9\msvc2015_64 + PLATFORM: amd64 + - QT: C:\Qt\5.9\msvc2015 + PLATFORM: x86 +init: + - ps: | + $version = new-object System.Version $env:APPVEYOR_BUILD_VERSION + $packageVersion = "{0}.{1}.{2}" -f $version.Major, $version.Minor, $version.Revision + $env:build_number = $version.Build + $env:flameshot_version = $packageVersion + +# scripts that run after cloning repository +install: + - set PATH=%QT%\bin\;C:\Qt\Tools\QtCreator\bin\;C:\Qt\QtIFW3.0.1\bin\;%PATH% + +# scripts that run before build +before_build: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM% + # After calling vcvarsall.bat, %PLATFORM% will be X64 or x86 + - qmake --version + - mkdir build + - cd build + - if "%PLATFORM%" EQU "X64" (qmake -r -spec win32-msvc CONFIG+=x86_64 CONFIG-=debug CONFIG+=release ../flameshot.pro) + - if "%PLATFORM%" EQU "x86" (qmake -r -spec win32-msvc CONFIG+=Win32 CONFIG-=debug CONFIG+=release ../flameshot.pro) + +# custom build scripts +build_script: + - nmake + +# scripts that run after build +after_build: + # Clone OpenSSL DLLs + - git clone https://github.com/tamlok/openssl-utils.git openssl-utils.git + - mkdir distrib\flameshot + - windeployqt.exe --dir .\distrib\flameshot %APPVEYOR_BUILD_FOLDER%\build\release\flameshot.exe + - copy "%APPVEYOR_BUILD_FOLDER%\build\release\flameshot.exe" "distrib\flameshot\flameshot.exe" + - copy "%APPVEYOR_BUILD_FOLDER%\README.md" "distrib\flameshot\README.md" + - copy "%APPVEYOR_BUILD_FOLDER%\LICENSE" "distrib\flameshot\LICENSE.txt" + - echo %flameshot_version% > "distrib\flameshot\version.txt" + - echo Build:%build_number% >> "distrib\flameshot\version.txt" + - echo %APPVEYOR_REPO_COMMIT% >> "distrib\flameshot\version.txt" + - copy "distrib\flameshot\flameshot.exe" "distrib\flameshot_win_%PLATFORM%.exe" + - copy "%APPVEYOR_BUILD_FOLDER%\build\translations\Internationalization_*.qm" "distrib\flameshot\translations" + # Delete translations\qt_*.qm + - del /F /Q "distrib\flameshot\translations\qt_*.qm" + # Copy OpenSSL DLLs + - if "%PLATFORM%" EQU "X64" (xcopy "openssl-utils.git\win64\*.dll" "distrib\flameshot") + - if "%PLATFORM%" EQU "x86" (xcopy "openssl-utils.git\win32\*.dll" "distrib\flameshot") + - cd distrib + - 7z a flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip flameshot + - curl --upload-file ./flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip https://transfer.sh/flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip + + +# artifacts: +# - path: build\distrib\flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip +# name: portable +# - path: build\distrib\flameshot_win_%PLATFORM%.exe +# name: exe_only diff --git a/flameshot-0.6.0/dbus/make/org.dharkael.Flameshot.service b/flameshot-0.6.0/dbus/make/org.dharkael.Flameshot.service new file mode 100644 index 0000000000000000000000000000000000000000..4a24495b091d494fc2c4f60bf4f3c1537966b2a0 --- /dev/null +++ b/flameshot-0.6.0/dbus/make/org.dharkael.Flameshot.service @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.dharkael.Flameshot +Exec=/usr/local/bin/flameshot diff --git a/flameshot-0.6.0/dbus/org.dharkael.Flameshot.xml b/flameshot-0.6.0/dbus/org.dharkael.Flameshot.xml new file mode 100644 index 0000000000000000000000000000000000000000..c378ef26b69b00a6d071ed178db84fd2ec05edf5 --- /dev/null +++ b/flameshot-0.6.0/dbus/org.dharkael.Flameshot.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flameshot-0.6.0/dbus/org.freedesktop.Notifications.xml b/flameshot-0.6.0/dbus/org.freedesktop.Notifications.xml new file mode 100644 index 0000000000000000000000000000000000000000..e9630a61228d866e615b92b548640e56e99b97fe --- /dev/null +++ b/flameshot-0.6.0/dbus/org.freedesktop.Notifications.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/flameshot-0.6.0/dbus/other-path/service-gen.sh b/flameshot-0.6.0/dbus/other-path/service-gen.sh new file mode 100644 index 0000000000000000000000000000000000000000..69e956e869fa4b5112d4498959f49ad37f09ec4c --- /dev/null +++ b/flameshot-0.6.0/dbus/other-path/service-gen.sh @@ -0,0 +1,14 @@ +#!/usr/bin/bash + +DIR=$(pwd) +TARGET="/usr/bin" + +if [ -n "$1" ] + then + TARGET=${1%/} +fi + +FILE='[D-BUS Service]\nName=org.dharkael.Flameshot\nExec=##REPLACE##/flameshot' + +FILE=${FILE//##REPLACE##/$TARGET} +echo -e $FILE > $DIR/org.dharkael.Flameshot.service diff --git a/flameshot-0.6.0/dbus/package/org.dharkael.Flameshot.service b/flameshot-0.6.0/dbus/package/org.dharkael.Flameshot.service new file mode 100644 index 0000000000000000000000000000000000000000..6b11aac645dfa76983428a99569d8fbd95ac82b0 --- /dev/null +++ b/flameshot-0.6.0/dbus/package/org.dharkael.Flameshot.service @@ -0,0 +1,3 @@ +[D-BUS Service] +Name=org.dharkael.Flameshot +Exec=/usr/bin/flameshot diff --git a/flameshot-0.6.0/debian/changelog b/flameshot-0.6.0/debian/changelog new file mode 100644 index 0000000000000000000000000000000000000000..348aa17a5d56c91e1c094b82ccf462cea04c6c85 --- /dev/null +++ b/flameshot-0.6.0/debian/changelog @@ -0,0 +1,5 @@ +flameshot (0.6~dev-1) unstable; urgency=medium + + * Initial deb package. + + -- Boyuan Yang <073plan@gmail.com> Mon, 07 May 2018 17:34:56 +0800 diff --git a/flameshot-0.6.0/debian/compat b/flameshot-0.6.0/debian/compat new file mode 100644 index 0000000000000000000000000000000000000000..ec635144f60048986bc560c5576355344005e6e7 --- /dev/null +++ b/flameshot-0.6.0/debian/compat @@ -0,0 +1 @@ +9 diff --git a/flameshot-0.6.0/debian/control b/flameshot-0.6.0/debian/control new file mode 100644 index 0000000000000000000000000000000000000000..d11ec684f4462b553c37ff8403a81e9ef4609843 --- /dev/null +++ b/flameshot-0.6.0/debian/control @@ -0,0 +1,30 @@ +Source: flameshot +Section: graphics +Priority: optional +Maintainer: Juanma Navarro Mañez +Uploaders: + Boyuan Yang <073plan@gmail.com>, +Build-Depends: + debhelper (>= 9), + qt5-qmake, + qtbase5-dev, + qttools5-dev-tools, + libqt5svg5-dev +Standards-Version: 4.1.4 +Homepage: https://github.com/lupoDharkael/flameshot +Vcs-Browser: https://github.com/lupoDharkael/flameshot +Vcs-Git: https://github.com/lupoDharkael/flameshot.git + +Package: flameshot +Architecture: any +Depends: + ${shlibs:Depends}, + ${misc:Depends}, +Suggests: + ca-certificates, + openssl, +Description: Powerful yet simple-to-use screenshot software + Flameshot is a powerful yet simple-to-use screenshot software. + Notable features include customizable appearance, in-app screenshot editing, + D-Bus interface, experimental GNOME/KDE Wayland support, integration with + Imgur and support for both GUI and CLI interface. diff --git a/flameshot-0.6.0/debian/copyright b/flameshot-0.6.0/debian/copyright new file mode 100644 index 0000000000000000000000000000000000000000..cd019c4872523759e5cedb407e396c0602f105d7 --- /dev/null +++ b/flameshot-0.6.0/debian/copyright @@ -0,0 +1,377 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: flameshot +Source: https://github.com/lupoDharkael/flameshot/ + +Files: * +Copyright: 2016-2017 lupoDharkael +License: GPL-3+ +Comments: + The author copied a few lines of code from KSnapshot regiongrabber.cpp + revision 796531 (LGPL). + +Files: debian/* +Copyright: 2017 Juanma Navarro Mañez + 2018 Boyuan Yang <073plan@gmail.com> +License: GPL-3+ + +Files: img/flameshot.* +Copyright: 2017 lupoDharkael +License: Free-Art-License-1.3 + +Files: img/buttonIconsBlack/* img/buttonIconsWhite/* +Copyright: Google Inc. +License: Apache-2.0 + +Files: src/widgets/capture/capturewidget.* +Copyright: 2017 Alejandro Sirgo Rica + 2017 Christian Kaiser + 2007 Luca Gugelmann +License: GPL-3+ +Comments: + Relicensed under GPL-3+ under flameshot project. + . + Originally based on Lightscreen areadialog.h, + Copyright 2017 Christian Kaiser + released under the GNU GPL2 + . + Originally based on KDE's KSnapshot regiongrabber.cpp, revision 796531, + Copyright 2007 Luca Gugelmann + released under the GNU LGPL + +Files: src/third-party/singleapplication/* +Copyright: 2015 - 2016 Itay Grudev +License: Expat + +Files: src/third-party/Qt-Color-Widgets/* +Copyright: 2013-2017 Mattia Basaglia +License: LGPL-3+ +Comments: + As a special exception, this library can be included in any project under the + terms of any of the GNU licenses, distributing the whole project under a + different GNU license, see LICENSE-EXCEPTION for details. + . + Linking this library statically or dynamically with other modules is making a + combined work based on this library. Thus, the terms and conditions of the + GNU Lesser General Public License version 3 cover the whole combination. + . + As a special exception, the copyright holders of this library give you + permission to combine this library with independent + modules to produce an executable, and to copy and distribute the resulting + executable under terms of any of the GNU General Public licenses, as published + by the Free Software Foundation, provided that you also meet, + for each linked independent module, the terms and conditions of the license of + that module. An independent module is a module which is not derived from or + based on this library. If you modify this library, you may extend this + exception to your version of the library, but you are not obliged to do so. + If you do not wish to do so, delete this exception statement from your version. + +License: LGPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Lesser Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package 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 General Lesser Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU Lesser General Public + License version 3 can be found in "/usr/share/common-licenses/LGPL-3". + +License: Expat + The MIT License (MIT) + . + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + . + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +License: Apache-2.0 + Google Material Design Icons are licensed under Apache License 2.0. + . + On Debian systems, the complete text of Apache License 2.0 can be + found in "/usr/share/common-licenses/Apache-2.0". + +License: Free-Art-License-1.3 + Free Art License 1.3 (FAL 1.3) + . + Preamble + . + The Free Art License grants the right to freely copy, distribute, and + transform creative works without infringing the author's rights. + . + The Free Art License recognizes and protects these rights. Their + implementation has been reformulated in order to allow everyone to use + creations of the human mind in a creative manner, regardless of their + types and ways of expression. + . + While the public's access to creations of the human mind usually is + restricted by the implementation of copyright law, it is favoured by + the Free Art License. This license intends to allow the use of a + work’s resources; to establish new conditions for creating in order to + increase creation opportunities. The Free Art License grants the right + to use a work, and acknowledges the right holder’s and the user’s + rights and responsibility. + . + The invention and development of digital technologies, Internet and + Free Software have changed creation methods: creations of the human + mind can obviously be distributed, exchanged, and transformed. They + allow to produce common works to which everyone can contribute to the + benefit of all. + . + The main rationale for this Free Art License is to promote and protect + these creations of the human mind according to the principles of + copyleft: freedom to use, copy, distribute, transform, and prohibition + of exclusive appropriation. + . + Definitions + . + “work” either means the initial work, the subsequent works or the + common work as defined hereafter: + . + “common work” means a work composed of the initial work and all + subsequent contributions to it (originals and copies). The initial + author is the one who, by choosing this license, defines the + conditions under which contributions are made. + . + “Initial work” means the work created by the initiator of the common + work (as defined above), the copies of which can be modified by + whoever wants to + . + “Subsequent works” means the contributions made by authors who + participate in the evolution of the common work by exercising the + rights to reproduce, distribute, and modify that are granted by the + license. + . + “Originals” (sources or resources of the work) means all copies of + either the initial work or any subsequent work mentioning a date and + used by their author(s) as references for any subsequent updates, + interpretations, copies or reproductions. + . + “Copy” means any reproduction of an original as defined by this + license. + . + 1. OBJECT + . + The aim of this license is to define the conditions under which one + can use this work freely. + . + 2. SCOPE + . + This work is subject to copyright law. Through this license its author + specifies the extent to which you can copy, distribute, and modify it. + . + 2.1 FREEDOM TO COPY (OR TO MAKE REPRODUCTIONS) + . + You have the right to copy this work for yourself, your friends or any + other person, whatever the technique used. + . + 2.2 FREEDOM TO DISTRIBUTE, TO PERFORM IN PUBLIC + . + You have the right to distribute copies of this work; whether modified + or not, whatever the medium and the place, with or without any charge, + provided that you: attach this license without any modification to the + copies of this work or indicate precisely where the license can be + found, specify to the recipient the names of the author(s) of the + originals, including yours if you have modified the work, specify to + the recipient where to access the originals (either initial or + subsequent). + . + The authors of the originals may, if they wish to, give you the right + to distribute the originals under the same conditions as the copies. + . + 2.3 FREEDOM TO MODIFY + . + You have the right to modify copies of the originals (whether initial + or subsequent) provided you comply with the following conditions: all + conditions in article 2.2 above, if you distribute modified copies; + indicate that the work has been modified and, if it is possible, what + kind of modifications have been made; distribute the subsequent work + under the same license or any compatible license. + . + The author(s) of the original work may give you the right to modify it + under the same conditions as the copies. + . + 3. RELATED RIGHTS + . + Activities giving rise to author’s rights and related rights shall not + challenge the rights granted by this license. + . + For example, this is the reason why performances must be subject to + the same license or a compatible license. Similarly, integrating the + work in a database, a compilation or an anthology shall not prevent + anyone from using the work under the same conditions as those defined + in this license. + . + 4. INCORPORATION OF THE WORK + . + Incorporating this work into a larger work that is not subject to the + Free Art License shall not challenge the rights granted by this + license. + . + If the work can no longer be accessed apart from the larger work in + which it is incorporated, then incorporation shall only be allowed + under the condition that the larger work is subject either to the Free + Art License or a compatible license. + . + 5. COMPATIBILITY + . + A license is compatible with the Free Art License provided: it gives + the right to copy, distribute, and modify copies of the work including + for commercial purposes and without any other restrictions than those + required by the respect of the other compatibility criteria; it + ensures proper attribution of the work to its authors and access to + previous versions of the work when possible; it recognizes the Free + Art License as compatible (reciprocity); it requires that changes made + to the work be subject to the same license or to a license which also + meets these compatibility criteria. + . + 6. YOUR INTELLECTUAL RIGHTS + . + This license does not aim at denying your author's rights in your + contribution or any related right. By choosing to contribute to the + development of this common work, you only agree to grant others the + same rights with regard to your contribution as those you were granted + by this license. Conferring these rights does not mean you have to + give up your intellectual rights. + . + 7. YOUR RESPONSIBILITIES + . + The freedom to use the work as defined by the Free Art License (right + to copy, distribute, modify) implies that everyone is responsible for + their own actions. + . + 8. DURATION OF THE LICENSE + . + This license takes effect as of your acceptance of its terms. The act + of copying, distributing, or modifying the work constitutes a tacit + agreement. This license will remain in effect for as long as the + copyright which is attached to the work. If you do not respect the + terms of this license, you automatically lose the rights that it + confers. + . + If the legal status or legislation to which you are subject makes it + impossible for you to respect the terms of this license, you may not + make use of the rights which it confers. + . + 9. VARIOUS VERSIONS OF THE LICENSE + . + This license may undergo periodic modifications to incorporate + improvements by its authors (instigators of the “Copyleft Attitude” + movement) by way of new, numbered versions. + . + You will always have the choice of accepting the terms contained in + the version under which the copy of the work was distributed to you, + or alternatively, to use the provisions of one of the subsequent + versions. + . + 10. SUB-LICENSING + . + Sub-licenses are not authorized by this license. Any person wishing to + make use of the rights that it confers will be directly bound to the + authors of the common work. + . + 11. LEGAL FRAMEWORK + . + This license is written with respect to both French law and the Berne + Convention for the Protection of Literary and Artistic Works. + . + USER GUIDE + . + - How to use the Free Art License? + . + To benefit from the Free Art License, you only need to mention the + following elements on your work: + . + [Name of the author, title, date of the work. When applicable, names + of authors of the common work and, if possible, where to find the + originals]. + . + Copyleft: This is a free work, you can copy, distribute, and modify it + under the terms of the Free Art License + http://artlibre.org/licence/lal/en/ + . + - Why to use the Free Art License? + . + 1.To give the greatest number of people access to your work. + . + 2.To allow it to be distributed freely. + . + 3.To allow it to evolve by allowing its copy, distribution, and + transformation by others. + . + 4.So that you benefit from the resources of a work when it is under + the Free Art License: to be able to copy, distribute or transform + it freely. + . + 5.But also, because the Free Art License offers a legal framework to + disallow any misappropriation. It is forbidden to take hold of + your work and bypass the creative process for one's exclusive + possession. + . + . + - When to use the Free Art License? + . + Any time you want to benefit and make others benefit from the right to + copy, distribute and transform creative works without any exclusive + appropriation, you should use the Free Art License. You can for + example use it for scientific, artistic or educational projects. + . + - What kinds of works can be subject to the Free Art License? + . + The Free Art License can be applied to digital as well as physical + works. You can choose to apply the Free Art License on any text, + picture, sound, gesture, or whatever sort of stuff on which you have + sufficient author's rights. + . + - Historical background of this license: + . + It is the result of observing, using and creating digital + technologies, free software, the Internet and art. It arose from the + “Copyleft Attitude” meetings which took place in Paris in 2000. For + the first time, these meetings brought together members of the Free + Software community, artists, and members of the art world. The goal + was to adapt the principles of Copyleft and free software to all sorts + of creations. http://www.artlibre.org + . + Copyleft Attitude, 2007. + . + You can make reproductions and distribute this license verbatim + (without any changes). + . + Translation : Jonathan Clarke, Benjamin Jean, Griselda Jung, Fanny + Mourguet, Antoine Pitrou. Thanks to framalang.org + +License: GPL-3+ + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the complete text of the GNU General + Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". diff --git a/flameshot-0.6.0/debian/docs b/flameshot-0.6.0/debian/docs new file mode 100644 index 0000000000000000000000000000000000000000..b43bf86b50fd8d3529a0dc062c30006ed38f309e --- /dev/null +++ b/flameshot-0.6.0/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/flameshot-0.6.0/debian/rules b/flameshot-0.6.0/debian/rules new file mode 100644 index 0000000000000000000000000000000000000000..5888922e06da7690762e8cc064759be21e5d4f0a --- /dev/null +++ b/flameshot-0.6.0/debian/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +export QT_SELECT := 5 + +%: + dh $@ + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + diff --git a/flameshot-0.6.0/debian/source/format b/flameshot-0.6.0/debian/source/format new file mode 100644 index 0000000000000000000000000000000000000000..163aaf8d82b6c54f23c45f32895dbdfdcc27b047 --- /dev/null +++ b/flameshot-0.6.0/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/flameshot-0.6.0/docs/appdata/flameshot.appdata.xml b/flameshot-0.6.0/docs/appdata/flameshot.appdata.xml new file mode 100644 index 0000000000000000000000000000000000000000..3d2745ad61a981b8b2aaf1f392d5ecff46de0f77 --- /dev/null +++ b/flameshot-0.6.0/docs/appdata/flameshot.appdata.xml @@ -0,0 +1,25 @@ + + + + flameshot.desktop + CC0-1.0 + GPL-3.0-or-later and ASL 2.0 and GPLv2 and LGPLv3 and Free Art + Flameshot + Powerful and simple to use screenshot software + +

+ Powerful and simple to use screenshot software with built-in + editor with advanced features. +

+
+ + + https://raw.githubusercontent.com/lupoDharkael/flameshot/master/img/preview/usageStatic.png + + + https://raw.githubusercontent.com/lupoDharkael/flameshot/master/img/preview/animatedUsage.gif + + + https://github.com/lupoDharkael/flameshot + https://github.com/lupoDharkael +
diff --git a/flameshot-0.6.0/docs/bash-completion/flameshot b/flameshot-0.6.0/docs/bash-completion/flameshot new file mode 100644 index 0000000000000000000000000000000000000000..2fe7fbe2439b2045b882b1308b6c389dc5f89cf8 --- /dev/null +++ b/flameshot-0.6.0/docs/bash-completion/flameshot @@ -0,0 +1,64 @@ +# bash-completion for flameshot command +# To be installed in "/usr/share/bash-completion/completions/flameshot" + +_flameshot() { + local prev cur cmd gui_opts full_opts config_opts + COMPREPLY=() + + prev="${COMP_WORDS[COMP_CWORD-1]}" + cur="${COMP_WORDS[COMP_CWORD]}" + cmd="gui full config screen" + screen_opts="--number --path --delay --raw -p -d -r -n" + gui_opts="--path --delay --raw -p -d -r" + full_opts="--path --delay --clipboard --raw -p -d -c -r" + config_opts="--contrastcolor --filename --maincolor --showhelp --trayicon -k -f -m -s -t" + + case "${prev}" in + screen) + COMPREPLY=( $(compgen -W "$screen_opts --help -h" -- ${cur}) ) + return 0 + ;; + gui) + COMPREPLY=( $(compgen -W "$gui_opts --help -h" -- ${cur}) ) + return 0 + ;; + full) + COMPREPLY=( $(compgen -W "$full_opts --help -h" -- ${cur}) ) + return 0 + ;; + config) + COMPREPLY=( $(compgen -W "$config_opts --help -h" -- ${cur}) ) + return 0 + ;; + -f|--filename|-p|--path) + _filedir -d + return 0 + ;; + -s|--showhelp|-t|--trayicon) + COMPREPLY=( $(compgen -W "true false" -- ${cur}) ) + return 0 + ;; + -d|--delay|-h|--help|-c|--clipboard|--version|-v|--number|-n) + return 0 + ;; + *) + ;; + esac + + # Options + case "${cur}" in + -*) + COMPREPLY=( $( compgen -W "--version --help -v -h" -- ${cur}) ) + return 0 + ;; + --*) + COMPREPLY=( $( compgen -W "--version --help" -- ${cur}) ) + return 0 + ;; + *) + COMPREPLY=( $( compgen -W "${cmd}" -- ${cur}) ) + return 0 + ;; + esac +} +complete -F _flameshot flameshot diff --git a/flameshot-0.6.0/docs/desktopEntry/package/flameshot.desktop b/flameshot-0.6.0/docs/desktopEntry/package/flameshot.desktop new file mode 100644 index 0000000000000000000000000000000000000000..522af471e06b05e417d2b002a42b3a9940344668 --- /dev/null +++ b/flameshot-0.6.0/docs/desktopEntry/package/flameshot.desktop @@ -0,0 +1,35 @@ +[Desktop Entry] +Name=Flameshot +Name[zh_CN]=火焰截图 +GenericName=Screenshot tool +GenericName[zh_CN]=屏幕截图工具 +GenericName[pl]=Zrzuty ekranu +GenericName[fr]=Outil de capture d'écran +Comment=Powerful yet simple to use screenshot software. +Comment[zh_CN]=强大又易用的屏幕截图软件 +Comment[pl]=Proste w użyciu narzędzie do zrzutów ekranu +Comment[fr]=Logiciel de capture d'écran puissant et simple d'utilisation. +Keywords=flameshot;screenshot;capture;shutter; +Keywords[zh_CN]=flameshot;screenshot;capture;shutter;截图;屏幕; +Keywords[fr]=flameshot;capture d'écran;capter;shutter; +Exec=flameshot +Icon=flameshot +Terminal=false +Type=Application +Categories=Graphics; +StartupNotify=false +Actions=Configure;Capture; + +[Desktop Action Configure] +Name=Configure +Name[zh_CN]=配置 +Name[pl]=Konfiguruj +Name[fr]=Configurer +Exec=flameshot config + +[Desktop Action Capture] +Name=Take screenshot +Name[zh_CN]=进行截图 +Name[pl]=Zrzut ekranu +Name[fr]=Prendre une capture d'écran +Exec=flameshot gui --delay 500 diff --git a/flameshot-0.6.0/docs/dev/package.md b/flameshot-0.6.0/docs/dev/package.md new file mode 100644 index 0000000000000000000000000000000000000000..2dac5effc6ef1bc9d11b4c137257183a98178e42 --- /dev/null +++ b/flameshot-0.6.0/docs/dev/package.md @@ -0,0 +1,5 @@ +# Debian +How to build the debian package based on the `./debian` folder: +1. Install the build dependencies. +2. apt install debhelper +3. dpkg-buildpackage -B diff --git a/flameshot-0.6.0/docs/dev/release.md b/flameshot-0.6.0/docs/dev/release.md new file mode 100644 index 0000000000000000000000000000000000000000..92652685b02d4d63a0fce1060a96fcd7044ba13f --- /dev/null +++ b/flameshot-0.6.0/docs/dev/release.md @@ -0,0 +1,9 @@ + What to do before every release? + + - Update translations. + - Update travis version + - Releases always use annotated tags as in `git tag -a v0.5.1 -m "version 0.5.1"` + - Add a changelog description in the Github's release. + - Update .pro hardcoded version. + - Run cppcheck --enable=all 2> err.txt + - Run codespell diff --git a/flameshot-0.6.0/docs/shortcuts-config/flameshot-shortcuts-kde b/flameshot-0.6.0/docs/shortcuts-config/flameshot-shortcuts-kde new file mode 100644 index 0000000000000000000000000000000000000000..408f14983777d6b3c5cc99ddc5c0172b195fdd71 --- /dev/null +++ b/flameshot-0.6.0/docs/shortcuts-config/flameshot-shortcuts-kde @@ -0,0 +1,135 @@ +[Data] +DataCount=1 + +[Data_1] +Comment=Shortcuts for taking screenshots with Flameshot +DataCount=4 +Enabled=true +Name=Flameshot +SystemGroup=0 +Type=ACTION_DATA_GROUP + +[Data_1Conditions] +Comment= +ConditionsCount=0 + +[Data_1_1] +Comment=Start the Flameshot screenshot tool and take a screenshot +Enabled=true +Name=Take screenshot +Type=SIMPLE_ACTION_DATA + +[Data_1_1Actions] +ActionsCount=1 + +[Data_1_1Actions0] +Arguments='Pictures/Screenshots' 0 0 +Call=graphicCapture +RemoteApp=org.dharkael.Flameshot +RemoteObj=/ +Type=DBUS + +[Data_1_1Conditions] +Comment= +ConditionsCount=0 + +[Data_1_1Triggers] +Comment=Simple_action +TriggersCount=1 + +[Data_1_1Triggers0] +Key=Print +Type=SHORTCUT +Uuid={65ecb470-7d89-497a-9f9d-406b068f7207} + +[Data_1_2] +Comment=Wait for 3 seconds, then start the Flameshot screenshot tool and take a screenshot +Enabled=true +Name=Take screenshot with delay +Type=SIMPLE_ACTION_DATA + +[Data_1_2Actions] +ActionsCount=1 + +[Data_1_2Actions0] +Arguments='Pictures/Screenshots' 3000 0 +Call=graphicCapture +RemoteApp=org.dharkael.Flameshot +RemoteObj=/ +Type=DBUS + +[Data_1_2Conditions] +Comment= +ConditionsCount=0 + +[Data_1_2Triggers] +Comment=Simple_action +TriggersCount=1 + +[Data_1_2Triggers0] +Key=Ctrl+Print +Type=SHORTCUT +Uuid={cea82966-75d5-437d-afaf-aeba83a4abfd} + +[Data_1_3] +Comment=Take a full-screen (all monitors) screenshot and save it +Enabled=true +Name=Take full-screen screenshot and save +Type=SIMPLE_ACTION_DATA + +[Data_1_3Actions] +ActionsCount=1 + +[Data_1_3Actions0] +Arguments='Pictures/Screenshots' false 0 0 +Call=fullScreen +RemoteApp=org.dharkael.Flameshot +RemoteObj=/ +Type=DBUS + +[Data_1_3Conditions] +Comment= +ConditionsCount=0 + +[Data_1_3Triggers] +Comment=Simple_action +TriggersCount=1 + +[Data_1_3Triggers0] +Key=Shift+Print +Type=SHORTCUT +Uuid={3c7ead73-00ad-4f90-bdba-5d15a70b8b43} + +[Data_1_4] +Comment=Take a full-screen (all monitors) screenshot and copy it to the clipboard +Enabled=true +Name=Take full-screen screenshot and copy it to clipboard +Type=SIMPLE_ACTION_DATA + +[Data_1_4Actions] +ActionsCount=1 + +[Data_1_4Actions0] +Arguments='' true 0 0 +Call=fullScreen +RemoteApp=org.dharkael.Flameshot +RemoteObj=/ +Type=DBUS + +[Data_1_4Conditions] +Comment= +ConditionsCount=0 + +[Data_1_4Triggers] +Comment=Simple_action +TriggersCount=1 + +[Data_1_4Triggers0] +Key=Ctrl+Shift+Print +Type=SHORTCUT +Uuid={a724b514-0cb6-40f0-bf14-c08db726b320} + +[Main] +AllowMerge=false +ImportId=flameshot +Version=2 diff --git a/flameshot-0.6.0/flameshot.pro b/flameshot-0.6.0/flameshot.pro new file mode 100644 index 0000000000000000000000000000000000000000..7485ab860efc600d33748ef5e182d3e2442f0a20 --- /dev/null +++ b/flameshot-0.6.0/flameshot.pro @@ -0,0 +1,283 @@ +#------------------------------------------------- +# +# Project created by Dharkael 2017-04-21T00:42:49 +# +#------------------------------------------------- + +win32:LIBS += -luser32 -lshell32 + +TAG_VERSION = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags) +isEmpty(TAG_VERSION){ + TAG_VERSION = v0.6.0 +} +DEFINES += APP_VERSION=\\\"$$TAG_VERSION\\\" + +QT += core gui widgets network svg + +unix:!macx { + QT += dbus +} + +CONFIG += c++11 link_pkgconfig + +#CONFIG += packaging # Enables "make install" for packaging paths + +TARGET = flameshot +TEMPLATE = app + +win32:RC_ICONS += img/app/flameshot.ico + +#release: DESTDIR = build/release +#debug: DESTDIR = build/debug + +#OBJECTS_DIR = $$DESTDIR/.obj +#MOC_DIR = $$DESTDIR/.moc +#RCC_DIR = $$DESTDIR/.qrc +#UI_DIR = $$DESTDIR/.ui + +TRANSLATIONS = translations/Internationalization_es.ts \ + translations/Internationalization_ca.ts \ + translations/Internationalization_ru.ts \ + translations/Internationalization_zh_CN.ts \ + translations/Internationalization_zh_TW.ts \ + translations/Internationalization_tr.ts \ + translations/Internationalization_ka.ts \ + translations/Internationalization_fr.ts \ + translations/Internationalization_pl.ts + +# Generate translations in build +TRANSLATIONS_FILES = + +qtPrepareTool(LRELEASE, lrelease) +for(tsfile, TRANSLATIONS) { + qmfile = $$shadowed($$tsfile) + qmfile ~= s,.ts$,.qm, + qmdir = $$dirname(qmfile) + !exists($$qmdir) { + mkpath($$qmdir)|error("Aborting.") + } + command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile + system($$command)|error("Failed to run: $$command") + TRANSLATIONS_FILES += $$qmfile +} + +DEFINES += QT_DEPRECATED_WARNINGS + +include(src/third-party/singleapplication/singleapplication.pri) +include(src/third-party/Qt-Color-Widgets//color_widgets.pri) + +DEFINES += QAPPLICATION_CLASS=QApplication + +SOURCES += src/main.cpp \ + src/widgets/capture/buttonhandler.cpp \ + src/widgets/infowindow.cpp \ + src/config/configwindow.cpp \ + src/widgets/capture/capturewidget.cpp \ + src/widgets/capture/colorpicker.cpp \ + src/config/buttonlistview.cpp \ + src/config/uicoloreditor.cpp \ + src/config/geneneralconf.cpp \ + src/core/controller.cpp \ + src/config/clickablelabel.cpp \ + src/config/filenameeditor.cpp \ + src/config/strftimechooserwidget.cpp \ + src/widgets/capture/capturebutton.cpp \ + src/tools/pencil/penciltool.cpp \ + src/tools/undo/undotool.cpp \ + src/tools/redo/redotool.cpp \ + src/tools/arrow/arrowtool.cpp \ + src/tools/circle/circletool.cpp \ + src/tools/copy/copytool.cpp \ + src/tools/exit/exittool.cpp \ + src/tools/imgur/imguruploadertool.cpp \ + src/tools/line/linetool.cpp \ + src/tools/marker/markertool.cpp \ + src/tools/move/movetool.cpp \ + src/tools/rectangle/rectangletool.cpp \ + src/tools/save/savetool.cpp \ + src/tools/selection/selectiontool.cpp \ + src/tools/sizeindicator/sizeindicatortool.cpp \ + src/tools/toolfactory.cpp \ + src/utils/filenamehandler.cpp \ + src/utils/screengrabber.cpp \ + src/utils/confighandler.cpp \ + src/utils/systemnotification.cpp \ + src/cli/commandlineparser.cpp \ + src/cli/commandoption.cpp \ + src/cli/commandargument.cpp \ + src/utils/screenshotsaver.cpp \ + src/tools/imgur/imguruploader.cpp \ + src/widgets/loadspinner.cpp \ + src/widgets/imagelabel.cpp \ + src/widgets/notificationwidget.cpp \ + src/widgets/capture/notifierbox.cpp \ + src/utils/desktopinfo.cpp \ + src/tools/launcher/applauncherwidget.cpp \ + src/utils/desktopfileparse.cpp \ + src/tools/launcher/launcheritemdelegate.cpp \ + src/tools/blur/blurtool.cpp \ + src/tools/pin/pintool.cpp \ + src/tools/launcher/terminallauncher.cpp \ + src/config/visualseditor.cpp \ + src/config/extendedslider.cpp \ + src/tools/launcher/openwithprogram.cpp \ + src/tools/launcher/applaunchertool.cpp \ + src/utils/pathinfo.cpp \ + src/utils/colorutils.cpp \ + src/tools/capturecontext.cpp \ + src/widgets/capture/modificationcommand.cpp \ + src/tools/abstractpathtool.cpp \ + src/tools/abstracttwopointtool.cpp \ + src/tools/abstractactiontool.cpp \ + src/utils/globalvalues.cpp \ + src/widgets/panel/utilitypanel.cpp \ + src/widgets/capture/hovereventfilter.cpp \ + src/widgets/capture/selectionwidget.cpp \ + src/tools/pin/pinwidget.cpp \ + src/tools/text/texttool.cpp \ + src/tools/text/textwidget.cpp \ + src/core/capturerequest.cpp \ + src/tools/text/textconfig.cpp \ + src/widgets/panel/colorpickerwidget.cpp + +HEADERS += src/widgets/capture/buttonhandler.h \ + src/widgets/infowindow.h \ + src/config/configwindow.h \ + src/widgets/capture/capturewidget.h \ + src/widgets/capture/colorpicker.h \ + src/config/buttonlistview.h \ + src/config/uicoloreditor.h \ + src/config/geneneralconf.h \ + src/config/clickablelabel.h \ + src/config/filenameeditor.h \ + src/utils/filenamehandler.h \ + src/config/strftimechooserwidget.h \ + src/utils/screengrabber.h \ + src/tools/capturetool.h \ + src/widgets/capture/capturebutton.h \ + src/tools/pencil/penciltool.h \ + src/tools/undo/undotool.h \ + src/tools/redo/redotool.h \ + src/tools/arrow/arrowtool.h \ + src/tools/circle/circletool.h \ + src/tools/copy/copytool.h \ + src/tools/exit/exittool.h \ + src/tools/imgur/imguruploadertool.h \ + src/tools/line/linetool.h \ + src/tools/marker/markertool.h \ + src/tools/move/movetool.h \ + src/tools/rectangle/rectangletool.h \ + src/tools/save/savetool.h \ + src/tools/selection/selectiontool.h \ + src/tools/sizeindicator/sizeindicatortool.h \ + src/tools/toolfactory.h \ + src/utils/confighandler.h \ + src/core/controller.h \ + src/utils/systemnotification.h \ + src/cli/commandlineparser.h \ + src/cli/commandoption.h \ + src/cli/commandargument.h \ + src/utils/screenshotsaver.h \ + src/tools/imgur/imguruploader.h \ + src/widgets/loadspinner.h \ + src/widgets/imagelabel.h \ + src/widgets/notificationwidget.h \ + src/widgets/capture/notifierbox.h \ + src/utils/desktopinfo.h \ + src/tools/launcher/applauncherwidget.h \ + src/utils/desktopfileparse.h \ + src/tools/launcher/launcheritemdelegate.h \ + src/tools/blur/blurtool.h \ + src/tools/pin/pintool.h \ + src/tools/launcher/terminallauncher.h \ + src/config/visualseditor.h \ + src/config/extendedslider.h \ + src/tools/launcher/openwithprogram.h \ + src/utils/pathinfo.h \ + src/tools/capturecontext.h \ + src/tools/launcher/applaunchertool.h \ + src/utils/globalvalues.h \ + src/utils/colorutils.h \ + src/widgets/capture/modificationcommand.h \ + src/tools/abstractpathtool.h \ + src/tools/abstracttwopointtool.h \ + src/tools/abstractactiontool.h \ + src/widgets/panel/utilitypanel.h \ + src/widgets/capture/hovereventfilter.h \ + src/widgets/capture/selectionwidget.h \ + src/tools/pin/pinwidget.h \ + src/tools/text/texttool.h \ + src/tools/text/textwidget.h \ + src/core/capturerequest.h \ + src/tools/text/textconfig.h \ + src/widgets/panel/colorpickerwidget.h + +unix:!macx { + SOURCES += src/core/flameshotdbusadapter.cpp \ + src/utils/dbusutils.cpp + + HEADERS += src/core/flameshotdbusadapter.h \ + src/utils/dbusutils.h +} + +win32 { + SOURCES += src/core/globalshortcutfilter.cpp + + HEADERS += src/core/globalshortcutfilter.h +} + +RESOURCES += \ + graphics.qrc + +# installs +unix:!macx { + isEmpty(PREFIX) { + packaging { + PREFIX = /usr + } else { + PREFIX = /usr/local + } + } + + DEFINES += APP_PREFIX=\\\"$$PREFIX\\\" + + target.path = $${PREFIX}/bin/ + + qmfile.path = $${PREFIX}/share/flameshot/translations/ + qmfile.files = $${TRANSLATIONS_FILES} + + dbus.path = $${PREFIX}/share/dbus-1/interfaces/ + dbus.files = dbus/org.dharkael.Flameshot.xml + + icon.path = $${PREFIX}/share/icons/hicolor/ + icon.files = img/hicolor/* + + completion.path = $${PREFIX}/share/bash-completion/completions/ + completion.files = docs/bash-completion/flameshot + + appdata.path = $${PREFIX}/share/metainfo/ + appdata.files = docs/appdata/flameshot.appdata.xml + + desktopentry.path = $${PREFIX}/share/applications + desktopentry.files = docs/desktopEntry/package/flameshot.desktop + + servicedbus.path = $${PREFIX}/share/dbus-1/services/ + + packaging { + servicedbus.files = dbus/package/org.dharkael.Flameshot.service + } else { + servicedbus.files = dbus/make/org.dharkael.Flameshot.service + } + + INSTALLS += target \ + icon \ + desktopentry \ + qmfile \ + servicedbus \ + dbus \ + completion \ + appdata +} + +# Imgur API data +include(src/imgur.pri) diff --git a/flameshot-0.6.0/flameshotgui.sh b/flameshot-0.6.0/flameshotgui.sh new file mode 100644 index 0000000000000000000000000000000000000000..50b1a9db98f51b33015bf76461c67719737172cb --- /dev/null +++ b/flameshot-0.6.0/flameshotgui.sh @@ -0,0 +1,4 @@ +#!/usr/bin/sh +flameshot & +sleep 0.5s +flameshot gui diff --git a/flameshot-0.6.0/graphics.qrc b/flameshot-0.6.0/graphics.qrc new file mode 100644 index 0000000000000000000000000000000000000000..87a2a7909fd676d8875bf862049e5c0d32389177 --- /dev/null +++ b/flameshot-0.6.0/graphics.qrc @@ -0,0 +1,68 @@ + + + img/app/flameshot.svg + img/app/flameshot.png + img/material/black/undo-variant.svg + img/material/black/text.svg + img/material/black/square.svg + img/material/black/square-outline.svg + img/material/black/size_indicator.svg + img/material/black/redo-variant.svg + img/material/black/pin.svg + img/material/black/pencil.svg + img/material/black/open_with.svg + img/material/black/name_edition.svg + img/material/black/mouse.svg + img/material/black/mouse-off.svg + img/material/black/marker.svg + img/material/black/line.svg + img/material/black/graphics.svg + img/material/black/format-text.svg + img/material/black/format_underlined.svg + img/material/black/format_strikethrough.svg + img/material/black/format_italic.svg + img/material/black/format_bold.svg + img/material/black/exit-to-app.svg + img/material/black/cursor-move.svg + img/material/black/content-save.svg + img/material/black/content-copy.svg + img/material/black/config.svg + img/material/black/colorize.svg + img/material/black/cloud-upload.svg + img/material/black/close.svg + img/material/black/circle-outline.svg + img/material/black/blur.svg + img/material/black/arrow-bottom-left.svg + img/material/white/undo-variant.svg + img/material/white/text.svg + img/material/white/square.svg + img/material/white/square-outline.svg + img/material/white/size_indicator.svg + img/material/white/redo-variant.svg + img/material/white/pin.svg + img/material/white/pencil.svg + img/material/white/open_with.svg + img/material/white/name_edition.svg + img/material/white/mouse.svg + img/material/white/mouse-off.svg + img/material/white/marker.svg + img/material/white/line.svg + img/material/white/graphics.svg + img/material/white/format-text.svg + img/material/white/format_underlined.svg + img/material/white/format_strikethrough.svg + img/material/white/format_italic.svg + img/material/white/format_bold.svg + img/material/white/exit-to-app.svg + img/material/white/cursor-move.svg + img/material/white/content-save.svg + img/material/white/content-copy.svg + img/material/white/config.svg + img/material/white/colorize.svg + img/material/white/cloud-upload.svg + img/material/white/close.svg + img/material/white/circle-outline.svg + img/material/white/blur.svg + img/material/white/arrow-bottom-left.svg + + diff --git a/flameshot-0.6.0/img/app/flameshot.ico b/flameshot-0.6.0/img/app/flameshot.ico new file mode 100644 index 0000000000000000000000000000000000000000..6d3a1d9337961e8d2a452f45dda077816c13c18a Binary files /dev/null and b/flameshot-0.6.0/img/app/flameshot.ico differ diff --git a/flameshot-0.6.0/img/app/flameshot.png b/flameshot-0.6.0/img/app/flameshot.png new file mode 100644 index 0000000000000000000000000000000000000000..483b595cb19f9df31c1be62332a54e48725f8149 Binary files /dev/null and b/flameshot-0.6.0/img/app/flameshot.png differ diff --git a/flameshot-0.6.0/img/app/flameshot.svg b/flameshot-0.6.0/img/app/flameshot.svg new file mode 100644 index 0000000000000000000000000000000000000000..8138a773cdc460a5981b5f51f0f9585386232c0a --- /dev/null +++ b/flameshot-0.6.0/img/app/flameshot.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/flameshot-0.6.0/img/app/flameshotLogoLicense.txt b/flameshot-0.6.0/img/app/flameshotLogoLicense.txt new file mode 100644 index 0000000000000000000000000000000000000000..027fc7870a7352de517f086e678137005ab01bb5 --- /dev/null +++ b/flameshot-0.6.0/img/app/flameshotLogoLicense.txt @@ -0,0 +1,253 @@ +Free Art License 1.3 + + +[ Copyleft Attitude ] + +Free Art License 1.3 (FAL 1.3) + +Preamble + +The Free Art License grants the right to freely copy, distribute, and +transform creative works without infringing the author's rights. + +The Free Art License recognizes and protects these rights. Their +implementation has been reformulated in order to allow everyone to use +creations of the human mind in a creative manner, regardless of their +types and ways of expression. + +While the public's access to creations of the human mind usually is +restricted by the implementation of copyright law, it is favoured by +the Free Art License. This license intends to allow the use of a +work’s resources; to establish new conditions for creating in order to +increase creation opportunities. The Free Art License grants the right +to use a work, and acknowledges the right holder’s and the user’s +rights and responsibility. + +The invention and development of digital technologies, Internet and +Free Software have changed creation methods: creations of the human +mind can obviously be distributed, exchanged, and transformed. They +allow to produce common works to which everyone can contribute to the +benefit of all. + +The main rationale for this Free Art License is to promote and protect +these creations of the human mind according to the principles of +copyleft: freedom to use, copy, distribute, transform, and prohibition +of exclusive appropriation. + +Definitions + +“work” either means the initial work, the subsequent works or the +common work as defined hereafter: + +“common work” means a work composed of the initial work and all +subsequent contributions to it (originals and copies). The initial +author is the one who, by choosing this license, defines the +conditions under which contributions are made. + +“Initial work” means the work created by the initiator of the common +work (as defined above), the copies of which can be modified by +whoever wants to + +“Subsequent works” means the contributions made by authors who +participate in the evolution of the common work by exercising the +rights to reproduce, distribute, and modify that are granted by the +license. + +“Originals” (sources or resources of the work) means all copies of +either the initial work or any subsequent work mentioning a date and +used by their author(s) as references for any subsequent updates, +interpretations, copies or reproductions. + +“Copy” means any reproduction of an original as defined by this +license. + +1. OBJECT + +The aim of this license is to define the conditions under which one +can use this work freely. + +2. SCOPE + +This work is subject to copyright law. Through this license its author +specifies the extent to which you can copy, distribute, and modify it. + +2.1 FREEDOM TO COPY (OR TO MAKE REPRODUCTIONS) + +You have the right to copy this work for yourself, your friends or any +other person, whatever the technique used. + +2.2 FREEDOM TO DISTRIBUTE, TO PERFORM IN PUBLIC + +You have the right to distribute copies of this work; whether modified +or not, whatever the medium and the place, with or without any charge, +provided that you: attach this license without any modification to the +copies of this work or indicate precisely where the license can be +found, specify to the recipient the names of the author(s) of the +originals, including yours if you have modified the work, specify to +the recipient where to access the originals (either initial or +subsequent). + +The authors of the originals may, if they wish to, give you the right +to distribute the originals under the same conditions as the copies. + +2.3 FREEDOM TO MODIFY + +You have the right to modify copies of the originals (whether initial +or subsequent) provided you comply with the following conditions: all +conditions in article 2.2 above, if you distribute modified copies; +indicate that the work has been modified and, if it is possible, what +kind of modifications have been made; distribute the subsequent work +under the same license or any compatible license. + +The author(s) of the original work may give you the right to modify it +under the same conditions as the copies. + +3. RELATED RIGHTS + +Activities giving rise to author’s rights and related rights shall not +challenge the rights granted by this license. + +For example, this is the reason why performances must be subject to +the same license or a compatible license. Similarly, integrating the +work in a database, a compilation or an anthology shall not prevent +anyone from using the work under the same conditions as those defined +in this license. + +4. INCORPORATION OF THE WORK + +Incorporating this work into a larger work that is not subject to the +Free Art License shall not challenge the rights granted by this +license. + +If the work can no longer be accessed apart from the larger work in +which it is incorporated, then incorporation shall only be allowed +under the condition that the larger work is subject either to the Free +Art License or a compatible license. + +5. COMPATIBILITY + +A license is compatible with the Free Art License provided: it gives +the right to copy, distribute, and modify copies of the work including +for commercial purposes and without any other restrictions than those +required by the respect of the other compatibility criteria; it +ensures proper attribution of the work to its authors and access to +previous versions of the work when possible; it recognizes the Free +Art License as compatible (reciprocity); it requires that changes made +to the work be subject to the same license or to a license which also +meets these compatibility criteria. + +6. YOUR INTELLECTUAL RIGHTS + +This license does not aim at denying your author's rights in your +contribution or any related right. By choosing to contribute to the +development of this common work, you only agree to grant others the +same rights with regard to your contribution as those you were granted +by this license. Conferring these rights does not mean you have to +give up your intellectual rights. + +7. YOUR RESPONSIBILITIES + +The freedom to use the work as defined by the Free Art License (right +to copy, distribute, modify) implies that everyone is responsible for +their own actions. + +8. DURATION OF THE LICENSE + +This license takes effect as of your acceptance of its terms. The act +of copying, distributing, or modifying the work constitutes a tacit +agreement. This license will remain in effect for as long as the +copyright which is attached to the work. If you do not respect the +terms of this license, you automatically lose the rights that it +confers. + +If the legal status or legislation to which you are subject makes it +impossible for you to respect the terms of this license, you may not +make use of the rights which it confers. + +9. VARIOUS VERSIONS OF THE LICENSE + +This license may undergo periodic modifications to incorporate +improvements by its authors (instigators of the “Copyleft Attitude” +movement) by way of new, numbered versions. + +You will always have the choice of accepting the terms contained in +the version under which the copy of the work was distributed to you, +or alternatively, to use the provisions of one of the subsequent +versions. + +10. SUB-LICENSING + +Sub-licenses are not authorized by this license. Any person wishing to +make use of the rights that it confers will be directly bound to the +authors of the common work. + +11. LEGAL FRAMEWORK + +This license is written with respect to both French law and the Berne +Convention for the Protection of Literary and Artistic Works. + +USER GUIDE + +- How to use the Free Art License? + +To benefit from the Free Art License, you only need to mention the +following elements on your work: + + [Name of the author, title, date of the work. When applicable, names + of authors of the common work and, if possible, where to find the + originals]. + +Copyleft: This is a free work, you can copy, distribute, and modify it +under the terms of the Free Art License +http://artlibre.org/licence/lal/en/ + +- Why to use the Free Art License? + + 1.To give the greatest number of people access to your work. + + 2.To allow it to be distributed freely. + + 3.To allow it to evolve by allowing its copy, distribution, and + transformation by others. + + 4.So that you benefit from the resources of a work when it is under + the Free Art License: to be able to copy, distribute or transform + it freely. + + 5.But also, because the Free Art License offers a legal framework to + disallow any misappropriation. It is forbidden to take hold of + your work and bypass the creative process for one's exclusive + possession. + + +- When to use the Free Art License? + +Any time you want to benefit and make others benefit from the right to +copy, distribute and transform creative works without any exclusive +appropriation, you should use the Free Art License. You can for +example use it for scientific, artistic or educational projects. + +- What kinds of works can be subject to the Free Art License? + +The Free Art License can be applied to digital as well as physical +works. You can choose to apply the Free Art License on any text, +picture, sound, gesture, or whatever sort of stuff on which you have +sufficient author's rights. + +- Historical background of this license: + +It is the result of observing, using and creating digital +technologies, free software, the Internet and art. It arose from the +“Copyleft Attitude” meetings which took place in Paris in 2000. For +the first time, these meetings brought together members of the Free +Software community, artists, and members of the art world. The goal +was to adapt the principles of Copyleft and free software to all sorts +of creations. http://www.artlibre.org + +Copyleft Attitude, 2007. + +You can make reproductions and distribute this license verbatim +(without any changes). + + Translation : Jonathan Clarke, Benjamin Jean, Griselda Jung, Fanny + Mourguet, Antoine Pitrou. Thanks to framalang.org diff --git a/flameshot-0.6.0/img/hicolor/128x128/apps/flameshot.png b/flameshot-0.6.0/img/hicolor/128x128/apps/flameshot.png new file mode 100644 index 0000000000000000000000000000000000000000..483b595cb19f9df31c1be62332a54e48725f8149 Binary files /dev/null and b/flameshot-0.6.0/img/hicolor/128x128/apps/flameshot.png differ diff --git a/flameshot-0.6.0/img/hicolor/48x48/apps/flameshot.png b/flameshot-0.6.0/img/hicolor/48x48/apps/flameshot.png new file mode 100644 index 0000000000000000000000000000000000000000..214b43753785b417e2b8f5340f5c3ca0318dc514 Binary files /dev/null and b/flameshot-0.6.0/img/hicolor/48x48/apps/flameshot.png differ diff --git a/flameshot-0.6.0/img/hicolor/scalable/apps/flameshot.svg b/flameshot-0.6.0/img/hicolor/scalable/apps/flameshot.svg new file mode 100644 index 0000000000000000000000000000000000000000..8138a773cdc460a5981b5f51f0f9585386232c0a --- /dev/null +++ b/flameshot-0.6.0/img/hicolor/scalable/apps/flameshot.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/flameshot-0.6.0/img/material/LICENSE.txt b/flameshot-0.6.0/img/material/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/flameshot-0.6.0/img/material/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/flameshot-0.6.0/img/material/README.md b/flameshot-0.6.0/img/material/README.md new file mode 100644 index 0000000000000000000000000000000000000000..53bed8720787a1161616e2f686b8299195cafd28 --- /dev/null +++ b/flameshot-0.6.0/img/material/README.md @@ -0,0 +1 @@ +Google Material Design Icons are licensed under Apache License 2.0 (see LICENSE.txt) diff --git a/flameshot-0.6.0/img/material/black/arrow-bottom-left.png b/flameshot-0.6.0/img/material/black/arrow-bottom-left.png new file mode 100644 index 0000000000000000000000000000000000000000..b05d6728d4e0ef5ea2236520df7b0637ce00a122 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/arrow-bottom-left.png differ diff --git a/flameshot-0.6.0/img/material/black/arrow-bottom-left.svg b/flameshot-0.6.0/img/material/black/arrow-bottom-left.svg new file mode 100644 index 0000000000000000000000000000000000000000..048a0d33d9ad856429b493780bbbd9ad491c04dd --- /dev/null +++ b/flameshot-0.6.0/img/material/black/arrow-bottom-left.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/blur.png b/flameshot-0.6.0/img/material/black/blur.png new file mode 100644 index 0000000000000000000000000000000000000000..19f95e3f408a2dea30f2db55a9a1b21a3d40b11b Binary files /dev/null and b/flameshot-0.6.0/img/material/black/blur.png differ diff --git a/flameshot-0.6.0/img/material/black/blur.svg b/flameshot-0.6.0/img/material/black/blur.svg new file mode 100644 index 0000000000000000000000000000000000000000..3cb0b2deca01d12f91b5385545e0ee5e54c26949 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/blur.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/circle-outline.png b/flameshot-0.6.0/img/material/black/circle-outline.png new file mode 100644 index 0000000000000000000000000000000000000000..c68e541ea75d31e92aa7e6839887830cf6db5589 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/circle-outline.png differ diff --git a/flameshot-0.6.0/img/material/black/circle-outline.svg b/flameshot-0.6.0/img/material/black/circle-outline.svg new file mode 100644 index 0000000000000000000000000000000000000000..01ff3ee520c5edf404f76a95b688682b7cc59926 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/circle-outline.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/close.png b/flameshot-0.6.0/img/material/black/close.png new file mode 100644 index 0000000000000000000000000000000000000000..e43ce49d89c20a69367c76477fc30d72e64da878 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/close.png differ diff --git a/flameshot-0.6.0/img/material/black/close.svg b/flameshot-0.6.0/img/material/black/close.svg new file mode 100644 index 0000000000000000000000000000000000000000..4049435ea75d4e385e9b8e003811de9f37db9d76 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/cloud-upload.png b/flameshot-0.6.0/img/material/black/cloud-upload.png new file mode 100644 index 0000000000000000000000000000000000000000..543233e28a1d0c7f729fae73b51d85b3f8de4411 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/cloud-upload.png differ diff --git a/flameshot-0.6.0/img/material/black/cloud-upload.svg b/flameshot-0.6.0/img/material/black/cloud-upload.svg new file mode 100644 index 0000000000000000000000000000000000000000..fef9f541dff31a43fdfc5ca055a672153450a325 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/cloud-upload.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/colorize.png b/flameshot-0.6.0/img/material/black/colorize.png new file mode 100644 index 0000000000000000000000000000000000000000..09678878e3a5e6731d3e020da14fd9680d456d01 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/colorize.png differ diff --git a/flameshot-0.6.0/img/material/black/colorize.svg b/flameshot-0.6.0/img/material/black/colorize.svg new file mode 100644 index 0000000000000000000000000000000000000000..dd91c4706229611ae75ee255efb666eea9b9df4b --- /dev/null +++ b/flameshot-0.6.0/img/material/black/colorize.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/config.png b/flameshot-0.6.0/img/material/black/config.png new file mode 100644 index 0000000000000000000000000000000000000000..6944e593a0c2c3028ed95046f0c6455c18b64a30 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/config.png differ diff --git a/flameshot-0.6.0/img/material/black/config.svg b/flameshot-0.6.0/img/material/black/config.svg new file mode 100644 index 0000000000000000000000000000000000000000..03eda2dc86a2e086b5e09a71ecdc544f5f822f42 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/config.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/content-copy.png b/flameshot-0.6.0/img/material/black/content-copy.png new file mode 100644 index 0000000000000000000000000000000000000000..ff73761d5b52c16978a1c9cbe39b3e2e6446925d Binary files /dev/null and b/flameshot-0.6.0/img/material/black/content-copy.png differ diff --git a/flameshot-0.6.0/img/material/black/content-copy.svg b/flameshot-0.6.0/img/material/black/content-copy.svg new file mode 100644 index 0000000000000000000000000000000000000000..b3238bf5c29d38af473cd61c148be450e96e8d50 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/content-copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/content-save.png b/flameshot-0.6.0/img/material/black/content-save.png new file mode 100644 index 0000000000000000000000000000000000000000..4cc7e013e56f6cf4e214e8b04e5da91b4bc998a3 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/content-save.png differ diff --git a/flameshot-0.6.0/img/material/black/content-save.svg b/flameshot-0.6.0/img/material/black/content-save.svg new file mode 100644 index 0000000000000000000000000000000000000000..37bc9d567e775857e50f13648d8cfa666c15b8c5 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/content-save.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/cursor-move.png b/flameshot-0.6.0/img/material/black/cursor-move.png new file mode 100644 index 0000000000000000000000000000000000000000..2b6eae8133560153da9bfccf4829b95a63025406 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/cursor-move.png differ diff --git a/flameshot-0.6.0/img/material/black/cursor-move.svg b/flameshot-0.6.0/img/material/black/cursor-move.svg new file mode 100644 index 0000000000000000000000000000000000000000..54bfbfbe611707a0fac5b93bb26f165b7bcda9ce --- /dev/null +++ b/flameshot-0.6.0/img/material/black/cursor-move.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/exit-to-app.png b/flameshot-0.6.0/img/material/black/exit-to-app.png new file mode 100644 index 0000000000000000000000000000000000000000..8af547b1de725c0b132c4870049e76f8c3a5c02e Binary files /dev/null and b/flameshot-0.6.0/img/material/black/exit-to-app.png differ diff --git a/flameshot-0.6.0/img/material/black/exit-to-app.svg b/flameshot-0.6.0/img/material/black/exit-to-app.svg new file mode 100644 index 0000000000000000000000000000000000000000..d2645cdc0185017e8f2c45874edbed8a83a31923 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/exit-to-app.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/format-text.svg b/flameshot-0.6.0/img/material/black/format-text.svg new file mode 100644 index 0000000000000000000000000000000000000000..1fa2da3a8e15cf8bae7a85670ab15949b248948f --- /dev/null +++ b/flameshot-0.6.0/img/material/black/format-text.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/format_bold.png b/flameshot-0.6.0/img/material/black/format_bold.png new file mode 100644 index 0000000000000000000000000000000000000000..540150d8a43cd53ad946f3375473d9c8d0d3e59a Binary files /dev/null and b/flameshot-0.6.0/img/material/black/format_bold.png differ diff --git a/flameshot-0.6.0/img/material/black/format_bold.svg b/flameshot-0.6.0/img/material/black/format_bold.svg new file mode 100644 index 0000000000000000000000000000000000000000..dd9a0db2b4318b398271bb0ac81ee09e0874dc49 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/format_bold.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/format_italic.png b/flameshot-0.6.0/img/material/black/format_italic.png new file mode 100644 index 0000000000000000000000000000000000000000..394aaf632c87f812dd62f765ac80c8f426e37d7b Binary files /dev/null and b/flameshot-0.6.0/img/material/black/format_italic.png differ diff --git a/flameshot-0.6.0/img/material/black/format_italic.svg b/flameshot-0.6.0/img/material/black/format_italic.svg new file mode 100644 index 0000000000000000000000000000000000000000..fe9670208993407b3304b44a1ff5f286555f50d3 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/format_italic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/format_strikethrough.png b/flameshot-0.6.0/img/material/black/format_strikethrough.png new file mode 100644 index 0000000000000000000000000000000000000000..6c3c226e12cd7a3c99bec9afa05324ed67b63741 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/format_strikethrough.png differ diff --git a/flameshot-0.6.0/img/material/black/format_strikethrough.svg b/flameshot-0.6.0/img/material/black/format_strikethrough.svg new file mode 100644 index 0000000000000000000000000000000000000000..5f9c953e53f48ced79705b5c21542e2276ee4266 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/format_strikethrough.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/format_underlined.png b/flameshot-0.6.0/img/material/black/format_underlined.png new file mode 100644 index 0000000000000000000000000000000000000000..5a0da6c63d1b9f205a4b01ede6b186b651549e74 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/format_underlined.png differ diff --git a/flameshot-0.6.0/img/material/black/format_underlined.svg b/flameshot-0.6.0/img/material/black/format_underlined.svg new file mode 100644 index 0000000000000000000000000000000000000000..4e05fc58d1b9498a011efb5be394e9bcc291e141 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/format_underlined.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/graphics.png b/flameshot-0.6.0/img/material/black/graphics.png new file mode 100644 index 0000000000000000000000000000000000000000..cbcf5275b30145633e40b7ef6623f1d2b7ad8866 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/graphics.png differ diff --git a/flameshot-0.6.0/img/material/black/graphics.svg b/flameshot-0.6.0/img/material/black/graphics.svg new file mode 100644 index 0000000000000000000000000000000000000000..f67a8333d8461807c7105015328fe8ca1f8765a8 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/graphics.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flameshot-0.6.0/img/material/black/line.png b/flameshot-0.6.0/img/material/black/line.png new file mode 100644 index 0000000000000000000000000000000000000000..3cf3e6fd6c2309b6cf6fdaea6a2a4b5cb04c26e4 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/line.png differ diff --git a/flameshot-0.6.0/img/material/black/line.svg b/flameshot-0.6.0/img/material/black/line.svg new file mode 100644 index 0000000000000000000000000000000000000000..c65c1d59319e37120ad4ecf31629da46d3781fef --- /dev/null +++ b/flameshot-0.6.0/img/material/black/line.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/marker.png b/flameshot-0.6.0/img/material/black/marker.png new file mode 100644 index 0000000000000000000000000000000000000000..0718e76748f07a7895eccdd52e5209a6c1a2084f Binary files /dev/null and b/flameshot-0.6.0/img/material/black/marker.png differ diff --git a/flameshot-0.6.0/img/material/black/marker.svg b/flameshot-0.6.0/img/material/black/marker.svg new file mode 100644 index 0000000000000000000000000000000000000000..ab143f0e032ca883ef9f9789d933c9b6e69611ea --- /dev/null +++ b/flameshot-0.6.0/img/material/black/marker.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/mouse-off.svg b/flameshot-0.6.0/img/material/black/mouse-off.svg new file mode 100644 index 0000000000000000000000000000000000000000..5b85392211ae9f5675aa5e6b281a95e2eb1c1b97 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/mouse-off.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/mouse.svg b/flameshot-0.6.0/img/material/black/mouse.svg new file mode 100644 index 0000000000000000000000000000000000000000..1605c8c548921c756f1a28eea155b2fd10318cfc --- /dev/null +++ b/flameshot-0.6.0/img/material/black/mouse.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/name_edition.png b/flameshot-0.6.0/img/material/black/name_edition.png new file mode 100644 index 0000000000000000000000000000000000000000..b280100992e7ebf13d9df964d48ca094ccc22c8d Binary files /dev/null and b/flameshot-0.6.0/img/material/black/name_edition.png differ diff --git a/flameshot-0.6.0/img/material/black/name_edition.svg b/flameshot-0.6.0/img/material/black/name_edition.svg new file mode 100644 index 0000000000000000000000000000000000000000..6eb207fc5e8627ef61a6f25b6bd30ca684d91120 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/name_edition.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/open_with.png b/flameshot-0.6.0/img/material/black/open_with.png new file mode 100644 index 0000000000000000000000000000000000000000..2b4e3c6c4106bcc306d39d2113777ec42b87bb1f Binary files /dev/null and b/flameshot-0.6.0/img/material/black/open_with.png differ diff --git a/flameshot-0.6.0/img/material/black/open_with.svg b/flameshot-0.6.0/img/material/black/open_with.svg new file mode 100644 index 0000000000000000000000000000000000000000..944ea1b76bbbaed286e36334ac6914eb45070561 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/open_with.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/pencil.png b/flameshot-0.6.0/img/material/black/pencil.png new file mode 100644 index 0000000000000000000000000000000000000000..24c2e17a1be884181350f04411f8d5f69c8bd8dd Binary files /dev/null and b/flameshot-0.6.0/img/material/black/pencil.png differ diff --git a/flameshot-0.6.0/img/material/black/pencil.svg b/flameshot-0.6.0/img/material/black/pencil.svg new file mode 100644 index 0000000000000000000000000000000000000000..30320d29242ea96b4d6f40accc543facc313ba10 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/pencil.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/pin.png b/flameshot-0.6.0/img/material/black/pin.png new file mode 100644 index 0000000000000000000000000000000000000000..7a3eee8827387b38699e9f45d23b51cd35e846dd Binary files /dev/null and b/flameshot-0.6.0/img/material/black/pin.png differ diff --git a/flameshot-0.6.0/img/material/black/pin.svg b/flameshot-0.6.0/img/material/black/pin.svg new file mode 100644 index 0000000000000000000000000000000000000000..01332557df56b6028570be1e336dece4a11977ad --- /dev/null +++ b/flameshot-0.6.0/img/material/black/pin.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/redo-variant.png b/flameshot-0.6.0/img/material/black/redo-variant.png new file mode 100644 index 0000000000000000000000000000000000000000..872869d12fe4c8a2939285dc8087c08802cb0fde Binary files /dev/null and b/flameshot-0.6.0/img/material/black/redo-variant.png differ diff --git a/flameshot-0.6.0/img/material/black/redo-variant.svg b/flameshot-0.6.0/img/material/black/redo-variant.svg new file mode 100644 index 0000000000000000000000000000000000000000..ba63f09b8e5def40b8313c307607c5e405d15de7 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/redo-variant.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/size_indicator.png b/flameshot-0.6.0/img/material/black/size_indicator.png new file mode 100644 index 0000000000000000000000000000000000000000..6146dbee2d5f2a8290d218e8e199522c487c05c5 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/size_indicator.png differ diff --git a/flameshot-0.6.0/img/material/black/size_indicator.svg b/flameshot-0.6.0/img/material/black/size_indicator.svg new file mode 100644 index 0000000000000000000000000000000000000000..2c6132baa9023431fadd7f865d1f1bb0db81447a --- /dev/null +++ b/flameshot-0.6.0/img/material/black/size_indicator.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/square-outline.png b/flameshot-0.6.0/img/material/black/square-outline.png new file mode 100644 index 0000000000000000000000000000000000000000..e4c5d03cc2116b44a27abd60d8a69252c6e85baa Binary files /dev/null and b/flameshot-0.6.0/img/material/black/square-outline.png differ diff --git a/flameshot-0.6.0/img/material/black/square-outline.svg b/flameshot-0.6.0/img/material/black/square-outline.svg new file mode 100644 index 0000000000000000000000000000000000000000..63fbf2eab80cc600eb0ccf481938f21873e1c550 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/square-outline.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/square.png b/flameshot-0.6.0/img/material/black/square.png new file mode 100644 index 0000000000000000000000000000000000000000..e04961b0e9f5a0e8a4529243097151852232cc64 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/square.png differ diff --git a/flameshot-0.6.0/img/material/black/square.svg b/flameshot-0.6.0/img/material/black/square.svg new file mode 100644 index 0000000000000000000000000000000000000000..31b8298a726baf993e35f2c48747d6364c576dd4 --- /dev/null +++ b/flameshot-0.6.0/img/material/black/square.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/black/text.png b/flameshot-0.6.0/img/material/black/text.png new file mode 100644 index 0000000000000000000000000000000000000000..5e137e0fef20f32a27c957d6cb321916c8e0ab81 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/text.png differ diff --git a/flameshot-0.6.0/img/material/black/text.svg b/flameshot-0.6.0/img/material/black/text.svg new file mode 100644 index 0000000000000000000000000000000000000000..19024ee29bef95131e2bf230845ddff0babd247c --- /dev/null +++ b/flameshot-0.6.0/img/material/black/text.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/black/undo-variant.png b/flameshot-0.6.0/img/material/black/undo-variant.png new file mode 100644 index 0000000000000000000000000000000000000000..1b2e075c99ef51af5df3b5682b0b3e8ca671ec95 Binary files /dev/null and b/flameshot-0.6.0/img/material/black/undo-variant.png differ diff --git a/flameshot-0.6.0/img/material/black/undo-variant.svg b/flameshot-0.6.0/img/material/black/undo-variant.svg new file mode 100644 index 0000000000000000000000000000000000000000..429653484dc040c408b4ee46d5628822542d3e9c --- /dev/null +++ b/flameshot-0.6.0/img/material/black/undo-variant.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/arrow-bottom-left.png b/flameshot-0.6.0/img/material/white/arrow-bottom-left.png new file mode 100644 index 0000000000000000000000000000000000000000..cd2e95ac550b0e4af392061e38b73816804a7fb1 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/arrow-bottom-left.png differ diff --git a/flameshot-0.6.0/img/material/white/arrow-bottom-left.svg b/flameshot-0.6.0/img/material/white/arrow-bottom-left.svg new file mode 100644 index 0000000000000000000000000000000000000000..a552ccc9ad7d76e9c3f414dd8caae8228514e7a4 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/arrow-bottom-left.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/blur.png b/flameshot-0.6.0/img/material/white/blur.png new file mode 100644 index 0000000000000000000000000000000000000000..07a55769b88b462b643171b6e264c460af757732 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/blur.png differ diff --git a/flameshot-0.6.0/img/material/white/blur.svg b/flameshot-0.6.0/img/material/white/blur.svg new file mode 100644 index 0000000000000000000000000000000000000000..1701d59c0e1dc4bd4cbf4d3d08c5a46d89599aeb --- /dev/null +++ b/flameshot-0.6.0/img/material/white/blur.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/circle-outline.png b/flameshot-0.6.0/img/material/white/circle-outline.png new file mode 100644 index 0000000000000000000000000000000000000000..bf09fa9aaf1a47a3aa07a61f662ffdb0cb7b3b51 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/circle-outline.png differ diff --git a/flameshot-0.6.0/img/material/white/circle-outline.svg b/flameshot-0.6.0/img/material/white/circle-outline.svg new file mode 100644 index 0000000000000000000000000000000000000000..9f40cdd4c71974a035d1c10760f747a29fed0709 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/circle-outline.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/close.png b/flameshot-0.6.0/img/material/white/close.png new file mode 100644 index 0000000000000000000000000000000000000000..a3321d412de7060b2464174a47ef28984502775d Binary files /dev/null and b/flameshot-0.6.0/img/material/white/close.png differ diff --git a/flameshot-0.6.0/img/material/white/close.svg b/flameshot-0.6.0/img/material/white/close.svg new file mode 100644 index 0000000000000000000000000000000000000000..748ac1e2d99d96749d369865d59499ec1a2a6451 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/cloud-upload.png b/flameshot-0.6.0/img/material/white/cloud-upload.png new file mode 100644 index 0000000000000000000000000000000000000000..7be1e5ede809419186e4157d1a74739ba096e743 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/cloud-upload.png differ diff --git a/flameshot-0.6.0/img/material/white/cloud-upload.svg b/flameshot-0.6.0/img/material/white/cloud-upload.svg new file mode 100644 index 0000000000000000000000000000000000000000..61c98dd330a74299a08bf93d7c9ba8d057a7cecd --- /dev/null +++ b/flameshot-0.6.0/img/material/white/cloud-upload.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/colorize.png b/flameshot-0.6.0/img/material/white/colorize.png new file mode 100644 index 0000000000000000000000000000000000000000..a3950f8d4139b5d6dfe9e15a753698cad0c3b460 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/colorize.png differ diff --git a/flameshot-0.6.0/img/material/white/colorize.svg b/flameshot-0.6.0/img/material/white/colorize.svg new file mode 100644 index 0000000000000000000000000000000000000000..352a9e4b67bbb13c5ad33a140b8e241747e6aa53 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/colorize.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/config.png b/flameshot-0.6.0/img/material/white/config.png new file mode 100644 index 0000000000000000000000000000000000000000..89f7f5926fb76b3754eb9ab32eff94b372dde59e Binary files /dev/null and b/flameshot-0.6.0/img/material/white/config.png differ diff --git a/flameshot-0.6.0/img/material/white/config.svg b/flameshot-0.6.0/img/material/white/config.svg new file mode 100644 index 0000000000000000000000000000000000000000..250c5f0dc76b9c7fca7009f5bfb2c1fdf50e7492 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/config.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/content-copy.png b/flameshot-0.6.0/img/material/white/content-copy.png new file mode 100644 index 0000000000000000000000000000000000000000..70056cc72ff69684dcd53bd3bd14adaff80255ab Binary files /dev/null and b/flameshot-0.6.0/img/material/white/content-copy.png differ diff --git a/flameshot-0.6.0/img/material/white/content-copy.svg b/flameshot-0.6.0/img/material/white/content-copy.svg new file mode 100644 index 0000000000000000000000000000000000000000..5df27a386d4cc6c7c9fb9a43c4818b5aec3f5c2b --- /dev/null +++ b/flameshot-0.6.0/img/material/white/content-copy.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/content-save.png b/flameshot-0.6.0/img/material/white/content-save.png new file mode 100644 index 0000000000000000000000000000000000000000..c869ef2e2e87e8abce76134123260c03bf5a997e Binary files /dev/null and b/flameshot-0.6.0/img/material/white/content-save.png differ diff --git a/flameshot-0.6.0/img/material/white/content-save.svg b/flameshot-0.6.0/img/material/white/content-save.svg new file mode 100644 index 0000000000000000000000000000000000000000..ce0dda6b0f0f01dc5c2e385b6eb6ded9ccc67827 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/content-save.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/cursor-move.png b/flameshot-0.6.0/img/material/white/cursor-move.png new file mode 100644 index 0000000000000000000000000000000000000000..6e4cb1d2434fa9753060a0e7b377cacf63102c96 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/cursor-move.png differ diff --git a/flameshot-0.6.0/img/material/white/cursor-move.svg b/flameshot-0.6.0/img/material/white/cursor-move.svg new file mode 100644 index 0000000000000000000000000000000000000000..ab78e45ad51e4420414dd8e20e634070552ed5e2 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/cursor-move.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/exit-to-app.png b/flameshot-0.6.0/img/material/white/exit-to-app.png new file mode 100644 index 0000000000000000000000000000000000000000..aac20dda39302fdf3fdd60197155cb56a003dd8e Binary files /dev/null and b/flameshot-0.6.0/img/material/white/exit-to-app.png differ diff --git a/flameshot-0.6.0/img/material/white/exit-to-app.svg b/flameshot-0.6.0/img/material/white/exit-to-app.svg new file mode 100644 index 0000000000000000000000000000000000000000..2b228a80de692cca41e03d8a41a28ce5d71dabdf --- /dev/null +++ b/flameshot-0.6.0/img/material/white/exit-to-app.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/format-text.png b/flameshot-0.6.0/img/material/white/format-text.png new file mode 100644 index 0000000000000000000000000000000000000000..7059fea63301e1b345f4db44a217138250240414 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/format-text.png differ diff --git a/flameshot-0.6.0/img/material/white/format-text.svg b/flameshot-0.6.0/img/material/white/format-text.svg new file mode 100644 index 0000000000000000000000000000000000000000..a1191b30432b254a82dde0a3a323a3d00e3f2524 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/format-text.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/format_bold.png b/flameshot-0.6.0/img/material/white/format_bold.png new file mode 100644 index 0000000000000000000000000000000000000000..e16a9f2e0245462ca8dad968b9b7c02e5cc122ca Binary files /dev/null and b/flameshot-0.6.0/img/material/white/format_bold.png differ diff --git a/flameshot-0.6.0/img/material/white/format_bold.svg b/flameshot-0.6.0/img/material/white/format_bold.svg new file mode 100644 index 0000000000000000000000000000000000000000..5381997a8808dd11e007666c559bd97d3c9268e5 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/format_bold.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/format_italic.png b/flameshot-0.6.0/img/material/white/format_italic.png new file mode 100644 index 0000000000000000000000000000000000000000..1a6422c91f95c0c2b0a507fe04df5c9fef186f05 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/format_italic.png differ diff --git a/flameshot-0.6.0/img/material/white/format_italic.svg b/flameshot-0.6.0/img/material/white/format_italic.svg new file mode 100644 index 0000000000000000000000000000000000000000..750f06fd7ed5201e8aaf71bc935ac702997205fc --- /dev/null +++ b/flameshot-0.6.0/img/material/white/format_italic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/format_strikethrough.png b/flameshot-0.6.0/img/material/white/format_strikethrough.png new file mode 100644 index 0000000000000000000000000000000000000000..c4f641c953fb94bf69dd4bf4c7d7f7cb4308e7eb Binary files /dev/null and b/flameshot-0.6.0/img/material/white/format_strikethrough.png differ diff --git a/flameshot-0.6.0/img/material/white/format_strikethrough.svg b/flameshot-0.6.0/img/material/white/format_strikethrough.svg new file mode 100644 index 0000000000000000000000000000000000000000..a760f702e6320e4861e78a1e2c9f1e2bb41a7255 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/format_strikethrough.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/format_underlined.png b/flameshot-0.6.0/img/material/white/format_underlined.png new file mode 100644 index 0000000000000000000000000000000000000000..ca485a68fee922d3063ca27fbc769f564e406d61 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/format_underlined.png differ diff --git a/flameshot-0.6.0/img/material/white/format_underlined.svg b/flameshot-0.6.0/img/material/white/format_underlined.svg new file mode 100644 index 0000000000000000000000000000000000000000..f8e0e1a6b075dc39f68344611effcaafce5c5acd --- /dev/null +++ b/flameshot-0.6.0/img/material/white/format_underlined.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/graphics.png b/flameshot-0.6.0/img/material/white/graphics.png new file mode 100644 index 0000000000000000000000000000000000000000..097fe658b2f8a5f48a8649355626cb97980323da Binary files /dev/null and b/flameshot-0.6.0/img/material/white/graphics.png differ diff --git a/flameshot-0.6.0/img/material/white/graphics.svg b/flameshot-0.6.0/img/material/white/graphics.svg new file mode 100644 index 0000000000000000000000000000000000000000..7d725e948e6e54474ad0c2b0612ef759c5d67531 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/graphics.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flameshot-0.6.0/img/material/white/line.png b/flameshot-0.6.0/img/material/white/line.png new file mode 100644 index 0000000000000000000000000000000000000000..670756ce6dd7f7b3a3ce1241758ef75c8e388bba Binary files /dev/null and b/flameshot-0.6.0/img/material/white/line.png differ diff --git a/flameshot-0.6.0/img/material/white/line.svg b/flameshot-0.6.0/img/material/white/line.svg new file mode 100644 index 0000000000000000000000000000000000000000..8d26f4030aa1e3d8f9a2ade207bb0f84122e02a1 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/line.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/marker.png b/flameshot-0.6.0/img/material/white/marker.png new file mode 100644 index 0000000000000000000000000000000000000000..f7dabbb6c6442b1751ccb2708bd7a9527b0bbcba Binary files /dev/null and b/flameshot-0.6.0/img/material/white/marker.png differ diff --git a/flameshot-0.6.0/img/material/white/marker.svg b/flameshot-0.6.0/img/material/white/marker.svg new file mode 100644 index 0000000000000000000000000000000000000000..1f6117e4eda4af5699b841dce435c7c1daf8fe70 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/marker.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/mouse-off.svg b/flameshot-0.6.0/img/material/white/mouse-off.svg new file mode 100644 index 0000000000000000000000000000000000000000..df6168bf3e1938694db7621dfd1efc31c687eca5 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/mouse-off.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/mouse.svg b/flameshot-0.6.0/img/material/white/mouse.svg new file mode 100644 index 0000000000000000000000000000000000000000..f559d1ea94245202b9c88e616ddc4cb6fe7059dc --- /dev/null +++ b/flameshot-0.6.0/img/material/white/mouse.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/name_edition.png b/flameshot-0.6.0/img/material/white/name_edition.png new file mode 100644 index 0000000000000000000000000000000000000000..03ce5a4fca5e1a6605079c7e2672d335b8517526 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/name_edition.png differ diff --git a/flameshot-0.6.0/img/material/white/name_edition.svg b/flameshot-0.6.0/img/material/white/name_edition.svg new file mode 100644 index 0000000000000000000000000000000000000000..f1573ed864614e647fc6994349e06fc7e9566bc4 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/name_edition.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/open_with.png b/flameshot-0.6.0/img/material/white/open_with.png new file mode 100644 index 0000000000000000000000000000000000000000..b4ad3d9d2b2d3b43c8b10aee75984bc6ef47e808 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/open_with.png differ diff --git a/flameshot-0.6.0/img/material/white/open_with.svg b/flameshot-0.6.0/img/material/white/open_with.svg new file mode 100644 index 0000000000000000000000000000000000000000..199322fd8dabd1a8d1c7cb580c2f7f842d99a2d8 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/open_with.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/flameshot-0.6.0/img/material/white/pencil.png b/flameshot-0.6.0/img/material/white/pencil.png new file mode 100644 index 0000000000000000000000000000000000000000..a6d56ba099c78c779eda1dd6c08fc7f1cf73f690 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/pencil.png differ diff --git a/flameshot-0.6.0/img/material/white/pencil.svg b/flameshot-0.6.0/img/material/white/pencil.svg new file mode 100644 index 0000000000000000000000000000000000000000..e53d8e6d17238a4a7c97d02b72bcd62aee9caf86 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/pencil.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/pin.png b/flameshot-0.6.0/img/material/white/pin.png new file mode 100644 index 0000000000000000000000000000000000000000..2b6e113bedb5d18360d9d64aaf51ad6c15d460c6 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/pin.png differ diff --git a/flameshot-0.6.0/img/material/white/pin.svg b/flameshot-0.6.0/img/material/white/pin.svg new file mode 100644 index 0000000000000000000000000000000000000000..628aa1afee9f8dee48a7ecda0fefd110ddc26401 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/pin.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/redo-variant.png b/flameshot-0.6.0/img/material/white/redo-variant.png new file mode 100644 index 0000000000000000000000000000000000000000..96833c125579453cde3a383791373f5969c0fdf0 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/redo-variant.png differ diff --git a/flameshot-0.6.0/img/material/white/redo-variant.svg b/flameshot-0.6.0/img/material/white/redo-variant.svg new file mode 100644 index 0000000000000000000000000000000000000000..a84484c450eac0277568b8e2b8d5093cf210a4a6 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/redo-variant.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/size_indicator.png b/flameshot-0.6.0/img/material/white/size_indicator.png new file mode 100644 index 0000000000000000000000000000000000000000..02785ff7aef31dd01298716096c6eb969f60c342 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/size_indicator.png differ diff --git a/flameshot-0.6.0/img/material/white/size_indicator.svg b/flameshot-0.6.0/img/material/white/size_indicator.svg new file mode 100644 index 0000000000000000000000000000000000000000..b526f998eff33d42d52b587c770cd099dbe51452 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/size_indicator.svg @@ -0,0 +1,4 @@ + + + + diff --git a/flameshot-0.6.0/img/material/white/square-outline.png b/flameshot-0.6.0/img/material/white/square-outline.png new file mode 100644 index 0000000000000000000000000000000000000000..a3a74de8961e68ffd79acfd8b40a69397490683d Binary files /dev/null and b/flameshot-0.6.0/img/material/white/square-outline.png differ diff --git a/flameshot-0.6.0/img/material/white/square-outline.svg b/flameshot-0.6.0/img/material/white/square-outline.svg new file mode 100644 index 0000000000000000000000000000000000000000..2c2f34b5b342df725b469aeb623487b4d7d5bda3 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/square-outline.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/square.png b/flameshot-0.6.0/img/material/white/square.png new file mode 100644 index 0000000000000000000000000000000000000000..82c2c18cbd705aa24fbe26ec75a98bcc9706f07d Binary files /dev/null and b/flameshot-0.6.0/img/material/white/square.png differ diff --git a/flameshot-0.6.0/img/material/white/square.svg b/flameshot-0.6.0/img/material/white/square.svg new file mode 100644 index 0000000000000000000000000000000000000000..a54a7d3da8459bfdbfc860b9318ff1cd18e01535 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/square.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/text.png b/flameshot-0.6.0/img/material/white/text.png new file mode 100644 index 0000000000000000000000000000000000000000..9288e78c899c1ecda4c504bfc5fddc6465e5dbf2 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/text.png differ diff --git a/flameshot-0.6.0/img/material/white/text.svg b/flameshot-0.6.0/img/material/white/text.svg new file mode 100644 index 0000000000000000000000000000000000000000..588ac514a1d46c8875184dd208c7fb2eacca8eb1 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/text.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/material/white/undo-variant.png b/flameshot-0.6.0/img/material/white/undo-variant.png new file mode 100644 index 0000000000000000000000000000000000000000..a0d8d77a8920f44a99ce8065ed613362e5923466 Binary files /dev/null and b/flameshot-0.6.0/img/material/white/undo-variant.png differ diff --git a/flameshot-0.6.0/img/material/white/undo-variant.svg b/flameshot-0.6.0/img/material/white/undo-variant.svg new file mode 100644 index 0000000000000000000000000000000000000000..425bb84d5ba692f2d24ecd9f5cfc593f3bfbe2c7 --- /dev/null +++ b/flameshot-0.6.0/img/material/white/undo-variant.svg @@ -0,0 +1,3 @@ + + + diff --git a/flameshot-0.6.0/img/preview/animatedUsage.gif b/flameshot-0.6.0/img/preview/animatedUsage.gif new file mode 100644 index 0000000000000000000000000000000000000000..a9b97955a183cc843457b56fb26f01b03f9e2a3c Binary files /dev/null and b/flameshot-0.6.0/img/preview/animatedUsage.gif differ diff --git a/flameshot-0.6.0/img/preview/usageStatic.png b/flameshot-0.6.0/img/preview/usageStatic.png new file mode 100644 index 0000000000000000000000000000000000000000..5639da0b2f9e4587324bc9cf23dc5a551865ff22 Binary files /dev/null and b/flameshot-0.6.0/img/preview/usageStatic.png differ diff --git a/flameshot-0.6.0/rpm/flameshot.spec b/flameshot-0.6.0/rpm/flameshot.spec new file mode 100644 index 0000000000000000000000000000000000000000..bdaa3e2cccd0d4f1d8a3eca7126bae7c59c51393 --- /dev/null +++ b/flameshot-0.6.0/rpm/flameshot.spec @@ -0,0 +1,73 @@ +Name: flameshot +Version: 0.5.0 +Release: 1%{?dist} +Summary: Powerful yet simple to use screenshot software +Summary(eu-ES): Potente pero simple de usar software de capturas + +%global sourcename flameshot + +Group: Application +License: GPLv3 +URL: https://github.com/lupoDharkael/%{sourcename} +Source0: https://github.com/lupoDharkael/%{sourcename}/archive/v%{version}.tar.gz + +#%%define _binaries_in_noarch_packages_terminate_build 0 +#BuildArch: noarch + +BuildRequires: gcc-c++ >= 4.9.2 +BuildRequires: pkgconfig(Qt5Core) >= 5.3.0 +BuildRequires: pkgconfig(Qt5Gui) >= 5.3.0 +BuildRequires: pkgconfig(Qt5Widgets) >= 5.3.0 +BuildRequires: qt5-qttools-devel +BuildRequires: qt5-linguist +BuildRequires: qt5-qtsvg-devel +BuildRequires: git + +Requires: qt5-qtbase >= 5.3.0 +Requires: qt5-qttools + +%description +Flameshot is a screenshot software, it's +powerful yet simple to use for GNU/Linux + +%prep +%setup -q -n v%{version} + +%build +#%%qmake_qt5 PREFIX=%{_prefix} +%qmake_qt5 CONFIG+=packaging CONFIG-=debug CONFIG+=release +make %{?_smp_mflags} + +%install +%make_install INSTALL_ROOT=%{buildroot} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc README.md +%license LICENSE +%{_bindir}/%{name} +%{_datadir}/dbus-1/interfaces/org.dharkael.Flameshot.xml +%{_datadir}/metainfo/flameshot.appdata.xml +%{_datadir}/dbus-1/services/org.dharkael.Flameshot.service +%{_datadir}/flameshot/translations/Internationalization_*.qm +%{_datadir}/applications/%{name}.desktop +%{_datadir}/bash-completion/completions/%{name} +%{_datadir}/icons/hicolor + +%changelog +* Tue Jan 09 2018 Zetao Yang - 0.5.0-1 +- Updated for flameshot 0.5.0 +- Catalan translation. +- Debian package configuration. +- Add --raw flag: prints the raw bytes of the png after the capture. +- Bash completion. +- Blur tool. +- Preview draw size on mouse pointer after tool selection. +- App Launcher tool: choose an app to open the capture. +- Travis integration +- Configuration import, export and reset. +- Experimental Wayland support (Plasma & Gnome) +* Tue Jan 09 2018 Zetao Yang - 0.5.0-1 +- Initial package diff --git a/flameshot-0.6.0/snap/gui/flameshot-init.desktop b/flameshot-0.6.0/snap/gui/flameshot-init.desktop new file mode 100644 index 0000000000000000000000000000000000000000..1f9af1f8f9be5b4e6b48d394953df63842ed2d9d --- /dev/null +++ b/flameshot-0.6.0/snap/gui/flameshot-init.desktop @@ -0,0 +1,18 @@ +[Desktop Entry] +Name=Launch Flameshot +Name[es]=Iniciar Flameshot +Name[tr]=Flameshot Başlat +Name[zh_CN]=启动 Flameshot +GenericName=Screenshot tool +GenericName[es]=Herramienta de captura de pantalla +GenericName[tr]=Ekran kayıt aracı +GenericName[zh_CN]=截图工具 +Comment=Powerful yet simple to use screenshot software. +Comment[es]=Potente pero simple de usar software de capturas. +Comment[zh_CN]=强大又易用的截图软件 +Keywords=flameshot;screenshot;capture; +Keywords[zh_CN]=flameshot;screenshot;capture;截图; +Exec=flameshot +Icon=${SNAP}/meta/gui/flameshot.png +Type=Application +Categories=Graphics; diff --git a/flameshot-0.6.0/snap/gui/flameshot.desktop b/flameshot-0.6.0/snap/gui/flameshot.desktop new file mode 100644 index 0000000000000000000000000000000000000000..7ba4d8d36bf92b19b5b640605ab930d3c215a7ee --- /dev/null +++ b/flameshot-0.6.0/snap/gui/flameshot.desktop @@ -0,0 +1,20 @@ +[Desktop Entry] +Name=Flameshot +Name[es]=Tomar captura gráfica +Name[zh_CN]=进行图形截图 +GenericName=Screen capture tool +GenericName[es]=Herramienta de captura de pantalla +GenericName[tr]=Ekran kayıt aracı +GenericName[zh_CN]=屏幕截图工具 +Comment=Powerful yet simple to use screenshot software. +Comment[es]=Potente pero simple de usar software de capturas. +Comment[tr]=Güçlü ve kullanımı kolay ekran kayıt yazılımı. +Comment[zh_CN]=强大又易用的截图软件 +Keywords=flameshot;screenshot;capture; +Keywords[zh_CN]=flameshot;screenshot;capture;截图; +Exec=flameshot gui +Icon=${SNAP}/meta/gui/flameshot.png +Terminal=false +Type=Application +Categories=Graphics; +StartupNotify=false diff --git a/flameshot-0.6.0/snap/gui/flameshot.png b/flameshot-0.6.0/snap/gui/flameshot.png new file mode 100644 index 0000000000000000000000000000000000000000..fbb35a27c9a2ac6f78280a491e73e1edccc4e9c3 Binary files /dev/null and b/flameshot-0.6.0/snap/gui/flameshot.png differ diff --git a/flameshot-0.6.0/snap/snapcraft.yaml b/flameshot-0.6.0/snap/snapcraft.yaml new file mode 100644 index 0000000000000000000000000000000000000000..454fd73f024e1e62701db95cf4bcbae0d1a11346 --- /dev/null +++ b/flameshot-0.6.0/snap/snapcraft.yaml @@ -0,0 +1,65 @@ +name: flameshot +version: git +icon: img/app/flameshot.svg +summary: Powerful yet simple to use screenshot software +description: | + A powerful open source screenshot and annotation tool for Linux, Flameshot + has a varied set of markup tools available, which include Freehand drawing, + Lines, Arrows, Boxes, Circles, Highlighting, Blur. Additionally, you can + customise the color, size and/or thickness of many of these image annotation + tools. + +grade: devel # must be 'stable' to release into candidate/stable channels +confinement: devmode # use 'strict' once you have the right plugs and slots + + +apps: + flameshot: + command: desktop-launch ${SNAP}/usr/bin/flameshot + environment: + LC_ALL: C.UTF-8 + slots: [ dbus-svc ] + plugs: + - desktop + - desktop-legacy + - home + - network + - network-bind + - opengl + - pulseaudio + - unity7 + - wayland + - x11 + +parts: + flameshot: + after: + - desktop-qt5 + - indicator-qt5 + plugin: qmake + qt-version: qt5 + options: + - CONFIG+=packaging + source: . + source-type: git + build-packages: + - qt5-default + - qttools5-dev-tools + - libqt5svg5-dev + stage-packages: + - dbus-x11 + - libgtk2.0-0 + - openssl + - ca-certificates + + desktop-qt5: + stage: [ -./**/lib/*/qt5/**/libappmenu-qt5.so ] + +slots: + # Depending on in which environment we're running we either need + # to use the system or session DBus so we also need to have one + # slot for each. + dbus-svc: + interface: dbus + bus: session + name: org.dharkael.Flameshot diff --git a/flameshot-0.6.0/src/cli/commandargument.cpp b/flameshot-0.6.0/src/cli/commandargument.cpp new file mode 100644 index 0000000000000000000000000000000000000000..19b41e78c3b17fe5f3529aa14bc56a26660f9382 --- /dev/null +++ b/flameshot-0.6.0/src/cli/commandargument.cpp @@ -0,0 +1,54 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "commandargument.h" + +CommandArgument::CommandArgument() { + +} + +CommandArgument::CommandArgument(const QString &name, + const QString &description) : + m_name(name), m_description(description) +{ + +} + +void CommandArgument::setName(const QString &name) { + m_name = name; +} + +QString CommandArgument::name() const { + return m_name; +} + +void CommandArgument::setDescription(const QString &description) { + m_description = description; +} + +QString CommandArgument::description() const { + return m_description; +} + +bool CommandArgument::isRoot() const { + return m_name.isEmpty() && m_description.isEmpty(); +} + +bool CommandArgument::operator ==(const CommandArgument &arg) const { + return m_description == arg.m_description + && m_name == arg.m_name; +} diff --git a/flameshot-0.6.0/src/cli/commandargument.h b/flameshot-0.6.0/src/cli/commandargument.h new file mode 100644 index 0000000000000000000000000000000000000000..e92df1d2316826942efa12be3a6727728c53fcf0 --- /dev/null +++ b/flameshot-0.6.0/src/cli/commandargument.h @@ -0,0 +1,40 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class CommandArgument { +public: + CommandArgument(); + explicit CommandArgument(const QString &name, const QString &description); + + void setName(const QString &name); + QString name() const; + + void setDescription(const QString &description); + QString description() const; + + bool isRoot() const; + + bool operator ==(const CommandArgument &arg) const; + +private: + QString m_name; + QString m_description; +}; diff --git a/flameshot-0.6.0/src/cli/commandlineparser.cpp b/flameshot-0.6.0/src/cli/commandlineparser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..726f3847f64b2ee090e5685ccfcf567168aaf489 --- /dev/null +++ b/flameshot-0.6.0/src/cli/commandlineparser.cpp @@ -0,0 +1,402 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "commandlineparser.h" +#include +#include + +CommandLineParser::CommandLineParser() : + m_description(qApp->applicationName()) +{ + +} + +namespace { + +QTextStream out(stdout); +QTextStream err(stderr); + +auto versionOption = CommandOption({"v", "version"}, + "Displays version information"); +auto helpOption = CommandOption({"h", "help"}, + "Displays this help"); + +QString optionsToString(const QList &options, + const QList &arguments) { + int size = 0; // track the largest size + QStringList dashedOptionList; + // save the dashed options and its size in order to print the description + // of every option at the same horizontal character position. + for (auto const &option: options) { + QStringList dashedOptions = option.dashedNames(); + QString joinedDashedOptions = dashedOptions.join(", "); + if (!option.valueName().isEmpty()) { + joinedDashedOptions += QStringLiteral(" <%1>") + .arg(option.valueName()); + } + if (joinedDashedOptions.length() > size) { + size = joinedDashedOptions.length(); + } + dashedOptionList << joinedDashedOptions; + } + // check the length of the arguments + for (auto const &arg: arguments) { + if(arg.name().length() > size) + size = arg.name().length(); + } + // generate the text + QString result; + if(!dashedOptionList.isEmpty()) { + result += "Options:\n"; + QString linePadding = QString(" ").repeated(size + 4).prepend("\n"); + for (int i = 0; i < options.length(); ++i) { + result += QStringLiteral(" %1 %2\n") + .arg(dashedOptionList.at(i).leftJustified(size, ' ')) + .arg(options.at(i).description() + .replace("\n", linePadding)); + } + if (!arguments.isEmpty()) { + result += "\n"; + } + } + if (!arguments.isEmpty()) { + result += "Arguments:\n"; + } + for (int i = 0; i < arguments.length(); ++i) { + result += QStringLiteral(" %1 %2\n") + .arg(arguments.at(i).name().leftJustified(size, ' ')) + .arg(arguments.at(i).description()); + } + return result; +} + +} // unnamed namespace + +bool CommandLineParser::processArgs(const QStringList &args, + QStringList::const_iterator &actualIt, + Node * &actualNode) +{ + QString argument = *actualIt; + bool ok = true; + bool isValidArg = false; + for (Node &n: actualNode->subNodes) { + if (n.argument.name() == argument) { + actualNode = &n; + isValidArg = true; + break; + } + } + if (isValidArg) { + auto nextArg = actualNode->argument; + m_foundArgs.append(nextArg); + // check next is help + ++actualIt; + ok = processIfOptionIsHelp(args, actualIt, actualNode); + --actualIt; + } else { + ok = false; + out << QStringLiteral("'%1' is not a valid argument.").arg(argument); + } + return ok; +} + +bool CommandLineParser::processOptions(const QStringList &args, + QStringList::const_iterator &actualIt, + Node *const actualNode) +{ + QString arg = *actualIt; + bool ok = true; + // track values + int equalsPos = arg.indexOf("="); + QString valueStr; + if (equalsPos != -1) { + valueStr = arg.mid(equalsPos +1); // right + arg = arg.mid(0, equalsPos); // left + } + // check format -x --xx... + bool isDoubleDashed = arg.startsWith("--"); + ok = isDoubleDashed ? arg.length() > 3 : + arg.length() == 2; + if (!ok) { + out << QStringLiteral("the option %1 has a wrong format.").arg(arg); + return ok; + } + arg = isDoubleDashed ? + arg.remove(0, 2) : + arg.remove(0, 1); + // get option + auto endIt = actualNode->options.cend(); + auto optionIt = endIt; + for (auto i = actualNode->options.cbegin(); i != endIt; ++i) { + if ((*i).names().contains(arg)) { + optionIt = i; + break; + } + } + if (optionIt == endIt) { + QString argName = actualNode->argument.name(); + if (argName.isEmpty()) { + argName = qApp->applicationName(); + } + out << QStringLiteral("the option '%1' is not a valid option " + "for the argument '%2'.").arg(arg) + .arg(argName); + ok = false; + return ok; + } + // check presence of values + CommandOption option = *optionIt; + bool requiresValue = !(option.valueName().isEmpty()); + if (!requiresValue && equalsPos != -1) { + out << QStringLiteral("the option '%1' contains a '=' and it doesn't " + "require a value.").arg(arg); + ok = false; + return ok; + } else if (requiresValue && valueStr.isEmpty()) { + // find in the next + if (actualIt+1 != args.cend()) { + ++actualIt; + } else { + out << QStringLiteral("Expected value after the option '%1'.").arg(arg); + ok = false; + return ok; + } + valueStr = *actualIt; + } + // check the value correctness + if (requiresValue) { + ok = option.checkValue(valueStr); + if (!ok) { + QString err = option.errorMsg(); + if (!err.endsWith(".")) + err += "."; + out << err; + return ok; + } + option.setValue(valueStr); + } + m_foundOptions.append(option); + return ok; +} + +bool CommandLineParser::parse(const QStringList &args) { + m_foundArgs.clear(); + m_foundOptions.clear(); + bool ok = true; + Node *actualNode = &m_parseTree; + auto it = ++args.cbegin(); + // check version option + QStringList dashedVersion = versionOption.dashedNames(); + if (m_withVersion && args.length() > 1 && + dashedVersion.contains(args.at(1))) + { + if (args.length() == 2) { + printVersion(); + m_foundOptions << versionOption; + } else { + out << "Invalid arguments after the version option."; + ok = false; + } + return ok; + + } + // check help option + ok = processIfOptionIsHelp(args, it, actualNode); + // process the other args + for (; it != args.cend() && ok; ++it) { + const QString &value = *it; + if (value.startsWith("-")) { + ok = processOptions(args, it, actualNode); + + } else { + ok = processArgs(args, it, actualNode); + } + } + if (!ok && !m_generalErrorMessage.isEmpty()) { + out << QStringLiteral(" %1\n").arg(m_generalErrorMessage); + } + return ok; +} + +CommandOption CommandLineParser::addVersionOption() { + m_withVersion = true; + return versionOption; +} + +CommandOption CommandLineParser::addHelpOption() { + m_withHelp = true; + return helpOption; +} + +bool CommandLineParser::AddArgument(const CommandArgument &arg, + const CommandArgument &parent) +{ + bool res = true; + Node *n = findParent(parent); + if (n == nullptr) { + res = false; + } else { + Node child; + child.argument = arg; + n->subNodes.append(child); + } + return res; +} + +bool CommandLineParser::AddOption(const CommandOption &option, + const CommandArgument &parent) +{ + bool res = true; + Node *n = findParent(parent); + if (n == nullptr) { + res = false; + } else { + n->options.append(option); + } + return res; +} + +bool CommandLineParser::AddOptions(const QList &options, + const CommandArgument &parent) +{ + bool res = true; + for (auto const &option: options) { + if (!AddOption(option, parent)) { + res = false; + break; + } + } + return res; +} + +void CommandLineParser::setGeneralErrorMessage(const QString &msg) { + m_generalErrorMessage = msg; +} + +void CommandLineParser::setDescription(const QString &description) { + m_description = description; +} + +bool CommandLineParser::isSet(const CommandArgument &arg) const { + return m_foundArgs.contains(arg); +} + + +bool CommandLineParser::isSet(const CommandOption &option) const { + return m_foundOptions.contains(option); +} + +QString CommandLineParser::value(const CommandOption &option) const { + QString value = option.value(); + for (const CommandOption &fOption: m_foundOptions) { + if (option == fOption) { + value = fOption.value(); + break; + } + } + return value; +} + +void CommandLineParser::printVersion() { + out << "Flameshot " << qApp->applicationVersion() << "\nCompiled with Qt " + << static_cast(QT_VERSION_STR) << "\n"; +} + +void CommandLineParser::printHelp(QStringList args, const Node *node) { + args.removeLast(); // remove the help, it's always the last + QString helpText; + // add usage info + QString argName = node->argument.name(); + if (argName.isEmpty()) { + argName = qApp->applicationName(); + } + QString argText = node->subNodes.isEmpty() ? "" : "[arguments]"; + helpText += QStringLiteral("Usage: %1 [%2-options] %3\n\n") + .arg(args.join(" ")) + .arg(argName).arg(argText); + // add command options and subarguments + QList subArgs; + for (const Node &n: node->subNodes) + subArgs.append(n.argument); + auto modifiedOptions = node->options; + if (m_withHelp) + modifiedOptions << helpOption; + if (m_withVersion && node == &m_parseTree) { + modifiedOptions << versionOption; + } + helpText += optionsToString(modifiedOptions, subArgs); + // print it + out << helpText; +} + +CommandLineParser::Node* CommandLineParser::findParent( + const CommandArgument &parent) +{ + if (parent == CommandArgument()) { + return &m_parseTree; + } + //find the parent in the subNodes recursively + Node *res = nullptr; + for (auto i = m_parseTree.subNodes.begin(); + i != m_parseTree.subNodes.end(); ++i) + { + res = recursiveParentSearch(parent, *i); + if (res != nullptr) { + break; + } + } + return res; +} + +CommandLineParser::Node* CommandLineParser::recursiveParentSearch( + const CommandArgument &parent, Node &node) const +{ + Node * res = nullptr; + if (node.argument == parent) { + res = &node; + } else { + for (auto i = node.subNodes.begin(); i != node.subNodes.end(); ++i){ + res = recursiveParentSearch(parent, *i); + if (res != nullptr) { + break; + } + } + } + return res; +} + +bool CommandLineParser::processIfOptionIsHelp( + const QStringList &args, + QStringList::const_iterator &actualIt, + Node * &actualNode) +{ + bool ok = true; + auto dashedHelpNames = helpOption.dashedNames(); + if (m_withHelp && actualIt != args.cend() && + dashedHelpNames.contains(*actualIt)) + { + if (actualIt+1 == args.cend()) { + m_foundOptions << helpOption; + printHelp(args, actualNode); + actualIt++; + } else { + out << "Invalid arguments after the help option."; + ok = false; + } + } + return ok; +} diff --git a/flameshot-0.6.0/src/cli/commandlineparser.h b/flameshot-0.6.0/src/cli/commandlineparser.h new file mode 100644 index 0000000000000000000000000000000000000000..dbd8d251c5ca7356f318dc6de6729bb08fde3cf4 --- /dev/null +++ b/flameshot-0.6.0/src/cli/commandlineparser.h @@ -0,0 +1,89 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/cli/commandargument.h" +#include "src/cli/commandoption.h" +#include + +class CommandLineParser { +public: + CommandLineParser(); + + bool parse(const QStringList &args); + + CommandArgument rootArgument() const { return CommandArgument(); } + + CommandOption addVersionOption(); + CommandOption addHelpOption(); + + bool AddArgument(const CommandArgument &arg, + const CommandArgument &parent = CommandArgument()); + + bool AddOption(const CommandOption &option, + const CommandArgument &parent = CommandArgument()); + + bool AddOptions(const QList &options, + const CommandArgument &parent = CommandArgument()); + + void setGeneralErrorMessage(const QString &msg); + void setDescription(const QString &description); + + bool isSet(const CommandArgument &arg) const; + bool isSet(const CommandOption &option) const; + QString value(const CommandOption &option) const; + +private: + bool m_withHelp = false; + bool m_withVersion = false; + QString m_description; + QString m_generalErrorMessage; + + struct Node { + explicit Node(const CommandArgument &arg) : argument(arg) {} + Node() {} + bool operator==(const Node &n) const { + return argument == n.argument && + options == n.options && + subNodes == n.subNodes; + } + CommandArgument argument; + QList options; + QList subNodes; + }; + + Node m_parseTree; + QList m_foundOptions; + QList m_foundArgs; + + // helper functions + void printVersion(); + void printHelp(QStringList args, const Node *node); + Node* findParent(const CommandArgument &parent); + Node* recursiveParentSearch(const CommandArgument &parent, + Node &node) const; + bool processIfOptionIsHelp(const QStringList &args, + QStringList::const_iterator &actualIt, + Node * &actualNode); + bool processArgs(const QStringList &args, + QStringList::const_iterator &actualIt, + Node * &actualNode); + bool processOptions(const QStringList &args, + QStringList::const_iterator &actualIt, + Node *const actualNode); +}; diff --git a/flameshot-0.6.0/src/cli/commandoption.cpp b/flameshot-0.6.0/src/cli/commandoption.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1fcadfebafba6c3e434c9e56c80fd4e9871b6ea3 --- /dev/null +++ b/flameshot-0.6.0/src/cli/commandoption.cpp @@ -0,0 +1,112 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "commandoption.h" + +CommandOption::CommandOption(const QString &name, const QString &description, + const QString &valueName, + const QString &defaultValue) : + m_names(name), m_description(description), m_valueName(valueName), + m_value(defaultValue) +{ + m_checker = [](QString const&){ return true; }; +} + +CommandOption::CommandOption(const QStringList &names, + const QString &description, + const QString &valueName, + const QString &defaultValue) : + m_names(names), m_description(description), m_valueName(valueName), + m_value(defaultValue) +{ + m_checker = [](QString const&) -> bool { return true; }; +} + +void CommandOption::setName(const QString &name) { + m_names = QStringList() << name; +} + +void CommandOption::setNames(const QStringList &names) { + m_names = names; +} + +QStringList CommandOption::names() const { + return m_names; +} + +QStringList CommandOption::dashedNames() const { + QStringList dashedNames; + for (const QString &name: m_names) { + // prepend "-" to single character options, and "--" to the others + QString dashedName = (name.length() == 1) ? + QStringLiteral("-%1").arg(name) : + QStringLiteral("--%1").arg(name); + dashedNames << dashedName; + } + return dashedNames; +} + +void CommandOption::setValueName(const QString &name) { + m_valueName = name; +} + +QString CommandOption::valueName() const { + return m_valueName; +} + +void CommandOption::setValue(const QString &value) { + if (m_valueName.isEmpty()) { + m_valueName = "value"; + } + m_value = value; +} + +QString CommandOption::value() const { + return m_value; +} + +void CommandOption::addChecker(const function checker, + const QString &errMsg) +{ + m_checker = checker; + m_errorMsg = errMsg; +} + +bool CommandOption::checkValue(const QString &value) const { + return m_checker(value); +} + +QString CommandOption::description() const +{ + return m_description; +} + +void CommandOption::setDescription(const QString &description) +{ + m_description = description; +} + +QString CommandOption::errorMsg() const { + return m_errorMsg; +} + +bool CommandOption::operator ==(const CommandOption &option) const +{ + return m_description == option.m_description + && m_names == option.m_names + && m_valueName == option.m_valueName; +} diff --git a/flameshot-0.6.0/src/cli/commandoption.h b/flameshot-0.6.0/src/cli/commandoption.h new file mode 100644 index 0000000000000000000000000000000000000000..924a97cf77bb261c8416018b52cd5fff86959a5f --- /dev/null +++ b/flameshot-0.6.0/src/cli/commandoption.h @@ -0,0 +1,64 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include + +using std::function; + +class CommandOption { +public: + CommandOption(const QString &name, const QString &description, + const QString &valueName = QString(), + const QString &defaultValue = QString()); + + CommandOption(const QStringList &names, const QString &description, + const QString &valueName = QString(), + const QString &defaultValue = QString()); + + void setName(const QString &name); + void setNames(const QStringList &names); + QStringList names() const; + QStringList dashedNames() const; + + void setValueName(const QString &name); + QString valueName() const; + + void setValue(const QString &value); + QString value() const; + + void addChecker(const function checker, const QString &errMsg); + bool checkValue(const QString &value) const; + + QString description() const; + void setDescription(const QString &description); + + QString errorMsg() const; + + bool operator==(const CommandOption &option) const; + +private: + QStringList m_names; + QString m_description; + QString m_valueName; + QString m_value; + + function m_checker; + QString m_errorMsg; +}; diff --git a/flameshot-0.6.0/src/config/buttonlistview.cpp b/flameshot-0.6.0/src/config/buttonlistview.cpp new file mode 100644 index 0000000000000000000000000000000000000000..398c395b0350e62a15d5a7891a431bb7b7d0c818 --- /dev/null +++ b/flameshot-0.6.0/src/config/buttonlistview.cpp @@ -0,0 +1,105 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "buttonlistview.h" +#include "src/tools/toolfactory.h" +#include "src/utils/confighandler.h" +#include +#include + +ButtonListView::ButtonListView(QWidget *parent) : QListWidget(parent) { + setMouseTracking(true); + setFlow(QListWidget::TopToBottom); + initButtonList(); + updateComponents(); + connect(this, &QListWidget::itemClicked, this, + &ButtonListView::reverseItemCheck); +} + +void ButtonListView::initButtonList() { + ToolFactory factory; + auto listTypes = CaptureButton::getIterableButtonTypes(); + + for (const CaptureButton::ButtonType t: listTypes) { + CaptureTool *tool = factory.CreateTool(t); + + // add element to the local map + m_buttonTypeByName.insert(tool->name(), t); + + // init the menu option + QListWidgetItem *m_buttonItem = new QListWidgetItem(this); + + // when the background is lighter than gray, it uses the white icons + QColor bgColor = this->palette().color(QWidget::backgroundRole()); + m_buttonItem->setIcon(tool->icon(bgColor, false)); + + m_buttonItem->setFlags(Qt::ItemIsUserCheckable); + QColor foregroundColor = this->palette().color(QWidget::foregroundRole()); + m_buttonItem->setForeground(foregroundColor); + + m_buttonItem->setText(tool->name()); + m_buttonItem->setToolTip(tool->description()); + tool->deleteLater(); + } +} + +void ButtonListView::updateActiveButtons(QListWidgetItem *item) { + CaptureButton::ButtonType bType = m_buttonTypeByName[item->text()]; + if (item->checkState() == Qt::Checked) { + m_listButtons.append(bType); + // TODO refactor so we don't need external sorts + using bt = CaptureButton::ButtonType; + std::sort(m_listButtons.begin(), m_listButtons.end(), [](bt a, bt b){ + return CaptureButton::getPriorityByButton(a) < + CaptureButton::getPriorityByButton(b); + }); + } else { + m_listButtons.remove(m_listButtons.indexOf(bType)); + } + ConfigHandler().setButtons(m_listButtons); +} + +void ButtonListView::reverseItemCheck(QListWidgetItem *item){ + if (item->checkState() == Qt::Checked) { + item->setCheckState(Qt::Unchecked); + } else { + item->setCheckState(Qt::Checked); + } + updateActiveButtons(item); +} + +void ButtonListView::selectAll() { + ConfigHandler().setAllTheButtons(); + for(int i = 0; i < this->count(); ++i) { + QListWidgetItem* item = this->item(i); + item->setCheckState(Qt::Checked); + } +} + +void ButtonListView::updateComponents() { + m_listButtons = ConfigHandler().getButtons(); + auto listTypes = CaptureButton::getIterableButtonTypes(); + for(int i = 0; i < this->count(); ++i) { + QListWidgetItem* item = this->item(i); + auto elem = static_cast(listTypes.at(i)); + if (m_listButtons.contains(elem)) { + item->setCheckState(Qt::Checked); + } else { + item->setCheckState(Qt::Unchecked); + } + } +} diff --git a/flameshot-0.6.0/src/config/buttonlistview.h b/flameshot-0.6.0/src/config/buttonlistview.h new file mode 100644 index 0000000000000000000000000000000000000000..2bc88713ea7cbff8ac4bd1555af0c944ab9095d0 --- /dev/null +++ b/flameshot-0.6.0/src/config/buttonlistview.h @@ -0,0 +1,42 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/widgets/capture/capturebutton.h" +#include + +class ButtonListView : public QListWidget { +public: + explicit ButtonListView(QWidget *parent= nullptr); + +public slots: + void selectAll(); + void updateComponents(); + +private slots: + void reverseItemCheck(QListWidgetItem *); + +protected: + void initButtonList(); + +private: + QVector m_listButtons; + QMap m_buttonTypeByName; + + void updateActiveButtons(QListWidgetItem *); +}; diff --git a/flameshot-0.6.0/src/config/clickablelabel.cpp b/flameshot-0.6.0/src/config/clickablelabel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9d6507b749190101368586d3e3d52a0e1d8aedea --- /dev/null +++ b/flameshot-0.6.0/src/config/clickablelabel.cpp @@ -0,0 +1,30 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "clickablelabel.h" + +ClickableLabel::ClickableLabel(QWidget *parent) : QLabel(parent) { + +} + +ClickableLabel::ClickableLabel(QString s, QWidget *parent) : QLabel(parent) { + setText(s); +} + +void ClickableLabel::mousePressEvent(QMouseEvent *) { + emit clicked(); +} diff --git a/flameshot-0.6.0/src/config/clickablelabel.h b/flameshot-0.6.0/src/config/clickablelabel.h new file mode 100644 index 0000000000000000000000000000000000000000..9efe863ca22bcb7d4f051049671dc6432d4d98f8 --- /dev/null +++ b/flameshot-0.6.0/src/config/clickablelabel.h @@ -0,0 +1,33 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class ClickableLabel : public QLabel { + Q_OBJECT +public: + explicit ClickableLabel(QWidget *parent = nullptr); + ClickableLabel(QString s, QWidget *parent = nullptr); + +signals: + void clicked(); + +private: + void mousePressEvent (QMouseEvent *); +}; diff --git a/flameshot-0.6.0/src/config/configwindow.cpp b/flameshot-0.6.0/src/config/configwindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ab935059272687544e64d231a6d0162e9fa1c766 --- /dev/null +++ b/flameshot-0.6.0/src/config/configwindow.cpp @@ -0,0 +1,88 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "configwindow.h" +#include "src/utils/colorutils.h" +#include "src/utils/confighandler.h" +#include "src/utils/pathinfo.h" +#include "src/widgets/capture/capturebutton.h" +#include "src/config/geneneralconf.h" +#include "src/config/filenameeditor.h" +#include "src/config/strftimechooserwidget.h" +#include "src/config/visualseditor.h" +#include "src/utils/globalvalues.h" +#include +#include +#include +#include +#include + +// ConfigWindow contains the menus where you can configure the application + +ConfigWindow::ConfigWindow(QWidget *parent) : QTabWidget(parent) { + setAttribute(Qt::WA_DeleteOnClose); + const int size = GlobalValues::buttonBaseSize() * 12; + setMinimumSize(size, size); + setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowTitle(tr("Configuration")); + + auto changedSlot = [this](QString s){ + QStringList files = m_configWatcher->files(); + if (!files.contains(s)) { + this->m_configWatcher->addPath(s); + } + emit updateChildren(); + }; + m_configWatcher = new QFileSystemWatcher(this); + m_configWatcher->addPath(ConfigHandler().configFilePath()); + connect(m_configWatcher, &QFileSystemWatcher::fileChanged, + this, changedSlot); + + QColor background = this->palette().background().color(); + bool isDark = ColorUtils::colorIsDark(background); + QString modifier = isDark ? PathInfo::whiteIconPath() : + PathInfo::blackIconPath(); + + // visuals + m_visuals = new VisualsEditor(); + addTab(m_visuals, QIcon(modifier + "graphics.svg"), + tr("Interface")); + + // filename + m_filenameEditor = new FileNameEditor(); + addTab(m_filenameEditor, QIcon(modifier + "name_edition.svg"), + tr("Filename Editor")); + + // general + m_generalConfig = new GeneneralConf(); + addTab(m_generalConfig, QIcon(modifier + "config.svg"), + tr("General")); + + // connect update sigslots + connect(this, &ConfigWindow::updateChildren, + m_filenameEditor, &FileNameEditor::updateComponents); + connect(this, &ConfigWindow::updateChildren, + m_visuals, &VisualsEditor::updateComponents); + connect(this, &ConfigWindow::updateChildren, + m_generalConfig, &GeneneralConf::updateComponents); +} + +void ConfigWindow::keyPressEvent(QKeyEvent *e) { + if (e->key() == Qt::Key_Escape) { + close(); + } +} diff --git a/flameshot-0.6.0/src/config/configwindow.h b/flameshot-0.6.0/src/config/configwindow.h new file mode 100644 index 0000000000000000000000000000000000000000..835e72afcdffa68b7c17c645622304392302a51d --- /dev/null +++ b/flameshot-0.6.0/src/config/configwindow.h @@ -0,0 +1,43 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class FileNameEditor; +class GeneneralConf; +class QFileSystemWatcher; +class VisualsEditor; + +class ConfigWindow : public QTabWidget { + Q_OBJECT +public: + explicit ConfigWindow(QWidget *parent = nullptr); + +signals: + void updateChildren(); + +protected: + void keyPressEvent(QKeyEvent *); + +private: + FileNameEditor *m_filenameEditor; + GeneneralConf *m_generalConfig; + VisualsEditor *m_visuals; + QFileSystemWatcher *m_configWatcher; +}; diff --git a/flameshot-0.6.0/src/config/extendedslider.cpp b/flameshot-0.6.0/src/config/extendedslider.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0254aacd9a7a0cbc0411dbf5b89f47e3474a151e --- /dev/null +++ b/flameshot-0.6.0/src/config/extendedslider.cpp @@ -0,0 +1,50 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "extendedslider.h" + +ExtendedSlider::ExtendedSlider(QWidget *parent) + : QSlider(parent) +{ + connect(this, &ExtendedSlider::valueChanged, + this, &ExtendedSlider::updateTooltip); + connect(this, &ExtendedSlider::sliderMoved, + this, &ExtendedSlider::fireTimer); + m_timer.setSingleShot(true); + connect(&m_timer, &QTimer::timeout, + this, &ExtendedSlider::modificationsEnded); +} + +int ExtendedSlider::mappedValue(int min, int max) { + qreal progress = + ((value() - minimum())) / static_cast(maximum() - minimum()); + return min + (max - min) * progress; +} + +void ExtendedSlider::setMapedValue(int min, int val, int max) { + qreal progress = ((val - min) + 1) / static_cast(max - min); + int value = minimum() + (maximum() - minimum()) * progress; + setValue(value); +} + +void ExtendedSlider::updateTooltip() { + setToolTip(QString::number(value())+"%"); +} + +void ExtendedSlider::fireTimer() { + m_timer.start(500); +} diff --git a/flameshot-0.6.0/src/config/extendedslider.h b/flameshot-0.6.0/src/config/extendedslider.h new file mode 100644 index 0000000000000000000000000000000000000000..d564dd28520e4e206221245556032557c9c18048 --- /dev/null +++ b/flameshot-0.6.0/src/config/extendedslider.h @@ -0,0 +1,40 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include + +class ExtendedSlider : public QSlider { + Q_OBJECT +public: + explicit ExtendedSlider(QWidget *parent = nullptr); + + int mappedValue(int min, int max); + void setMapedValue(int min, int val, int max); + +signals: + void modificationsEnded(); + +private slots: + void updateTooltip(); + void fireTimer(); + +private: + QTimer m_timer; +}; diff --git a/flameshot-0.6.0/src/config/filenameeditor.cpp b/flameshot-0.6.0/src/config/filenameeditor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..2f62f4345425670ca7c2c6d48f03618359ac147a --- /dev/null +++ b/flameshot-0.6.0/src/config/filenameeditor.cpp @@ -0,0 +1,115 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "filenameeditor.h" +#include "src/utils/filenamehandler.h" +#include "src/utils/confighandler.h" +#include "src/config/strftimechooserwidget.h" +#include +#include +#include +#include +#include + +FileNameEditor::FileNameEditor(QWidget *parent) : QWidget(parent) { + initWidgets(); + initLayout(); +} + +void FileNameEditor::initLayout() { + m_layout = new QVBoxLayout(this); + auto infoLabel = new QLabel(tr("Edit the name of your captures:"), this); + infoLabel->setFixedHeight(20); + m_layout->addWidget(infoLabel); + m_layout->addWidget(m_helperButtons); + m_layout->addWidget(new QLabel(tr("Edit:"))); + m_layout->addWidget(m_nameEditor); + m_layout->addWidget(new QLabel(tr("Preview:"))); + m_layout->addWidget(m_outputLabel); + + QHBoxLayout *horizLayout = new QHBoxLayout(); + horizLayout->addWidget(m_saveButton); + horizLayout->addWidget(m_resetButton); + horizLayout->addWidget(m_clearButton); + m_layout->addLayout(horizLayout); +} + +void FileNameEditor::initWidgets() { + m_nameHandler = new FileNameHandler(this); + + // editor + m_nameEditor = new QLineEdit(this); + m_nameEditor->setMaxLength(FileNameHandler::MAX_CHARACTERS); + + // preview + m_outputLabel = new QLineEdit(this); + m_outputLabel->setDisabled(true); + QString foreground = this->palette().foreground().color().name(); + m_outputLabel->setStyleSheet(QStringLiteral("color: %1").arg(foreground)); + QPalette pal = m_outputLabel->palette(); + QColor color = pal.color(QPalette::Disabled, m_outputLabel->backgroundRole()); + pal.setColor(QPalette::Active, m_outputLabel->backgroundRole(), color); + m_outputLabel->setPalette(pal); + + connect(m_nameEditor, &QLineEdit::textChanged, this, + &FileNameEditor::showParsedPattern); + updateComponents(); + + // helper buttons + m_helperButtons = new StrftimeChooserWidget(this); + connect(m_helperButtons, &StrftimeChooserWidget::variableEmitted, + this, &FileNameEditor::addToNameEditor); + + // save + m_saveButton = new QPushButton(tr("Save"), this); + connect(m_saveButton, &QPushButton::clicked, this, &FileNameEditor::savePattern); + m_saveButton->setToolTip(tr("Saves the pattern")); + // reset + m_resetButton = new QPushButton(tr("Reset"), this); + connect(m_resetButton, &QPushButton::clicked, + this, &FileNameEditor::resetName); + m_resetButton->setToolTip(tr("Restores the saved pattern")); + // clear + m_clearButton = new QPushButton(tr("Clear"), this); + connect(m_clearButton, &QPushButton::clicked, this, + [this](){ m_nameEditor->setText(QString()); + }); + m_clearButton->setToolTip(tr("Deletes the name"));} + +void FileNameEditor::savePattern() { + QString pattern = m_nameEditor->text(); + m_nameHandler->setPattern(pattern); +} + +void FileNameEditor::showParsedPattern(const QString &p) { + QString output = m_nameHandler->parseFilename(p); + m_outputLabel->setText(output); +} + +void FileNameEditor::resetName() { + m_nameEditor->setText(ConfigHandler().filenamePatternValue()); +} + +void FileNameEditor::addToNameEditor(QString s) { + m_nameEditor->setText(m_nameEditor->text() + s); + m_nameEditor->setFocus(); +} + +void FileNameEditor::updateComponents() { + m_nameEditor->setText(ConfigHandler().filenamePatternValue()); + m_outputLabel->setText(m_nameHandler->parsedPattern()); +} diff --git a/flameshot-0.6.0/src/config/filenameeditor.h b/flameshot-0.6.0/src/config/filenameeditor.h new file mode 100644 index 0000000000000000000000000000000000000000..b74da4ed1e44aafeb9fd452d92487c02e895dcc2 --- /dev/null +++ b/flameshot-0.6.0/src/config/filenameeditor.h @@ -0,0 +1,55 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include + +class QVBoxLayout; +class QLineEdit; +class FileNameHandler; +class QPushButton; +class StrftimeChooserWidget; + +class FileNameEditor : public QWidget { + Q_OBJECT +public: + explicit FileNameEditor(QWidget *parent = nullptr); + +private: + QVBoxLayout *m_layout; + QLineEdit *m_outputLabel; + QLineEdit *m_nameEditor; + FileNameHandler *m_nameHandler; + StrftimeChooserWidget *m_helperButtons; + QPushButton *m_saveButton; + QPushButton *m_resetButton; + QPushButton *m_clearButton; + + void initLayout(); + void initWidgets(); + +public slots: + void addToNameEditor(QString s); + void updateComponents(); + +private slots: + void savePattern(); + void showParsedPattern(const QString &); + void resetName(); +}; diff --git a/flameshot-0.6.0/src/config/geneneralconf.cpp b/flameshot-0.6.0/src/config/geneneralconf.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23e64d61d72fb1ffb5caba13f07743136b2f0f72 --- /dev/null +++ b/flameshot-0.6.0/src/config/geneneralconf.cpp @@ -0,0 +1,206 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "geneneralconf.h" +#include "src/utils/confighandler.h" +#include "src/utils/confighandler.h" +#include "src/core/controller.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GeneneralConf::GeneneralConf(QWidget *parent) : QWidget(parent) { + m_layout = new QVBoxLayout(this); + m_layout->setAlignment(Qt::AlignTop); + initShowHelp(); + initShowDesktopNotification(); + initShowTrayIcon(); + initAutostart(); + + // this has to be at the end + initConfingButtons(); + updateComponents(); +} + +void GeneneralConf::updateComponents() { + ConfigHandler config; + m_helpMessage->setChecked(config.showHelpValue()); + m_sysNotifications->setChecked(config.desktopNotificationValue()); + m_autostart->setChecked(config.startupLaunchValue()); + +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + m_showTray->setChecked(!config.disabledTrayIconValue()); +#endif +} + +void GeneneralConf::showHelpChanged(bool checked) { + ConfigHandler().setShowHelp(checked); +} + +void GeneneralConf::showDesktopNotificationChanged(bool checked) { + ConfigHandler().setDesktopNotification(checked); +} + +void GeneneralConf::showTrayIconChanged(bool checked) { + auto controller = Controller::getInstance(); + if (checked) { + controller->enableTrayIcon(); + } else { + controller->disableTrayIcon(); + } +} + +void GeneneralConf::autostartChanged(bool checked) { + ConfigHandler().setStartupLaunch(checked); +} + +void GeneneralConf::importConfiguration() { + QString fileName = QFileDialog::getOpenFileName(this, tr("Import")); + if (fileName.isEmpty()) { + return; + } + QFile file(fileName); + QTextCodec *codec = QTextCodec::codecForLocale(); + if (!file.open(QFile::ReadOnly)) { + QMessageBox::about(this, tr("Error"), tr("Unable to read file.")); + return; + } + QString text = codec->toUnicode(file.readAll()); + file.close(); + + QFile config(ConfigHandler().configFilePath()); + if (!config.open(QFile::WriteOnly)) { + QMessageBox::about(this, tr("Error"), tr("Unable to write file.")); + return; + } + config.write(codec->fromUnicode(text)); + config.close(); +} + +void GeneneralConf::exportFileConfiguration() { + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), + "flameshot.conf"); + + // Cancel button + if (fileName.isNull()) { + return; + } + + QFile targetFile(fileName); + if (targetFile.exists()) { + targetFile.remove(); + } + bool ok = QFile::copy(ConfigHandler().configFilePath(), fileName); + if (!ok) { + QMessageBox::about(this, tr("Error"), tr("Unable to write file.")); + } +} + +void GeneneralConf::resetConfiguration() { + QMessageBox::StandardButton reply; + reply = QMessageBox::question( + this, tr("Confirm Reset"), + tr("Are you sure you want to reset the configuration?"), + QMessageBox::Yes | QMessageBox::No); + if (reply == QMessageBox::Yes) { + ConfigHandler().setDefaults(); + } +} + + +void GeneneralConf::initShowHelp() { + m_helpMessage = new QCheckBox(tr("Show help message"), this); + ConfigHandler config; + bool checked = config.showHelpValue(); + m_helpMessage->setChecked(checked); + m_helpMessage->setToolTip(tr("Show the help message at the beginning " + "in the capture mode.")); + m_layout->addWidget(m_helpMessage); + + connect(m_helpMessage, &QCheckBox::clicked, this, + &GeneneralConf::showHelpChanged); +} + +void GeneneralConf::initShowDesktopNotification() { + m_sysNotifications = + new QCheckBox(tr("Show desktop notifications"), this); + ConfigHandler config; + bool checked = config.desktopNotificationValue(); + m_sysNotifications->setChecked(checked); + m_sysNotifications->setToolTip(tr("Show desktop notifications")); + m_layout->addWidget(m_sysNotifications); + + connect(m_sysNotifications, &QCheckBox::clicked, this, + &GeneneralConf::showDesktopNotificationChanged); +} + +void GeneneralConf::initShowTrayIcon() { +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + m_showTray = new QCheckBox(tr("Show tray icon"), this); + ConfigHandler config; + bool checked = !config.disabledTrayIconValue(); + m_showTray->setChecked(checked); + m_showTray->setToolTip(tr("Show the systemtray icon")); + m_layout->addWidget(m_showTray); + + connect(m_showTray, &QCheckBox::clicked, this, + &GeneneralConf::showTrayIconChanged); +#endif +} + +void GeneneralConf::initConfingButtons() { + QHBoxLayout *buttonLayout = new QHBoxLayout(); + m_layout->addStretch(); + QGroupBox *box = new QGroupBox(tr("Configuration File")); + box->setFlat(true); + box->setLayout(buttonLayout); + m_layout->addWidget(box); + + m_exportButton = new QPushButton(tr("Export")); + buttonLayout->addWidget(m_exportButton); + connect(m_exportButton, &QPushButton::clicked, this, + &GeneneralConf::exportFileConfiguration); + + m_importButton = new QPushButton(tr("Import")); + buttonLayout->addWidget(m_importButton); + connect(m_importButton, &QPushButton::clicked, this, + &GeneneralConf::importConfiguration); + + m_resetButton = new QPushButton(tr("Reset")); + buttonLayout->addWidget(m_resetButton); + connect(m_resetButton, &QPushButton::clicked, this, + &GeneneralConf::resetConfiguration); +} + +void GeneneralConf::initAutostart() { + m_autostart = + new QCheckBox(tr("Launch at startup"), this); + ConfigHandler config; + bool checked = config.startupLaunchValue(); + m_autostart->setChecked(checked); + m_autostart->setToolTip(tr("Launch Flameshot")); + m_layout->addWidget(m_autostart); + + connect(m_autostart, &QCheckBox::clicked, this, + &GeneneralConf::autostartChanged); +} diff --git a/flameshot-0.6.0/src/config/geneneralconf.h b/flameshot-0.6.0/src/config/geneneralconf.h new file mode 100644 index 0000000000000000000000000000000000000000..a2192e900f2c9972baaa54a434bfa9c8f8e7c46c --- /dev/null +++ b/flameshot-0.6.0/src/config/geneneralconf.h @@ -0,0 +1,58 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QVBoxLayout; +class QCheckBox; +class QPushButton; + +class GeneneralConf : public QWidget { + Q_OBJECT +public: + explicit GeneneralConf(QWidget *parent = nullptr); + +public slots: + void updateComponents(); + +private slots: + void showHelpChanged(bool checked); + void showDesktopNotificationChanged(bool checked); + void showTrayIconChanged(bool checked); + void autostartChanged(bool checked); + void importConfiguration(); + void exportFileConfiguration(); + void resetConfiguration(); + +private: + QVBoxLayout *m_layout; + QCheckBox *m_sysNotifications; + QCheckBox *m_showTray; + QCheckBox *m_helpMessage; + QCheckBox *m_autostart; + QPushButton *m_importButton; + QPushButton *m_exportButton; + QPushButton *m_resetButton; + + void initShowHelp(); + void initShowDesktopNotification(); + void initShowTrayIcon(); + void initConfingButtons(); + void initAutostart(); +}; diff --git a/flameshot-0.6.0/src/config/strftimechooserwidget.cpp b/flameshot-0.6.0/src/config/strftimechooserwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9924fe30a991f8a79113db2ce28cae634b0e7064 --- /dev/null +++ b/flameshot-0.6.0/src/config/strftimechooserwidget.cpp @@ -0,0 +1,68 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "strftimechooserwidget.h" +#include +#include +#include + +StrftimeChooserWidget::StrftimeChooserWidget(QWidget *parent) : QWidget(parent) { + QGridLayout *layout = new QGridLayout(this); + auto k = m_buttonData.keys(); + int middle = k.length()/2; + // add the buttons in 2 columns (they need to be even) + for (int i = 0; i < 2; i++) { + for (int j = 0; j < middle; j++) { + QString key = k.last(); + k.pop_back(); + QString variable = m_buttonData.value(key); + QPushButton *button = new QPushButton(this); + button->setText(tr(key.toStdString().data())); + button->setToolTip(variable); + button->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + button->setMinimumHeight(25); + layout->addWidget(button, j, i); + connect(button, &QPushButton::clicked, + this, [variable, this](){emit variableEmitted(variable);}); + } + } + setLayout(layout); +} + +QMap StrftimeChooserWidget::m_buttonData { + { QT_TR_NOOP("Century (00-99)"), "%C"}, + { QT_TR_NOOP("Year (00-99)"), "%y"}, + { QT_TR_NOOP("Year (2000)"), "%Y"}, + { QT_TR_NOOP("Month Name (jan)"), "%b"}, + { QT_TR_NOOP("Month Name (january)"), "%B"}, + { QT_TR_NOOP("Month (01-12)"), "%m"}, + { QT_TR_NOOP("Week Day (1-7)"), "%u"}, + { QT_TR_NOOP("Week (01-53)"), "%V"}, + { QT_TR_NOOP("Day Name (mon)"), "%a"}, + { QT_TR_NOOP("Day Name (monday)"), "%A"}, + { QT_TR_NOOP("Day (01-31)"), "%d"}, + { QT_TR_NOOP("Day of Month (1-31)"), "%e"}, + { QT_TR_NOOP("Day (001-366)"), "%j"}, + { QT_TR_NOOP("Time (%H-%M-%S)"), "%T"}, + { QT_TR_NOOP("Time (%H-%M)"), "%R"}, + { QT_TR_NOOP("Hour (00-23)"), "%H"}, + { QT_TR_NOOP("Hour (01-12)"), "%I"}, + { QT_TR_NOOP("Minute (00-59)"), "%M"}, + { QT_TR_NOOP("Second (00-59)"), "%S"}, + { QT_TR_NOOP("Full Date (%m/%d/%y)"), "%D"}, + { QT_TR_NOOP("Full Date (%Y-%m-%d)"), "%F"}, +}; diff --git a/flameshot-0.6.0/src/config/strftimechooserwidget.h b/flameshot-0.6.0/src/config/strftimechooserwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..7216f8eb58ff0b7e0b6d1371bb59dafb3eb46f53 --- /dev/null +++ b/flameshot-0.6.0/src/config/strftimechooserwidget.h @@ -0,0 +1,32 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class StrftimeChooserWidget : public QWidget { + Q_OBJECT +public: + explicit StrftimeChooserWidget(QWidget *parent = nullptr); + +signals: + void variableEmitted(const QString &); + +private: + static QMap m_buttonData; +}; diff --git a/flameshot-0.6.0/src/config/uicoloreditor.cpp b/flameshot-0.6.0/src/config/uicoloreditor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..89afe1f3d64dd4564b3ad7945dc130ea8c9acfd0 --- /dev/null +++ b/flameshot-0.6.0/src/config/uicoloreditor.cpp @@ -0,0 +1,165 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "src/utils/confighandler.h" +#include "uicoloreditor.h" +#include "clickablelabel.h" +#include "src/utils/globalvalues.h" +#include +#include +#include +#include +#include +#include + +UIcolorEditor::UIcolorEditor(QWidget *parent) : QGroupBox(parent) { + setTitle(tr("UI Color Editor")); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_hLayout = new QHBoxLayout; + m_vLayout = new QVBoxLayout; + + const int space = QApplication::fontMetrics().lineSpacing(); + m_hLayout->addItem(new QSpacerItem(space, space, QSizePolicy::Expanding)); + m_vLayout->setAlignment(Qt::AlignVCenter); + + initButtons(); + initColorWheel(); + + m_vLayout->addSpacing(space); + m_hLayout->addLayout(m_vLayout); + m_hLayout->addItem(new QSpacerItem(space, space, QSizePolicy::Expanding)); + setLayout(m_hLayout); + updateComponents(); +} + +void UIcolorEditor::updateComponents() { + ConfigHandler config; + m_uiColor = config.uiMainColorValue(); + m_contrastColor = config.uiContrastColorValue(); + m_buttonContrast->setColor(m_contrastColor); + m_buttonMainColor->setColor(m_uiColor); + if (m_lastButtonPressed == m_buttonMainColor) { + m_colorWheel->setColor(m_uiColor); + } else { + m_colorWheel->setColor(m_contrastColor); + } +} + +// updateUIcolor updates the appearance of the buttons +void UIcolorEditor::updateUIcolor() { + ConfigHandler config; + if (m_lastButtonPressed == m_buttonMainColor) { + config.setUIMainColor(m_uiColor); + } else { + config.setUIContrastColor(m_contrastColor); + } +} + +// updateLocalColor updates the local button +void UIcolorEditor::updateLocalColor(const QColor c) { + if (m_lastButtonPressed == m_buttonMainColor) { + m_uiColor = c; + } else { + m_contrastColor = c; + } + m_lastButtonPressed->setColor(c); +} + +void UIcolorEditor::initColorWheel() { + m_colorWheel = new color_widgets::ColorWheel(this); + connect(m_colorWheel, &color_widgets::ColorWheel::mouseReleaseOnColor, this, + &UIcolorEditor::updateUIcolor); + connect(m_colorWheel, &color_widgets::ColorWheel::colorChanged, this, + &UIcolorEditor::updateLocalColor); + + const int size = GlobalValues::buttonBaseSize() * 3; + m_colorWheel->setMinimumSize(size, size); + m_colorWheel->setMaximumSize(size*2, size*2); + m_colorWheel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + m_colorWheel->setToolTip(tr("Change the color moving the selectors and see" + " the changes in the preview buttons.")); + + m_hLayout->addWidget(m_colorWheel); +} + +void UIcolorEditor::initButtons() { + const int extraSize = GlobalValues::buttonBaseSize() / 3; + int frameSize = GlobalValues::buttonBaseSize() + extraSize; + + m_vLayout->addWidget(new QLabel(tr("Select a Button to modify it"), this)); + + QGroupBox *frame = new QGroupBox(); + frame->setFixedSize(frameSize, frameSize); + + m_buttonMainColor = new CaptureButton(m_buttonIconType, frame); + m_buttonMainColor->move(m_buttonMainColor->x() + extraSize/2, m_buttonMainColor->y() + extraSize/2); + QHBoxLayout *h1 = new QHBoxLayout(); + h1->addWidget(frame); + m_labelMain = new ClickableLabel(tr("Main Color"), this); + h1->addWidget(m_labelMain); + m_vLayout->addLayout(h1); + + m_buttonMainColor->setToolTip(tr("Click on this button to set the edition" + " mode of the main color.")); + + QGroupBox *frame2 = new QGroupBox(); + m_buttonContrast = new CaptureButton(m_buttonIconType, frame2); + m_buttonContrast->move(m_buttonContrast->x() + extraSize/2, + m_buttonContrast->y() + extraSize/2); + + QHBoxLayout *h2 = new QHBoxLayout(); + h2->addWidget(frame2); + frame2->setFixedSize(frameSize, frameSize); + m_labelContrast = new ClickableLabel(tr("Contrast Color"), this); + m_labelContrast->setStyleSheet("color : gray"); + h2->addWidget(m_labelContrast); + m_vLayout->addLayout(h2); + + m_buttonContrast->setToolTip(tr("Click on this button to set the edition" + " mode of the contrast color.")); + + connect(m_buttonMainColor, &CaptureButton::pressedButton, + this, &UIcolorEditor::changeLastButton); + connect(m_buttonContrast, &CaptureButton::pressedButton, + this, &UIcolorEditor::changeLastButton); + // clicking the labels changes the button too + connect(m_labelMain, &ClickableLabel::clicked, + this, [this]{ changeLastButton(m_buttonMainColor); }); + connect(m_labelContrast, &ClickableLabel::clicked, + this, [this]{ changeLastButton(m_buttonContrast); }); + m_lastButtonPressed = m_buttonMainColor; +} + +// visual update for the selected button +void UIcolorEditor::changeLastButton(CaptureButton *b) { + if (m_lastButtonPressed != b) { + m_lastButtonPressed = b; + + QString offStyle("QLabel { color : gray; }"); + + if (b == m_buttonMainColor) { + m_colorWheel->setColor(m_uiColor); + m_labelContrast->setStyleSheet(offStyle); + m_labelMain->setStyleSheet(styleSheet()); + } else { + m_colorWheel->setColor(m_contrastColor); + m_labelContrast->setStyleSheet(styleSheet()); + m_labelMain->setStyleSheet(offStyle); + } + b->setIcon(b->icon()); + } +} diff --git a/flameshot-0.6.0/src/config/uicoloreditor.h b/flameshot-0.6.0/src/config/uicoloreditor.h new file mode 100644 index 0000000000000000000000000000000000000000..df795e64f57d3df24f5743fa12a650c8d88db7dc --- /dev/null +++ b/flameshot-0.6.0/src/config/uicoloreditor.h @@ -0,0 +1,58 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "color_wheel.hpp" +#include "src/widgets/capture/capturebutton.h" +#include + +class QVBoxLayout; +class QHBoxLayout; +class CaptureButton; +class ClickableLabel; + +class UIcolorEditor : public QGroupBox { + Q_OBJECT +public: + explicit UIcolorEditor(QWidget *parent = nullptr); + +public slots: + void updateComponents(); + +private slots: + void updateUIcolor(); + void updateLocalColor(const QColor); + void changeLastButton(CaptureButton *); + +private: + QColor m_uiColor, m_contrastColor; + CaptureButton *m_buttonMainColor; + ClickableLabel *m_labelMain; + CaptureButton *m_buttonContrast; + ClickableLabel *m_labelContrast; + CaptureButton *m_lastButtonPressed; + color_widgets::ColorWheel *m_colorWheel; + + static const CaptureButton::ButtonType m_buttonIconType = CaptureButton::TYPE_CIRCLE; + + QHBoxLayout *m_hLayout; + QVBoxLayout *m_vLayout; + + void initColorWheel(); + void initButtons(); +}; diff --git a/flameshot-0.6.0/src/config/visualseditor.cpp b/flameshot-0.6.0/src/config/visualseditor.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f32aef486730a97ad38ce8e0137942ceaf3a64d4 --- /dev/null +++ b/flameshot-0.6.0/src/config/visualseditor.cpp @@ -0,0 +1,87 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "visualseditor.h" +#include "src/config/buttonlistview.h" +#include "src/config/uicoloreditor.h" +#include "src/utils/confighandler.h" +#include "src/config/extendedslider.h" +#include +#include +#include + +VisualsEditor::VisualsEditor(QWidget *parent) : QWidget(parent) { + m_layout= new QVBoxLayout(); + setLayout(m_layout); + initWidgets(); +} + +void VisualsEditor::updateComponents() { + m_buttonList->updateComponents(); + m_colorEditor->updateComponents(); + int opacity = ConfigHandler().contrastOpacityValue(); + m_opacitySlider->setMapedValue(0, opacity, 255); +} + +void VisualsEditor::initOpacitySlider() { + m_opacitySlider = new ExtendedSlider(); + m_opacitySlider->setFocusPolicy(Qt::NoFocus); + m_opacitySlider->setOrientation(Qt::Horizontal); + m_opacitySlider->setRange(0, 100); + connect(m_opacitySlider, &ExtendedSlider::modificationsEnded, + this, &VisualsEditor::saveOpacity); + QHBoxLayout *localLayout = new QHBoxLayout(); + localLayout->addWidget(new QLabel("0%")); + localLayout->addWidget(m_opacitySlider); + localLayout->addWidget(new QLabel("100%")); + + QLabel *label = new QLabel(); + QString labelMsg = tr("Opacity of area outside selection:") + " %1%"; + connect(m_opacitySlider, &ExtendedSlider::valueChanged, + this, [labelMsg, label](int val){ + label->setText(labelMsg.arg(val)); + }); + m_layout->addWidget(label); + m_layout->addLayout(localLayout); + + int opacity = ConfigHandler().contrastOpacityValue(); + m_opacitySlider->setMapedValue(0, opacity, 255); +} + +void VisualsEditor::saveOpacity() { + int value = m_opacitySlider->mappedValue(0, 255); + ConfigHandler().setContrastOpacity(value); +} + +void VisualsEditor::initWidgets() { + m_colorEditor = new UIcolorEditor(); + m_layout->addWidget(m_colorEditor); + + initOpacitySlider(); + + auto boxButtons = new QGroupBox(); + boxButtons->setTitle(tr("Button Selection")); + auto listLayout = new QVBoxLayout(boxButtons); + m_buttonList = new ButtonListView(); + m_layout->addWidget(boxButtons); + listLayout->addWidget(m_buttonList); + + QPushButton* setAllButtons = new QPushButton(tr("Select All")); + connect(setAllButtons, &QPushButton::clicked, + m_buttonList, &ButtonListView::selectAll); + listLayout->addWidget(setAllButtons); +} diff --git a/flameshot-0.6.0/src/config/visualseditor.h b/flameshot-0.6.0/src/config/visualseditor.h new file mode 100644 index 0000000000000000000000000000000000000000..a32a60eaf07b1490ed2df110166f60b39b1b32d1 --- /dev/null +++ b/flameshot-0.6.0/src/config/visualseditor.h @@ -0,0 +1,46 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class ExtendedSlider; +class QVBoxLayout; +class ButtonListView; +class UIcolorEditor; + +class VisualsEditor : public QWidget { + Q_OBJECT +public: + explicit VisualsEditor(QWidget *parent = nullptr); + +public slots: + void updateComponents(); + +private slots: + void saveOpacity(); + +private: + QVBoxLayout *m_layout; + ButtonListView *m_buttonList; + UIcolorEditor *m_colorEditor; + ExtendedSlider *m_opacitySlider; + + void initWidgets(); + void initOpacitySlider(); +}; diff --git a/flameshot-0.6.0/src/core/capturerequest.cpp b/flameshot-0.6.0/src/core/capturerequest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..99bbc2e62056b8a69e53c9349e49c1d9aabbca3c --- /dev/null +++ b/flameshot-0.6.0/src/core/capturerequest.cpp @@ -0,0 +1,86 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "capturerequest.h" +#include "src/utils/screenshotsaver.h" +#include +#include + +CaptureRequest::CaptureRequest(CaptureRequest::CaptureMode mode, + const uint delay, const QString &path, + const QVariant &data, + CaptureRequest::ExportTask tasks) : + m_mode(mode), m_delay(delay), m_path(path), m_tasks(tasks), + m_data(data), m_forcedID(false), m_id(0) +{ + +} + +void CaptureRequest::setStaticID(uint id) { + m_forcedID = true; + m_id = id; +} + +uint CaptureRequest::id() const { + if (m_forcedID) { + return m_id; + } + + uint id = 0; + QVectorv; + v << qHash(m_mode) << qHash(m_delay * QDateTime::currentMSecsSinceEpoch()) + << qHash(m_path) << qHash(m_tasks) << m_data.toInt(); + for(uint i : v) { + id ^= i + 0x9e3779b9 + (id << 6) + (id >> 2); + } + return id; +} + +CaptureRequest::CaptureMode CaptureRequest::captureMode() const { + return m_mode; +} + +uint CaptureRequest::delay() const { + return m_delay; +} + +QString CaptureRequest::path() const { + return m_path; +} + +QVariant CaptureRequest::data() const { + return m_data; +} + +void CaptureRequest::addTask(CaptureRequest::ExportTask task) { + m_tasks |= task; +} + +void CaptureRequest::exportCapture(const QPixmap &p) { + if ((m_tasks & ExportTask::FILESYSTEM_SAVE_TASK) != ExportTask::NO_TASK) { + if (m_path.isEmpty()) { + ScreenshotSaver().saveToFilesystemGUI(p); + } else { + ScreenshotSaver().saveToFilesystem(p, m_path); + } + } + + if ((m_tasks & ExportTask::CLIPBOARD_SAVE_TASK) != ExportTask::NO_TASK) { + ScreenshotSaver().saveToClipboard(p); + } + +} diff --git a/flameshot-0.6.0/src/core/capturerequest.h b/flameshot-0.6.0/src/core/capturerequest.h new file mode 100644 index 0000000000000000000000000000000000000000..fc65c8b3fa6365e542c68ac4e5ac09fcf83e70fd --- /dev/null +++ b/flameshot-0.6.0/src/core/capturerequest.h @@ -0,0 +1,80 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include +#include + +class CaptureRequest { +public: + enum CaptureMode { + FULLSCREEN_MODE, + GRAPHICAL_MODE, + SCREEN_MODE, + }; + + enum ExportTask { + NO_TASK = 0, + CLIPBOARD_SAVE_TASK = 1, + FILESYSTEM_SAVE_TASK = 2, + }; + + CaptureRequest(CaptureMode mode, + const uint delay = 0, + const QString &path = "", + const QVariant &data = QVariant(), + ExportTask tasks = NO_TASK); + + void setStaticID(uint id); + + uint id() const; + uint delay() const; + QString path() const; + QVariant data() const; + CaptureMode captureMode() const; + + void addTask(ExportTask task); + void exportCapture(const QPixmap &p); + +private: + CaptureMode m_mode; + uint m_delay; + QString m_path; + ExportTask m_tasks; + QVariant m_data; + + bool m_forcedID; + uint m_id; +}; + +using eTask = CaptureRequest::ExportTask; + +inline eTask operator|(const eTask &a, const eTask &b) { + return static_cast(static_cast(a) | static_cast(b)); +} + +inline eTask operator&(const eTask &a, const eTask &b) { + return static_cast(static_cast(a) & static_cast(b)); +} + +inline eTask& operator|=(eTask &a, const eTask &b) { + a = static_cast(static_cast(a) | static_cast(b)); + return a; +} + diff --git a/flameshot-0.6.0/src/core/controller.cpp b/flameshot-0.6.0/src/core/controller.cpp new file mode 100644 index 0000000000000000000000000000000000000000..459ec35430e420c172bdc8ebc74ddfc2deaf1556 --- /dev/null +++ b/flameshot-0.6.0/src/core/controller.cpp @@ -0,0 +1,259 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "controller.h" +#include "src/widgets/capture/capturewidget.h" +#include "src/utils/confighandler.h" +#include "src/widgets/infowindow.h" +#include "src/config/configwindow.h" +#include "src/widgets/capture/capturebutton.h" +#include "src/utils/systemnotification.h" +#include "src/utils/screengrabber.h" +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_WIN +#include "src/core/globalshortcutfilter.h" +#endif + +// Controller is the core component of Flameshot, creates the trayIcon and +// launches the capture widget + +Controller::Controller() : m_captureWindow(nullptr) { + qApp->setQuitOnLastWindowClosed(false); + + // init tray icon +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + if (!ConfigHandler().disabledTrayIconValue()) { + enableTrayIcon(); + } +#elif defined(Q_OS_WIN) + enableTrayIcon(); + + GlobalShortcutFilter *nativeFilter = new GlobalShortcutFilter(this); + qApp->installNativeEventFilter(nativeFilter); + connect(nativeFilter, &GlobalShortcutFilter::printPressed, + this, [this](){ + this->requestCapture(CaptureRequest(CaptureRequest::GRAPHICAL_MODE)); + }); +#endif + + QString StyleSheet = CaptureButton::globalStyleSheet(); + qApp->setStyleSheet(StyleSheet); +} + +Controller *Controller::getInstance() { + static Controller c; + return &c; +} + +void Controller::enableExports() { + connect(this, &Controller::captureTaken, + this, &Controller::handleCaptureTaken); + connect(this, &Controller::captureFailed, + this, &Controller::handleCaptureFailed); +} + +void Controller::requestCapture(const CaptureRequest &request) { + uint id = request.id(); + m_requestMap.insert(id, request); + + switch (request.captureMode()) { + case CaptureRequest::FULLSCREEN_MODE: + doLater(request.delay(), this, [this, id](){ + this->startFullscreenCapture(id); + }); + break; + case CaptureRequest::SCREEN_MODE: { + int &&number = request.data().toInt(); + doLater(request.delay(), this, [this, id, number](){ + this->startScreenGrab(id, number); + }); + break; + } case CaptureRequest::GRAPHICAL_MODE: { + QString &&path = request.path(); + doLater(request.delay(), this, [this, id, path](){ + this->startVisualCapture(id, path); + }); + break; + } default: + emit captureFailed(id); + break; + } +} + +// creation of a new capture in GUI mode +void Controller::startVisualCapture(const uint id, const QString &forcedSavePath) { + if (!m_captureWindow) { + QWidget *modalWidget = nullptr; + do { + modalWidget = qApp->activeModalWidget(); + if (modalWidget) { + modalWidget->close(); + modalWidget->deleteLater(); + } + } while (modalWidget); + + m_captureWindow = new CaptureWidget(id, forcedSavePath); + //m_captureWindow = new CaptureWidget(id, forcedSavePath, false); // debug + connect(m_captureWindow, &CaptureWidget::captureFailed, + this, &Controller::captureFailed); + connect(m_captureWindow, &CaptureWidget::captureTaken, + this, &Controller::captureTaken); + +#ifdef Q_OS_WIN + m_captureWindow->show(); +#else + m_captureWindow->showFullScreen(); + //m_captureWindow->show(); // Debug +#endif + } else { + emit captureFailed(id); + } +} + +void Controller::startScreenGrab(const uint id, const int screenNumber) { + bool ok = true; + int n = screenNumber; + + if (n < 0) { + QPoint globalCursorPos = QCursor::pos(); + n = qApp->desktop()->screenNumber(globalCursorPos); + } + QPixmap p(ScreenGrabber().grabScreen(n, ok)); + if (ok) { + emit captureTaken(id, p); + } else { + emit captureFailed(id); + } +} + +// creation of the configuration window +void Controller::openConfigWindow() { + if (!m_configWindow) { + m_configWindow = new ConfigWindow(); + m_configWindow->show(); + } +} + +// creation of the window of information +void Controller::openInfoWindow() { + if (!m_infoWindow) { + m_infoWindow = new InfoWindow(); + } +} + +void Controller::enableTrayIcon() { + if (m_trayIcon) { + return; + } + ConfigHandler().setDisabledTrayIcon(false); + QAction *captureAction = new QAction(tr("&Take Screenshot"), this); + connect(captureAction, &QAction::triggered, this, [this](){ + // Wait 400 ms to hide the QMenu + doLater(400, this, [this](){ this->startVisualCapture(); }); + }); + QAction *configAction = new QAction(tr("&Configuration"), this); + connect(configAction, &QAction::triggered, this, + &Controller::openConfigWindow); + QAction *infoAction = new QAction(tr("&Information"), this); + connect(infoAction, &QAction::triggered, this, + &Controller::openInfoWindow); + QAction *quitAction = new QAction(tr("&Quit"), this); + connect(quitAction, &QAction::triggered, qApp, + &QCoreApplication::quit); + + QMenu *trayIconMenu = new QMenu(); + trayIconMenu->addAction(captureAction); + trayIconMenu->addAction(configAction); + trayIconMenu->addAction(infoAction); + trayIconMenu->addSeparator(); + trayIconMenu->addAction(quitAction); + + m_trayIcon = new QSystemTrayIcon(); + m_trayIcon->setToolTip("Flameshot"); + m_trayIcon->setContextMenu(trayIconMenu); + QIcon trayicon = QIcon::fromTheme("flameshot-tray", QIcon(":img/app/flameshot.png")); + m_trayIcon->setIcon(trayicon); + + auto trayIconActivated = [this](QSystemTrayIcon::ActivationReason r){ + if (r == QSystemTrayIcon::Trigger) { + startVisualCapture(); + } + }; + connect(m_trayIcon, &QSystemTrayIcon::activated, this, trayIconActivated); + m_trayIcon->show(); +} + +void Controller::disableTrayIcon() { +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + if (m_trayIcon) { + m_trayIcon->deleteLater(); + } + ConfigHandler().setDisabledTrayIcon(true); +#endif +} + +void Controller::sendTrayNotification( + const QString &text, + const QString &title, + const int timeout) +{ + if (m_trayIcon) { + m_trayIcon->showMessage(title, text, QSystemTrayIcon::Information, timeout); + } +} + +void Controller::updateConfigComponents() { + if (m_configWindow) { + m_configWindow->updateChildren(); + } +} + +void Controller::startFullscreenCapture(const uint id) { + bool ok = true; + QPixmap p(ScreenGrabber().grabEntireDesktop(ok)); + if (ok) { + emit captureTaken(id, p); + } else { + emit captureFailed(id); + } +} + +void Controller::handleCaptureTaken(uint id, QPixmap p) { + auto it = m_requestMap.find(id); + if (it != m_requestMap.end()) { + it.value().exportCapture(p); + m_requestMap.erase(it); + } +} + +void Controller::handleCaptureFailed(uint id) { + m_requestMap.remove(id); +} + +void Controller::doLater(int msec, QObject *receiver, lambda func) { + QTimer *timer = new QTimer(receiver); + QObject::connect(timer, &QTimer::timeout, receiver, + [timer, func](){ func(); timer->deleteLater(); }); + timer->setInterval(msec); + timer->start(); +} diff --git a/flameshot-0.6.0/src/core/controller.h b/flameshot-0.6.0/src/core/controller.h new file mode 100644 index 0000000000000000000000000000000000000000..6d80a4b2d9a1e2e6630ea4d55181ef1617077155 --- /dev/null +++ b/flameshot-0.6.0/src/core/controller.h @@ -0,0 +1,84 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/core/capturerequest.h" +#include +#include +#include +#include +#include +#include + +class CaptureWidget; +class ConfigWindow; +class InfoWindow; +class QSystemTrayIcon; + +using lambda = std::function; + +class Controller : public QObject { + Q_OBJECT + +public: + static Controller* getInstance(); + + Controller(const Controller&) = delete; + void operator =(const Controller&) = delete; + + void enableExports(); + +signals: + void captureTaken(uint id, QPixmap p); + void captureFailed(uint id); + +public slots: + void requestCapture(const CaptureRequest &request); + + void openConfigWindow(); + void openInfoWindow(); + void enableTrayIcon(); + void disableTrayIcon(); + void sendTrayNotification(const QString &text, + const QString &title = "Flameshot Info", + const int timeout = 5000); + + void updateConfigComponents(); + +private slots: + void startFullscreenCapture(const uint id = 0); + void startVisualCapture(const uint id = 0, + const QString &forcedSavePath = QString()); + void startScreenGrab(const uint id = 0, const int screenNumber = -1); + + void handleCaptureTaken(uint id, QPixmap p); + void handleCaptureFailed(uint id); + +private: + Controller(); + + // replace QTimer::singleShot introduced in Qt 5.4 + // the actual target Qt version is 5.3 + void doLater(int msec, QObject *receiver, lambda func); + + QMap m_requestMap; + QPointer m_captureWindow; + QPointer m_infoWindow; + QPointer m_configWindow; + QPointer m_trayIcon; +}; diff --git a/flameshot-0.6.0/src/core/flameshotdbusadapter.cpp b/flameshot-0.6.0/src/core/flameshotdbusadapter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..92b85d8d206e98adc79e41ebed08264e92464cff --- /dev/null +++ b/flameshot-0.6.0/src/core/flameshotdbusadapter.cpp @@ -0,0 +1,101 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "flameshotdbusadapter.h" +#include "src/utils/confighandler.h" +#include "src/utils/screengrabber.h" +#include "src/core/controller.h" +#include "src/utils/screenshotsaver.h" +#include "src/utils/systemnotification.h" +#include +FlameshotDBusAdapter::FlameshotDBusAdapter(QObject *parent) + : QDBusAbstractAdaptor(parent) +{ + auto controller = Controller::getInstance(); + connect(controller, &Controller::captureFailed, + this, &FlameshotDBusAdapter::captureFailed); + connect(controller, &Controller::captureTaken, + this, &FlameshotDBusAdapter::handleCaptureTaken); +} + +FlameshotDBusAdapter::~FlameshotDBusAdapter() { + +} + +void FlameshotDBusAdapter::graphicCapture(QString path, int delay, uint id) { + CaptureRequest req(CaptureRequest::GRAPHICAL_MODE, delay, path); +// if (toClipboard) { +// req.addTask(CaptureRequest::CLIPBOARD_SAVE_TASK); +// } + req.setStaticID(id); + Controller::getInstance()->requestCapture(req); +} + +void FlameshotDBusAdapter::fullScreen( + QString path, bool toClipboard, int delay, uint id) +{ + CaptureRequest req(CaptureRequest::FULLSCREEN_MODE, delay, path); + if (toClipboard) { + req.addTask(CaptureRequest::CLIPBOARD_SAVE_TASK); + } + if (!path.isEmpty()) { + req.addTask(CaptureRequest::FILESYSTEM_SAVE_TASK); + } + req.setStaticID(id); + Controller::getInstance()->requestCapture(req); +} + +void FlameshotDBusAdapter::captureScreen(int number, QString path, + bool toClipboard, int delay, uint id) +{ + CaptureRequest req(CaptureRequest::SCREEN_MODE, delay, path, number); + if (toClipboard) { + req.addTask(CaptureRequest::CLIPBOARD_SAVE_TASK); + } + if (!path.isEmpty()) { + req.addTask(CaptureRequest::FILESYSTEM_SAVE_TASK); + } + req.setStaticID(id); + Controller::getInstance()->requestCapture(req); +} + +void FlameshotDBusAdapter::openConfig() { + Controller::getInstance()->openConfigWindow(); +} + +void FlameshotDBusAdapter::trayIconEnabled(bool enabled) { + auto controller = Controller::getInstance(); + if (enabled) { + controller->enableTrayIcon(); + } else { + controller->disableTrayIcon(); + } +} + +void FlameshotDBusAdapter::autostartEnabled(bool enabled) { + ConfigHandler().setStartupLaunch(enabled); + auto controller = Controller::getInstance(); + // Autostart is not saved in a .ini file, requires manual update + controller->updateConfigComponents(); +} + +void FlameshotDBusAdapter::handleCaptureTaken(uint id, const QPixmap &p) { + QByteArray byteArray; + QBuffer buffer(&byteArray); + p.save(&buffer, "PNG"); + emit captureTaken(id, byteArray); +} diff --git a/flameshot-0.6.0/src/core/flameshotdbusadapter.h b/flameshot-0.6.0/src/core/flameshotdbusadapter.h new file mode 100644 index 0000000000000000000000000000000000000000..d2c2074b7593532f71aedf699f88d446ffbc3e2e --- /dev/null +++ b/flameshot-0.6.0/src/core/flameshotdbusadapter.h @@ -0,0 +1,45 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include "src/core/controller.h" + +class FlameshotDBusAdapter : public QDBusAbstractAdaptor { + Q_OBJECT + Q_CLASSINFO("D-Bus Interface", "org.dharkael.Flameshot") + +public: + explicit FlameshotDBusAdapter(QObject *parent = nullptr); + virtual ~FlameshotDBusAdapter(); + +signals: + void captureTaken(uint id, QByteArray rawImage); + void captureFailed(uint id); + +public slots: + Q_NOREPLY void graphicCapture(QString path, int delay, uint id); + Q_NOREPLY void fullScreen(QString path, bool toClipboard, int delay, uint id); + Q_NOREPLY void captureScreen(int number, QString path, bool toClipboard, int delay, uint id); + Q_NOREPLY void openConfig(); + Q_NOREPLY void trayIconEnabled(bool enabled); + Q_NOREPLY void autostartEnabled(bool enabled); + +private slots: + void handleCaptureTaken(uint id, const QPixmap &p); +}; diff --git a/flameshot-0.6.0/src/core/globalshortcutfilter.cpp b/flameshot-0.6.0/src/core/globalshortcutfilter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..58d83c888f8c373e2f3f7a4ac973c02883b5b4b7 --- /dev/null +++ b/flameshot-0.6.0/src/core/globalshortcutfilter.cpp @@ -0,0 +1,51 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "globalshortcutfilter.h" +#include "src/core/controller.h" +#include + +GlobalShortcutFilter::GlobalShortcutFilter(QObject *parent) : + QObject(parent) +{ + // Forced Print Screen + if (RegisterHotKey(NULL, 1, 0, VK_SNAPSHOT)) { + // ok + } +} + +bool GlobalShortcutFilter::nativeEventFilter( + const QByteArray &eventType, + void *message, + long *result) +{ + Q_UNUSED(eventType); + Q_UNUSED(result); + + MSG* msg = static_cast(message); + if (msg->message == WM_HOTKEY) { + //const quint32 keycode = HIWORD(msg->lParam); + //const quint32 modifiers = LOWORD(msg->lParam); + + // TODO: this is just a temporal workwrround, proper global + // support would need custom shortcuts defined by the user. + Controller::getInstance()->requestCapture( + CaptureRequest(CaptureRequest::GRAPHICAL_MODE)); + return true; + } + return false; +} diff --git a/flameshot-0.6.0/src/core/globalshortcutfilter.h b/flameshot-0.6.0/src/core/globalshortcutfilter.h new file mode 100644 index 0000000000000000000000000000000000000000..827fa518c32220588343d683977adff8b5c91264 --- /dev/null +++ b/flameshot-0.6.0/src/core/globalshortcutfilter.h @@ -0,0 +1,38 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include + +class GlobalShortcutFilter : public QObject, public QAbstractNativeEventFilter { + Q_OBJECT +public: + explicit GlobalShortcutFilter(QObject *parent = nullptr); + + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); + +signals: + void printPressed(); + +private: + quint32 getNativeModifier(Qt::KeyboardModifiers modifiers); + quint32 nativeKeycode(Qt::Key key); + bool registerShortcut(quint32 nativeKey, quint32 nativeMods); + bool unregisterShortcut(quint32 nativeKey, quint32 nativeMods); +}; diff --git a/flameshot-0.6.0/src/imgur.pri b/flameshot-0.6.0/src/imgur.pri new file mode 100644 index 0000000000000000000000000000000000000000..6e34b1e14c4aba96f00a4ff5920cd9da97c787d9 --- /dev/null +++ b/flameshot-0.6.0/src/imgur.pri @@ -0,0 +1,7 @@ +# Use default Imgur client_id if user did not pass +# this variable to qmake +isEmpty(IMGUR_CLIENT_ID) { + IMGUR_CLIENT_ID = "313baf0c7b4d3ff" +} + +DEFINES += IMGUR_CLIENT_ID=\\\"$${IMGUR_CLIENT_ID}\\\" diff --git a/flameshot-0.6.0/src/main.cpp b/flameshot-0.6.0/src/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83fa1c1a5e6504beeff12821493d80f5fcea44fd --- /dev/null +++ b/flameshot-0.6.0/src/main.cpp @@ -0,0 +1,421 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "src/core/controller.h" +#include "singleapplication.h" +#include "src/utils/filenamehandler.h" +#include "src/utils/confighandler.h" +#include "src/cli/commandlineparser.h" +#include "src/utils/systemnotification.h" +#include "src/utils/pathinfo.h" +#include "src/core/capturerequest.h" +#include +#include +#include +#include +#include + +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +#include "src/core/flameshotdbusadapter.h" +#include "src/utils/dbusutils.h" +#include +#include +#endif + +int main(int argc, char *argv[]) { + // required for the button serialization + // TODO: change to QVector in v1.0 + qRegisterMetaTypeStreamOperators >("QList"); + qApp->setApplicationVersion(static_cast(APP_VERSION)); + + // no arguments, just launch Flameshot + if (argc == 1) { + SingleApplication app(argc, argv); + + QTranslator translator; + QStringList trPaths = PathInfo::translationsPaths(); + + for (const QString &path: trPaths) { + bool match = translator.load(QLocale(), + "Internationalization", "_", + path); + if (match) { + break; + } + } + + app.installTranslator(&translator); + app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true); + app.setApplicationName("flameshot"); + app.setOrganizationName("Dharkael"); + + auto c = Controller::getInstance(); +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + new FlameshotDBusAdapter(c); + QDBusConnection dbus = QDBusConnection::sessionBus(); + if (!dbus.isConnected()) { + SystemNotification().sendMessage( + QObject::tr("Unable to connect via DBus")); + } + dbus.registerObject("/", c); + dbus.registerService("org.dharkael.Flameshot"); +#endif + // Exporting captures must be connected after the dbus interface + // or the dbus signal gets blocked until we end the exports. + c->enableExports(); + return app.exec(); + } + +#ifndef Q_OS_WIN + /*--------------| + * CLI parsing | + * ------------*/ + QCoreApplication app(argc, argv); + app.setApplicationName("flameshot"); + app.setOrganizationName("Dharkael"); + app.setApplicationVersion(qApp->applicationVersion()); + CommandLineParser parser; + // Add description + parser.setDescription( + "Powerful yet simple to use screenshot software."); + parser.setGeneralErrorMessage("See 'flameshot --help'."); + // Arguments + CommandArgument fullArgument("full", "Capture the entire desktop."); + CommandArgument guiArgument("gui", "Start a manual capture in GUI mode."); + CommandArgument configArgument("config", "Configure flameshot."); + CommandArgument screenArgument("screen", "Capture a single screen."); + + // Options + CommandOption pathOption( + {"p", "path"}, + "Path where the capture will be saved", + "path"); + CommandOption clipboardOption( + {"c", "clipboard"}, + "Save the capture to the clipboard"); + CommandOption delayOption( + {"d", "delay"}, + "Delay time in milliseconds", + "milliseconds"); + CommandOption filenameOption( + {"f", "filename"}, + "Set the filename pattern", + "pattern"); + CommandOption trayOption( + {"t", "trayicon"}, + "Enable or disable the trayicon", + "bool"); + CommandOption autostartOption( + {"a", "autostart"}, + "Enable or disable run at startup", + "bool"); + CommandOption showHelpOption( + {"s", "showhelp"}, + "Show the help message in the capture mode", + "bool"); + CommandOption mainColorOption( + {"m", "maincolor"}, + "Define the main UI color", + "color-code"); + CommandOption contrastColorOption( + {"k", "contrastcolor"}, + "Define the contrast UI color", + "color-code"); + CommandOption rawImageOption( + {"r", "raw"}, + "Print raw PNG capture"); + CommandOption screenNumberOption( + {"n", "number"}, + "Define the screen to capture,\ndefault: screen containing the cursor", + "Screen number", "-1"); + + // Add checkers + auto colorChecker = [&parser](const QString &colorCode) -> bool { + QColor parsedColor(colorCode); + return parsedColor.isValid() && parsedColor.alphaF() == 1.0; + }; + QString colorErr = "Invalid color, " + "this flag supports the following formats:\n" + "- #RGB (each of R, G, and B is a single hex digit)\n" + "- #RRGGBB\n- #RRRGGGBBB\n" + "- #RRRRGGGGBBBB\n" + "- Named colors like 'blue' or 'red'\n" + "You may need to escape the '#' sign as in '\\#FFF'"; + + const QString delayErr = "Invalid delay, it must be higher than 0"; + const QString numberErr = "Invalid screen number, it must be non negative"; + auto numericChecker = [&parser](const QString &delayValue) -> bool { + int value = delayValue.toInt(); + return value >= 0; + }; + + const QString pathErr = "Invalid path, it must be a real path in the system"; + auto pathChecker = [&parser, pathErr](const QString &pathValue) -> bool { + bool res = QDir(pathValue).exists(); + if (!res) { + SystemNotification().sendMessage(QObject::tr(pathErr.toLatin1().data())); + } + return res; + }; + + const QString booleanErr = "Invalid value, it must be defined as 'true' or 'false'"; + auto booleanChecker = [&parser](const QString &value) -> bool { + return value == "true" || value == "false"; + }; + + contrastColorOption.addChecker(colorChecker, colorErr); + mainColorOption.addChecker(colorChecker, colorErr); + delayOption.addChecker(numericChecker, delayErr); + pathOption.addChecker(pathChecker, pathErr); + trayOption.addChecker(booleanChecker, booleanErr); + autostartOption.addChecker(booleanChecker, booleanErr); + showHelpOption.addChecker(booleanChecker, booleanErr); + screenNumberOption.addChecker(numericChecker, numberErr); + + // Relationships + parser.AddArgument(guiArgument); + parser.AddArgument(screenArgument); + parser.AddArgument(fullArgument); + parser.AddArgument(configArgument); + auto helpOption = parser.addHelpOption(); + auto versionOption = parser.addVersionOption(); + parser.AddOptions({ pathOption, delayOption, rawImageOption }, guiArgument); + parser.AddOptions({ screenNumberOption, clipboardOption,pathOption, + delayOption, rawImageOption }, + screenArgument); + parser.AddOptions({ pathOption, clipboardOption, delayOption, rawImageOption }, + fullArgument); + parser.AddOptions({ autostartOption, filenameOption, trayOption, + showHelpOption, mainColorOption, contrastColorOption }, + configArgument); + // Parse + if (!parser.parse(app.arguments())) { + goto finish; + } + + // PROCESS DATA + //-------------- + if (parser.isSet(helpOption) || parser.isSet(versionOption)) { + } + else if (parser.isSet(guiArgument)) { // GUI + QString pathValue = parser.value(pathOption); + int delay = parser.value(delayOption).toInt(); + bool isRaw = parser.isSet(rawImageOption); + DBusUtils dbusUtils; + CaptureRequest req(CaptureRequest::GRAPHICAL_MODE, delay, pathValue); + uint id = req.id(); + + // Send message + QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", + "/", "", "graphicCapture"); + m << pathValue << delay << id; + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + dbusUtils.checkDBusConnection(sessionBus); + sessionBus.call(m); + + if (isRaw) { + dbusUtils.connectPrintCapture(sessionBus, id); + QTimer t; + t.setInterval(delay + 1000 * 60 * 15); // 15 minutes timeout + QObject::connect(&t, &QTimer::timeout, qApp, + &QCoreApplication::quit); + t.start(); + // wait + app.exec(); + } + } + else if (parser.isSet(fullArgument)) { // FULL + QString pathValue = parser.value(pathOption); + int delay = parser.value(delayOption).toInt(); + bool toClipboard = parser.isSet(clipboardOption); + bool isRaw = parser.isSet(rawImageOption); + // Not a valid command + if (!isRaw && !toClipboard && pathValue.isEmpty()) { + QTextStream out(stdout); + out << "Invalid format, set where to save the content with one of " + << "the following flags:\n " + << pathOption.dashedNames().join(", ") << "\n " + << rawImageOption.dashedNames().join(", ") << "\n " + << clipboardOption.dashedNames().join(", ") << "\n\n"; + parser.parse(QStringList() << argv[0] << "full" << "-h"); + goto finish; + } + + CaptureRequest req(CaptureRequest::FULLSCREEN_MODE, delay, pathValue); + if (toClipboard) { + req.addTask(CaptureRequest::CLIPBOARD_SAVE_TASK); + } + if (!pathValue.isEmpty()) { + req.addTask(CaptureRequest::FILESYSTEM_SAVE_TASK); + } + uint id = req.id(); + DBusUtils dbusUtils; + + // Send message + QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", + "/", "", "fullScreen"); + m << pathValue << toClipboard << delay << id; + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + dbusUtils.checkDBusConnection(sessionBus); + sessionBus.call(m); + + if (isRaw) { + dbusUtils.connectPrintCapture(sessionBus, id); + // timeout just in case + QTimer t; + t.setInterval(delay + 2000); + QObject::connect(&t, &QTimer::timeout, qApp, + &QCoreApplication::quit); + t.start(); + // wait + app.exec(); + } + } + else if (parser.isSet(screenArgument)) { // SCREEN + QString numberStr = parser.value(screenNumberOption); + int number = numberStr.startsWith("-") ? -1 : numberStr.toInt(); + QString pathValue = parser.value(pathOption); + int delay = parser.value(delayOption).toInt(); + bool toClipboard = parser.isSet(clipboardOption); + bool isRaw = parser.isSet(rawImageOption); + // Not a valid command + if (!isRaw && !toClipboard && pathValue.isEmpty()) { + QTextStream out(stdout); + out << "Invalid format, set where to save the content with one of " + << "the following flags:\n " + << pathOption.dashedNames().join(", ") << "\n " + << rawImageOption.dashedNames().join(", ") << "\n " + << clipboardOption.dashedNames().join(", ") << "\n\n"; + parser.parse(QStringList() << argv[0] << "screen" << "-h"); + goto finish; + } + + CaptureRequest req(CaptureRequest::SCREEN_MODE, + delay, pathValue, number); + if (toClipboard) { + req.addTask(CaptureRequest::CLIPBOARD_SAVE_TASK); + } + if (!pathValue.isEmpty()) { + req.addTask(CaptureRequest::FILESYSTEM_SAVE_TASK); + } + uint id = req.id(); + DBusUtils dbusUtils; + + // Send message + QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", + "/", "", "captureScreen"); + m << number << pathValue << toClipboard << delay << id; + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + dbusUtils.checkDBusConnection(sessionBus); + sessionBus.call(m); + + if (isRaw) { + dbusUtils.connectPrintCapture(sessionBus, id); + // timeout just in case + QTimer t; + t.setInterval(delay + 2000); + QObject::connect(&t, &QTimer::timeout, qApp, + &QCoreApplication::quit); + t.start(); + // wait + app.exec(); + } + } + else if (parser.isSet(configArgument)) { // CONFIG + bool autostart = parser.isSet(autostartOption); + bool filename = parser.isSet(filenameOption); + bool tray = parser.isSet(trayOption); + bool help = parser.isSet(showHelpOption); + bool mainColor = parser.isSet(mainColorOption); + bool contrastColor = parser.isSet(contrastColorOption); + bool someFlagSet = (filename || tray || help || + mainColor || contrastColor); + ConfigHandler config; + if (autostart) { + QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", + "/", "", "autostartEnabled"); + if (parser.value(autostartOption) == "false") { + m << false; + } else if (parser.value(autostartOption) == "true") { + m << true; + } + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + if (!sessionBus.isConnected()) { + SystemNotification().sendMessage( + QObject::tr("Unable to connect via DBus")); + } + sessionBus.call(m); + } + if (filename) { + QString newFilename(parser.value(filenameOption)); + config.setFilenamePattern(newFilename); + FileNameHandler fh; + QTextStream(stdout) + << QStringLiteral("The new pattern is '%1'\n" + "Parsed pattern example: %2\n").arg(newFilename) + .arg(fh.parsedPattern()); + } + if (tray) { + QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", + "/", "", "trayIconEnabled"); + if (parser.value(trayOption) == "false") { + m << false; + } else if (parser.value(trayOption) == "true") { + m << true; + } + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + if (!sessionBus.isConnected()) { + SystemNotification().sendMessage( + QObject::tr("Unable to connect via DBus")); + } + sessionBus.call(m); + } + if (help) { + if (parser.value(showHelpOption) == "false") { + config.setShowHelp(false); + } else if (parser.value(showHelpOption) == "true") { + config.setShowHelp(true); + } + } + if (mainColor) { + QString colorCode = parser.value(mainColorOption); + QColor parsedColor(colorCode); + config.setUIMainColor(parsedColor); + } + if (contrastColor) { + QString colorCode = parser.value(contrastColorOption); + QColor parsedColor(colorCode); + config.setUIContrastColor(parsedColor); + } + + // Open gui when no options + if (!someFlagSet) { + QDBusMessage m = QDBusMessage::createMethodCall("org.dharkael.Flameshot", + "/", "", "openConfig"); + QDBusConnection sessionBus = QDBusConnection::sessionBus(); + if (!sessionBus.isConnected()) { + SystemNotification().sendMessage( + QObject::tr("Unable to connect via DBus")); + } + sessionBus.call(m); + } + } +finish: + +#endif + return 0; +} diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/COPYING b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/COPYING new file mode 100644 index 0000000000000000000000000000000000000000..65c5ca88a67c30becee01c5a8816d964b03862f9 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/COPYING @@ -0,0 +1,165 @@ + 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/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/LICENSE-EXCEPTION b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/LICENSE-EXCEPTION new file mode 100644 index 0000000000000000000000000000000000000000..066981283bbc964204722213316c87e0e3031353 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/LICENSE-EXCEPTION @@ -0,0 +1,14 @@ +Linking this library statically or dynamically with other modules is making a +combined work based on this library. Thus, the terms and conditions of the +GNU Lesser General Public License version 3 cover the whole combination. + +As a special exception, the copyright holders of this library give you +permission to combine this library with independent +modules to produce an executable, and to copy and distribute the resulting +executable under terms of any of the GNU General Public licenses, as published +by the Free Software Foundation, provided that you also meet, +for each linked independent module, the terms and conditions of the license of +that module. An independent module is a module which is not derived from or +based on this library. If you modify this library, you may extend this +exception to your version of the library, but you are not obliged to do so. +If you do not wish to do so, delete this exception statement from your version. diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/README.md b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b3c0b2a5e482fb8dc88172485881592ed82a2d7e --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/README.md @@ -0,0 +1,64 @@ +Color Widgets +============= + +Here is a color dialog that is more user-friendly than the default QColorDialog +and several other color-related widgets + +The provided widgets are: + +* ColorWheel, An analog widget used to select a color +* ColorPreview, A simple widget that displays a color +* GradientSlider, A slider that has a gradient background +* HueSlider, A variant of GradientSlider that has a rainbow background +* ColorSelector, A ColorPreview that shows a ColorDialog when clicked +* ColorDialog, A dialog that uses the above widgets to provide a better user experience than QColorDialog +* ColorListWidget, A widget to edit a list of colors +* Swatch, A widget to display a color palette +* ColorPaletteWidget, A widget to use and manage a list of palettes +* Color2DSlider, An analog widget used to select 2 color components +* ColorLineEdit, A widget to manipulate a string representing a color + +they are all in the color_widgets namespace. + +See [the gallery](gallery/README.md) for more information and screenshots. + + +Using it in a project +--------------------- + +For QMake-based projects, include color_widgets.pri in the QMake project file. +For CMake-based projects, add this as subdirectory, it will be compiled as a +library and you can link the required targets to ColorWidgets-qt5. +All the required files are in ./src and ./include. + + +Installing as a Qt Designer/Creator Plugin +------------------------------------------ + +The sources for the designer plugin are in ./color_widgets_designer_plugin + +Compile the library and install in +(Qt SDK)/Tools/QtCreator/bin/designer/ +(Qt SDK)/(Qt Version)/(Toolchain)/plugins/designer + +cd build && cmake .. && make ColorWidgetsPlugin && make install + + +Latest Version +-------------- + +The latest version of the sources can be found at the following locations: + +* https://github.com/mbasaglia/Qt-Color-Widgets +* git://github.com/mbasaglia/Qt-Color-Widgets.git + + +License +------- + +LGPLv3+, See COPYING. +As a special exception, this library can be included in any project under the +terms of any of the GNU liceses, distributing the whole project under a +different GNU license, see LICENSE-EXCEPTION for details. + +Copyright (C) 2013-2017 Mattia Basaglia diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/color_widgets.pri b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/color_widgets.pri new file mode 100644 index 0000000000000000000000000000000000000000..29175aa4f69c91defb0faefb62aa030e88c1a123 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/color_widgets.pri @@ -0,0 +1,31 @@ +# Copyright (C) 2013-2017 Mattia Basaglia +# +# +# This software 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. +# +# This software 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 Color Widgets. If not, see . + +CONFIG += c++11 + +INCLUDEPATH += $$PWD/src $$PWD/include + +SOURCES += \ + $$PWD/src/color_wheel.cpp \ + $$PWD/src/color_utils.cpp + +HEADERS += \ + $$PWD/include/color_wheel.hpp \ + $$PWD/src/color_utils.hpp + +RESOURCES += \ + $$PWD/src/color_widgets.qrc + diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/color_widgets.pro b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/color_widgets.pro new file mode 100644 index 0000000000000000000000000000000000000000..4241ac2dc0778da35dacff06eccc78e3bbaf3499 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/color_widgets.pro @@ -0,0 +1,53 @@ +# +# Copyright (C) 2013-2017 Mattia Basaglia +# +# This program 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. +# +# 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 Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program. If not, see . +# +TEMPLATE=lib +CONFIG += dll +QT += core gui widgets +DEFINES += QTCOLORWIDGETS_LIBRARY + +TARGET=ColorWidgets-qt5 + +VERSION=1.0.0 + +OBJECTS_DIR = out/obj +MOC_DIR = out/generated +UI_DIR = out/generated +RCC_DIR = out/generated + +include(color_widgets.pri) + +build_all:!build_pass { + CONFIG -= build_all + CONFIG += release +} + +unix { + LIB_TARGET = lib$${TARGET}.so +} +win32 { + LIB_TARGET = $${TARGET}.dll +} + +isEmpty(PREFIX) { + PREFIX = /usr/local +} +target.path = $$PREFIX/lib +headers.path = $$PREFIX/include/QtColorWidgets +headers.files = $$HEADERS + +INSTALLS += target headers + diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/include/ColorWheel b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/include/ColorWheel new file mode 100644 index 0000000000000000000000000000000000000000..ed17f68308b84af20623c632dfeb2c36c67c5e36 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/include/ColorWheel @@ -0,0 +1 @@ +#include "color_wheel.hpp" diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/include/color_wheel.hpp b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/include/color_wheel.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ea9668defdd0950f71b2532756b5136cd93cb7a1 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/include/color_wheel.hpp @@ -0,0 +1,169 @@ +/** + * \file + * + * \author Mattia Basaglia + * + * \copyright Copyright (C) 2013-2017 Mattia Basaglia + * + * This program 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. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + */ +#ifndef COLOR_WHEEL_HPP +#define COLOR_WHEEL_HPP + +#include + +namespace color_widgets { + +/** + * \brief Display an analog widget that allows the selection of a HSV color + * + * It has an outer wheel to select the Hue and an intenal square to select + * Saturation and Lightness. + */ +class ColorWheel : public QWidget +{ + Q_OBJECT + + Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true STORED false ) + Q_PROPERTY(qreal hue READ hue WRITE setHue DESIGNABLE false ) + Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation DESIGNABLE false ) + Q_PROPERTY(qreal value READ value WRITE setValue DESIGNABLE false ) + Q_PROPERTY(unsigned wheelWidth READ wheelWidth WRITE setWheelWidth DESIGNABLE true ) + Q_PROPERTY(DisplayFlags displayFlags READ displayFlags WRITE setDisplayFlags NOTIFY displayFlagsChanged DESIGNABLE true ) + +public: + enum DisplayEnum + { + SHAPE_DEFAULT = 0x000, ///< Use the default shape + SHAPE_TRIANGLE = 0x001, ///< A triangle + SHAPE_SQUARE = 0x002, ///< A square + SHAPE_FLAGS = 0x00f, ///< Mask for the shape flags + + ANGLE_DEFAULT = 0x000, ///< Use the default rotation style + ANGLE_FIXED = 0x010, ///< The inner part doesn't rotate + ANGLE_ROTATING = 0x020, ///< The inner part follows the hue selector + ANGLE_FLAGS = 0x0f0, ///< Mask for the angle flags + + COLOR_DEFAULT = 0x000, ///< Use the default colorspace + COLOR_HSV = 0x100, ///< Use the HSV color space + COLOR_HSL = 0x200, ///< Use the HSL color space + COLOR_LCH = 0x400, ///< Use Luma Chroma Hue (Y_601') + COLOR_FLAGS = 0xf00, ///< Mask for the color space flags + + FLAGS_DEFAULT = 0x000, ///< Use all defaults + FLAGS_ALL = 0xfff ///< Mask matching all flags + }; + Q_DECLARE_FLAGS(DisplayFlags, DisplayEnum) + Q_FLAGS(DisplayFlags) + + explicit ColorWheel(QWidget *parent = nullptr); + ~ColorWheel(); + + /// Get current color + QColor color() const; + + virtual QSize sizeHint() const Q_DECL_OVERRIDE; + + /// Get current hue in the range [0-1] + qreal hue() const; + + /// Get current saturation in the range [0-1] + qreal saturation() const; + + /// Get current value in the range [0-1] + qreal value() const; + + /// Get the width in pixels of the outer wheel + unsigned int wheelWidth() const; + + /// Set the width in pixels of the outer wheel + void setWheelWidth(unsigned int w); + + /// Get display flags + DisplayFlags displayFlags(DisplayFlags mask = FLAGS_ALL) const; + + /// Set the default display flags + static void setDefaultDisplayFlags(DisplayFlags flags); + + /// Get default display flags + static DisplayFlags defaultDisplayFlags(DisplayFlags mask = FLAGS_ALL); + + /** + * @brief Set a specific display flag + * @param flag Flag replacing the mask + * @param mask Mask to be cleared + */ + void setDisplayFlag(DisplayFlags flag, DisplayFlags mask); + +public Q_SLOTS: + + /// Set current color + void setColor(QColor c); + + /** + * @param h Hue [0-1] + */ + void setHue(qreal h); + + /** + * @param s Saturation [0-1] + */ + void setSaturation(qreal s); + + /** + * @param v Value [0-1] + */ + void setValue(qreal v); + + /** + * @brief Set the display flags + * @param flags which will replace the current ones + */ + void setDisplayFlags(ColorWheel::DisplayFlags flags); + +Q_SIGNALS: + /** + * Emitted when the user selects a color or setColor is called + */ + void colorChanged(QColor); + + /** + * Emitted when the user selects a color + */ + void colorSelected(QColor); + + void displayFlagsChanged(ColorWheel::DisplayFlags flags); + + void mouseReleaseOnColor(QColor); + +protected: + void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE; + void dragEnterEvent(QDragEnterEvent* event) Q_DECL_OVERRIDE; + void dropEvent(QDropEvent* event) Q_DECL_OVERRIDE; + +private: + class Private; + Private * const p; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(ColorWheel::DisplayFlags) + +} // namespace color_widgets + +#endif // COLOR_WHEEL_HPP diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/alphaback.png b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/alphaback.png new file mode 100644 index 0000000000000000000000000000000000000000..62d5c6e5071dba04c249b40119911ff04573a425 Binary files /dev/null and b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/alphaback.png differ diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_utils.cpp b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_utils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e0bdb79390b389c3f3a4a7349c6148ed841c46d3 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_utils.cpp @@ -0,0 +1,83 @@ +/** + * \file + * + * \author Mattia Basaglia + * + * \copyright Copyright (C) 2013-2017 Mattia Basaglia + * + * This program 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. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + */ +#include "color_utils.hpp" + +namespace color_widgets { +namespace detail { + +QColor color_from_lch(qreal hue, qreal chroma, qreal luma, qreal alpha ) +{ + qreal h1 = hue*6; + qreal x = chroma*(1-qAbs(std::fmod(h1,2)-1)); + QColor col; + if ( h1 >= 0 && h1 < 1 ) + col = QColor::fromRgbF(chroma,x,0); + else if ( h1 < 2 ) + col = QColor::fromRgbF(x,chroma,0); + else if ( h1 < 3 ) + col = QColor::fromRgbF(0,chroma,x); + else if ( h1 < 4 ) + col = QColor::fromRgbF(0,x,chroma); + else if ( h1 < 5 ) + col = QColor::fromRgbF(x,0,chroma); + else if ( h1 < 6 ) + col = QColor::fromRgbF(chroma,0,x); + + qreal m = luma - color_lumaF(col); + + return QColor::fromRgbF( + qBound(0.0,col.redF()+m,1.0), + qBound(0.0,col.greenF()+m,1.0), + qBound(0.0,col.blueF()+m,1.0), + alpha); +} + +QColor color_from_hsl(qreal hue, qreal sat, qreal lig, qreal alpha ) +{ + qreal chroma = (1 - qAbs(2*lig-1))*sat; + qreal h1 = hue*6; + qreal x = chroma*(1-qAbs(std::fmod(h1,2)-1)); + QColor col; + if ( h1 >= 0 && h1 < 1 ) + col = QColor::fromRgbF(chroma,x,0); + else if ( h1 < 2 ) + col = QColor::fromRgbF(x,chroma,0); + else if ( h1 < 3 ) + col = QColor::fromRgbF(0,chroma,x); + else if ( h1 < 4 ) + col = QColor::fromRgbF(0,x,chroma); + else if ( h1 < 5 ) + col = QColor::fromRgbF(x,0,chroma); + else if ( h1 < 6 ) + col = QColor::fromRgbF(chroma,0,x); + + qreal m = lig-chroma/2; + + return QColor::fromRgbF( + qBound(0.0,col.redF()+m,1.0), + qBound(0.0,col.greenF()+m,1.0), + qBound(0.0,col.blueF()+m,1.0), + alpha); +} + +} // namespace detail +} // namespace color_widgets diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_utils.hpp b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_utils.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5e61cdc9fc6e9dc4f21d582f5278c3410fd7e5c9 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_utils.hpp @@ -0,0 +1,70 @@ +/** + * \file + * + * \author Mattia Basaglia + * + * \copyright Copyright (C) 2013-2017 Mattia Basaglia + * + * This program 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. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + */ +#include +#include + +namespace color_widgets { +namespace detail { + + +inline qreal color_chromaF(const QColor& c) +{ + qreal max = qMax(c.redF(), qMax(c.greenF(), c.blueF())); + qreal min = qMin(c.redF(), qMin(c.greenF(), c.blueF())); + return max - min; +} + +inline qreal color_lumaF(const QColor& c) +{ + return 0.30 * c.redF() + 0.59 * c.greenF() + 0.11 * c.blueF(); +} +QColor color_from_lch(qreal hue, qreal chroma, qreal luma, qreal alpha = 1 ); + +inline QColor rainbow_lch(qreal hue) +{ + return color_from_lch(hue,1,1); +} + +inline QColor rainbow_hsv(qreal hue) +{ + return QColor::fromHsvF(hue,1,1); +} + +inline qreal color_lightnessF(const QColor& c) +{ + return ( qMax(c.redF(),qMax(c.greenF(),c.blueF())) + + qMin(c.redF(),qMin(c.greenF(),c.blueF())) ) / 2; +} + +inline qreal color_HSL_saturationF(const QColor& col) +{ + qreal c = color_chromaF(col); + qreal l = color_lightnessF(col); + if ( qFuzzyCompare(l+1,1) || qFuzzyCompare(l+1,2) ) + return 0; + return c / (1-qAbs(2*l-1)); +} + +QColor color_from_hsl(qreal hue, qreal sat, qreal lig, qreal alpha = 1 ); + +} // namespace detail +} // namespace color_widgets diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..222a7ebcc31661defa7be69e9493c43a6492aa1f --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp @@ -0,0 +1,580 @@ +/** + * \file + * + * \author Mattia Basaglia + * + * \copyright Copyright (C) 2013-2017 Mattia Basaglia + * + * This program 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. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + * + */ +#include "color_wheel.hpp" + +#include +#include +#include +#include +#include +#include +#include "color_utils.hpp" +#include + +namespace color_widgets { + +enum MouseStatus +{ + Nothing, + DragCircle, + DragSquare +}; + +static const ColorWheel::DisplayFlags hard_default_flags = ColorWheel::SHAPE_TRIANGLE|ColorWheel::ANGLE_ROTATING|ColorWheel::COLOR_HSV; +static ColorWheel::DisplayFlags default_flags = hard_default_flags; +static const double selector_radius = 6; + +class ColorWheel::Private +{ +private: + ColorWheel * const w; + +public: + qreal hue, sat, val; + qreal bgBrightness; + unsigned int wheel_width; + MouseStatus mouse_status; + QPixmap hue_ring; + QImage inner_selector; + DisplayFlags display_flags; + QColor (*color_from)(qreal,qreal,qreal,qreal); + QColor (*rainbow_from_hue)(qreal); + int max_size = 128; + + explicit Private(ColorWheel *widget) + : w(widget), hue(0), sat(0), val(0), + wheel_width(20), mouse_status(Nothing), + display_flags(FLAGS_DEFAULT), + color_from(&QColor::fromHsvF), rainbow_from_hue(&detail::rainbow_hsv) + { + QColor bgColor = widget->palette().background().color(); + bgBrightness = color_widgets::detail::color_lumaF(bgColor); + } + + /// Calculate outer wheel radius from idget center + qreal outer_radius() const + { + return qMin(w->geometry().width(), w->geometry().height())/2; + } + + /// Calculate inner wheel radius from idget center + qreal inner_radius() const + { + return outer_radius()-wheel_width; + } + + /// Calculate the edge length of the inner square + qreal square_size() const + { + return inner_radius()*qSqrt(2); + } + + /// Calculate the height of the inner triangle + qreal triangle_height() const + { + return inner_radius()*3/2; + } + + /// Calculate the side of the inner triangle + qreal triangle_side() const + { + return inner_radius()*qSqrt(3); + } + + /// return line from center to given point + QLineF line_to_point(const QPoint &p) const + { + return QLineF (w->geometry().width()/2, w->geometry().height()/2, p.x(), p.y()); + } + + void render_square() + { + int width = qMin(square_size(), max_size); + QSize size(width, width); + inner_selector = QImage(size, QImage::Format_RGB32); + + for ( int y = 0; y < width; ++y ) + { + for ( int x = 0; x < width; ++x ) + { + inner_selector.setPixel( x, y, + color_from(hue,double(x)/width,double(y)/width,1).rgb()); + } + } + } + + /** + * \brief renders the selector as a triangle + * \note It's the same as a square with the edge with value=0 collapsed to a single point + */ + void render_triangle() + { + QSizeF size = selector_size(); + if ( size.height() > max_size ) + size *= max_size / size.height(); + + qreal ycenter = size.height()/2; + inner_selector = QImage(size.toSize(), QImage::Format_RGB32); + + for (int x = 0; x < inner_selector.width(); x++ ) + { + qreal pval = x / size.height(); + qreal slice_h = size.height() * pval; + for (int y = 0; y < inner_selector.height(); y++ ) + { + qreal ymin = ycenter-slice_h/2; + qreal psat = qBound(0.0,(y-ymin)/slice_h,1.0); + + inner_selector.setPixel(x,y,color_from(hue,psat,pval,1).rgb()); + } + } + } + + /// Updates the inner image that displays the saturation-value selector + void render_inner_selector() + { + if ( display_flags & ColorWheel::SHAPE_TRIANGLE ) + render_triangle(); + else + render_square(); + } + + /// Offset of the selector image + QPointF selector_image_offset() + { + if ( display_flags & SHAPE_TRIANGLE ) + return QPointF(-inner_radius(),-triangle_side()/2); + return QPointF(-square_size()/2,-square_size()/2); + } + + /** + * \brief Size of the selector when rendered to the screen + */ + QSizeF selector_size() + { + if ( display_flags & SHAPE_TRIANGLE ) + return QSizeF(triangle_height(), triangle_side()); + return QSizeF(square_size(), square_size()); + } + + + /// Rotation of the selector image + qreal selector_image_angle() + { + if ( display_flags & SHAPE_TRIANGLE ) + { + if ( display_flags & ANGLE_ROTATING ) + return -hue*360-60; + return -150; + } + else + { + if ( display_flags & ANGLE_ROTATING ) + return -hue*360-45; + else + return 180; + } + } + + /// Updates the outer ring that displays the hue selector + void render_ring() + { + hue_ring = QPixmap(outer_radius()*2,outer_radius()*2); + hue_ring.fill(Qt::transparent); + QPainter painter(&hue_ring); + painter.setRenderHint(QPainter::Antialiasing); + painter.setCompositionMode(QPainter::CompositionMode_Source); + + + const int hue_stops = 24; + QConicalGradient gradient_hue(0, 0, 0); + if ( gradient_hue.stops().size() < hue_stops ) + { + for ( double a = 0; a < 1.0; a+=1.0/(hue_stops-1) ) + { + gradient_hue.setColorAt(a,rainbow_from_hue(a)); + } + gradient_hue.setColorAt(1,rainbow_from_hue(0)); + } + + painter.translate(outer_radius(),outer_radius()); + + painter.setPen(Qt::NoPen); + painter.setBrush(QBrush(gradient_hue)); + painter.drawEllipse(QPointF(0,0),outer_radius(),outer_radius()); + + painter.setBrush(Qt::transparent);//palette().background()); + painter.drawEllipse(QPointF(0,0),inner_radius(),inner_radius()); + } + + void set_color(const QColor& c) + { + if ( display_flags & ColorWheel::COLOR_HSV ) + { + hue = qMax(0.0, c.hsvHueF()); + sat = c.hsvSaturationF(); + val = c.valueF(); + } + else if ( display_flags & ColorWheel::COLOR_HSL ) + { + hue = qMax(0.0, c.hueF()); + sat = detail::color_HSL_saturationF(c); + val = detail::color_lightnessF(c); + } + else if ( display_flags & ColorWheel::COLOR_LCH ) + { + hue = qMax(0.0, c.hsvHueF()); + sat = detail::color_chromaF(c); + val = detail::color_lumaF(c); + } + } +}; + +ColorWheel::ColorWheel(QWidget *parent) : + QWidget(parent), p(new Private(this)) +{ + setDisplayFlags(FLAGS_DEFAULT); + setAcceptDrops(true); +} + +ColorWheel::~ColorWheel() +{ + delete p; +} + +QColor ColorWheel::color() const +{ + return p->color_from(p->hue, p->sat, p->val, 1); +} + +QSize ColorWheel::sizeHint() const +{ + return QSize(p->wheel_width*5, p->wheel_width*5); +} + +qreal ColorWheel::hue() const +{ + if ( (p->display_flags & COLOR_LCH) && p->sat > 0.01 ) + return color().hueF(); + return p->hue; +} + +qreal ColorWheel::saturation() const +{ + return color().hsvSaturationF(); +} + +qreal ColorWheel::value() const +{ + return color().valueF(); +} + +unsigned int ColorWheel::wheelWidth() const +{ + return p->wheel_width; +} + +void ColorWheel::setWheelWidth(unsigned int w) +{ + p->wheel_width = w; + p->render_inner_selector(); + update(); +} + +void ColorWheel::paintEvent(QPaintEvent * ) +{ + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing); + painter.translate(geometry().width()/2,geometry().height()/2); + + // hue wheel + if(p->hue_ring.isNull()) + p->render_ring(); + + painter.drawPixmap(-p->outer_radius(), -p->outer_radius(), p->hue_ring); + + // hue selector + QColor penColor = p->bgBrightness < 0.6 ? Qt::white : Qt::black; + painter.setPen(QPen(penColor,3)); + painter.setBrush(Qt::NoBrush); + QLineF ray(0, 0, p->outer_radius(), 0); + ray.setAngle(p->hue*360); + QPointF h1 = ray.p2(); + ray.setLength(p->inner_radius()); + QPointF h2 = ray.p2(); + painter.drawLine(h1,h2); + + // lum-sat square + if(p->inner_selector.isNull()) + p->render_inner_selector(); + + painter.rotate(p->selector_image_angle()); + painter.translate(p->selector_image_offset()); + + QPointF selector_position; + if ( p->display_flags & SHAPE_SQUARE ) + { + qreal side = p->square_size(); + selector_position = QPointF(p->sat*side, p->val*side); + } + else if ( p->display_flags & SHAPE_TRIANGLE ) + { + qreal side = p->triangle_side(); + qreal height = p->triangle_height(); + qreal slice_h = side * p->val; + qreal ymin = side/2-slice_h/2; + + selector_position = QPointF(p->val*height, ymin + p->sat*slice_h); + QPolygonF triangle; + triangle.append(QPointF(0,side/2)); + triangle.append(QPointF(height,0)); + triangle.append(QPointF(height,side)); + QPainterPath clip; + clip.addPolygon(triangle); + painter.setClipPath(clip); + } + + painter.drawImage(QRectF(QPointF(0, 0), p->selector_size()), p->inner_selector); + painter.setClipping(false); + + // lum-sat selector + // we define the color of the selecto based on the background color of the widget + // in order to improve the contrast + qreal colorBrightness = color_widgets::detail::color_lumaF(color()); + if (p->bgBrightness < 0.6) // dark theme + { + bool isWhite = (colorBrightness < 0.7); + painter.setPen(QPen(isWhite ? Qt::white : Qt::black, 3)); + } + else // light theme + { + bool isWhite = (colorBrightness < 0.4 && p->val < 0.3); + painter.setPen(QPen(isWhite ? Qt::white : Qt::black, 3)); + } + painter.setBrush(Qt::NoBrush); + painter.drawEllipse(selector_position, selector_radius, selector_radius); + +} + +void ColorWheel::mouseMoveEvent(QMouseEvent *ev) +{ + if (p->mouse_status == DragCircle ) + { + p->hue = p->line_to_point(ev->pos()).angle()/360.0; + p->render_inner_selector(); + + emit colorSelected(color()); + emit colorChanged(color()); + update(); + } + else if(p->mouse_status == DragSquare) + { + QLineF glob_mouse_ln = p->line_to_point(ev->pos()); + QLineF center_mouse_ln ( QPointF(0,0), + glob_mouse_ln.p2() - glob_mouse_ln.p1() ); + + center_mouse_ln.setAngle(center_mouse_ln.angle()+p->selector_image_angle()); + center_mouse_ln.setP2(center_mouse_ln.p2()-p->selector_image_offset()); + + if ( p->display_flags & SHAPE_SQUARE ) + { + p->sat = qBound(0.0, center_mouse_ln.x2()/p->square_size(), 1.0); + p->val = qBound(0.0, center_mouse_ln.y2()/p->square_size(), 1.0); + } + else if ( p->display_flags & SHAPE_TRIANGLE ) + { + QPointF pt = center_mouse_ln.p2(); + + qreal side = p->triangle_side(); + p->val = qBound(0.0, pt.x() / p->triangle_height(), 1.0); + qreal slice_h = side * p->val; + + qreal ycenter = side/2; + qreal ymin = ycenter-slice_h/2; + + if ( slice_h > 0 ) + p->sat = qBound(0.0, (pt.y()-ymin)/slice_h, 1.0); + } + + emit colorSelected(color()); + emit colorChanged(color()); + update(); + } +} + +void ColorWheel::mousePressEvent(QMouseEvent *ev) +{ + if ( ev->buttons() & Qt::LeftButton ) + { + setFocus(); + QLineF ray = p->line_to_point(ev->pos()); + if ( ray.length() <= p->inner_radius() ) + p->mouse_status = DragSquare; + else if ( ray.length() <= p->outer_radius() ) + p->mouse_status = DragCircle; + + // Update the color + mouseMoveEvent(ev); + } +} + +void ColorWheel::mouseReleaseEvent(QMouseEvent *ev) +{ + mouseMoveEvent(ev); + p->mouse_status = Nothing; + emit mouseReleaseOnColor(color()); + +} + +void ColorWheel::resizeEvent(QResizeEvent *) +{ + p->render_ring(); + p->render_inner_selector(); +} + +void ColorWheel::setColor(QColor c) +{ + qreal oldh = p->hue; + p->set_color(c); + if (!qFuzzyCompare(oldh+1, p->hue+1)) + p->render_inner_selector(); + update(); + emit colorChanged(c); +} + +void ColorWheel::setHue(qreal h) +{ + p->hue = qBound(0.0, h, 1.0); + p->render_inner_selector(); + update(); +} + +void ColorWheel::setSaturation(qreal s) +{ + p->sat = qBound(0.0, s, 1.0); + update(); +} + +void ColorWheel::setValue(qreal v) +{ + p->val = qBound(0.0, v, 1.0); + update(); +} + + +void ColorWheel::setDisplayFlags(DisplayFlags flags) +{ + if ( ! (flags & COLOR_FLAGS) ) + flags |= default_flags & COLOR_FLAGS; + if ( ! (flags & ANGLE_FLAGS) ) + flags |= default_flags & ANGLE_FLAGS; + if ( ! (flags & SHAPE_FLAGS) ) + flags |= default_flags & SHAPE_FLAGS; + + if ( (flags & COLOR_FLAGS) != (p->display_flags & COLOR_FLAGS) ) + { + QColor old_col = color(); + if ( flags & ColorWheel::COLOR_HSL ) + { + p->hue = old_col.hueF(); + p->sat = detail::color_HSL_saturationF(old_col); + p->val = detail::color_lightnessF(old_col); + p->color_from = &detail::color_from_hsl; + p->rainbow_from_hue = &detail::rainbow_hsv; + } + else if ( flags & ColorWheel::COLOR_LCH ) + { + p->hue = old_col.hueF(); + p->sat = detail::color_chromaF(old_col); + p->val = detail::color_lumaF(old_col); + p->color_from = &detail::color_from_lch; + p->rainbow_from_hue = &detail::rainbow_lch; + } + else + { + p->hue = old_col.hsvHueF(); + p->sat = old_col.hsvSaturationF(); + p->val = old_col.valueF(); + p->color_from = &QColor::fromHsvF; + p->rainbow_from_hue = &detail::rainbow_hsv; + } + p->render_ring(); + } + + p->display_flags = flags; + p->render_inner_selector(); + update(); + emit displayFlagsChanged(flags); +} + +ColorWheel::DisplayFlags ColorWheel::displayFlags(DisplayFlags mask) const +{ + return p->display_flags & mask; +} + +void ColorWheel::setDefaultDisplayFlags(DisplayFlags flags) +{ + if ( !(flags & COLOR_FLAGS) ) + flags |= hard_default_flags & COLOR_FLAGS; + if ( !(flags & ANGLE_FLAGS) ) + flags |= hard_default_flags & ANGLE_FLAGS; + if ( !(flags & SHAPE_FLAGS) ) + flags |= hard_default_flags & SHAPE_FLAGS; + default_flags = flags; +} + +ColorWheel::DisplayFlags ColorWheel::defaultDisplayFlags(DisplayFlags mask) +{ + return default_flags & mask; +} + +void ColorWheel::setDisplayFlag(DisplayFlags flag, DisplayFlags mask) +{ + setDisplayFlags((p->display_flags&~mask)|flag); +} + +void ColorWheel::dragEnterEvent(QDragEnterEvent* event) +{ + if ( event->mimeData()->hasColor() || + ( event->mimeData()->hasText() && QColor(event->mimeData()->text()).isValid() ) ) + event->acceptProposedAction(); +} + +void ColorWheel::dropEvent(QDropEvent* event) +{ + if ( event->mimeData()->hasColor() ) + { + setColor(event->mimeData()->colorData().value()); + event->accept(); + } + else if ( event->mimeData()->hasText() ) + { + QColor col(event->mimeData()->text()); + if ( col.isValid() ) + { + setColor(col); + event->accept(); + } + } +} + +} // namespace color_widgets diff --git a/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_widgets.qrc b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_widgets.qrc new file mode 100644 index 0000000000000000000000000000000000000000..7b8cfcd304a49af2e66660d3f513c6c1ae8e7311 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/Qt-Color-Widgets/src/color_widgets.qrc @@ -0,0 +1,5 @@ + + + alphaback.png + + diff --git a/flameshot-0.6.0/src/third-party/singleapplication/CHANGELOG.md b/flameshot-0.6.0/src/third-party/singleapplication/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..4665222cf9051380c7991ec51a507e7f99a1ef64 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/CHANGELOG.md @@ -0,0 +1,162 @@ +Changelog +========= + +__3.0.10__ +---------- + +* Removed C style casts and eliminated all clang warnings. Fixed `instanceId` + reading from only one byte in the message deserialization. Cleaned up + serialization code using `QDataStream`. Changed connection type to use + `quint8 enum` rather than `char`. +* Renamed `SingleAppConnectionType` to `ConnectionType`. Added initialization + values to all `ConnectionType` enum cases. + + _Jedidiah Buck McCready_ + +__3.0.9__ +--------- + +* Added SingleApplicationPrivate::primaryPid() as a solution to allow + bringing the primary window of an application to the foreground on + Windows. + + _Eelco van Dam from Peacs BV_ + +__3.0.8__ +--------- + +* Bug fix - changed QApplication::instance() to QCoreApplication::instance() + + _Evgeniy Bazhenov_ + +__3.0.7a__ +---------- + +* Fixed compilation error with Mingw32 in MXE thanks to Vitaly Tonkacheyev. +* Removed QMutex used for thread safe behaviour. The implementation now uses + QCoreApplication::instance() to get an instance to SingleApplication for + memory deallocation. + +__3.0.6a__ +---------- + +* Reverted GetUserName API usage on Windows. Fixed bug with missing library. +* Fixed bug in the Calculator example, preventing it's window to be raised + on Windows. + + Special thanks to Charles Gunawan. + +__3.0.5a__ +---------- + +* Fixed a memory leak in the SingleApplicationPrivate destructor. + + _Sergei Moiseev_ + +__3.0.4a__ +---------- + +* Fixed shadow and uninitialised variable warnings. + + _Paul Walmsley_ + +__3.0.3a__ +---------- + +* Removed Microsoft Windows specific code for getting username due to + multiple problems and compiler differences on Windows platforms. On + Windows the shared memory block in User mode now includes the user's + home path (which contains the user's username). + +* Explicitly getting absolute path of the user's home directory as on Unix + a relative path (`~`) may be returned. + +__3.0.2a__ +---------- + +* Fixed bug on Windows when username containing wide characters causes the + library to crash. + + _Le Liu_ + +__3.0.1a__ +---------- + +* Allows the application path and version to be excluded from the server name + hash. The following flags were added for this purpose: + * `SingleApplication::Mode::ExcludeAppVersion` + * `SingleApplication::Mode::ExcludeAppPath` +* Allow a non elevated process to connect to a local server created by an + elevated process run by the same user on Windows +* Fixes a problem with upper case letters in paths on Windows + + _Le Liu_ + +__v3.0a__ +--------- + +* Depricated secondary instances count. +* Added a sendMessage() method to send a message to the primary instance. +* Added a receivedMessage() signal, emitted when a message is received from a + secondary instance. +* The SingleApplication constructor's third parameter is now a bool + specifying if the current instance should be allowed to run as a secondary + instance if there is already a primary instance. +* The SingleApplication constructor accept a fourth parameter specifying if + the SingleApplication block should be User-wide or System-wide. +* SingleApplication no longer relies on `applicationName` and + `organizationName` to be set. It instead concatenates all of the following + data and computes a `SHA256` hash which is used as the key of the + `QSharedMemory` block and the `QLocalServer`. Since at least + `applicationFilePath` is always present there is no need to explicitly set + any of the following prior to initialising `SingleApplication`. + * `QCoreApplication::applicationName` + * `QCoreApplication::applicationVersion` + * `QCoreApplication::applicationFilePath` + * `QCoreApplication::organizationName` + * `QCoreApplication::organizationDomain` + * User name or home directory path if in User mode +* The primary instance is no longer notified when a secondary instance had + been started by default. A `Mode` flag for this feature exists. +* Added `instanceNumber()` which represents a unique identifier for each + secondary instance started. When called from the primary instance will + return `0`. + +__v2.4__ +-------- + +* Stability improvements +* Support for secondary instances. +* The library now recovers safely after the primary process has crashed +and the shared memory had not been deleted. + +__v2.3__ +-------- + +* Improved pimpl design and inheritance safety. + + _Vladislav Pyatnichenko_ + +__v2.2__ +-------- + +* The `QAPPLICATION_CLASS` macro can now be defined in the file including the +Single Application header or with a `DEFINES+=` statement in the project file. + +__v2.1__ +-------- + +* A race condition can no longer occur when starting two processes nearly + simultaneously. + + Fix issue [#3](https://github.com/itay-grudev/SingleApplication/issues/3) + +__v2.0__ +-------- + +* SingleApplication is now being passed a reference to `argc` instead of a + copy. + + Fix issue [#1](https://github.com/itay-grudev/SingleApplication/issues/1) + +* Improved documentation. diff --git a/flameshot-0.6.0/src/third-party/singleapplication/LICENSE b/flameshot-0.6.0/src/third-party/singleapplication/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..85b2a149574fd1091053f7d73dd64dbdf8f5a7a5 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/LICENSE @@ -0,0 +1,24 @@ +The MIT License (MIT) + +Copyright (c) Itay Grudev 2015 - 2016 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +Note: Some of the examples include code not distributed under the terms of the +MIT License. diff --git a/flameshot-0.6.0/src/third-party/singleapplication/README.md b/flameshot-0.6.0/src/third-party/singleapplication/README.md new file mode 100644 index 0000000000000000000000000000000000000000..82e7a5b618ff919578c7aefd43c8bc407d9a771c --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/README.md @@ -0,0 +1,287 @@ +SingleApplication +================= + +This is a replacement of the QtSingleApplication for `Qt5`. + +Keeps the Primary Instance of your Application and kills each subsequent +instances. It can (if enabled) spawn secondary (non-related to the primary) +instances and can send data to the primary instance from secondary instances. + +Usage +----- + +The `SingleApplication` class inherits from whatever `Q[Core|Gui]Application` +class you specify via the `QAPPLICATION_CLASS` macro (`QCoreApplication` is the +default). Further usage is similar to the use of the `Q[Core|Gui]Application` +classes. + +The library sets up a `QLocalServer` and a `QSharedMemory` block. The first +instance of your Application is your Primary Instance. It would check if the +shared memory block exists and if not it will start a `QLocalServer` and listen +for connections. Each subsequent instance of your application would check if the +shared memory block exists and if it does, it will connect to the QLocalServer +to notify the primary instance that a new instance had been started, after which +it would terminate with status code `0`. In the Primary Instance +`SingleApplication` would emit the `instanceStarted()` signal upon detecting +that a new instance had been started. + +The library uses `stdlib` to terminate the program with the `exit()` function. + +You can use the library as if you use any other `QCoreApplication` derived +class: + +```cpp +#include +#include + +int main( int argc, char* argv[] ) +{ + SingleApplication app( argc, argv ); + + return app.exec(); +} +``` + +To include the library files I would recommend that you add it as a git +submodule to your project and include it's contents with a `.pri` file. Here is +how: + +```bash +git submodule add git@github.com:itay-grudev/SingleApplication.git singleapplication +``` + +Then include the `singleapplication.pri` file in your `.pro` project file. Also +don't forget to specify which `QCoreApplication` class your app is using if it +is not `QCoreApplication`. + +```qmake +include(singleapplication/singleapplication.pri) +DEFINES += QAPPLICATION_CLASS=QApplication +``` + +The `Instance Started` signal +------------------------ + +The SingleApplication class implements a `instanceStarted()` signal. You can +bind to that signal to raise your application's window when a new instance had +been started, for example. + +```cpp +// window is a QWindow instance +QObject::connect( + &app, + &SingleApplication::instanceStarted, + &window, + &QWindow::raise +); +``` + +Using `SingleApplication::instance()` is a neat way to get the +`SingleApplication` instance for binding to it's signals anywhere in your +program. + +__Note:__ On Windows the ability to bring the application windows to the +foreground is restricted. See [Windows specific implementations](Windows.md) +for a workaround and an example implementation. + + +Secondary Instances +------------------- + +If you want to be able to launch additional Secondary Instances (not related to +your Primary Instance) you have to enable that with the third parameter of the +`SingleApplication` constructor. The default is `false` meaning no Secondary +Instances. Here is an example of how you would start a Secondary Instance send +a message with the command line arguments to the primary instance and then shut +down. + +```cpp +int main(int argc, char *argv[]) +{ + SingleApplication app( argc, argv, true ); + + if( app.isSecondary() ) { + app.sendMessage( app.arguments().join(' ')).toUtf8() ); + app.exit( 0 ); + } + + return app.exec(); +} +``` + +*__Note:__ A secondary instance won't cause the emission of the +`instanceStarted()` signal by default. See `SingleApplication::Mode` for more +details.* + +You can check whether your instance is a primary or secondary with the following +methods: + +```cpp +app.isPrimary(); +// or +app.isSecondary(); +``` + +*__Note:__ If your Primary Instance is terminated a newly launched instance +will replace the Primary one even if the Secondary flag has been set.* + +API +--- + +### Members + +```cpp +SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 100 ) +``` + +Depending on whether `allowSecondary` is set, this constructor may terminate +your app if there is already a primary instance running. Additional `Options` +can be specified to set whether the SingleApplication block should work +user-wide or system-wide. Additionally the `Mode::SecondaryNotification` may be +used to notify the primary instance whenever a secondary instance had been +started (disabled by default). `timeout` specifies the maximum time in +milliseconds to wait for blocking operations. + +*__Note:__ `argc` and `argv` may be changed as Qt removes arguments that it +recognizes.* + +*__Note:__ `Mode::SecondaryNotification` only works if set on both the primary +and the secondary instance.* + +*__Note:__ Operating system can restrict the shared memory blocks to the same +user, in which case the User/System modes will have no effect and the block will +be user wide.* + +--- + +```cpp +bool SingleApplication::sendMessage( QByteArray message, int timeout = 100 ) +``` + +Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout +in milliseconds for blocking functions + +--- + +```cpp +bool SingleApplication::isPrimary() +``` + +Returns if the instance is the primary instance. + +--- + +```cpp +bool SingleApplication::isSecondary() +``` +Returns if the instance is a secondary instance. + +--- + +```cpp +quint32 SingleApplication::instanceId() +``` + +Returns a unique identifier for the current instance. + +--- + +```cpp +qint64 SingleApplication::primaryPid() +``` + +Returns the process ID (PID) of the primary instance. + +### Signals + +```cpp +void SingleApplication::instanceStarted() +``` + +Triggered whenever a new instance had been started, except for secondary +instances if the `Mode::SecondaryNotification` flag is not specified. + +--- + +```cpp +void SingleApplication::receivedMessage( quint32 instanceId, QByteArray message ) +``` + +Triggered whenever there is a message received from a secondary instance. + +--- + +### Flags + +```cpp +enum SingleApplication::Mode +``` + +* `Mode::User` - The SingleApplication block should apply user wide. This adds + user specific data to the key used for the shared memory and server name. + This is the default functionality. +* `Mode::System` – The SingleApplication block applies system-wide. +* `Mode::SecondaryNotification` – Whether to trigger `instanceStarted()` even + whenever secondary instances are started. +* `Mode::ExcludeAppPath` – Excludes the application path from the server name + (and memory block) hash. +* `Mode::ExcludeAppVersion` – Excludes the application version from the server + name (and memory block) hash. + +*__Note:__ `Mode::SecondaryNotification` only works if set on both the primary +and the secondary instance.* + +*__Note:__ Operating system can restrict the shared memory blocks to the same +user, in which case the User/System modes will have no effect and the block will +be user wide.* + +--- + +Versioning +---------- + +Each major version introduces either very significant changes or is not +backwards compatible with the previous version. Minor versions only add +additional features, bug fixes or performance improvements and are backwards +compatible with the previous release. See [`CHANGELOG.md`](CHANGELOG.md) for +more details. + +Implementation +-------------- + +The library is implemented with a QSharedMemory block which is thread safe and +guarantees a race condition will not occur. It also uses a QLocalSocket to +notify the main process that a new instance had been spawned and thus invoke the +`instanceStarted()` signal. + +To handle an issue on `*nix` systems, where the operating system owns the shared +memory block and if the program crashes the memory remains untouched, the +library binds to the following signals and closes the program with +`error code = 128 + signum` where signum is the number representation of the +signal listed below. Handling the signal is required in order to safely delete +the `QSharedMemory` block. Each of these signals are potentially lethal and will +results in process termination. + +* `SIGHUP` - `1`, Hangup. +* `SIGINT` - `2`, Terminal interrupt signal +* `SIGQUIT` - `3`, Terminal quit signal. +* `SIGILL` - `4`, Illegal instruction. +* `SIGABRT` - `6`, Process abort signal. +* `SIGBUS` - `7`, Access to an undefined portion of a memory object. +* `SIGFPE` - `8`, Erroneous arithmetic operation (such as division by zero). +* `SIGSEGV` - `11`, Invalid memory reference. +* `SIGSYS` - `12`, Bad system call. +* `SIGPIPE` - `13`, Write on a pipe with no one to read it. +* `SIGALRM` - `14`, Alarm clock. +* `SIGTERM` - `15`, Termination signal. +* `SIGXCPU` - `24`, CPU time limit exceeded. +* `SIGXFSZ` - `25`, File size limit exceeded. + +Additionally the library can recover from being killed with uncatchable signals +and will reset the memory block given that there are no other instances running. + +License +------- +This library and it's supporting documentation are released under +`The MIT License (MIT)` with the exception of some of the examples distributed +under the BSD license. diff --git a/flameshot-0.6.0/src/third-party/singleapplication/Windows.md b/flameshot-0.6.0/src/third-party/singleapplication/Windows.md new file mode 100644 index 0000000000000000000000000000000000000000..48b0748ce6318564a4e576d4f090ba20dbac41e3 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/Windows.md @@ -0,0 +1,46 @@ +Windows Specific Implementations +================================ + +Setting the foreground window +----------------------------- + +In the `instanceStarted()` example in the `README` we demonstrated how an +application can bring it's primary instance window whenever a second copy +of the application is started. + +On Windows the ability to bring the application windows to the foreground is +restricted, see [`AllowSetForegroundWindow()`][AllowSetForegroundWindow] for more +details. + +The background process (the primary instance) can bring its windows to the +foreground if it is allowed by the current foreground process (the secondary +instance). To bypass this `SingleApplication` must be initialized with the +`allowSecondary` parameter set to `true` and the `options` parameter must +include `Mode::SecondaryNotification`, See `SingleApplication::Mode` for more +details. + +Here is an example: + +```cpp +if( app.isSecondary() ) { + // This API requires LIBS += User32.lib to be added to the project + AllowSetForegroundWindow( DWORD( app.getPrimaryPid() ) ); +} + +if( app.isPrimary() ) { + QObject::connect( + &app, + &SingleApplication::instanceStarted, + this, + &App::instanceStarted + ); +} +``` + +```cpp +void App::instanceStarted() { + QApplication::setActiveWindow( [window/widget to set to the foreground] ); +} +``` + +[AllowSetForegroundWindow]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632668.aspx diff --git a/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.cpp b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ddb48c04aed3f9e61c60ac798dbb67f8664ba76 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.cpp @@ -0,0 +1,468 @@ +// The MIT License (MIT) +// +// Copyright (c) Itay Grudev 2015 - 2016 +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef Q_OS_UNIX + #include + #include +#endif + +#ifdef Q_OS_WIN + #include + #include +#endif + +#include "singleapplication.h" +#include "singleapplication_p.h" + + +SingleApplicationPrivate::SingleApplicationPrivate( SingleApplication *q_ptr ) : q_ptr( q_ptr ) { + server = nullptr; + socket = nullptr; +} + +SingleApplicationPrivate::~SingleApplicationPrivate() +{ + if( socket != nullptr ) { + socket->close(); + delete socket; + } + + memory->lock(); + InstancesInfo* inst = static_cast(memory->data()); + if( server != nullptr ) { + server->close(); + delete server; + inst->primary = false; + inst->primaryPid = -1; + } + memory->unlock(); + + delete memory; +} + +void SingleApplicationPrivate::genBlockServerName( int timeout ) +{ + QCryptographicHash appData( QCryptographicHash::Sha256 ); + appData.addData( "SingleApplication", 17 ); + appData.addData( SingleApplication::app_t::applicationName().toUtf8() ); + appData.addData( SingleApplication::app_t::organizationName().toUtf8() ); + appData.addData( SingleApplication::app_t::organizationDomain().toUtf8() ); + + if( ! (options & SingleApplication::Mode::ExcludeAppVersion) ) { + appData.addData( SingleApplication::app_t::applicationVersion().toUtf8() ); + } + + if( ! (options & SingleApplication::Mode::ExcludeAppPath) ) { +#ifdef Q_OS_WIN + appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() ); +#else + appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() ); +#endif + } + + // User level block requires a user specific data in the hash + if( options & SingleApplication::Mode::User ) { +#ifdef Q_OS_WIN + Q_UNUSED(timeout); + wchar_t username [ UNLEN + 1 ]; + // Specifies size of the buffer on input + DWORD usernameLength = UNLEN + 1; + if( GetUserNameW( username, &usernameLength ) ) { + appData.addData( QString::fromWCharArray(username).toUtf8() ); + } else { + appData.addData( QStandardPaths::standardLocations( QStandardPaths::HomeLocation ).join("").toUtf8() ); + } +#endif +#ifdef Q_OS_UNIX + QProcess process; + process.start( "whoami" ); + if( process.waitForFinished( timeout ) && + process.exitCode() == QProcess::NormalExit) { + appData.addData( process.readLine() ); + } else { + appData.addData( + QDir( + QStandardPaths::standardLocations( QStandardPaths::HomeLocation ).first() + ).absolutePath().toUtf8() + ); + } +#endif + } + + // Replace the backslash in RFC 2045 Base64 [a-zA-Z0-9+/=] to comply with + // server naming requirements. + blockServerName = appData.result().toBase64().replace("/", "_"); +} + +void SingleApplicationPrivate::startPrimary( bool resetMemory ) +{ + Q_Q(SingleApplication); + +#ifdef Q_OS_UNIX + // Handle any further termination signals to ensure the + // QSharedMemory block is deleted even if the process crashes + crashHandler(); +#endif + // Successful creation means that no main process exists + // So we start a QLocalServer to listen for connections + QLocalServer::removeServer( blockServerName ); + server = new QLocalServer(); + + // Restrict access to the socket according to the + // SingleApplication::Mode::User flag on User level or no restrictions + if( options & SingleApplication::Mode::User ) { + server->setSocketOptions( QLocalServer::UserAccessOption ); + } else { + server->setSocketOptions( QLocalServer::WorldAccessOption ); + } + + server->listen( blockServerName ); + QObject::connect( + server, + &QLocalServer::newConnection, + this, + &SingleApplicationPrivate::slotConnectionEstablished + ); + + // Reset the number of connections + memory->lock(); + InstancesInfo* inst = static_cast(memory->data()); + + if( resetMemory ) { + inst->secondary = 0; + } + + inst->primary = true; + inst->primaryPid = q->applicationPid(); + + memory->unlock(); + + instanceNumber = 0; +} + +void SingleApplicationPrivate::startSecondary() +{ +#ifdef Q_OS_UNIX + // Handle any further termination signals to ensure the + // QSharedMemory block is deleted even if the process crashes + crashHandler(); +#endif +} + +void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType ) +{ + // Connect to the Local Server of the Primary Instance if not already + // connected. + if( socket == nullptr ) { + socket = new QLocalSocket(); + } + + // If already connected - we are done; + if( socket->state() == QLocalSocket::ConnectedState ) + return; + + // If not connect + if( socket->state() == QLocalSocket::UnconnectedState || + socket->state() == QLocalSocket::ClosingState ) { + socket->connectToServer( blockServerName ); + } + + // Wait for being connected + if( socket->state() == QLocalSocket::ConnectingState ) { + socket->waitForConnected( msecs ); + } + + // Initialisation message according to the SingleApplication protocol + if( socket->state() == QLocalSocket::ConnectedState ) { + // Notify the parent that a new instance had been started; + QByteArray initMsg; + QDataStream writeStream(&initMsg, QIODevice::WriteOnly); + writeStream.setVersion(QDataStream::Qt_5_2); + writeStream << blockServerName.toLatin1(); + writeStream << static_cast(connectionType); + writeStream << instanceNumber; + quint16 checksum = qChecksum(initMsg.constData(), static_cast(initMsg.length())); + writeStream << checksum; + + socket->write( initMsg ); + socket->flush(); + socket->waitForBytesWritten( msecs ); + } +} + +qint64 SingleApplicationPrivate::primaryPid() +{ + qint64 pid; + + memory->lock(); + InstancesInfo* inst = static_cast(memory->data()); + pid = inst->primaryPid; + memory->unlock(); + + return pid; +} + +#ifdef Q_OS_UNIX + void SingleApplicationPrivate::crashHandler() + { + // Handle any further termination signals to ensure the + // QSharedMemory block is deleted even if the process crashes + signal( SIGHUP, SingleApplicationPrivate::terminate ); // 1 + signal( SIGINT, SingleApplicationPrivate::terminate ); // 2 + signal( SIGQUIT, SingleApplicationPrivate::terminate ); // 3 + signal( SIGILL, SingleApplicationPrivate::terminate ); // 4 + signal( SIGABRT, SingleApplicationPrivate::terminate ); // 6 + signal( SIGFPE, SingleApplicationPrivate::terminate ); // 8 + signal( SIGBUS, SingleApplicationPrivate::terminate ); // 10 + signal( SIGSEGV, SingleApplicationPrivate::terminate ); // 11 + signal( SIGSYS, SingleApplicationPrivate::terminate ); // 12 + signal( SIGPIPE, SingleApplicationPrivate::terminate ); // 13 + signal( SIGALRM, SingleApplicationPrivate::terminate ); // 14 + signal( SIGTERM, SingleApplicationPrivate::terminate ); // 15 + signal( SIGXCPU, SingleApplicationPrivate::terminate ); // 24 + signal( SIGXFSZ, SingleApplicationPrivate::terminate ); // 25 + } + + void SingleApplicationPrivate::terminate( int signum ) + { + delete ((SingleApplication*)QCoreApplication::instance())->d_ptr; + ::exit( 128 + signum ); + } +#endif + +/** + * @brief Executed when a connection has been made to the LocalServer + */ +void SingleApplicationPrivate::slotConnectionEstablished() +{ + Q_Q(SingleApplication); + + QLocalSocket *nextConnSocket = server->nextPendingConnection(); + + quint32 instanceId = 0; + ConnectionType connectionType = InvalidConnection; + if( nextConnSocket->waitForReadyRead( 100 ) ) { + // read all data from message in same order/format as written + QByteArray msgBytes = nextConnSocket->read(nextConnSocket->bytesAvailable() - static_cast(sizeof(quint16))); + QByteArray checksumBytes = nextConnSocket->read(sizeof(quint16)); + QDataStream readStream(msgBytes); + readStream.setVersion(QDataStream::Qt_5_2); + + // server name + QByteArray latin1Name; + readStream >> latin1Name; + // connectioon type + quint8 connType = InvalidConnection; + readStream >> connType; + connectionType = static_cast(connType); + // instance id + readStream >> instanceId; + // checksum + quint16 msgChecksum = 0; + QDataStream checksumStream(checksumBytes); + checksumStream.setVersion(QDataStream::Qt_5_2); + checksumStream >> msgChecksum; + + const quint16 actualChecksum = qChecksum(msgBytes.constData(), static_cast(msgBytes.length())); + + if (readStream.status() != QDataStream::Ok || QLatin1String(latin1Name) != blockServerName || msgChecksum != actualChecksum) { + connectionType = InvalidConnection; + } + } + + if( connectionType == InvalidConnection ) { + nextConnSocket->close(); + delete nextConnSocket; + return; + } + + QObject::connect( + nextConnSocket, + &QLocalSocket::aboutToClose, + this, + [nextConnSocket, instanceId, this]() { + emit this->slotClientConnectionClosed( nextConnSocket, instanceId ); + } + ); + + QObject::connect( + nextConnSocket, + &QLocalSocket::readyRead, + this, + [nextConnSocket, instanceId, this]() { + emit this->slotDataAvailable( nextConnSocket, instanceId ); + } + ); + + if( connectionType == NewInstance || ( + connectionType == SecondaryInstance && + options & SingleApplication::Mode::SecondaryNotification + ) + ) { + emit q->instanceStarted(); + } + + if( nextConnSocket->bytesAvailable() > 0 ) { + emit this->slotDataAvailable( nextConnSocket, instanceId ); + } +} + +void SingleApplicationPrivate::slotDataAvailable( QLocalSocket *dataSocket, quint32 instanceId ) +{ + Q_Q(SingleApplication); + emit q->receivedMessage( instanceId, dataSocket->readAll() ); +} + +void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId ) +{ + if( closedSocket->bytesAvailable() > 0 ) + emit slotDataAvailable( closedSocket, instanceId ); + closedSocket->deleteLater(); +} + +/** + * @brief Constructor. Checks and fires up LocalServer or closes the program + * if another instance already exists + * @param argc + * @param argv + * @param {bool} allowSecondaryInstances + */ +SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary, Options options, int timeout ) + : app_t( argc, argv ), d_ptr( new SingleApplicationPrivate( this ) ) +{ + Q_D(SingleApplication); + + // Store the current mode of the program + d->options = options; + + // Generating an application ID used for identifying the shared memory + // block and QLocalServer + d->genBlockServerName( timeout ); + + // Guarantee thread safe behaviour with a shared memory block. Also by + // explicitly attaching it and then deleting it we make sure that the + // memory is deleted even if the process had crashed on Unix. +#ifdef Q_OS_UNIX + d->memory = new QSharedMemory( d->blockServerName ); + d->memory->attach(); + delete d->memory; +#endif + d->memory = new QSharedMemory( d->blockServerName ); + + // Create a shared memory block + if( d->memory->create( sizeof( InstancesInfo ) ) ) { + d->startPrimary( true ); + return; + } else { + // Attempt to attach to the memory segment + if( d->memory->attach() ) { + d->memory->lock(); + InstancesInfo* inst = static_cast(d->memory->data()); + + if( ! inst->primary ) { + d->startPrimary( false ); + d->memory->unlock(); + return; + } + + // Check if another instance can be started + if( allowSecondary ) { + inst->secondary += 1; + d->instanceNumber = inst->secondary; + d->startSecondary(); + if( d->options & Mode::SecondaryNotification ) { + d->connectToPrimary( timeout, SingleApplicationPrivate::SecondaryInstance ); + } + d->memory->unlock(); + return; + } + + d->memory->unlock(); + } + } + + d->connectToPrimary( timeout, SingleApplicationPrivate::NewInstance ); + delete d; + ::exit( EXIT_SUCCESS ); +} + +/** + * @brief Destructor + */ +SingleApplication::~SingleApplication() +{ + Q_D(SingleApplication); + delete d; +} + +bool SingleApplication::isPrimary() +{ + Q_D(SingleApplication); + return d->server != nullptr; +} + +bool SingleApplication::isSecondary() +{ + Q_D(SingleApplication); + return d->server == nullptr; +} + +quint32 SingleApplication::instanceId() +{ + Q_D(SingleApplication); + return d->instanceNumber; +} + +qint64 SingleApplication::primaryPid() +{ + Q_D(SingleApplication); + return d->primaryPid(); +} + +bool SingleApplication::sendMessage( QByteArray message, int timeout ) +{ + Q_D(SingleApplication); + + // Nobody to connect to + if( isPrimary() ) return false; + + // Make sure the socket is connected + d->connectToPrimary( timeout, SingleApplicationPrivate::Reconnect ); + + d->socket->write( message ); + bool dataWritten = d->socket->flush(); + d->socket->waitForBytesWritten( timeout ); + return dataWritten; +} diff --git a/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.h b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.h new file mode 100644 index 0000000000000000000000000000000000000000..33a9898aba2e4111dc90f31dd45fc833463a2100 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.h @@ -0,0 +1,135 @@ +// The MIT License (MIT) +// +// Copyright (c) Itay Grudev 2015 - 2016 +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef SINGLE_APPLICATION_H +#define SINGLE_APPLICATION_H + +#include +#include + +#ifndef QAPPLICATION_CLASS + #define QAPPLICATION_CLASS QCoreApplication +#endif + +#include QT_STRINGIFY(QAPPLICATION_CLASS) + +class SingleApplicationPrivate; + +/** + * @brief The SingleApplication class handles multipe instances of the same + * Application + * @see QCoreApplication + */ +class SingleApplication : public QAPPLICATION_CLASS +{ + Q_OBJECT + + typedef QAPPLICATION_CLASS app_t; + +public: + /** + * @brief Mode of operation of SingleApplication. + * Whether the block should be user-wide or system-wide and whether the + * primary instance should be notified when a secondary instance had been + * started. + * @note Operating system can restrict the shared memory blocks to the same + * user, in which case the User/System modes will have no effect and the + * block will be user wide. + * @enum + */ + enum Mode { + User = 1 << 0, + System = 1 << 1, + SecondaryNotification = 1 << 2, + ExcludeAppVersion = 1 << 3, + ExcludeAppPath = 1 << 4 + }; + Q_DECLARE_FLAGS(Options, Mode) + + /** + * @brief Intitializes a SingleApplication instance with argc command line + * arguments in argv + * @arg {int &} argc - Number of arguments in argv + * @arg {const char *[]} argv - Supplied command line arguments + * @arg {bool} allowSecondary - Whether to start the instance as secondary + * if there is already a primary instance. + * @arg {Mode} mode - Whether for the SingleApplication block to be applied + * User wide or System wide. + * @arg {int} timeout - Timeout to wait in miliseconds. + * @note argc and argv may be changed as Qt removes arguments that it + * recognizes + * @note Mode::SecondaryNotification only works if set on both the primary + * instance and the secondary instance. + * @note The timeout is just a hint for the maximum time of blocking + * operations. It does not guarantee that the SingleApplication + * initialisation will be completed in given time, though is a good hint. + * Usually 4*timeout would be the worst case (fail) scenario. + * @see See the corresponding QAPPLICATION_CLASS constructor for reference + */ + explicit SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 100 ); + ~SingleApplication(); + + /** + * @brief Returns if the instance is the primary instance + * @returns {bool} + */ + bool isPrimary(); + + /** + * @brief Returns if the instance is a secondary instance + * @returns {bool} + */ + bool isSecondary(); + + /** + * @brief Returns a unique identifier for the current instance + * @returns {qint32} + */ + quint32 instanceId(); + + /** + * @brief Returns the process ID (PID) of the primary instance + * @returns {qint64} + */ + qint64 primaryPid(); + + /** + * @brief Sends a message to the primary instance. Returns true on success. + * @param {int} timeout - Timeout for connecting + * @returns {bool} + * @note sendMessage() will return false if invoked from the primary + * instance. + */ + bool sendMessage( QByteArray message, int timeout = 100 ); + +Q_SIGNALS: + void instanceStarted(); + void receivedMessage( quint32 instanceId, QByteArray message ); + +private: + SingleApplicationPrivate *d_ptr; + Q_DECLARE_PRIVATE(SingleApplication) +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(SingleApplication::Options) + +#endif // SINGLE_APPLICATION_H diff --git a/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.pri b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.pri new file mode 100644 index 0000000000000000000000000000000000000000..a82ff28696bf910645c439bb0d55193b6244e7de --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication.pri @@ -0,0 +1,18 @@ +QT += core network +CONFIG += c++11 + +HEADERS += $$PWD/singleapplication.h \ + $$PWD/singleapplication_p.h +SOURCES += $$PWD/singleapplication.cpp + +INCLUDEPATH += $$PWD + +win32 { + msvc:LIBS += Advapi32.lib + gcc:LIBS += -lAdvapi32 +} + +DISTFILES += \ + $$PWD/README.md \ + $$PWD/CHANGELOG.md \ + $$PWD/Windows.md diff --git a/flameshot-0.6.0/src/third-party/singleapplication/singleapplication_p.h b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication_p.h new file mode 100644 index 0000000000000000000000000000000000000000..a990a53c7d8b8a0162aa7524a2458850f4e0fde5 --- /dev/null +++ b/flameshot-0.6.0/src/third-party/singleapplication/singleapplication_p.h @@ -0,0 +1,85 @@ +// The MIT License (MIT) +// +// Copyright (c) Itay Grudev 2015 - 2016 +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// +// W A R N I N G !!! +// ----------------- +// +// This file is not part of the SingleApplication API. It is used purely as an +// implementation detail. This header file may change from version to +// version without notice, or may even be removed. +// + +#ifndef SINGLEAPPLICATION_P_H +#define SINGLEAPPLICATION_P_H + +#include +#include +#include +#include "singleapplication.h" + +struct InstancesInfo { + bool primary; + quint32 secondary; + qint64 primaryPid; +}; + +class SingleApplicationPrivate : public QObject { +Q_OBJECT +public: + enum ConnectionType : quint8 { + InvalidConnection = 0, + NewInstance = 1, + SecondaryInstance = 2, + Reconnect = 3 + }; + Q_DECLARE_PUBLIC(SingleApplication) + + SingleApplicationPrivate( SingleApplication *q_ptr ); + ~SingleApplicationPrivate(); + + void genBlockServerName( int msecs ); + void startPrimary( bool resetMemory ); + void startSecondary(); + void connectToPrimary(int msecs, ConnectionType connectionType ); + qint64 primaryPid(); + +#ifdef Q_OS_UNIX + void crashHandler(); + static void terminate( int signum ); +#endif + + QSharedMemory *memory; + SingleApplication *q_ptr; + QLocalSocket *socket; + QLocalServer *server; + quint32 instanceNumber; + QString blockServerName; + SingleApplication::Options options; + +public Q_SLOTS: + void slotConnectionEstablished(); + void slotDataAvailable( QLocalSocket*, quint32 ); + void slotClientConnectionClosed( QLocalSocket*, quint32 ); +}; + +#endif // SINGLEAPPLICATION_P_H diff --git a/flameshot-0.6.0/src/tools/abstractactiontool.cpp b/flameshot-0.6.0/src/tools/abstractactiontool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e7d294b07417617c93240384283bca0aefe026d3 --- /dev/null +++ b/flameshot-0.6.0/src/tools/abstractactiontool.cpp @@ -0,0 +1,71 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "abstractactiontool.h" + +AbstractActionTool::AbstractActionTool(QObject *parent) : CaptureTool(parent) { + +} + +bool AbstractActionTool::isValid() const { + return true; +} + +bool AbstractActionTool::isSelectable() const { + return false; +} + +bool AbstractActionTool::showMousePreview() const { + return false; +} + +void AbstractActionTool::undo(QPixmap &pixmap) { + Q_UNUSED(pixmap); +} + +void AbstractActionTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + Q_UNUSED(painter); + Q_UNUSED(pixmap); + Q_UNUSED(recordUndo); +} + +void AbstractActionTool::paintMousePreview( + QPainter &painter, const CaptureContext &context) +{ + Q_UNUSED(painter); + Q_UNUSED(context); +} + +void AbstractActionTool::drawEnd(const QPoint &p) { + Q_UNUSED(p); +} + +void AbstractActionTool::drawMove(const QPoint &p) { + Q_UNUSED(p); +} + +void AbstractActionTool::drawStart(const CaptureContext &context) { + Q_UNUSED(context); +} + +void AbstractActionTool::colorChanged(const QColor &c) { + Q_UNUSED(c); +} + +void AbstractActionTool::thicknessChanged(const int th) { + Q_UNUSED(th); +} diff --git a/flameshot-0.6.0/src/tools/abstractactiontool.h b/flameshot-0.6.0/src/tools/abstractactiontool.h new file mode 100644 index 0000000000000000000000000000000000000000..a96427ffc99a171faa9250f6e8811d2f0849e77b --- /dev/null +++ b/flameshot-0.6.0/src/tools/abstractactiontool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "capturetool.h" + +class AbstractActionTool : public CaptureTool { + Q_OBJECT +public: + explicit AbstractActionTool(QObject *parent = nullptr); + + bool isValid() const override; + bool isSelectable() const override; + bool showMousePreview() const override; + + void undo(QPixmap &pixmap) override; + void process(QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawEnd(const QPoint &p) override; + void drawMove(const QPoint &p) override; + void drawStart(const CaptureContext &context) override; + void colorChanged(const QColor &c) override; + void thicknessChanged(const int th) override; +}; diff --git a/flameshot-0.6.0/src/tools/abstractpathtool.cpp b/flameshot-0.6.0/src/tools/abstractpathtool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..204b584923a4d1d78080d873a355f25378574329 --- /dev/null +++ b/flameshot-0.6.0/src/tools/abstractpathtool.cpp @@ -0,0 +1,84 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "abstractpathtool.h" + +AbstractPathTool::AbstractPathTool(QObject *parent) : + CaptureTool(parent), m_thickness(0), m_padding(0) +{ + +} + +bool AbstractPathTool::isValid() const { + return m_points.length() > 1; +} + +bool AbstractPathTool::closeOnButtonPressed() const { + return false; +} + +bool AbstractPathTool::isSelectable() const { + return true; +} + +bool AbstractPathTool::showMousePreview() const { + return true; +} + +void AbstractPathTool::undo(QPixmap &pixmap) { + QPainter p(&pixmap); + const int val = m_thickness + m_padding; + QRect area = m_backupArea + QMargins(val, val, val, val); + p.drawPixmap(area.intersected(pixmap.rect()) + .topLeft(), m_pixmapBackup); +} + +void AbstractPathTool::drawEnd(const QPoint &p) { + Q_UNUSED(p); +} + +void AbstractPathTool::drawMove(const QPoint &p) { + addPoint(p); +} + +void AbstractPathTool::colorChanged(const QColor &c) { + m_color = c; +} + +void AbstractPathTool::thicknessChanged(const int th) { + m_thickness = th; +} + +void AbstractPathTool::updateBackup(const QPixmap &pixmap) { + const int val = m_thickness + m_padding; + QRect area = m_backupArea.normalized() + QMargins(val, val, val, val); + m_pixmapBackup = pixmap.copy(area); +} + +void AbstractPathTool::addPoint(const QPoint &point) { + if (m_backupArea.left() > point.x()) { + m_backupArea.setLeft(point.x()); + } else if (m_backupArea.right() < point.x()) { + m_backupArea.setRight(point.x()); + } + if (m_backupArea.top() > point.y()) { + m_backupArea.setTop(point.y()); + } else if (m_backupArea.bottom() < point.y()) { + m_backupArea.setBottom(point.y()); + } + m_points.append(point); +} diff --git a/flameshot-0.6.0/src/tools/abstractpathtool.h b/flameshot-0.6.0/src/tools/abstractpathtool.h new file mode 100644 index 0000000000000000000000000000000000000000..f6554f3f890a74534823a98103e54358affff744 --- /dev/null +++ b/flameshot-0.6.0/src/tools/abstractpathtool.h @@ -0,0 +1,51 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "capturetool.h" + +class AbstractPathTool : public CaptureTool { + Q_OBJECT +public: + explicit AbstractPathTool(QObject *parent = nullptr); + + bool isValid() const override; + bool closeOnButtonPressed() const override; + bool isSelectable() const override; + bool showMousePreview() const override; + + void undo(QPixmap &pixmap) override; + +public slots: + void drawEnd(const QPoint &p) override; + void drawMove(const QPoint &p) override; + void colorChanged(const QColor &c) override; + void thicknessChanged(const int th) override; + +protected: + void updateBackup(const QPixmap &pixmap); + void addPoint(const QPoint &point); + + QPixmap m_pixmapBackup; + QRect m_backupArea; + QColor m_color; + QVector m_points; + int m_thickness; + // use m_padding to extend the area of the backup + int m_padding; +}; diff --git a/flameshot-0.6.0/src/tools/abstracttwopointtool.cpp b/flameshot-0.6.0/src/tools/abstracttwopointtool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..db077ad3bf47ebdcf2cc2f4947e376cb70be93d9 --- /dev/null +++ b/flameshot-0.6.0/src/tools/abstracttwopointtool.cpp @@ -0,0 +1,72 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "abstracttwopointtool.h" + +AbstractTwoPointTool::AbstractTwoPointTool(QObject *parent) : + CaptureTool(parent), m_thickness(0), m_padding(0) +{ + +} + +bool AbstractTwoPointTool::isValid() const { + return (m_points.first != m_points.second); +} + +bool AbstractTwoPointTool::closeOnButtonPressed() const { + return false; +} + +bool AbstractTwoPointTool::isSelectable() const { + return true; +} + +bool AbstractTwoPointTool::showMousePreview() const { + return true; +} + +void AbstractTwoPointTool::undo(QPixmap &pixmap) { + QPainter p(&pixmap); + p.drawPixmap(backupRect(pixmap.rect()).topLeft(), m_pixmapBackup); +} + +void AbstractTwoPointTool::drawEnd(const QPoint &p) { + Q_UNUSED(p); +} + +void AbstractTwoPointTool::drawMove(const QPoint &p) { + m_points.second = p; +} + +void AbstractTwoPointTool::colorChanged(const QColor &c) { + m_color = c; +} + +void AbstractTwoPointTool::thicknessChanged(const int th) { + m_thickness = th; +} + +void AbstractTwoPointTool::updateBackup(const QPixmap &pixmap) { + m_pixmapBackup = pixmap.copy(backupRect(pixmap.rect())); +} + +QRect AbstractTwoPointTool::backupRect(const QRect &limits) const { + QRect r = QRect(m_points.first, m_points.second).normalized(); + const int val = m_thickness + m_padding; + r += QMargins(val, val, val, val); + return r.intersected(limits); +} diff --git a/flameshot-0.6.0/src/tools/abstracttwopointtool.h b/flameshot-0.6.0/src/tools/abstracttwopointtool.h new file mode 100644 index 0000000000000000000000000000000000000000..1f360028760edb8a55edb78fbc5d01dbc3d91119 --- /dev/null +++ b/flameshot-0.6.0/src/tools/abstracttwopointtool.h @@ -0,0 +1,51 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "capturetool.h" + +class AbstractTwoPointTool : public CaptureTool { + Q_OBJECT +public: + explicit AbstractTwoPointTool(QObject *parent = nullptr); + + bool isValid() const override; + bool closeOnButtonPressed() const override; + bool isSelectable() const override; + bool showMousePreview() const override; + + void undo(QPixmap &pixmap) override; + +public slots: + void drawEnd(const QPoint &p) override; + void drawMove(const QPoint &p) override; + void colorChanged(const QColor &c) override; + void thicknessChanged(const int th) override; + +protected: + void updateBackup(const QPixmap &pixmap); + QRect backupRect(const QRect &limits) const; + + QPixmap m_pixmapBackup; + QPair m_points; + QColor m_color; + int m_thickness; + // use m_padding to extend the area of the backup + int m_padding; + +}; diff --git a/flameshot-0.6.0/src/tools/arrow/arrowtool.cpp b/flameshot-0.6.0/src/tools/arrow/arrowtool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5fce9a155708c39b650783c53427f127d74aa7df --- /dev/null +++ b/flameshot-0.6.0/src/tools/arrow/arrowtool.cpp @@ -0,0 +1,119 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include +#include "arrowtool.h" + +namespace { + +#define PADDING_VALUE 2 + +const int ArrowWidth = 10; +const int ArrowHeight = 18; + +QPainterPath getArrowHead(QPoint p1, QPoint p2, const int thickness) { + QLineF base(p1, p2); + // Create the vector for the position of the base of the arrowhead + QLineF temp(QPoint(0,0), p2-p1); + int val = ArrowHeight + thickness*4; + if (base.length() < val) { + val = (base.length() + thickness*2); + } + temp.setLength(base.length() + thickness*2 - val); + // Move across the line up to the head + QPointF bottonTranslation(temp.p2()); + + // Rotate base of the arrowhead + base.setLength(ArrowWidth + thickness*2); + base.setAngle(base.angle() + 90); + // Move to the correct point + QPointF temp2 = p1 - base.p2(); + // Center it + QPointF centerTranslation((temp2.x()/2), (temp2.y()/2)); + + base.translate(bottonTranslation); + base.translate(centerTranslation); + + QPainterPath path; + path.moveTo(p2); + path.lineTo(base.p1()); + path.lineTo(base.p2()); + path.lineTo(p2); + return path; +} + +// gets a shorter line to prevent overlap in the point of the arrow +QLine getShorterLine(QPoint p1, QPoint p2, const int thickness) { + QLineF l(p1, p2); + int val = ArrowHeight + thickness*4; + if (l.length() < val) { + val = (l.length() + thickness*2); + } + l.setLength(l.length() + thickness*2 - val); + return l.toLine(); +} + +} // unnamed namespace + +ArrowTool::ArrowTool(QObject *parent) : AbstractTwoPointTool(parent) { + m_padding = ArrowWidth / 2; +} + +QIcon ArrowTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "arrow-bottom-left.svg"); +} +QString ArrowTool::name() const { + return tr("Arrow"); +} + +QString ArrowTool::nameID() { + return ""; +} + +QString ArrowTool::description() const { + return tr("Sets the Arrow as the paint tool"); +} + +CaptureTool* ArrowTool::copy(QObject *parent) { + return new ArrowTool(parent); +} + +void ArrowTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setPen(QPen(m_color, m_thickness)); + painter.drawLine(getShorterLine(m_points.first, m_points.second, m_thickness)); + painter.fillPath(getArrowHead(m_points.first, m_points.second, m_thickness), QBrush(m_color)); +} + +void ArrowTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void ArrowTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void ArrowTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/arrow/arrowtool.h b/flameshot-0.6.0/src/tools/arrow/arrowtool.h new file mode 100644 index 0000000000000000000000000000000000000000..abdbe336e6a7894f2a502c365ee7f9779b7062d6 --- /dev/null +++ b/flameshot-0.6.0/src/tools/arrow/arrowtool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" +#include + +class ArrowTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit ArrowTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/blur/blurtool.cpp b/flameshot-0.6.0/src/tools/blur/blurtool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e845d471830fe379e6047d52f02a3835056b33d2 --- /dev/null +++ b/flameshot-0.6.0/src/tools/blur/blurtool.cpp @@ -0,0 +1,88 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "blurtool.h" +#include +#include +#include +#include +#include + +BlurTool::BlurTool(QObject *parent) : AbstractTwoPointTool(parent) { + +} + +QIcon BlurTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "blur.svg"); +} +QString BlurTool::name() const { + return tr("Blur"); +} + +QString BlurTool::nameID() { + return ""; +} + +QString BlurTool::description() const { + return tr("Sets the Blur as the paint tool"); +} + +CaptureTool* BlurTool::copy(QObject *parent) { + return new BlurTool(parent); +} + +void BlurTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + QPoint &p0 = m_points.first; + QPoint &p1 = m_points.second; + auto pixelRatio = pixmap.devicePixelRatio(); + + QRect selection = QRect(p0, p1).normalized(); + QRect selectionScaled = QRect(p0 * pixelRatio, p1 * pixelRatio).normalized(); + + QGraphicsBlurEffect *blur = new QGraphicsBlurEffect; + blur->setBlurRadius(10); + QGraphicsPixmapItem *item = new QGraphicsPixmapItem ( + pixmap.copy(selectionScaled)); + item->setGraphicsEffect(blur); + + QGraphicsScene scene; + scene.addItem(item); + + scene.render(&painter, selection, QRectF()); + blur->setBlurRadius(12); + scene.render(&painter, selection, QRectF()); + scene.render(&painter, selection, QRectF()); +} + +void BlurTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + Q_UNUSED(context); + Q_UNUSED(painter); +} + +void BlurTool::drawStart(const CaptureContext &context) { + m_thickness = context.thickness; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void BlurTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/blur/blurtool.h b/flameshot-0.6.0/src/tools/blur/blurtool.h new file mode 100644 index 0000000000000000000000000000000000000000..a93cfb67ce5bab062d47c820deb8a7175f8037dc --- /dev/null +++ b/flameshot-0.6.0/src/tools/blur/blurtool.h @@ -0,0 +1,40 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class BlurTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit BlurTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/capturecontext.cpp b/flameshot-0.6.0/src/tools/capturecontext.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ba75312b0128b5ed9b76d27e71e26d098db65298 --- /dev/null +++ b/flameshot-0.6.0/src/tools/capturecontext.cpp @@ -0,0 +1,26 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "capturecontext.h" + +QPixmap CaptureContext::selectedScreenshotArea() const { + if (selection.isNull()) { + return screenshot; + } else { + return screenshot.copy(selection); + } +} diff --git a/flameshot-0.6.0/src/tools/capturecontext.h b/flameshot-0.6.0/src/tools/capturecontext.h new file mode 100644 index 0000000000000000000000000000000000000000..784606718be5deb4c787e4a90d3f78247dfb0de6 --- /dev/null +++ b/flameshot-0.6.0/src/tools/capturecontext.h @@ -0,0 +1,48 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include +#include +#include + +struct CaptureContext { + // screenshot with modifications + QPixmap screenshot; + // unmodified screenshot + QPixmap origScreenshot; + // Selection area + QRect selection; + // Widget dimensions + QRect widgetDimensions; + // Selected tool color + QColor color; + // Path where the content has to be saved + QString savePath; + // Ofset of the capture widget based on the system's screen (top-left) + QPoint widgetOffset; + // Mouse position inside the widget + QPoint mousePos; + // Value of the desired thickness + int thickness; + // Mode of the capture widget + bool fullscreen; + + QPixmap selectedScreenshotArea() const ; +}; diff --git a/flameshot-0.6.0/src/tools/capturetool.h b/flameshot-0.6.0/src/tools/capturetool.h new file mode 100644 index 0000000000000000000000000000000000000000..804298e6bf70a480b278cdb1592fceb28ddaefb7 --- /dev/null +++ b/flameshot-0.6.0/src/tools/capturetool.h @@ -0,0 +1,146 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/capturecontext.h" +#include "src/utils/colorutils.h" +#include "src/utils/pathinfo.h" +#include +#include + +class CaptureTool : public QObject { + Q_OBJECT + +public: + // Request actions on the main widget + enum Request { + // Call close() in the editor. + REQ_CLOSE_GUI, + // Call hide() in the editor. + REQ_HIDE_GUI, + // Select the whole screen. + REQ_SELECT_ALL, + // Disable the selection. + REQ_HIDE_SELECTION, + // Undo the last active modification in the stack. + REQ_UNDO_MODIFICATION, + // Redo the next modification in the stack. + REQ_REDO_MODIFICATION, + // Remove all the modifications. + REQ_CLEAR_MODIFICATIONS, + // Disable the active tool. + REQ_MOVE_MODE, + // Open the color picker under the mouse. + REQ_SHOW_COLOR_PICKER, + // Open/Close the side-panel. + REQ_TOGGLE_SIDEBAR, + // Call update() in the editor. + REQ_REDRAW, + // Append this tool to the undo/redo stack + REQ_APPEND_TO_STACK, + // Notify is the screenshot has been saved. + REQ_CAPTURE_DONE_OK, + // Instance this->widget()'s widget inside the editor under the mouse. + REQ_ADD_CHILD_WIDGET, + // Instance this->widget()'s widget as a window which closes after + // closing the editor. + REQ_ADD_CHILD_WINDOW, + // Instance this->widget()'s widget which handles its own lifetime. + REQ_ADD_EXTERNAL_WIDGETS, + }; + + explicit CaptureTool(QObject *parent = nullptr) : QObject(parent){} + + // Returns false when the tool is in an inconsistent state and shouldn't + // be included in the tool undo/redo stack. + virtual bool isValid() const = 0; + // Close the capture after the process() call if the tool was activated + // from a button press. + virtual bool closeOnButtonPressed() const = 0; + // If the tool keeps active after the selection. + virtual bool isSelectable() const = 0; + // Enable mouse preview. + virtual bool showMousePreview() const = 0; + + // The icon of the tool. + // inEditor is true when the icon is requested inside the editor + // and false otherwise. + virtual QIcon icon(const QColor &background, + bool inEditor) const = 0; + // Name displayed for the tool, this could be translated with tr() + virtual QString name() const = 0; + // Codename for the tool, this hsouldn't change as it is used as ID + // for the tool in the internals of Flameshot + static QString nameID(); + // Short description of the tool. + virtual QString description() const = 0; + + // if the type is TYPE_WIDGET the widget is loaded in the main widget. + // If the type is TYPE_EXTERNAL_WIDGET it is created outside as an + // individual widget. + virtual QWidget* widget() { + return nullptr; + } + // When the tool is selected this method is called and the widget is added + // to the configuration panel inside the main widget. + virtual QWidget* configurationWidget() { + return nullptr; + } + // Permanent configuration used in the configuration outside of the + // capture. + virtual QWidget* permanentConfigurationWidget() { + return nullptr; + } + // Return a copy of the tool + virtual CaptureTool* copy(QObject *parent = nullptr) = 0; + + // revert changes + virtual void undo(QPixmap &pixmap) = 0; + // Called every time the tool has to draw + // recordUndo indicates when the tool should save the information + // for the undo(), if the value is false calling undo() after + // that process should not modify revert the changes. + virtual void process(QPainter &painter, + const QPixmap &pixmap, + bool recordUndo = false) = 0; + // When the tool is selected, this is called when the mouse moves + virtual void paintMousePreview(QPainter &painter, const CaptureContext &context) = 0; + +signals: + void requestAction(Request r); + +protected: + QString iconPath(const QColor &c) const { + return ColorUtils::colorIsDark(c) ? + PathInfo::whiteIconPath() : PathInfo::blackIconPath(); + } + +public slots: + // On mouse release. + virtual void drawEnd(const QPoint &p) = 0; + // Mouse pressed and moving, called once a pixel. + virtual void drawMove(const QPoint &p) = 0; + // Called when the tool is activated. + virtual void drawStart(const CaptureContext &context) = 0; + // Called right after pressign the button which activates the tool. + virtual void pressed(const CaptureContext &context) = 0; + // Called when the color is changed in the editor. + virtual void colorChanged(const QColor &c) = 0; + // Called when the thickness of the tool is updated in the editor. + virtual void thicknessChanged(const int th) = 0; +}; diff --git a/flameshot-0.6.0/src/tools/circle/circletool.cpp b/flameshot-0.6.0/src/tools/circle/circletool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4ce2f5d8e7f846210e1a7306cf36bd61ed9e44d1 --- /dev/null +++ b/flameshot-0.6.0/src/tools/circle/circletool.cpp @@ -0,0 +1,71 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "circletool.h" +#include + +namespace { +#define PADDING_VALUE 2 +} + +CircleTool::CircleTool(QObject *parent) : AbstractTwoPointTool(parent) { + +} + +QIcon CircleTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "circle-outline.svg"); +} +QString CircleTool::name() const { + return tr("Circle"); +} + +QString CircleTool::nameID() { + return ""; +} + +QString CircleTool::description() const { + return tr("Sets the Circle as the paint tool"); +} + +CaptureTool* CircleTool::copy(QObject *parent) { + return new CircleTool(parent); +} + +void CircleTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setPen(QPen(m_color, m_thickness)); + painter.drawEllipse(QRect(m_points.first, m_points.second)); +} + +void CircleTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void CircleTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void CircleTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/circle/circletool.h b/flameshot-0.6.0/src/tools/circle/circletool.h new file mode 100644 index 0000000000000000000000000000000000000000..7d06fbc2b40ff2690d154591940ef4f1c63575cb --- /dev/null +++ b/flameshot-0.6.0/src/tools/circle/circletool.h @@ -0,0 +1,40 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class CircleTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit CircleTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/copy/copytool.cpp b/flameshot-0.6.0/src/tools/copy/copytool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3914dd1931c0c028f67369abba8924f1ff570ba2 --- /dev/null +++ b/flameshot-0.6.0/src/tools/copy/copytool.cpp @@ -0,0 +1,53 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "copytool.h" +#include "src/utils/screenshotsaver.h" +#include + +CopyTool::CopyTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool CopyTool::closeOnButtonPressed() const { + return true; +} + +QIcon CopyTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "content-copy.svg"); +} +QString CopyTool::name() const { + return tr("Copy"); +} + +QString CopyTool::nameID() { + return ""; +} + +QString CopyTool::description() const { + return tr("Copies the selection into the clipboard"); +} + +CaptureTool* CopyTool::copy(QObject *parent) { + return new CopyTool(parent); +} + +void CopyTool::pressed(const CaptureContext &context) { + emit requestAction(REQ_CAPTURE_DONE_OK); + ScreenshotSaver().saveToClipboard(context.selectedScreenshotArea()); +} diff --git a/flameshot-0.6.0/src/tools/copy/copytool.h b/flameshot-0.6.0/src/tools/copy/copytool.h new file mode 100644 index 0000000000000000000000000000000000000000..a7c15dc59a6fc3dce3e03ae0130112e17fad9366 --- /dev/null +++ b/flameshot-0.6.0/src/tools/copy/copytool.h @@ -0,0 +1,38 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class CopyTool : public AbstractActionTool { + Q_OBJECT +public: + explicit CopyTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/exit/exittool.cpp b/flameshot-0.6.0/src/tools/exit/exittool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e4661c3356a13fed8aea16220064384c5fe2af94 --- /dev/null +++ b/flameshot-0.6.0/src/tools/exit/exittool.cpp @@ -0,0 +1,52 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "exittool.h" +#include + +ExitTool::ExitTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool ExitTool::closeOnButtonPressed() const { + return true; +} + +QIcon ExitTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "close.svg"); +} +QString ExitTool::name() const { + return tr("Exit"); +} + +QString ExitTool::nameID() { + return ""; +} + +QString ExitTool::description() const { + return tr("Leave the capture screen"); +} + +CaptureTool* ExitTool::copy(QObject *parent) { + return new ExitTool(parent); +} + +void ExitTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); + emit requestAction(REQ_CLOSE_GUI); +} diff --git a/flameshot-0.6.0/src/tools/exit/exittool.h b/flameshot-0.6.0/src/tools/exit/exittool.h new file mode 100644 index 0000000000000000000000000000000000000000..bf2842c9d79c83fc563721768a3f928a687e7a2f --- /dev/null +++ b/flameshot-0.6.0/src/tools/exit/exittool.h @@ -0,0 +1,38 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class ExitTool : public AbstractActionTool { + Q_OBJECT +public: + explicit ExitTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/imgur/imguruploader.cpp b/flameshot-0.6.0/src/tools/imgur/imguruploader.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c6bece910316d9363f8f8ab59f76ed8cc9f98f5c --- /dev/null +++ b/flameshot-0.6.0/src/tools/imgur/imguruploader.cpp @@ -0,0 +1,175 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "imguruploader.h" +#include "src/utils/filenamehandler.h" +#include "src/utils/systemnotification.h" +#include "src/widgets/loadspinner.h" +#include "src/widgets/imagelabel.h" +#include "src/widgets/notificationwidget.h" +#include "src/utils/confighandler.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +ImgurUploader::ImgurUploader(const QPixmap &capture, QWidget *parent) : + QWidget(parent), m_pixmap(capture) +{ + setWindowTitle(tr("Upload to Imgur")); + + m_spinner = new LoadSpinner(this); + m_spinner->setColor(ConfigHandler().uiMainColorValue()); + m_spinner->start(); + + m_infoLabel = new QLabel(tr("Uploading Image")); + + m_vLayout = new QVBoxLayout(); + setLayout(m_vLayout); + m_vLayout->addWidget(m_spinner, 0, Qt::AlignHCenter); + m_vLayout->addWidget(m_infoLabel); + + m_NetworkAM = new QNetworkAccessManager(this); + connect(m_NetworkAM, &QNetworkAccessManager::finished, this, + &ImgurUploader::handleReply); + + setAttribute(Qt::WA_DeleteOnClose); + + upload(); + // QTimer::singleShot(2000, this, &ImgurUploader::onUploadOk); // testing +} + +void ImgurUploader::handleReply(QNetworkReply *reply) { + m_spinner->deleteLater(); + if (reply->error() == QNetworkReply::NoError) { + QJsonDocument response = QJsonDocument::fromJson(reply->readAll()); + QJsonObject json = response.object(); + QJsonObject data = json["data"].toObject(); + m_imageURL.setUrl(data["link"].toString()); + m_deleteImageURL.setUrl(QString("https://imgur.com/delete/%1").arg( + data["deletehash"].toString())); + onUploadOk(); + } else { + m_infoLabel->setText(reply->errorString()); + } + new QShortcut(Qt::Key_Escape, this, SLOT(close())); +} + +void ImgurUploader::startDrag() { + QMimeData *mimeData = new QMimeData; + mimeData->setUrls(QList { m_imageURL }); + mimeData->setImageData(m_pixmap); + + QDrag *dragHandler = new QDrag(this); + dragHandler->setMimeData(mimeData); + dragHandler->setPixmap(m_pixmap.scaled(256, 256, Qt::KeepAspectRatioByExpanding, + Qt::SmoothTransformation)); + dragHandler->exec(); +} + +void ImgurUploader::upload() { + QByteArray byteArray; + QBuffer buffer(&byteArray); + m_pixmap.save(&buffer, "PNG"); + + QUrlQuery urlQuery; + urlQuery.addQueryItem("title", "flameshot_screenshot"); + QString description = FileNameHandler().parsedPattern(); + urlQuery.addQueryItem("description", description); + + QUrl url("https://api.imgur.com/3/image"); + url.setQuery(urlQuery); + QNetworkRequest request(url); + request.setHeader(QNetworkRequest::ContentTypeHeader, + "application/application/x-www-form-urlencoded"); + request.setRawHeader("Authorization", QString("Client-ID %1").arg(IMGUR_CLIENT_ID).toUtf8()); + + m_NetworkAM->post(request, byteArray); +} + +void ImgurUploader::onUploadOk() { + m_infoLabel->deleteLater(); + + m_notification = new NotificationWidget(); + m_vLayout->addWidget(m_notification); + + ImageLabel *imageLabel = new ImageLabel(); + imageLabel->setScreenshot(m_pixmap); + imageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + connect(imageLabel, &ImageLabel::dragInitiated, this, &ImgurUploader::startDrag); + m_vLayout->addWidget(imageLabel); + + m_hLayout = new QHBoxLayout(); + m_vLayout->addLayout(m_hLayout); + + m_copyUrlButton = new QPushButton(tr("Copy URL")); + m_openUrlButton = new QPushButton(tr("Open URL")); + m_openDeleteUrlButton = new QPushButton(tr("Delete image")); + m_toClipboardButton = new QPushButton(tr("Image to Clipboard.")); + m_hLayout->addWidget(m_copyUrlButton); + m_hLayout->addWidget(m_openUrlButton); + m_hLayout->addWidget(m_openDeleteUrlButton); + m_hLayout->addWidget(m_toClipboardButton); + + connect(m_copyUrlButton, &QPushButton::clicked, + this, &ImgurUploader::copyURL); + connect(m_openUrlButton, &QPushButton::clicked, + this, &ImgurUploader::openURL); + connect(m_openDeleteUrlButton, &QPushButton::clicked, + this, &ImgurUploader::openDeleteURL); + connect(m_toClipboardButton, &QPushButton::clicked, + this, &ImgurUploader::copyImage); +} + +void ImgurUploader::openURL() { + bool successful = QDesktopServices::openUrl(m_imageURL); + if (!successful) { + m_notification->showMessage(tr("Unable to open the URL.")); + } +} + +void ImgurUploader::copyURL() { + QApplication::clipboard()->setText(m_imageURL.toString()); + m_notification->showMessage(tr("URL copied to clipboard.")); +} + +void ImgurUploader::openDeleteURL() +{ + bool successful = QDesktopServices::openUrl(m_deleteImageURL); + if (!successful) { + m_notification->showMessage(tr("Unable to open the URL.")); + } +} + +void ImgurUploader::copyImage() { + QApplication::clipboard()->setPixmap(m_pixmap); + m_notification->showMessage(tr("Screenshot copied to clipboard.")); +} diff --git a/flameshot-0.6.0/src/tools/imgur/imguruploader.h b/flameshot-0.6.0/src/tools/imgur/imguruploader.h new file mode 100644 index 0000000000000000000000000000000000000000..870d5c0c7320a2938388cb5d18d18c0b3accdcd0 --- /dev/null +++ b/flameshot-0.6.0/src/tools/imgur/imguruploader.h @@ -0,0 +1,67 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include + +class QNetworkReply; +class QNetworkAccessManager; +class QHBoxLayout; +class QVBoxLayout; +class QLabel; +class LoadSpinner; +class QPushButton; +class QUrl; +class NotificationWidget; + +class ImgurUploader : public QWidget { + Q_OBJECT +public: + explicit ImgurUploader(const QPixmap &capture, QWidget *parent = nullptr); + +private slots: + void handleReply(QNetworkReply *reply); + void startDrag(); + + void openURL(); + void copyURL(); + void openDeleteURL(); + void copyImage(); + +private: + QPixmap m_pixmap; + QNetworkAccessManager *m_NetworkAM; + + QVBoxLayout *m_vLayout; + QHBoxLayout *m_hLayout; + // loading + QLabel *m_infoLabel; + LoadSpinner *m_spinner; + // uploaded + QPushButton *m_openUrlButton; + QPushButton *m_openDeleteUrlButton; + QPushButton *m_copyUrlButton; + QPushButton *m_toClipboardButton; + QUrl m_imageURL; + QUrl m_deleteImageURL; + NotificationWidget *m_notification; + + void upload(); + void onUploadOk(); +}; diff --git a/flameshot-0.6.0/src/tools/imgur/imguruploadertool.cpp b/flameshot-0.6.0/src/tools/imgur/imguruploadertool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..92d4e86800ddb8020dfedfdf94c6996de6707846 --- /dev/null +++ b/flameshot-0.6.0/src/tools/imgur/imguruploadertool.cpp @@ -0,0 +1,58 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "imguruploadertool.h" +#include "imguruploader.h" +#include + +ImgurUploaderTool::ImgurUploaderTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool ImgurUploaderTool::closeOnButtonPressed() const { + return true; +} + +QIcon ImgurUploaderTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "cloud-upload.svg"); +} +QString ImgurUploaderTool::name() const { + return tr("Image Uploader"); +} + +QString ImgurUploaderTool::nameID() { + return ""; +} + +QString ImgurUploaderTool::description() const { + return tr("Uploads the selection to Imgur"); +} + +QWidget* ImgurUploaderTool::widget() { + return new ImgurUploader(capture); +} + +CaptureTool* ImgurUploaderTool::copy(QObject *parent) { + return new ImgurUploaderTool(parent); +} + +void ImgurUploaderTool::pressed(const CaptureContext &context) { + capture = context.selectedScreenshotArea(); + emit requestAction(REQ_CAPTURE_DONE_OK); + emit requestAction(REQ_ADD_EXTERNAL_WIDGETS); +} diff --git a/flameshot-0.6.0/src/tools/imgur/imguruploadertool.h b/flameshot-0.6.0/src/tools/imgur/imguruploadertool.h new file mode 100644 index 0000000000000000000000000000000000000000..c5638ff6086f505094cbc43a1333e273d96d9fe4 --- /dev/null +++ b/flameshot-0.6.0/src/tools/imgur/imguruploadertool.h @@ -0,0 +1,43 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class ImgurUploaderTool : public AbstractActionTool { + Q_OBJECT +public: + explicit ImgurUploaderTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + QWidget* widget() override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; + +private: + QPixmap capture; +}; diff --git a/flameshot-0.6.0/src/tools/launcher/applaunchertool.cpp b/flameshot-0.6.0/src/tools/launcher/applaunchertool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..15c4b9921c8c38acb48f7f79ac46da81485a813f --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/applaunchertool.cpp @@ -0,0 +1,57 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "applaunchertool.h" +#include "applauncherwidget.h" + +AppLauncher::AppLauncher(QObject *parent) : AbstractActionTool(parent) { + +} + +bool AppLauncher::closeOnButtonPressed() const { + return true; +} + +QIcon AppLauncher::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "open_with.svg"); +} +QString AppLauncher::name() const { + return tr("App Launcher"); +} + +QString AppLauncher::nameID() { + return ""; +} + +QString AppLauncher::description() const { + return tr("Choose an app to open the capture"); +} + +QWidget* AppLauncher::widget() { + return new AppLauncherWidget(capture); +} + +CaptureTool* AppLauncher::copy(QObject *parent) { + return new AppLauncher(parent); +} + +void AppLauncher::pressed(const CaptureContext &context) { + capture = context.selectedScreenshotArea(); + emit requestAction(REQ_CAPTURE_DONE_OK); + emit requestAction(REQ_ADD_EXTERNAL_WIDGETS); +} diff --git a/flameshot-0.6.0/src/tools/launcher/applaunchertool.h b/flameshot-0.6.0/src/tools/launcher/applaunchertool.h new file mode 100644 index 0000000000000000000000000000000000000000..f925b6765f5687e97cc5bc6c019011ff553b1472 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/applaunchertool.h @@ -0,0 +1,43 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class AppLauncher : public AbstractActionTool { + Q_OBJECT +public: + explicit AppLauncher(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + QWidget* widget() override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; + +private: + QPixmap capture; +}; diff --git a/flameshot-0.6.0/src/tools/launcher/applauncherwidget.cpp b/flameshot-0.6.0/src/tools/launcher/applauncherwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9edccae491682a3731e3625113f304cd0846770f --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/applauncherwidget.cpp @@ -0,0 +1,246 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "applauncherwidget.h" +#include "src/utils/filenamehandler.h" +#include "src/tools/launcher/launcheritemdelegate.h" +#include "src/utils/globalvalues.h" +#include "src/utils/confighandler.h" +#include "terminallauncher.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +QMap catIconNames({ + { "Multimedia", "applications-multimedia" }, + { "Development","applications-development" }, + { "Graphics", "applications-graphics" }, + { "Network", "preferences-system-network" }, + { "Office", "applications-office" }, + { "Science", "applications-science" }, + { "Settings", "preferences-desktop" }, + { "System", "preferences-system" }, + { "Utility", "applications-utilities" } + }); +} + +AppLauncherWidget::AppLauncherWidget(const QPixmap &p, QWidget *parent): + QWidget(parent), m_pixmap(p) +{ + setAttribute(Qt::WA_DeleteOnClose); + setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowTitle(tr("Open With")); + + m_keepOpen = ConfigHandler().keepOpenAppLauncherValue(); + + QString dirLocal = QDir::homePath() + "/.local/share/applications/"; + QDir appsDirLocal(dirLocal); + m_parser.processDirectory(appsDirLocal); + + QString dir = "/usr/share/applications/"; + QDir appsDir(dir); + m_parser.processDirectory(appsDir); + + initAppMap(); + initListWidget(); + + m_terminalCheckbox = new QCheckBox(tr("Launch in terminal"), this); + m_keepOpenCheckbox = new QCheckBox(tr("Keep open after selection"), this); + m_keepOpenCheckbox->setChecked(ConfigHandler().keepOpenAppLauncherValue()); + connect(m_keepOpenCheckbox, &QCheckBox::clicked, this, &AppLauncherWidget::checkboxClicked); + + // search items + m_lineEdit = new QLineEdit; + connect(m_lineEdit, &QLineEdit::textChanged, + this, &AppLauncherWidget::searchChanged); + m_filterList = new QListWidget; + m_filterList->hide(); + configureListView(m_filterList); + connect(m_filterList, &QListWidget::clicked, this, &AppLauncherWidget::launch); + + m_layout = new QVBoxLayout(this); + m_layout->addWidget(m_filterList); + m_layout->addWidget(m_tabWidget); + m_layout->addWidget(m_lineEdit); + m_layout->addWidget(m_keepOpenCheckbox); + m_layout->addWidget(m_terminalCheckbox); + m_lineEdit->setFocus(); +} + +void AppLauncherWidget::launch(const QModelIndex &index) { + if (!QFileInfo(m_tempFile).isReadable()) { + m_tempFile = FileNameHandler().generateAbsolutePath(QDir::tempPath()) + ".png"; + bool ok = m_pixmap.save(m_tempFile); + if (!ok) { + QMessageBox::about(this, tr("Error"), tr("Unable to write in") + + QDir::tempPath()); + return; + } + } + QString command = index.data(Qt::UserRole).toString().replace( + QRegExp("(\\%.)"), '"' + m_tempFile + '"'); + bool inTerminal = index.data(Qt::UserRole+1).toBool() || + m_terminalCheckbox->isChecked(); + if (inTerminal) { + bool ok = TerminalLauncher::launchDetached(command); + if (!ok) { + QMessageBox::about(this, tr("Error"), + tr("Unable to launch in terminal.")); + } + } else { + QProcess::startDetached(command); + } + if (!m_keepOpen) { + close(); + } +} + +void AppLauncherWidget::checkboxClicked(const bool enabled) { + m_keepOpen = enabled; + ConfigHandler().setKeepOpenAppLauncher(enabled); + m_keepOpenCheckbox->setChecked(enabled); +} + +void AppLauncherWidget::searchChanged(const QString &text) { + if (text.isEmpty()) { + m_filterList->hide(); + m_tabWidget->show(); + } else { + m_tabWidget->hide(); + m_filterList->show(); + m_filterList->clear(); + QRegExp regexp(text, Qt::CaseInsensitive, QRegExp::Wildcard); + QVector apps; + + for (auto const& i : catIconNames.toStdMap()) { + const QString &cat = i.first; + if (!m_appsMap.contains(cat)) { + continue; + } + const QVector &appList = m_appsMap[cat]; + for (const DesktopAppData &app: appList) { + if (!apps.contains(app) && (app.name.contains(regexp) || + app.description.contains(regexp) )) + { + apps.append(app); + } + } + } + addAppsToListWidget(m_filterList, apps); + } +} + +void AppLauncherWidget::initListWidget() { + m_tabWidget = new QTabWidget; + const int size = GlobalValues::buttonBaseSize(); + m_tabWidget->setIconSize(QSize(size, size)); + + for (auto const& i : catIconNames.toStdMap()) { + const QString &cat = i.first; + const QString &iconName = i.second; + + if (!m_appsMap.contains(cat)) { + continue; + } + + QListWidget *itemsWidget = new QListWidget(); + configureListView(itemsWidget); + + const QVector &appList = m_appsMap[cat]; + addAppsToListWidget(itemsWidget, appList); + + m_tabWidget->addTab(itemsWidget, QIcon::fromTheme(iconName), ""); + m_tabWidget->setTabToolTip(m_tabWidget->count(), cat); + if (cat == "Graphics") { + m_tabWidget->setCurrentIndex(m_tabWidget->count() -1); + } + } +} + +void AppLauncherWidget::initAppMap() { + QStringList categories({"AudioVideo", + "Audio", + "Video", + "Development", + "Graphics", + "Network", + "Office", + "Science", + "Settings", + "System", + "Utility"}); + + m_appsMap = m_parser.getAppsByCategory(categories); + + // Unify multimedia. + QVector multimediaList; + QStringList multimediaNames; + multimediaNames << "AudioVideo" << "Audio" << "Video"; + for (const QString &name : multimediaNames) { + if(!m_appsMap.contains(name)) { + continue; + } + for (auto i : m_appsMap[name]) { + if (!multimediaList.contains(i)) { + multimediaList.append(i); + } + } + m_appsMap.remove(name); + } + m_appsMap.insert("Multimedia", multimediaList); +} + +void AppLauncherWidget::configureListView(QListWidget *widget) { + widget->setItemDelegate(new LauncherItemDelegate()); + widget->setViewMode(QListWidget::IconMode); + widget->setResizeMode(QListView::Adjust); + widget->setSpacing(4); + widget->setFlow(QListView::LeftToRight); + widget->setDragEnabled(false); + widget->setMinimumWidth(GlobalValues::buttonBaseSize() * 11); + connect(widget, &QListWidget::clicked, + this, &AppLauncherWidget::launch); +} + +void AppLauncherWidget::addAppsToListWidget( + QListWidget *widget, const QVector &appList) +{ + for (const DesktopAppData &app: appList) { + QListWidgetItem *buttonItem = new QListWidgetItem(widget); + buttonItem->setData(Qt::DecorationRole, app.icon); + buttonItem->setData(Qt::DisplayRole, app.name); + buttonItem->setData(Qt::UserRole, app.exec); + buttonItem->setData(Qt::UserRole+1, app.showInTerminal); + QColor foregroundColor = + this->palette().color(QWidget::foregroundRole()); + buttonItem->setForeground(foregroundColor); + + buttonItem->setIcon(app.icon); + buttonItem->setText(app.name); + buttonItem->setToolTip(app.description); + } +} diff --git a/flameshot-0.6.0/src/tools/launcher/applauncherwidget.h b/flameshot-0.6.0/src/tools/launcher/applauncherwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..6c0f22a4ad78bad7d0cf5f1d7f902a6881360a48 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/applauncherwidget.h @@ -0,0 +1,58 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/utils/desktopfileparse.h" +#include +#include + +class QTabWidget; +class QCheckBox; +class QVBoxLayout; +class QLineEdit; +class QListWidget; + +class AppLauncherWidget: public QWidget { + Q_OBJECT +public: + explicit AppLauncherWidget(const QPixmap &p, QWidget *parent = nullptr); + +private slots: + void launch(const QModelIndex &index); + void checkboxClicked(const bool enabled); + void searchChanged(const QString &text); + +private: + void initListWidget(); + void initAppMap(); + void configureListView(QListWidget *widget); + void addAppsToListWidget(QListWidget *widget, + const QVector &appList); + + DesktopFileParser m_parser; + QPixmap m_pixmap; + QString m_tempFile; + bool m_keepOpen; + QMap> m_appsMap; + QCheckBox *m_keepOpenCheckbox; + QCheckBox *m_terminalCheckbox; + QVBoxLayout *m_layout; + QLineEdit *m_lineEdit; + QListWidget *m_filterList; + QTabWidget *m_tabWidget; +}; diff --git a/flameshot-0.6.0/src/tools/launcher/launcheritemdelegate.cpp b/flameshot-0.6.0/src/tools/launcher/launcheritemdelegate.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b96addf9202eae2c0807a5b40f1c0fd3cb4fb69 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/launcheritemdelegate.cpp @@ -0,0 +1,66 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "launcheritemdelegate.h" +#include "src/utils/globalvalues.h" +#include + +LauncherItemDelegate::LauncherItemDelegate(QObject *parent) : + QStyledItemDelegate(parent) +{ +} + +void LauncherItemDelegate::paint( + QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const +{ + const QRect &rect = option.rect; + if (option.state & (QStyle::State_Selected | QStyle::State_MouseOver)) { + painter->save(); + painter->setPen(Qt::transparent); + painter->setBrush(QPalette().highlight()); + painter->drawRect(rect.x(), rect.y(), + rect.width() -1, rect.height() -1); + painter->restore(); + } + QIcon icon = index.data(Qt::DecorationRole).value(); + + const int iconSide = GlobalValues::buttonBaseSize() * 1.3; + const int halfIcon = iconSide/2; + const int halfWidth = rect.width()/2; + const int halfHeight = rect.height()/2; + QSize size(iconSide, iconSide); + QPixmap pixIcon = icon.pixmap(size).scaled(size, Qt::KeepAspectRatio); + painter->drawPixmap(rect.x() + (halfWidth - halfIcon), + rect.y()+ (halfHeight/2 - halfIcon), + iconSide, iconSide, pixIcon); + const QRect textRect(rect.x(), rect.y() + halfHeight, + rect.width(), halfHeight); + painter->drawText(textRect, Qt::TextWordWrap | Qt::AlignHCenter, + index.data(Qt::DisplayRole).toString()); +} + +QSize LauncherItemDelegate::sizeHint( + const QStyleOptionViewItem &option, + const QModelIndex &index) const +{ + Q_UNUSED(option); + Q_UNUSED(index); + const int size = GlobalValues::buttonBaseSize(); + return QSize(size * 3.2, size * 3.7); +} diff --git a/flameshot-0.6.0/src/tools/launcher/launcheritemdelegate.h b/flameshot-0.6.0/src/tools/launcher/launcheritemdelegate.h new file mode 100644 index 0000000000000000000000000000000000000000..ff2e1c2bc9929788a1444649f2c721f00d1d1a31 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/launcheritemdelegate.h @@ -0,0 +1,33 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/utils/desktopfileparse.h" +#include + +class LauncherItemDelegate : public QStyledItemDelegate { + Q_OBJECT +public: + explicit LauncherItemDelegate(QObject *parent = nullptr); + + void paint(QPainter *painter, + const QStyleOptionViewItem &option, + const QModelIndex &index) const; + + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; +}; diff --git a/flameshot-0.6.0/src/tools/launcher/openwithprogram.cpp b/flameshot-0.6.0/src/tools/launcher/openwithprogram.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c08935512756dc0db9b5be61cb5a26f0c3a3e022 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/openwithprogram.cpp @@ -0,0 +1,54 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + + +#include "openwithprogram.h" + +#if defined(Q_OS_WIN) +#include "src/utils/filenamehandler.h" +#include +#include +#include +#include + +#pragma comment(lib, "Shell32.lib") +#else +#include "src/tools/launcher/applauncherwidget.h" +#endif + +void showOpenWithMenu(const QPixmap &capture) { +#if defined(Q_OS_WIN) + QString tempFile = + FileNameHandler().generateAbsolutePath(QDir::tempPath()) + ".png"; + bool ok = capture.save(tempFile); + if (!ok) { + QMessageBox::about(nullptr, QObject::tr("Error"), + QObject::tr("Unable to write in") + QDir::tempPath()); + return; + } + + OPENASINFO info; + auto wStringFile = tempFile.replace("/", "\\").toStdWString(); + info.pcszFile = wStringFile.c_str(); + info.pcszClass = nullptr; + info.oaifInFlags = OAIF_ALLOW_REGISTRATION | OAIF_EXEC; + SHOpenWithDialog(nullptr, &info); +#else + auto w = new AppLauncherWidget(capture); + w->show(); +#endif +} diff --git a/flameshot-0.6.0/src/tools/launcher/openwithprogram.h b/flameshot-0.6.0/src/tools/launcher/openwithprogram.h new file mode 100644 index 0000000000000000000000000000000000000000..f3ad602a60c4ae5fa68293072ba890d65a0fa3bd --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/openwithprogram.h @@ -0,0 +1,22 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +void showOpenWithMenu(const QPixmap &capture); diff --git a/flameshot-0.6.0/src/tools/launcher/terminallauncher.cpp b/flameshot-0.6.0/src/tools/launcher/terminallauncher.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6e7ee5cabb7d0977b61e7adc0766a52e4579366 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/terminallauncher.cpp @@ -0,0 +1,60 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "terminallauncher.h" +#include +#include +#include +#include + +namespace { + static const TerminalApp terminalApps[] = { + { "x-terminal-emulator", "-e" }, + { "xfce4-terminal", "-x" }, + { "konsole", "-e" }, + { "gnome-terminal", "--" }, + { "terminator", "-e" }, + { "terminology", "-e" }, + { "tilix", "-e" }, + { "xterm", "-e" }, + { "aterm", "-e" }, + { "Eterm", "-e" }, + { "rxvt", "-e" }, + { "urxvt", "-e" }, + }; +} + +TerminalLauncher::TerminalLauncher(QObject *parent) : QObject(parent) { +} + +TerminalApp TerminalLauncher::getPreferedTerminal() { + TerminalApp res; + for (const TerminalApp &app : terminalApps) { + QString path = QStandardPaths::findExecutable(app.name); + if (!path.isEmpty()) { + res = app; + break; + } + } + return res; +} + +bool TerminalLauncher::launchDetached(const QString &command) { + TerminalApp app = getPreferedTerminal(); + QString s = app.name + " " + app.arg + " " + command; + return QProcess::startDetached(s); +} diff --git a/flameshot-0.6.0/src/tools/launcher/terminallauncher.h b/flameshot-0.6.0/src/tools/launcher/terminallauncher.h new file mode 100644 index 0000000000000000000000000000000000000000..e61c204110b6766d43b5a6ef52acb2085b987948 --- /dev/null +++ b/flameshot-0.6.0/src/tools/launcher/terminallauncher.h @@ -0,0 +1,35 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +struct TerminalApp { + QString name; + QString arg; +}; + +class TerminalLauncher : public QObject { + Q_OBJECT +public: + explicit TerminalLauncher(QObject *parent = nullptr); + + static bool launchDetached(const QString &command); +private: + static TerminalApp getPreferedTerminal(); +}; diff --git a/flameshot-0.6.0/src/tools/line/linetool.cpp b/flameshot-0.6.0/src/tools/line/linetool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c6daeb8b50eae93af1f77f8b780a3cb56285608c --- /dev/null +++ b/flameshot-0.6.0/src/tools/line/linetool.cpp @@ -0,0 +1,86 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "linetool.h" +#include + +namespace { + +#define ADJ_VALUE 13 +#define PADDING_VALUE 2 + +// Have to force horizontal position +bool needsAdjustment(const QPoint &p0, const QPoint &p1) { + return (p1.y() >= p0.y() - ADJ_VALUE) && (p1.y() <= p0.y() + ADJ_VALUE); +} + +} + +LineTool::LineTool(QObject *parent) : AbstractTwoPointTool(parent) { + +} + +QIcon LineTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "line.svg"); +} +QString LineTool::name() const { + return tr("Line"); +} + +QString LineTool::nameID() { + return ""; +} + +QString LineTool::description() const { + return tr("Sets the Line as the paint tool"); +} + +CaptureTool* LineTool::copy(QObject *parent) { + return new LineTool(parent); +} + +void LineTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setPen(QPen(m_color, m_thickness)); + painter.drawLine(m_points.first, m_points.second); +} + +void LineTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void LineTool::drawMove(const QPoint &p) { + m_points.second = p; + if (needsAdjustment(m_points.first, m_points.second)) { + m_points.second.setY(m_points.first.y()); + } +} + +void LineTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void LineTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/line/linetool.h b/flameshot-0.6.0/src/tools/line/linetool.h new file mode 100644 index 0000000000000000000000000000000000000000..0705138aa9885d52adcff9efc65e95149885fabe --- /dev/null +++ b/flameshot-0.6.0/src/tools/line/linetool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class LineTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit LineTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawMove(const QPoint &p) override; + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/marker/markertool.cpp b/flameshot-0.6.0/src/tools/marker/markertool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..85a11ddeddb7768eb4f7b235ef85b2d09ec0b86e --- /dev/null +++ b/flameshot-0.6.0/src/tools/marker/markertool.cpp @@ -0,0 +1,92 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "markertool.h" +#include + +namespace { + +#define ADJ_VALUE 14 +#define PADDING_VALUE 14 + +// Have to force horizontal position +bool needsAdjustment(const QPoint &p0, const QPoint &p1) { + return (p1.y() >= p0.y() - ADJ_VALUE) && (p1.y() <= p0.y() + ADJ_VALUE); +} + +} + +MarkerTool::MarkerTool(QObject *parent) : AbstractTwoPointTool(parent) { + +} + +QIcon MarkerTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "marker.svg"); +} +QString MarkerTool::name() const { + return tr("Marker"); +} + +QString MarkerTool::nameID() { + return ""; +} + +QString MarkerTool::description() const { + return tr("Sets the Marker as the paint tool"); +} + +CaptureTool* MarkerTool::copy(QObject *parent) { + return new MarkerTool(parent); +} + +void MarkerTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setOpacity(0.35); + painter.setPen(QPen(m_color, m_thickness)); + painter.drawLine(m_points.first, m_points.second); +} + +void MarkerTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setOpacity(0.35); + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void MarkerTool::drawMove(const QPoint &p) { + m_points.second = p; + if (needsAdjustment(m_points.first, m_points.second)) { + m_points.second.setY(m_points.first.y()); + } +} + +void MarkerTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void MarkerTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} + +void MarkerTool::thicknessChanged(const int th) { + m_thickness = th + PADDING_VALUE; +} diff --git a/flameshot-0.6.0/src/tools/marker/markertool.h b/flameshot-0.6.0/src/tools/marker/markertool.h new file mode 100644 index 0000000000000000000000000000000000000000..f39f6d5ecd624758a01de0aa7460fa94ee2190ba --- /dev/null +++ b/flameshot-0.6.0/src/tools/marker/markertool.h @@ -0,0 +1,42 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class MarkerTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit MarkerTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawMove(const QPoint &p) override; + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; + void thicknessChanged(const int th) override; +}; diff --git a/flameshot-0.6.0/src/tools/move/movetool.cpp b/flameshot-0.6.0/src/tools/move/movetool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..08e902fb5c31d2c848f933b033f10771cd27729d --- /dev/null +++ b/flameshot-0.6.0/src/tools/move/movetool.cpp @@ -0,0 +1,52 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "movetool.h" +#include + +MoveTool::MoveTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool MoveTool::closeOnButtonPressed() const { + return false; +} + +QIcon MoveTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "cursor-move.svg"); +} +QString MoveTool::name() const { + return tr("Move"); +} + +QString MoveTool::nameID() { + return ""; +} + +QString MoveTool::description() const { + return tr("Move the selection area"); +} + +CaptureTool* MoveTool::copy(QObject *parent) { + return new MoveTool(parent); +} + +void MoveTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); + emit requestAction(REQ_MOVE_MODE); +} diff --git a/flameshot-0.6.0/src/tools/move/movetool.h b/flameshot-0.6.0/src/tools/move/movetool.h new file mode 100644 index 0000000000000000000000000000000000000000..125eb2bc78ed82913d79b77db3953b78841165d3 --- /dev/null +++ b/flameshot-0.6.0/src/tools/move/movetool.h @@ -0,0 +1,38 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class MoveTool : public AbstractActionTool { + Q_OBJECT +public: + explicit MoveTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/pencil/penciltool.cpp b/flameshot-0.6.0/src/tools/pencil/penciltool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..509c825b2053e01f99be5f27a036fdc6b981f630 --- /dev/null +++ b/flameshot-0.6.0/src/tools/pencil/penciltool.cpp @@ -0,0 +1,68 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "penciltool.h" +#include + +PencilTool::PencilTool(QObject *parent) : AbstractPathTool(parent) { + +} + +QIcon PencilTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "pencil.svg"); +} +QString PencilTool::name() const { + return tr("Pencil"); +} + +QString PencilTool::nameID() { + return ""; +} + +QString PencilTool::description() const { + return tr("Sets the Pencil as the paint tool"); +} + +CaptureTool* PencilTool::copy(QObject *parent) { + return new PencilTool(parent); +} + +void PencilTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setPen(QPen(m_color, m_thickness)); + painter.drawPolyline(m_points.data(), m_points.size()); +} + +void PencilTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, context.thickness + 2)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void PencilTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + 2; + m_points.append(context.mousePos); + m_backupArea.setTopLeft(context.mousePos); + m_backupArea.setBottomRight(context.mousePos); +} + +void PencilTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/pencil/penciltool.h b/flameshot-0.6.0/src/tools/pencil/penciltool.h new file mode 100644 index 0000000000000000000000000000000000000000..621c1a00465a607f79192d6e856d5b4e64d5aaa6 --- /dev/null +++ b/flameshot-0.6.0/src/tools/pencil/penciltool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractpathtool.h" + +class PencilTool : public AbstractPathTool { + Q_OBJECT +public: + explicit PencilTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/pin/pintool.cpp b/flameshot-0.6.0/src/tools/pin/pintool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5017e14dbea25e4ca2c12fc03b62651948660dab --- /dev/null +++ b/flameshot-0.6.0/src/tools/pin/pintool.cpp @@ -0,0 +1,68 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "pintool.h" +#include "src/tools/pin/pinwidget.h" + +PinTool::PinTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool PinTool::closeOnButtonPressed() const { + return true; +} + +QIcon PinTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "pin.svg"); +} +QString PinTool::name() const { + return tr("Pin Tool"); +} + +QString PinTool::nameID() { + return ""; +} + +QString PinTool::description() const { + return tr("Pin image on the desktop"); +} + +QWidget* PinTool::widget() { + PinWidget *w = new PinWidget(m_pixmap); + const int &&m = w->margin(); +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + QRect adjusted_pos = m_geometry + QMargins(m,-m,-m,-m); +#else + QRect adjusted_pos = m_geometry + QMargins(m, m, m, m); +#endif + w->setGeometry(adjusted_pos); + return w; +} + +CaptureTool* PinTool::copy(QObject *parent) { + return new PinTool(parent); +} + +void PinTool::pressed(const CaptureContext &context) { + emit requestAction(REQ_CAPTURE_DONE_OK); + m_geometry = context.selection; + m_geometry.setTopLeft(m_geometry.topLeft() + context.widgetOffset); + m_pixmap = context.selectedScreenshotArea(); + emit requestAction(REQ_ADD_EXTERNAL_WIDGETS); + +} diff --git a/flameshot-0.6.0/src/tools/pin/pintool.h b/flameshot-0.6.0/src/tools/pin/pintool.h new file mode 100644 index 0000000000000000000000000000000000000000..045e4b024c81b7357d947e35daec1d648890cdef --- /dev/null +++ b/flameshot-0.6.0/src/tools/pin/pintool.h @@ -0,0 +1,44 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class PinTool : public AbstractActionTool { + Q_OBJECT +public: + explicit PinTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + QWidget* widget() override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; + +private: + QRect m_geometry; + QPixmap m_pixmap; +}; diff --git a/flameshot-0.6.0/src/tools/pin/pinwidget.cpp b/flameshot-0.6.0/src/tools/pin/pinwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..330c37ff2c7af5b65576f73b05f4d6a951e7ba33 --- /dev/null +++ b/flameshot-0.6.0/src/tools/pin/pinwidget.cpp @@ -0,0 +1,102 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "pinwidget.h" +#include "src/utils/confighandler.h" +#include +#include +#include +#include +#include + +PinWidget::PinWidget(const QPixmap &pixmap, QWidget *parent) : + QWidget(parent), m_pixmap(pixmap) +{ + setWindowFlags(Qt::WindowStaysOnTopHint + | Qt::FramelessWindowHint); + //set the bottom widget background transparent + setAttribute(Qt::WA_TranslucentBackground); + + ConfigHandler conf; + m_baseColor = conf.uiMainColorValue(); + m_hoverColor = conf.uiContrastColorValue(); + + m_layout = new QVBoxLayout(this); + const int margin = this->margin(); + m_layout->setContentsMargins(margin, margin, margin, margin); + + m_shadowEffect = new QGraphicsDropShadowEffect(this); + m_shadowEffect->setColor(m_baseColor); + m_shadowEffect->setBlurRadius(2 * margin); + m_shadowEffect->setOffset(0, 0); + setGraphicsEffect(m_shadowEffect); + + m_label = new QLabel(); + m_label->setPixmap(m_pixmap); + m_layout->addWidget(m_label); + + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close())); + new QShortcut(Qt::Key_Escape, this, SLOT(close())); +} + +int PinWidget::margin() const { + return 7; +} + +void PinWidget::wheelEvent(QWheelEvent *e) { + int val = e->delta() > 0 ? 5 : -5; + int newWidth = qBound(50, m_label->width() + val, maximumWidth()); + int newHeight = qBound(50, m_label->height() + val, maximumHeight()); + + QSize size(newWidth, newHeight); + setScaledPixmap(size); + adjustSize(); + + e->accept(); +} + +void PinWidget::enterEvent(QEvent *) { + m_shadowEffect->setColor(m_hoverColor); +} +void PinWidget::leaveEvent(QEvent *) { + m_shadowEffect->setColor(m_baseColor); +} + +void PinWidget::mouseDoubleClickEvent(QMouseEvent *) { + close(); +} + +void PinWidget::mousePressEvent(QMouseEvent *e) { + m_dragStart = e->globalPos(); + m_offsetX = e->localPos().x() / width(); + m_offsetY = e->localPos().y() / height(); +} + +void PinWidget::mouseMoveEvent(QMouseEvent *e) { + const QPoint delta = e->globalPos() - m_dragStart; + int offsetW = width() * m_offsetX; + int offsetH = height() * m_offsetY; + move(m_dragStart.x() + delta.x() - offsetW, m_dragStart.y() + delta.y() - offsetH); +} + +void PinWidget::setScaledPixmap(const QSize &size) { + const qreal scale = qApp->devicePixelRatio(); + QPixmap scaledPixmap = m_pixmap.scaled(size * scale, Qt::KeepAspectRatio, + Qt::SmoothTransformation); + scaledPixmap.setDevicePixelRatio(scale); + m_label->setPixmap(scaledPixmap); +} diff --git a/flameshot-0.6.0/src/tools/pin/pinwidget.h b/flameshot-0.6.0/src/tools/pin/pinwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..3bfa29230c38e70b2f6afaebb70b8a3497515263 --- /dev/null +++ b/flameshot-0.6.0/src/tools/pin/pinwidget.h @@ -0,0 +1,51 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include + +class QVBoxLayout; +class QLabel; + +class PinWidget : public QWidget { + Q_OBJECT +public: + explicit PinWidget(const QPixmap &pixmap, QWidget *parent = nullptr); + + int margin() const; + +protected: + void wheelEvent(QWheelEvent *e); + void mouseDoubleClickEvent(QMouseEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void enterEvent(QEvent *); + void leaveEvent(QEvent *); + +private: + void setScaledPixmap(const QSize &size); + + QPixmap m_pixmap; + QVBoxLayout *m_layout; + QLabel *m_label; + QPoint m_dragStart; + qreal m_offsetX, m_offsetY; + QGraphicsDropShadowEffect *m_shadowEffect; + QColor m_baseColor, m_hoverColor; +}; diff --git a/flameshot-0.6.0/src/tools/rectangle/rectangletool.cpp b/flameshot-0.6.0/src/tools/rectangle/rectangletool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..368199c130568cd710da9f044311dffc6164f460 --- /dev/null +++ b/flameshot-0.6.0/src/tools/rectangle/rectangletool.cpp @@ -0,0 +1,72 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "rectangletool.h" +#include + +namespace { +#define PADDING_VALUE 2 +} + +RectangleTool::RectangleTool(QObject *parent) : AbstractTwoPointTool(parent) { + +} + +QIcon RectangleTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "square.svg"); +} +QString RectangleTool::name() const { + return tr("Rectangle"); +} + +QString RectangleTool::nameID() { + return ""; +} + +QString RectangleTool::description() const { + return tr("Sets the Rectangle as the paint tool"); +} + +CaptureTool* RectangleTool::copy(QObject *parent) { + return new RectangleTool(parent); +} + +void RectangleTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setPen(QPen(m_color, m_thickness)); + painter.setBrush(QBrush(m_color)); + painter.drawRect(QRect(m_points.first, m_points.second)); +} + +void RectangleTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void RectangleTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void RectangleTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/rectangle/rectangletool.h b/flameshot-0.6.0/src/tools/rectangle/rectangletool.h new file mode 100644 index 0000000000000000000000000000000000000000..dd04cfaca896d7baee43e4da3a04660960ecbe1b --- /dev/null +++ b/flameshot-0.6.0/src/tools/rectangle/rectangletool.h @@ -0,0 +1,40 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class RectangleTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit RectangleTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/redo/redotool.cpp b/flameshot-0.6.0/src/tools/redo/redotool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ee8a8c037261719c7639fb9bef2c6fe947d4e369 --- /dev/null +++ b/flameshot-0.6.0/src/tools/redo/redotool.cpp @@ -0,0 +1,52 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "redotool.h" +#include + +RedoTool::RedoTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool RedoTool::closeOnButtonPressed() const { + return false; +} + +QIcon RedoTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "redo-variant.svg"); +} +QString RedoTool::name() const { + return tr("Redo"); +} + +QString RedoTool::nameID() { + return ""; +} + +QString RedoTool::description() const { + return tr("Redo the next modification"); +} + +CaptureTool* RedoTool::copy(QObject *parent) { + return new RedoTool(parent); +} + +void RedoTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); + emit requestAction(REQ_REDO_MODIFICATION); +} diff --git a/flameshot-0.6.0/src/tools/redo/redotool.h b/flameshot-0.6.0/src/tools/redo/redotool.h new file mode 100644 index 0000000000000000000000000000000000000000..c5a9d41f08bc9356ca1378262e58d259723250f8 --- /dev/null +++ b/flameshot-0.6.0/src/tools/redo/redotool.h @@ -0,0 +1,39 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class RedoTool : public AbstractActionTool { + Q_OBJECT +public: + explicit RedoTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; + +}; diff --git a/flameshot-0.6.0/src/tools/save/savetool.cpp b/flameshot-0.6.0/src/tools/save/savetool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ec7027fc370dcbaf3a33b893d2f69cf48ee9ee48 --- /dev/null +++ b/flameshot-0.6.0/src/tools/save/savetool.cpp @@ -0,0 +1,65 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "savetool.h" +#include "src/utils/screenshotsaver.h" +#include + +SaveTool::SaveTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool SaveTool::closeOnButtonPressed() const { + return true; +} + +QIcon SaveTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "content-save.svg"); +} +QString SaveTool::name() const { + return tr("Save"); +} + +QString SaveTool::nameID() { + return ""; +} + +QString SaveTool::description() const { + return tr("Save the capture"); +} + +CaptureTool* SaveTool::copy(QObject *parent) { + return new SaveTool(parent); +} + +void SaveTool::pressed(const CaptureContext &context) { + if (context.savePath.isEmpty()) { + emit requestAction(REQ_HIDE_GUI); + bool ok = ScreenshotSaver().saveToFilesystemGUI( + context.selectedScreenshotArea()); + if (ok) { + emit requestAction(REQ_CAPTURE_DONE_OK); + } + } else { + bool ok = ScreenshotSaver().saveToFilesystem( + context.selectedScreenshotArea(), context.savePath); + if (ok) { + emit requestAction(REQ_CAPTURE_DONE_OK); + } + } +} diff --git a/flameshot-0.6.0/src/tools/save/savetool.h b/flameshot-0.6.0/src/tools/save/savetool.h new file mode 100644 index 0000000000000000000000000000000000000000..081eeea04736e8f21cb04efb86d838a7b20e7545 --- /dev/null +++ b/flameshot-0.6.0/src/tools/save/savetool.h @@ -0,0 +1,38 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class SaveTool : public AbstractActionTool { + Q_OBJECT +public: + explicit SaveTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/selection/selectiontool.cpp b/flameshot-0.6.0/src/tools/selection/selectiontool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..fb3b312546088dc01dc7840f2dd6eddb129f0744 --- /dev/null +++ b/flameshot-0.6.0/src/tools/selection/selectiontool.cpp @@ -0,0 +1,75 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "selectiontool.h" +#include + +namespace { +#define PADDING_VALUE 2 +} + +SelectionTool::SelectionTool(QObject *parent) : AbstractTwoPointTool(parent) { + +} + +bool SelectionTool::closeOnButtonPressed() const { + return false; +} + +QIcon SelectionTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "square-outline.svg"); +} +QString SelectionTool::name() const { + return tr("Rectangular Selection"); +} + +QString SelectionTool::nameID() { + return ""; +} + +QString SelectionTool::description() const { + return tr("Sets the Selection as the paint tool"); +} + +CaptureTool* SelectionTool::copy(QObject *parent) { + return new SelectionTool(parent); +} + +void SelectionTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setPen(QPen(m_color, m_thickness)); + painter.drawRect(QRect(m_points.first, m_points.second)); +} + +void SelectionTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void SelectionTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_points.second = context.mousePos; +} + +void SelectionTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/selection/selectiontool.h b/flameshot-0.6.0/src/tools/selection/selectiontool.h new file mode 100644 index 0000000000000000000000000000000000000000..23610866a4de243cc3e13a599ea9803cd55ba651 --- /dev/null +++ b/flameshot-0.6.0/src/tools/selection/selectiontool.h @@ -0,0 +1,42 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class SelectionTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit SelectionTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/sizeindicator/sizeindicatortool.cpp b/flameshot-0.6.0/src/tools/sizeindicator/sizeindicatortool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1e883048211c58c4ba58bf31bb15757758d5ca88 --- /dev/null +++ b/flameshot-0.6.0/src/tools/sizeindicator/sizeindicatortool.cpp @@ -0,0 +1,51 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "sizeindicatortool.h" +#include + +SizeIndicatorTool::SizeIndicatorTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool SizeIndicatorTool::closeOnButtonPressed() const { + return false; +} + +QIcon SizeIndicatorTool::icon(const QColor &background, bool inEditor) const { + return inEditor ? QIcon() : + QIcon(iconPath(background) + "size_indicator.svg"); +} +QString SizeIndicatorTool::name() const { + return tr("Selection Size Indicator"); +} + +QString SizeIndicatorTool::nameID() { + return ""; +} + +QString SizeIndicatorTool::description() const { + return tr("Shows the dimensions of the selection (X Y)"); +} + +CaptureTool* SizeIndicatorTool::copy(QObject *parent) { + return new SizeIndicatorTool(parent); +} + +void SizeIndicatorTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/flameshot-0.6.0/src/tools/sizeindicator/sizeindicatortool.h b/flameshot-0.6.0/src/tools/sizeindicator/sizeindicatortool.h new file mode 100644 index 0000000000000000000000000000000000000000..ade0f7780b9b456d7afce1b8c6619373cd600421 --- /dev/null +++ b/flameshot-0.6.0/src/tools/sizeindicator/sizeindicatortool.h @@ -0,0 +1,38 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class SizeIndicatorTool : public AbstractActionTool { + Q_OBJECT +public: + explicit SizeIndicatorTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; +}; diff --git a/flameshot-0.6.0/src/tools/text/textconfig.cpp b/flameshot-0.6.0/src/tools/text/textconfig.cpp new file mode 100644 index 0000000000000000000000000000000000000000..357fa0413657dedaae7be3cc52e852339b353e43 --- /dev/null +++ b/flameshot-0.6.0/src/tools/text/textconfig.cpp @@ -0,0 +1,103 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "textconfig.h" +#include "src/utils/colorutils.h" +#include "src/utils/pathinfo.h" +#include +#include +#include +#include +#include + +TextConfig::TextConfig(QWidget *parent) : QWidget(parent) { + m_layout = new QVBoxLayout(this); + + QFontDatabase fontDB; + QComboBox *fontsCB = new QComboBox(); + connect(fontsCB, &QComboBox::currentTextChanged, + this, &TextConfig::fontFamilyChanged); + fontsCB->addItems(fontDB.families()); + // TODO save family in config + int index = fontsCB->findText(font().family()); + fontsCB->setCurrentIndex(index); + + QColor bgColor(palette().background().color()); + QString iconPrefix = ColorUtils::colorIsDark(bgColor) ? + PathInfo::whiteIconPath() : + PathInfo::blackIconPath(); + + m_strikeOutButton = new QPushButton( + QIcon(iconPrefix + "format_strikethrough.svg"), ""); + m_strikeOutButton->setCheckable(true); + connect(m_strikeOutButton, &QPushButton::clicked, + this, &TextConfig::fontStrikeOutChanged); + m_strikeOutButton->setToolTip(tr("StrikeOut")); + + m_underlineButton = new QPushButton( + QIcon(iconPrefix + "format_underlined.svg"), ""); + m_underlineButton->setCheckable(true); + connect(m_underlineButton, &QPushButton::clicked, + this, &TextConfig::fontUnderlineChanged); + m_underlineButton->setToolTip(tr("Underline")); + + m_weightButton = new QPushButton( + QIcon(iconPrefix + "format_bold.svg"), ""); + m_weightButton->setCheckable(true); + connect(m_weightButton, &QPushButton::clicked, + this, &TextConfig::weightButtonPressed); + m_weightButton->setToolTip(tr("Bold")); + + m_italicButton = new QPushButton( + QIcon(iconPrefix + "format_italic.svg"), ""); + m_italicButton->setCheckable(true); + connect(m_italicButton, &QPushButton::clicked, + this, &TextConfig::fontItalicChanged); + m_italicButton->setToolTip(tr("Italic")); + QHBoxLayout *modifiersLayout = new QHBoxLayout(); + + m_layout->addWidget(fontsCB); + modifiersLayout->addWidget(m_strikeOutButton); + modifiersLayout->addWidget(m_underlineButton); + modifiersLayout->addWidget(m_weightButton); + modifiersLayout->addWidget(m_italicButton); + m_layout->addLayout(modifiersLayout); +} + +void TextConfig::setUnderline(const bool u) { + m_underlineButton->setChecked(u); +} + +void TextConfig::setStrikeOut(const bool s) { + m_strikeOutButton->setChecked(s); +} + +void TextConfig::setWeight(const int w) { + m_weightButton->setChecked(static_cast(w) == QFont::Bold); +} + +void TextConfig::setItalic(const bool i) { + m_italicButton->setChecked(i); +} + +void TextConfig::weightButtonPressed(const bool w) { + if (w) { + emit fontWeightChanged(QFont::Bold); + } else { + emit fontWeightChanged(QFont::Normal); + } +} diff --git a/flameshot-0.6.0/src/tools/text/textconfig.h b/flameshot-0.6.0/src/tools/text/textconfig.h new file mode 100644 index 0000000000000000000000000000000000000000..c9f15932c1987eb1e54babba3a49c2c346a6e8c4 --- /dev/null +++ b/flameshot-0.6.0/src/tools/text/textconfig.h @@ -0,0 +1,53 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QVBoxLayout; +class QPushButton; + +class TextConfig : public QWidget { + Q_OBJECT +public: + explicit TextConfig(QWidget *parent = nullptr); + + void setUnderline(const bool u); + void setStrikeOut(const bool s); + void setWeight(const int w); + void setItalic(const bool i); + +signals: + void fontFamilyChanged(const QString &f); + void fontUnderlineChanged(const bool underlined); + void fontStrikeOutChanged(const bool dashed); + void fontWeightChanged(const QFont::Weight w); + void fontItalicChanged(const bool italic); + +public slots: + +private slots: + void weightButtonPressed(const bool w); + +private: + QVBoxLayout *m_layout; + QPushButton *m_strikeOutButton; + QPushButton *m_underlineButton; + QPushButton *m_weightButton; + QPushButton *m_italicButton; +}; diff --git a/flameshot-0.6.0/src/tools/text/texttool.cpp b/flameshot-0.6.0/src/tools/text/texttool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6688dc95a94f0dcd38242f33bd2294d934c256da --- /dev/null +++ b/flameshot-0.6.0/src/tools/text/texttool.cpp @@ -0,0 +1,210 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "texttool.h" +#include "textwidget.h" +#include "textconfig.h" + +#define BASE_POINT_SIZE 8 + + +TextTool::TextTool(QObject *parent) : CaptureTool(parent), m_size(1) { +} + +bool TextTool::isValid() const { + return !m_text.isEmpty(); +} + +bool TextTool::closeOnButtonPressed() const { + return false; +} + +bool TextTool::isSelectable() const { + return true; +} + +bool TextTool::showMousePreview() const { + return false; +} + +QIcon TextTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "text.svg"); +} + +QString TextTool::name() const { + return tr("Text"); +} + +QString TextTool::nameID() { + return ""; +} + +QString TextTool::description() const { + return tr("Add text to your capture"); +} + +QWidget *TextTool::widget() { + TextWidget *w = new TextWidget(); + w->setTextColor(m_color); + m_font.setPointSize(m_size + BASE_POINT_SIZE); + w->setFont(m_font); + connect(w, &TextWidget::textUpdated, + this, &TextTool::updateText); + m_widget = w; + return w; +} + +QWidget *TextTool::configurationWidget() { + m_confW = new TextConfig(); + connect(m_confW, &TextConfig::fontFamilyChanged, + this, &TextTool::updateFamily); + connect(m_confW, &TextConfig::fontItalicChanged, + this, &TextTool::updateFontItalic); + connect(m_confW, &TextConfig::fontStrikeOutChanged, + this, &TextTool::updateFontStrikeOut); + connect(m_confW, &TextConfig::fontUnderlineChanged, + this, &TextTool::updateFontUnderline); + connect(m_confW, &TextConfig::fontWeightChanged, + this, &TextTool::updateFontWeight); + m_confW->setItalic(m_font.italic()); + m_confW->setUnderline(m_font.underline()); + m_confW->setStrikeOut(m_font.strikeOut()); + m_confW->setWeight(m_font.weight()); + return m_confW; +} + +CaptureTool *TextTool::copy(QObject *parent) { + TextTool *tt = new TextTool(parent); + connect(m_confW, &TextConfig::fontFamilyChanged, + tt, &TextTool::updateFamily); + connect(m_confW, &TextConfig::fontItalicChanged, + tt, &TextTool::updateFontItalic); + connect(m_confW, &TextConfig::fontStrikeOutChanged, + tt, &TextTool::updateFontStrikeOut); + connect(m_confW, &TextConfig::fontUnderlineChanged, + tt, &TextTool::updateFontUnderline); + connect(m_confW, &TextConfig::fontWeightChanged, + tt, &TextTool::updateFontWeight); + tt->m_font = m_font; + return tt; +} + +void TextTool::undo(QPixmap &pixmap) { + QPainter p(&pixmap); + p.drawPixmap(m_backupArea.topLeft(), m_pixmapBackup); +} + +void TextTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (m_text.isEmpty()) { + return; + } + QFontMetrics fm(m_font); + QSize size(fm.boundingRect(QRect(), 0, m_text).size()); + m_backupArea.setSize(size); + if (recordUndo) { + m_pixmapBackup = pixmap.copy(m_backupArea + QMargins(0, 0, 5, 5)); + } + // draw text + painter.setFont(m_font); + painter.setPen(m_color); + painter.drawText(m_backupArea + QMargins(-5, -5, 5, 5), m_text); +} + +void TextTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + Q_UNUSED(painter); + Q_UNUSED(context); +} + +void TextTool::drawEnd(const QPoint &p) { + m_backupArea.moveTo(p); +} + +void TextTool::drawMove(const QPoint &p) { + m_widget->move(p); +} + +void TextTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_size = context.thickness; + emit requestAction(REQ_ADD_CHILD_WIDGET); +} + +void TextTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} + +void TextTool::colorChanged(const QColor &c) { + m_color = c; + if (m_widget) { + m_widget->setTextColor(c); + } +} + +void TextTool::thicknessChanged(const int th) { + m_size = th; + m_font.setPointSize(m_size + BASE_POINT_SIZE); + if (m_widget) { + m_widget->setFont(m_font); + } +} + +void TextTool::updateText(const QString &s) { + m_text = s; +} + +void TextTool::setFont(const QFont &f) { + m_font = f; + if (m_widget) { + m_widget->setFont(f); + } +} + +void TextTool::updateFamily(const QString &s) { + m_font.setFamily(s); + if (m_widget) { + m_widget->setFont(m_font); + } +} + +void TextTool::updateFontUnderline(const bool underlined) { + m_font.setUnderline(underlined); + if (m_widget) { + m_widget->setFont(m_font); + } +} + +void TextTool::updateFontStrikeOut(const bool s) { + m_font.setStrikeOut(s); + if (m_widget) { + m_widget->setFont(m_font); + } +} + +void TextTool::updateFontWeight(const QFont::Weight w) { + m_font.setWeight(w); + if (m_widget) { + m_widget->setFont(m_font); + } +} + +void TextTool::updateFontItalic(const bool italic) { + m_font.setItalic(italic); + if (m_widget) { + m_widget->setFont(m_font); + } +} diff --git a/flameshot-0.6.0/src/tools/text/texttool.h b/flameshot-0.6.0/src/tools/text/texttool.h new file mode 100644 index 0000000000000000000000000000000000000000..594a2f70707fd4d1247eb0b1dcdf5d82646a10ce --- /dev/null +++ b/flameshot-0.6.0/src/tools/text/texttool.h @@ -0,0 +1,77 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/capturetool.h" +#include + +class TextWidget; +class TextConfig; + +class TextTool : public CaptureTool { + Q_OBJECT +public: + explicit TextTool(QObject *parent = nullptr); + + bool isValid() const override; + bool closeOnButtonPressed() const override; + bool isSelectable() const override; + bool showMousePreview() const override; + + QIcon icon(const QColor &background, + bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + QWidget* widget() override; + QWidget* configurationWidget() override; + CaptureTool* copy(QObject *parent = nullptr) override; + + void undo(QPixmap &pixmap) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; + +public slots: + void drawEnd(const QPoint &p) override; + void drawMove(const QPoint &p) override; + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; + void colorChanged(const QColor &c) override; + void thicknessChanged(const int th) override; + +private slots: + void updateText(const QString &s); + void setFont(const QFont &f); + void updateFamily(const QString &s); + void updateFontUnderline(const bool underlined); + void updateFontStrikeOut(const bool s); + void updateFontWeight(const QFont::Weight w); + void updateFontItalic(const bool italic); + +private: + QFont m_font; + QString m_text; + int m_size; + QColor m_color; + QPixmap m_pixmapBackup; + QRect m_backupArea; + QPointer m_widget; + QPointer m_confW; +}; diff --git a/flameshot-0.6.0/src/tools/text/textwidget.cpp b/flameshot-0.6.0/src/tools/text/textwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..100b4c71472a5e72bd5d3768ec16e90d3aadf723 --- /dev/null +++ b/flameshot-0.6.0/src/tools/text/textwidget.cpp @@ -0,0 +1,87 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "textwidget.h" + +TextWidget::TextWidget(QWidget *parent) : QTextEdit(parent) { + setStyleSheet("TextWidget { background: transparent; }"); + connect(this, &TextWidget::textChanged, + this, &TextWidget::adjustSize); + connect(this, &TextWidget::textChanged, + this, &TextWidget::emitTextUpdated); + setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setContextMenuPolicy(Qt::NoContextMenu); +} + +void TextWidget::showEvent(QShowEvent *e) { + QFont font; + QFontMetrics fm(font); + setFixedWidth(fm.lineSpacing() *6); + setFixedHeight(fm.lineSpacing() * 2.5); + m_baseSize = size(); + m_minSize = m_baseSize; + QTextEdit::showEvent(e); + adjustSize(); +} + +void TextWidget::resizeEvent(QResizeEvent *e) { + m_minSize.setHeight(qMin(m_baseSize.height(), height())); + m_minSize.setWidth(qMin(m_baseSize.width(), width())); + QTextEdit::resizeEvent(e); +} + +void TextWidget::setFont(const QFont &f) { + QTextEdit::setFont(f); + adjustSize(); +} + +void TextWidget::updateFont(const QFont &f) { + setFont(f); +} + +void TextWidget::setFontPointSize(qreal s) { + QFont f = font(); + f.setPointSize(s); + setFont(f); +} + +void TextWidget::setTextColor(const QColor &c) { + QString s("TextWidget { background: transparent; color: %1; }"); + setStyleSheet(s.arg(c.name())); +} + +void TextWidget::adjustSize() { + QString &&text = this->toPlainText(); + + QFontMetrics fm(font()); + QRect bounds = fm.boundingRect(QRect(), 0, text); + int pixelsWide = bounds.width() + fm.lineSpacing(); + int pixelsHigh = bounds.height() * 1.15 + fm.lineSpacing(); + if (pixelsWide < m_minSize.width()) { + pixelsWide = m_minSize.width(); + } + if (pixelsHigh < m_minSize.height()) { + pixelsHigh = m_minSize.height(); + } + + this->setFixedSize(pixelsWide, pixelsHigh); +} + +void TextWidget::emitTextUpdated() { + emit textUpdated(this->toPlainText()); +} diff --git a/flameshot-0.6.0/src/tools/text/textwidget.h b/flameshot-0.6.0/src/tools/text/textwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..7d12b2f55b3104ca550fa6b69d25d70d7a0753e5 --- /dev/null +++ b/flameshot-0.6.0/src/tools/text/textwidget.h @@ -0,0 +1,49 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class TextWidget : public QTextEdit +{ + Q_OBJECT +public: + explicit TextWidget(QWidget *parent = nullptr); + + void adjustSize(); + void setFont(const QFont &f); + +protected: + void showEvent(QShowEvent *e); + void resizeEvent(QResizeEvent *e); + +signals: + void textUpdated(const QString &s); + +public slots: + void updateFont(const QFont &f); + void setTextColor(const QColor &c); + void setFontPointSize(qreal s); + +private slots: + void emitTextUpdated(); + +private: + QSize m_baseSize; + QSize m_minSize; +}; diff --git a/flameshot-0.6.0/src/tools/toolfactory.cpp b/flameshot-0.6.0/src/tools/toolfactory.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9638b598351e564947a13a6943d3b50c7892b056 --- /dev/null +++ b/flameshot-0.6.0/src/tools/toolfactory.cpp @@ -0,0 +1,111 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "toolfactory.h" +#include "arrow/arrowtool.h" +#include "circle/circletool.h" +#include "copy/copytool.h" +#include "exit/exittool.h" +#include "imgur/imguruploadertool.h" +#include "line/linetool.h" +#include "marker/markertool.h" +#include "move/movetool.h" +#include "pencil/penciltool.h" +#include "rectangle/rectangletool.h" +#include "save/savetool.h" +#include "selection/selectiontool.h" +#include "sizeindicator/sizeindicatortool.h" +#include "undo/undotool.h" +#include "launcher/applaunchertool.h" +#include "blur/blurtool.h" +#include "redo/redotool.h" +#include "pin/pintool.h" +#include "text/texttool.h" + +ToolFactory::ToolFactory(QObject *parent) : QObject(parent) { + +} + +CaptureTool* ToolFactory::CreateTool( + CaptureButton::ButtonType t, + QObject *parent) +{ + CaptureTool *tool; + switch (t) { + case CaptureButton::TYPE_ARROW: + tool = new ArrowTool(parent); + break; + case CaptureButton::TYPE_CIRCLE: + tool = new CircleTool(parent); + break; + case CaptureButton::TYPE_COPY: + tool = new CopyTool(parent); + break; + case CaptureButton::TYPE_EXIT: + tool = new ExitTool(parent); + break; + case CaptureButton::TYPE_IMAGEUPLOADER: + tool = new ImgurUploaderTool(parent); + break; + case CaptureButton::TYPE_DRAWER: + tool = new LineTool(parent); + break; + case CaptureButton::TYPE_MARKER: + tool = new MarkerTool(parent); + break; + case CaptureButton::TYPE_MOVESELECTION: + tool = new MoveTool(parent); + break; + case CaptureButton::TYPE_PENCIL: + tool = new PencilTool(parent); + break; + case CaptureButton::TYPE_RECTANGLE: + tool = new RectangleTool(parent); + break; + case CaptureButton::TYPE_SAVE: + tool = new SaveTool(parent); + break; + case CaptureButton::TYPE_SELECTION: + tool = new SelectionTool(parent); + break; + case CaptureButton::TYPE_SELECTIONINDICATOR: + tool = new SizeIndicatorTool(parent); + break; + case CaptureButton::TYPE_UNDO: + tool = new UndoTool(parent); + break; + case CaptureButton::TYPE_REDO: + tool = new RedoTool(parent); + break; + case CaptureButton::TYPE_OPEN_APP: + tool = new AppLauncher(parent); + break; + case CaptureButton::TYPE_BLUR: + tool = new BlurTool(parent); + break; + case CaptureButton::TYPE_PIN: + tool = new PinTool(parent); + break; + case CaptureButton::TYPE_TEXT: + tool = new TextTool(parent); + break; + default: + tool = nullptr; + break; + } + return tool; +} diff --git a/flameshot-0.6.0/src/tools/toolfactory.h b/flameshot-0.6.0/src/tools/toolfactory.h new file mode 100644 index 0000000000000000000000000000000000000000..10512b4128ed15a19b86a5c841d2a0373fbf885b --- /dev/null +++ b/flameshot-0.6.0/src/tools/toolfactory.h @@ -0,0 +1,39 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/widgets/capture/capturebutton.h" +#include "src/tools/capturetool.h" +#include + +class CaptureTool; + +class ToolFactory : public QObject { + Q_OBJECT + +public: + + explicit ToolFactory(QObject *parent = nullptr); + + ToolFactory(const ToolFactory &) = delete; + ToolFactory & operator=(const ToolFactory &) = delete; + + CaptureTool* CreateTool( + CaptureButton::ButtonType t, + QObject *parent = nullptr); +}; diff --git a/flameshot-0.6.0/src/tools/undo/undotool.cpp b/flameshot-0.6.0/src/tools/undo/undotool.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1d1d791d9efdb87fbf0d93727fba2be56eb46c96 --- /dev/null +++ b/flameshot-0.6.0/src/tools/undo/undotool.cpp @@ -0,0 +1,52 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "undotool.h" +#include + +UndoTool::UndoTool(QObject *parent) : AbstractActionTool(parent) { + +} + +bool UndoTool::closeOnButtonPressed() const { + return false; +} + +QIcon UndoTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "undo-variant.svg"); +} +QString UndoTool::name() const { + return tr("Undo"); +} + +QString UndoTool::nameID() { + return ""; +} + +QString UndoTool::description() const { + return tr("Undo the last modification"); +} + +CaptureTool* UndoTool::copy(QObject *parent) { + return new UndoTool(parent); +} + +void UndoTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); + emit requestAction(REQ_UNDO_MODIFICATION); +} diff --git a/flameshot-0.6.0/src/tools/undo/undotool.h b/flameshot-0.6.0/src/tools/undo/undotool.h new file mode 100644 index 0000000000000000000000000000000000000000..97125f33b6b3c2740cdc592e4f7c2812780f55be --- /dev/null +++ b/flameshot-0.6.0/src/tools/undo/undotool.h @@ -0,0 +1,39 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstractactiontool.h" + +class UndoTool : public AbstractActionTool { + Q_OBJECT +public: + explicit UndoTool(QObject *parent = nullptr); + + bool closeOnButtonPressed() const; + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + +public slots: + void pressed(const CaptureContext &context) override; + +}; diff --git a/flameshot-0.6.0/src/utils/colorutils.cpp b/flameshot-0.6.0/src/utils/colorutils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1253aafa286e3c6b7587e5937d2b58a76d703df6 --- /dev/null +++ b/flameshot-0.6.0/src/utils/colorutils.cpp @@ -0,0 +1,39 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "colorutils.h" + +inline qreal getColorLuma(const QColor &c) { + return 0.30 * c.redF() + 0.59 * c.greenF() + 0.11 * c.blueF(); +} + +bool ColorUtils::colorIsDark(const QColor &c) { + bool isWhite = false; + if (getColorLuma(c) <= 0.60) { + isWhite = true; + } + return isWhite; +} + +QColor ColorUtils::contrastColor(const QColor &c) { + int change = colorIsDark(c) ? 30 : -45; + + return QColor(qBound(0, c.red() + change, 255), + qBound(0, c.green() + change, 255), + qBound(0, c.blue() + change, 255)); +} + diff --git a/flameshot-0.6.0/src/utils/colorutils.h b/flameshot-0.6.0/src/utils/colorutils.h new file mode 100644 index 0000000000000000000000000000000000000000..87a8e587ab6300f525e4364ce9ed9e399679e61f --- /dev/null +++ b/flameshot-0.6.0/src/utils/colorutils.h @@ -0,0 +1,28 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +namespace ColorUtils { // namespace + +bool colorIsDark(const QColor &c); + +QColor contrastColor(const QColor &c); + +} // namespace diff --git a/flameshot-0.6.0/src/utils/confighandler.cpp b/flameshot-0.6.0/src/utils/confighandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c3a110b01da5b8831d38e34cc258fee912b6d112 --- /dev/null +++ b/flameshot-0.6.0/src/utils/confighandler.cpp @@ -0,0 +1,347 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "confighandler.h" +#include +#include +#include +#include + +ConfigHandler::ConfigHandler(){ + m_settings.setDefaultFormat(QSettings::IniFormat); +} + +QVector ConfigHandler::getButtons() { + QVector buttons; + if (m_settings.contains("buttons")) { + // TODO: remove toList in v1.0 + QVector buttonsInt = + m_settings.value("buttons").value >().toVector(); + bool modified = normalizeButtons(buttonsInt); + if (modified) { + m_settings.setValue("buttons", QVariant::fromValue(buttonsInt.toList())); + } + buttons = fromIntToButton(buttonsInt); + } else { + // Default tools + buttons << CaptureButton::TYPE_PENCIL + << CaptureButton::TYPE_DRAWER + << CaptureButton::TYPE_ARROW + << CaptureButton::TYPE_SELECTION + << CaptureButton::TYPE_RECTANGLE + << CaptureButton::TYPE_CIRCLE + << CaptureButton::TYPE_MARKER + << CaptureButton::TYPE_BLUR + << CaptureButton::TYPE_SELECTIONINDICATOR + << CaptureButton::TYPE_MOVESELECTION + << CaptureButton::TYPE_UNDO + << CaptureButton::TYPE_REDO + << CaptureButton::TYPE_COPY + << CaptureButton::TYPE_SAVE + << CaptureButton::TYPE_EXIT + //<< CaptureButton::TYPE_IMAGEUPLOADER + << CaptureButton::TYPE_OPEN_APP; + } + + using bt = CaptureButton::ButtonType; + std::sort(buttons.begin(), buttons.end(), [](bt a, bt b){ + return CaptureButton::getPriorityByButton(a) < + CaptureButton::getPriorityByButton(b); + }); + return buttons; +} + +void ConfigHandler::setButtons(const QVector &buttons) { + QVector l = fromButtonToInt(buttons); + normalizeButtons(l); + // TODO: remove toList in v1.0 + m_settings.setValue("buttons", QVariant::fromValue(l.toList())); +} + +QVector ConfigHandler::getUserColors() { + QVector colors; + const QVector &defaultColors = { + Qt::darkRed, + Qt::red, + Qt::yellow, + Qt::green, + Qt::darkGreen, + Qt::cyan, + Qt::blue, + Qt::magenta, + Qt::darkMagenta + }; + + if (m_settings.contains("userColors")) { + for (const QString &hex : m_settings.value("userColors").toStringList()) { + if (QColor::isValidColor(hex)) { + colors.append(QColor(hex)); + } + } + + if (colors.isEmpty()) { + colors = defaultColors; + } + } else { + colors = defaultColors; + } + + return colors; +} + +void ConfigHandler::setUserColors(const QVector &l) { + QStringList hexColors; + + for (const QColor &color : l) { + hexColors.append(color.name()); + } + + m_settings.setValue("userColors", QVariant::fromValue(hexColors)); +} + +QString ConfigHandler::savePathValue() { + return m_settings.value("savePath").toString(); +} + +void ConfigHandler::setSavePath(const QString &savePath) { + m_settings.setValue("savePath", savePath); +} + +QColor ConfigHandler::uiMainColorValue() { + QColor res = QColor(44, 157, 252); + + if (m_settings.contains("uiColor")) { + QString hex = m_settings.value("uiColor").toString(); + + if (QColor::isValidColor(hex)) { + res = QColor(hex); + } + } + return res; +} + +void ConfigHandler::setUIMainColor(const QColor &c) { + m_settings.setValue("uiColor", c.name()); +} + +QColor ConfigHandler::uiContrastColorValue() { + QColor res = QColor(10, 126, 202); + + if (m_settings.contains("contastUiColor")) { + QString hex = m_settings.value("contastUiColor").toString(); + + if (QColor::isValidColor(hex)) { + res = QColor(hex); + } + } + + return res; +} + +void ConfigHandler::setUIContrastColor(const QColor &c) { + m_settings.setValue("contastUiColor", c.name()); +} + +QColor ConfigHandler::drawColorValue() { + QColor res(Qt::red); + + if (m_settings.contains("drawColor")) { + QString hex = m_settings.value("drawColor").toString(); + + if (QColor::isValidColor(hex)) { + res = QColor(hex); + } + } + + return res; +} + +void ConfigHandler::setDrawColor(const QColor &c) { + m_settings.setValue("drawColor", c.name()); +} + +bool ConfigHandler::showHelpValue() { + bool res = true; + if (m_settings.contains("showHelp")) { + res = m_settings.value("showHelp").toBool(); + } + return res; +} + +void ConfigHandler::setShowHelp(const bool showHelp) { + m_settings.setValue("showHelp", showHelp); +} + +bool ConfigHandler::desktopNotificationValue() { + bool res = true; + if (m_settings.contains("showDesktopNotification")) { + res = m_settings.value("showDesktopNotification").toBool(); + } + return res; +} + +void ConfigHandler::setDesktopNotification(const bool showDesktopNotification) { + m_settings.setValue("showDesktopNotification", showDesktopNotification); +} + +QString ConfigHandler::filenamePatternValue() { + return m_settings.value("filenamePattern").toString(); +} + +void ConfigHandler::setFilenamePattern(const QString &pattern) { + return m_settings.setValue("filenamePattern", pattern); +} + +bool ConfigHandler::disabledTrayIconValue() { + bool res = false; + if (m_settings.contains("disabledTrayIcon")) { + res = m_settings.value("disabledTrayIcon").toBool(); + } + return res; +} + +void ConfigHandler::setDisabledTrayIcon(const bool disabledTrayIcon) { + m_settings.setValue("disabledTrayIcon", disabledTrayIcon); +} + +int ConfigHandler::drawThicknessValue() { + int res = 0; + if (m_settings.contains("drawThickness")) { + res = m_settings.value("drawThickness").toInt(); + } + return res; +} + +void ConfigHandler::setdrawThickness(const int thickness) { + m_settings.setValue("drawThickness", thickness); +} + +bool ConfigHandler::keepOpenAppLauncherValue() { + return m_settings.value("keepOpenAppLauncher").toBool(); +} + +void ConfigHandler::setKeepOpenAppLauncher(const bool keepOpen) { + m_settings.setValue("keepOpenAppLauncher", keepOpen); +} + +bool ConfigHandler::startupLaunchValue() { + bool res = false; +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + QString path = QDir::homePath() + "/.config/autostart/Flameshot.desktop"; + res = QFile(path).exists(); +#elif defined(Q_OS_WIN) + QSettings bootUpSettings( + "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", + QSettings::NativeFormat); + res = bootUpSettings.value("Flameshot").toString() == + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()); +#endif + return res; +} + +void ConfigHandler::setStartupLaunch(const bool start) { +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + QString path = QDir::homePath() + "/.config/autostart/Flameshot.desktop"; + QFile file(path); + if (start) { + if (file.open(QIODevice::WriteOnly)) { + QByteArray data("[Desktop Entry]\nName=flameshot\nIcon=flameshot" + "\nExec=flameshot\nTerminal=false\nType=Application" + "\nX-GNOME-Autostart-enabled=true\n"); + file.write(data); + } + } else { + file.remove(); + } +#elif defined(Q_OS_WIN) + QSettings bootUpSettings( + "HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", + QSettings::NativeFormat); + if (start) { + QString app_path = + QDir::toNativeSeparators(QCoreApplication::applicationFilePath()); + bootUpSettings.setValue("Flameshot", app_path); + } else { + bootUpSettings.remove("Flameshot"); + } +#endif +} + +int ConfigHandler::contrastOpacityValue() { + int opacity = 190; + if (m_settings.contains("contrastOpacity")) { + opacity = m_settings.value("contrastOpacity").toInt(); + opacity = qBound(0, opacity, 255); + } + return opacity; +} + +void ConfigHandler::setContrastOpacity(const int transparency) { + m_settings.setValue("contrastOpacity", transparency); +} + +void ConfigHandler::setDefaults() { + m_settings.clear(); +} + +void ConfigHandler::setAllTheButtons() { + QVector buttons; + auto listTypes = CaptureButton::getIterableButtonTypes(); + for (const CaptureButton::ButtonType t: listTypes) { + buttons << static_cast(t); + } + // TODO: remove toList in v1.0 + m_settings.setValue("buttons", QVariant::fromValue(buttons.toList())); +} + +QString ConfigHandler::configFilePath() const { + return m_settings.fileName(); +} + +bool ConfigHandler::normalizeButtons(QVector &buttons) { + auto listTypes = CaptureButton::getIterableButtonTypes(); + QVector listTypesInt; + for(auto i: listTypes) + listTypesInt << static_cast(i); + + bool hasChanged = false; + for (int i = 0; i < buttons.size(); i++) { + if (!listTypesInt.contains(buttons.at(i))) { + buttons.remove(i); + hasChanged = true; + } + } + return hasChanged; +} + +QVector ConfigHandler::fromIntToButton( + const QVector &l) +{ + QVector buttons; + for (auto const i: l) + buttons << static_cast(i); + return buttons; +} + +QVector ConfigHandler::fromButtonToInt( + const QVector &l) +{ + QVector buttons; + for (auto const i: l) + buttons << static_cast(i); + return buttons; +} diff --git a/flameshot-0.6.0/src/utils/confighandler.h b/flameshot-0.6.0/src/utils/confighandler.h new file mode 100644 index 0000000000000000000000000000000000000000..00b6cfa96262da1a199dc44fdf2a39551ddf1d32 --- /dev/null +++ b/flameshot-0.6.0/src/utils/confighandler.h @@ -0,0 +1,82 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/widgets/capture/capturebutton.h" +#include +#include + +class ConfigHandler { +public: + explicit ConfigHandler(); + + QVector getButtons(); + void setButtons(const QVector &); + + QVector getUserColors(); + void setUserColors(const QVector &); + + QString savePathValue(); + void setSavePath(const QString &); + + QColor uiMainColorValue(); + void setUIMainColor(const QColor &); + + QColor uiContrastColorValue(); + void setUIContrastColor(const QColor &); + + QColor drawColorValue(); + void setDrawColor(const QColor &); + + bool showHelpValue(); + void setShowHelp(const bool); + + bool desktopNotificationValue(); + void setDesktopNotification(const bool); + + QString filenamePatternValue(); + void setFilenamePattern(const QString &); + + bool disabledTrayIconValue(); + void setDisabledTrayIcon(const bool); + + int drawThicknessValue(); + void setdrawThickness(const int); + + bool keepOpenAppLauncherValue(); + void setKeepOpenAppLauncher(const bool); + + bool startupLaunchValue(); + void setStartupLaunch(const bool); + + int contrastOpacityValue(); + void setContrastOpacity(const int); + + void setDefaults(); + void setAllTheButtons(); + + QString configFilePath() const; + +private: + QSettings m_settings; + + bool normalizeButtons(QVector &); + + QVector fromIntToButton(const QVector &l); + QVector fromButtonToInt(const QVector &l); +}; diff --git a/flameshot-0.6.0/src/utils/dbusutils.cpp b/flameshot-0.6.0/src/utils/dbusutils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9bb6405bcaf129bb70d6f5f05fe93b20ffa3877 --- /dev/null +++ b/flameshot-0.6.0/src/utils/dbusutils.cpp @@ -0,0 +1,63 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "dbusutils.h" +#include "src/utils/systemnotification.h" +#include +#include +#include + +DBusUtils::DBusUtils(QObject *parent) : QObject(parent) { +} + +void DBusUtils::connectPrintCapture(QDBusConnection &session, uint id) { + m_id = id; + // captureTaken + session.connect("org.dharkael.Flameshot", + "/", "", "captureTaken", + this, + SLOT(captureTaken(uint, QByteArray))); + // captureFailed + session.connect("org.dharkael.Flameshot", + "/", "", "captureFailed", + this, + SLOT(captureFailed(uint))); +} + +void DBusUtils::checkDBusConnection(const QDBusConnection &connection) { + if (!connection.isConnected()) { + SystemNotification().sendMessage(tr("Unable to connect via DBus")); + qApp->exit(); + } +} + +void DBusUtils::captureTaken(uint id, QByteArray rawImage) { + if (m_id == id) { + QFile file; + file.open(stdout, QIODevice::WriteOnly); + file.write(rawImage); + file.close(); + qApp->exit(); + } +} + +void DBusUtils::captureFailed(uint id) { + if (m_id == id) { + QTextStream(stdout) << "screenshot aborted\n"; + qApp->exit(); + } +} diff --git a/flameshot-0.6.0/src/utils/dbusutils.h b/flameshot-0.6.0/src/utils/dbusutils.h new file mode 100644 index 0000000000000000000000000000000000000000..36d26b1235ef28524a13f1db92acd2c62cde02d3 --- /dev/null +++ b/flameshot-0.6.0/src/utils/dbusutils.h @@ -0,0 +1,39 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/cli/commandlineparser.h" +#include +#include + +class DBusUtils : public QObject { + Q_OBJECT +public: + explicit DBusUtils(QObject *parent = nullptr); + + void connectPrintCapture(QDBusConnection &session, uint id); + void checkDBusConnection(const QDBusConnection &connection); + +public slots: + void captureTaken(uint id, QByteArray rawImage); + void captureFailed(uint id); + +private: + + uint m_id; +}; diff --git a/flameshot-0.6.0/src/utils/desktopfileparse.cpp b/flameshot-0.6.0/src/utils/desktopfileparse.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8a5e986fa3d5702461844e51beb1dc89ba0de3a8 --- /dev/null +++ b/flameshot-0.6.0/src/utils/desktopfileparse.cpp @@ -0,0 +1,152 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "desktopfileparse.h" +#include +#include +#include +#include +#include + +DesktopFileParser::DesktopFileParser() { + QString locale = QLocale().name(); + QString localeShort = QLocale().name().left(2); + m_localeName = QStringLiteral("Name[%1]").arg(locale); + m_localeDescription = QStringLiteral("Comment[%1]").arg(locale); + m_localeNameShort = QStringLiteral("Name[%1]").arg(localeShort); + m_localeDescriptionShort = QStringLiteral("Comment[%1]") + .arg(localeShort); + m_defaultIcon = QIcon::fromTheme("application-x-executable"); +} + +DesktopAppData DesktopFileParser::parseDesktopFile( + const QString &fileName, bool &ok) const +{ + DesktopAppData res; + ok = true; + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + ok = false; + return res; + } + bool nameLocaleSet = false; + bool descriptionLocaleSet = false; + bool isApplication = false; + QTextStream in(&file); + // enter the desktop entry definition + while (!in.atEnd() && in.readLine() != "[Desktop Entry]") { + } + // start parsing + while (!in.atEnd()) { + QString line = in.readLine(); + if (line.startsWith("Icon")) { + res.icon = QIcon::fromTheme( + line.mid(line.indexOf("=")+1).trimmed(), + m_defaultIcon); + } + else if (!nameLocaleSet && line.startsWith("Name")) { + if (line.startsWith(m_localeName) || + line.startsWith(m_localeNameShort)) + { + res.name = line.mid(line.indexOf("=")+1).trimmed(); + nameLocaleSet = true; + } else if (line.startsWith("Name=")) { + res.name = line.mid(line.indexOf("=")+1).trimmed(); + } + } + else if (!descriptionLocaleSet && line.startsWith("Comment")) { + if (line.startsWith(m_localeDescription) || + line.startsWith(m_localeDescriptionShort)) + { + res.description = line.mid(line.indexOf("=")+1).trimmed(); + descriptionLocaleSet = true; + } else if (line.startsWith("Comment=")) { + res.description = line.mid(line.indexOf("=")+1).trimmed(); + } + } + else if (line.startsWith("Exec")) { + if (line.contains("%")) { + res.exec = line.mid(line.indexOf("=")+1) + .trimmed(); + } else { + ok = false; + break; + } + } + else if (line.startsWith("Type")) { + if (line.contains("Application")) { + isApplication = true; + } + } + else if (line.startsWith("Categories")) { + res.categories = line.mid(line.indexOf("=")+1).split(";"); + } + else if (line == "NoDisplay=true") { + ok = false; + break; + } + else if (line == "Terminal=true") { + res.showInTerminal = true; + } + // ignore the other entries + else if (line.startsWith("[")) { + break; + } + } + file.close(); + if (res.exec.isEmpty() || res.name.isEmpty() || !isApplication) { + ok = false; + } + return res; +} + +int DesktopFileParser::processDirectory(const QDir &dir) { + QStringList entries = dir.entryList(QDir::NoDotAndDotDot | QDir::Files); + bool ok; + int length = m_appList.length(); + for (QString file: entries){ + DesktopAppData app = parseDesktopFile(dir.absoluteFilePath(file), ok); + if (ok) { + m_appList.append(app); + } + } + return m_appList.length() - length; +} + +QVector DesktopFileParser::getAppsByCategory(const QString &category) { + QVector res; + for (const DesktopAppData &app : m_appList) { + if (app.categories.contains(category)) { + res.append(app); + } + } + return res; +} + +QMap> DesktopFileParser::getAppsByCategory( + const QStringList &categories) +{ + QMap> res; + for (const DesktopAppData &app : m_appList) { + for (const QString &category: categories) { + if (app.categories.contains(category)) { + res[category].append(app); + } + } + } + return res; +} diff --git a/flameshot-0.6.0/src/utils/desktopfileparse.h b/flameshot-0.6.0/src/utils/desktopfileparse.h new file mode 100644 index 0000000000000000000000000000000000000000..466e132b29ce7763ba89d0edd03171d71e426f75 --- /dev/null +++ b/flameshot-0.6.0/src/utils/desktopfileparse.h @@ -0,0 +1,72 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include +#include + +class QDir; +class QString; +class QTextStream; + +struct DesktopAppData { + DesktopAppData() : showInTerminal() {} + + DesktopAppData( + const QString &name, + const QString &description, + const QString &exec, + QIcon icon) : + name(name), + description(description), + exec(exec), + icon(icon), + showInTerminal(false) + {} + + bool operator==(const DesktopAppData &other) const { + return name == other.name; + } + + QString name; + QString description; + QString exec; + QStringList categories; + QIcon icon; + bool showInTerminal; +}; + +struct DesktopFileParser { + DesktopFileParser(); + DesktopAppData parseDesktopFile(const QString &fileName, bool &ok) const; + int processDirectory(const QDir &dir); + + QVector getAppsByCategory(const QString &category); + QMap> getAppsByCategory( + const QStringList &categories); + +private: + QString m_localeName; + QString m_localeDescription; + QString m_localeNameShort; + QString m_localeDescriptionShort; + + QIcon m_defaultIcon; + QVector m_appList; +}; diff --git a/flameshot-0.6.0/src/utils/desktopinfo.cpp b/flameshot-0.6.0/src/utils/desktopinfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4751164e74bf427b0839132e10041e745adc9c4f --- /dev/null +++ b/flameshot-0.6.0/src/utils/desktopinfo.cpp @@ -0,0 +1,46 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "desktopinfo.h" +#include + +DesktopInfo::DesktopInfo() { + auto e = QProcessEnvironment::systemEnvironment(); + XDG_CURRENT_DESKTOP = e.value("XDG_CURRENT_DESKTOP"); + XDG_SESSION_TYPE = e.value("XDG_SESSION_TYPE"); + WAYLAND_DISPLAY = e.value("WAYLAND_DISPLAY"); + KDE_FULL_SESSION = e.value("KDE_FULL_SESSION"); + GNOME_DESKTOP_SESSION_ID = e.value("GNOME_DESKTOP_SESSION_ID"); + DESKTOP_SESSION = e.value("DESKTOP_SESSION"); +} + +bool DesktopInfo::waylandDectected() { + return XDG_SESSION_TYPE == "wayland" || + WAYLAND_DISPLAY.contains("wayland", Qt::CaseInsensitive); +} + +DesktopInfo::WM DesktopInfo::windowManager() { + DesktopInfo::WM res = DesktopInfo::OTHER; + if (XDG_CURRENT_DESKTOP.contains("GNOME", Qt::CaseInsensitive) || + !GNOME_DESKTOP_SESSION_ID.isEmpty()) + { + res = DesktopInfo::GNOME; + } else if (!KDE_FULL_SESSION.isEmpty() || DESKTOP_SESSION == "kde-plasma") { + res = DesktopInfo::KDE; + } + return res; +} diff --git a/flameshot-0.6.0/src/utils/desktopinfo.h b/flameshot-0.6.0/src/utils/desktopinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..3071f2b8639357fe7fc49a46c034965b85a0857c --- /dev/null +++ b/flameshot-0.6.0/src/utils/desktopinfo.h @@ -0,0 +1,43 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class DesktopInfo { +public: + DesktopInfo(); + + enum WM { + GNOME, + KDE, + OTHER + }; + + bool waylandDectected(); + WM windowManager(); + +private: + QString XDG_CURRENT_DESKTOP; + QString XDG_SESSION_TYPE; + QString WAYLAND_DISPLAY; + QString KDE_FULL_SESSION; + QString GNOME_DESKTOP_SESSION_ID; + QString GDMSESSION; + QString DESKTOP_SESSION; +}; diff --git a/flameshot-0.6.0/src/utils/filenamehandler.cpp b/flameshot-0.6.0/src/utils/filenamehandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d31bcfd654a65660ee9d3403c87ef79d5bf8a6d6 --- /dev/null +++ b/flameshot-0.6.0/src/utils/filenamehandler.cpp @@ -0,0 +1,109 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "filenamehandler.h" +#include "src/utils/confighandler.h" +#include +#include +#include +#include + +FileNameHandler::FileNameHandler(QObject *parent) : QObject(parent) { + std::locale::global(std::locale("")); +} + +QString FileNameHandler::parsedPattern() { + return parseFilename(ConfigHandler().filenamePatternValue()); +} + +QString FileNameHandler::parseFilename(const QString &name) { + QString res = name; + if (name.isEmpty()) { + res = "%F_%H-%M"; + } + std::time_t t = std::time(NULL); + + char *tempData = QStringTocharArr(res); + char data[MAX_CHARACTERS] = {0}; + std::strftime(data, sizeof(data), + tempData, std::localtime(&t)); + res = QString::fromLocal8Bit(data, (int)strlen(data)); + free(tempData); + + // add the parsed pattern in a correct format for the filesystem + res = res.replace("/", "⁄").replace(":", "-"); + return res; +} + +QString FileNameHandler::generateAbsolutePath(const QString &path) { + QString directory = path; + QString filename = parsedPattern(); + fixPath(directory, filename); + return directory + filename; +} +// path a images si no existe, add numeration +void FileNameHandler::setPattern(const QString &pattern) { + ConfigHandler().setFilenamePattern(pattern); +} + +QString FileNameHandler::absoluteSavePath(QString &directory, QString &filename) { + ConfigHandler config; + directory = config.savePathValue(); + if (directory.isEmpty() || !QDir(directory).exists() || !QFileInfo(directory).isWritable()) { + directory = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation); + } + filename = parsedPattern(); + fixPath(directory, filename); + return directory + filename; +} + +QString FileNameHandler::absoluteSavePath() { + QString dir, file; + return absoluteSavePath(dir, file); +} + +QString FileNameHandler::charArrToQString(const char *c) { + return QString::fromLocal8Bit(c, MAX_CHARACTERS); +} + +char * FileNameHandler::QStringTocharArr(const QString &s) { + QByteArray ba = s.toLocal8Bit(); + return const_cast(strdup(ba.constData())); +} + +void FileNameHandler::fixPath(QString &directory, QString &filename) { + // add '/' at the end of the directory + if (!directory.endsWith("/")) { + directory += "/"; + } + // add numeration in case of repeated filename in the directory + // find unused name adding _n where n is a number + QFileInfo checkFile(directory + filename + ".png"); + if (checkFile.exists()) { + filename += "_"; + int i = 1; + while (true) { + checkFile.setFile( + directory + filename + QString::number(i) + ".png"); + if (!checkFile.exists()) { + filename += QString::number(i); + break; + } + ++i; + } + } +} diff --git a/flameshot-0.6.0/src/utils/filenamehandler.h b/flameshot-0.6.0/src/utils/filenamehandler.h new file mode 100644 index 0000000000000000000000000000000000000000..6e4b286692dae8813b67aefa2385b2b108d52e06 --- /dev/null +++ b/flameshot-0.6.0/src/utils/filenamehandler.h @@ -0,0 +1,45 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class FileNameHandler : public QObject { + Q_OBJECT +public: + explicit FileNameHandler(QObject *parent = nullptr); + + QString parsedPattern(); + QString parseFilename(const QString &name); + QString generateAbsolutePath(const QString &path); + QString absoluteSavePath(QString &directory, QString &filename); + QString absoluteSavePath(); + + + static const int MAX_CHARACTERS = 70; + +public slots: + void setPattern(const QString &pattern); + +private: + //using charArr = char[MAX_CHARACTERS]; + QString charArrToQString(const char *c); + char * QStringTocharArr(const QString &s); + + void fixPath(QString &directory, QString &filename); +}; diff --git a/flameshot-0.6.0/src/utils/globalvalues.cpp b/flameshot-0.6.0/src/utils/globalvalues.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d65fc8d8a93295d3cb3359b239b04658b4115af5 --- /dev/null +++ b/flameshot-0.6.0/src/utils/globalvalues.cpp @@ -0,0 +1,24 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "globalvalues.h" +#include +#include + +int GlobalValues::buttonBaseSize() { + return QApplication::fontMetrics().lineSpacing() * 2.2; +} diff --git a/flameshot-0.6.0/src/utils/globalvalues.h b/flameshot-0.6.0/src/utils/globalvalues.h new file mode 100644 index 0000000000000000000000000000000000000000..362e085c801d1a2fc3e28fd08cb51bb1d3e9d41c --- /dev/null +++ b/flameshot-0.6.0/src/utils/globalvalues.h @@ -0,0 +1,27 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#define pragma once + +#include +#include "src/widgets/capture/capturebutton.h" + +namespace GlobalValues { + +int buttonBaseSize(); + +} diff --git a/flameshot-0.6.0/src/utils/pathinfo.cpp b/flameshot-0.6.0/src/utils/pathinfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a8bbaa5f29e5695bb804ec9b516fc3404fbab1a6 --- /dev/null +++ b/flameshot-0.6.0/src/utils/pathinfo.cpp @@ -0,0 +1,45 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "pathinfo.h" +#include +#include +#include + +const QString PathInfo::whiteIconPath() { + return ":/img/material/white/"; +} + +const QString PathInfo::blackIconPath() { + return ":/img/material/black/"; +} + +QStringList PathInfo::translationsPaths() { + QString binaryPath = QFileInfo(qApp->applicationDirPath()) + .absoluteFilePath(); + QString trPath = QDir::toNativeSeparators(binaryPath + "/translations") ; +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + return QStringList() + << QString(APP_PREFIX) + "/share/flameshot/translations" + << trPath + << "/usr/share/flameshot/translations" + << "/usr/local/share/flameshot/translations"; +#elif defined(Q_OS_WIN) + return QStringList() + << trPath; +#endif +} diff --git a/flameshot-0.6.0/src/utils/pathinfo.h b/flameshot-0.6.0/src/utils/pathinfo.h new file mode 100644 index 0000000000000000000000000000000000000000..503eaa18af2162812f1c6fc01424ba1a830fb9ba --- /dev/null +++ b/flameshot-0.6.0/src/utils/pathinfo.h @@ -0,0 +1,30 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +namespace PathInfo { // namespace + +const QString whiteIconPath(); + +const QString blackIconPath(); + +QStringList translationsPaths(); + +} // namespace diff --git a/flameshot-0.6.0/src/utils/screengrabber.cpp b/flameshot-0.6.0/src/utils/screengrabber.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0f2545274c86ae66fae363b233f106c83c2f68a --- /dev/null +++ b/flameshot-0.6.0/src/utils/screengrabber.cpp @@ -0,0 +1,120 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "screengrabber.h" +#include "src/utils/filenamehandler.h" +#include "src/utils/systemnotification.h" +#include +#include +#include +#include +#include + +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +#include +#include +#include +#endif + +ScreenGrabber::ScreenGrabber(QObject *parent) : QObject(parent) { + +} + +QPixmap ScreenGrabber::grabEntireDesktop(bool &ok) { + ok = true; +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) + if(m_info.waylandDectected()) { + QPixmap res; + // handle screenshot based on DE + switch (m_info.windowManager()) { + case DesktopInfo::GNOME: { + // https://github.com/GNOME/gnome-shell/blob/695bfb96160033be55cfb5ac41c121998f98c328/data/org.gnome.Shell.Screenshot.xml + QString path = FileNameHandler().generateAbsolutePath(QDir::tempPath()) + ".png"; + QDBusInterface gnomeInterface(QStringLiteral("org.gnome.Shell"), + QStringLiteral("/org/gnome/Shell/Screenshot"), + QStringLiteral("org.gnome.Shell.Screenshot")); + QDBusReply reply = gnomeInterface.call("Screenshot", false, false, path); + if (reply.value()) { + res = QPixmap(path); + } else { + ok = false; + } + break; + } case DesktopInfo::KDE: { + // https://github.com/KDE/spectacle/blob/517a7baf46a4ca0a45f32fd3f2b1b7210b180134/src/PlatformBackends/KWinWaylandImageGrabber.cpp#L145 + QDBusInterface kwinInterface(QStringLiteral("org.kde.KWin"), + QStringLiteral("/Screenshot"), + QStringLiteral("org.kde.kwin.Screenshot")); + QDBusReply reply = kwinInterface.call("screenshotFullscreen"); + res = QPixmap(reply.value()); + break; + } default: + ok = false; + break; + } + if (!ok) { + SystemNotification().sendMessage(tr("Unable to capture screen")); + } + return res; + } +#endif + + QRect geometry; + for (QScreen *const screen : QGuiApplication::screens()) { + geometry = geometry.united(screen->geometry()); + } + + QPixmap p(QApplication::primaryScreen()->grabWindow( + QApplication::desktop()->winId(), + geometry.x(), + geometry.y(), + geometry.width(), + geometry.height()) + ); + auto screenNumber = QApplication::desktop()->screenNumber(); + QScreen *screen = QApplication::screens()[screenNumber]; + p.setDevicePixelRatio(screen->devicePixelRatio()); + return p; +} + +QPixmap ScreenGrabber::grabScreen(int screenNumber, bool &ok) { + QPixmap p; + bool isVirtual = QApplication::desktop()->isVirtualDesktop(); + if (isVirtual || m_info.waylandDectected()) { + p = grabEntireDesktop(ok); + if (ok) { + QPoint topLeft(0, 0); +#ifdef Q_OS_WIN + for (QScreen *const screen : QGuiApplication::screens()) { + QPoint topLeftScreen = screen->geometry().topLeft(); + if (topLeft.x() > topLeftScreen.x() || + topLeft.y() > topLeftScreen.y()) { + topLeft = topLeftScreen; + } + } +#endif + QRect geometry = QApplication::desktop()-> + screenGeometry(screenNumber); + geometry.moveTo(geometry.topLeft() - topLeft); + p = p.copy(geometry); + } + } else { + p = QApplication::desktop()->screen(screenNumber)->grab(); + ok = true; + } + return p; +} diff --git a/flameshot-0.6.0/src/utils/screengrabber.h b/flameshot-0.6.0/src/utils/screengrabber.h new file mode 100644 index 0000000000000000000000000000000000000000..8ddef2207c6ab38053ca6fdef374940ac5ea1edd --- /dev/null +++ b/flameshot-0.6.0/src/utils/screengrabber.h @@ -0,0 +1,32 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/utils/desktopinfo.h" +#include + +class ScreenGrabber : public QObject { + Q_OBJECT +public: + explicit ScreenGrabber(QObject *parent = nullptr); + QPixmap grabEntireDesktop(bool &ok); + QPixmap grabScreen(int screenNumber, bool &ok); + +private: + DesktopInfo m_info; +}; diff --git a/flameshot-0.6.0/src/utils/screenshotsaver.cpp b/flameshot-0.6.0/src/utils/screenshotsaver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3c5cb6e9499704a7d38ee4e2923ed284d4cfb7bf --- /dev/null +++ b/flameshot-0.6.0/src/utils/screenshotsaver.cpp @@ -0,0 +1,91 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "screenshotsaver.h" +#include "src/utils/systemnotification.h" +#include "src/utils/filenamehandler.h" +#include "src/utils/confighandler.h" +#include +#include +#include +#include +#include + +ScreenshotSaver::ScreenshotSaver() { +} + +void ScreenshotSaver::saveToClipboard(const QPixmap &capture) { + SystemNotification().sendMessage( + QObject::tr("Capture saved to clipboard")); + QApplication::clipboard()->setPixmap(capture); +} + +bool ScreenshotSaver::saveToFilesystem(const QPixmap &capture, + const QString &path) +{ + QString completePath = FileNameHandler().generateAbsolutePath(path); + completePath += ".png"; + bool ok = capture.save(completePath); + QString saveMessage; + + if (ok) { + ConfigHandler().setSavePath(path); + saveMessage = QObject::tr("Capture saved as ") + completePath; + } else { + saveMessage = QObject::tr("Error trying to save as ") + completePath; + } + + SystemNotification().sendMessage(saveMessage); + return ok; +} + +bool ScreenshotSaver::saveToFilesystemGUI(const QPixmap &capture) { + bool ok = false; + + while (!ok) { + QString savePath = QFileDialog::getSaveFileName( + nullptr, + QString(), + FileNameHandler().absoluteSavePath() + ".png"); + + if (savePath.isNull()) { + break; + } + + if (!savePath.endsWith(".png")) { + savePath += ".png"; + } + + ok = capture.save(savePath); + + if (ok) { + QString pathNoFile = savePath.left(savePath.lastIndexOf("/")); + ConfigHandler().setSavePath(pathNoFile); + QString msg = QObject::tr("Capture saved as ") + savePath; + SystemNotification().sendMessage(msg); + } else { + QString msg = QObject::tr("Error trying to save as ") + savePath; + QMessageBox saveErrBox( + QMessageBox::Warning, + QObject::tr("Save Error"), + msg); + saveErrBox.setWindowIcon(QIcon(":img/app/flameshot.svg")); + saveErrBox.exec(); + } + } + return ok; +} diff --git a/flameshot-0.6.0/src/utils/screenshotsaver.h b/flameshot-0.6.0/src/utils/screenshotsaver.h new file mode 100644 index 0000000000000000000000000000000000000000..cf241f56d181ed1ba8eb47bf5e03fbc7ec7e9c68 --- /dev/null +++ b/flameshot-0.6.0/src/utils/screenshotsaver.h @@ -0,0 +1,31 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +class QPixmap; +class QString; + +class ScreenshotSaver { +public: + ScreenshotSaver(); + + void saveToClipboard(const QPixmap &capture); + bool saveToFilesystem(const QPixmap &capture, const QString &path); + bool saveToFilesystemGUI(const QPixmap &capture); + +}; diff --git a/flameshot-0.6.0/src/utils/systemnotification.cpp b/flameshot-0.6.0/src/utils/systemnotification.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ac92f6fe02be45427256911c68b5c4b1f8cfd77f --- /dev/null +++ b/flameshot-0.6.0/src/utils/systemnotification.cpp @@ -0,0 +1,55 @@ +#include "systemnotification.h" +#include "src/utils/confighandler.h" +#include + +#ifndef Q_OS_WIN +#include +#include +#include +#else +#endif +#include "src/core/controller.h" + +#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) +SystemNotification::SystemNotification(QObject *parent) : QObject(parent) { + m_interface = new QDBusInterface(QStringLiteral("org.freedesktop.Notifications"), + QStringLiteral("/org/freedesktop/Notifications"), + QStringLiteral("org.freedesktop.Notifications"), + QDBusConnection::sessionBus(), + this); +} +#else +SystemNotification::SystemNotification(QObject *parent) : QObject(parent) { + m_interface = nullptr; +} +#endif + +void SystemNotification::sendMessage(const QString &text) { + sendMessage(text, tr("Flameshot Info")); +} + +void SystemNotification::sendMessage( + const QString &text, + const QString &title, + const int timeout) +{ + if(!ConfigHandler().desktopNotificationValue()) { + return; + } + +#ifndef Q_OS_WIN + QList args; + args << (qAppName()) //appname + << static_cast(0) //id + << "flameshot" //icon + << title //summary + << text //body + << QStringList() //actions + << QVariantMap() //hints + << timeout; //timeout + m_interface->callWithArgumentList(QDBus::AutoDetect, "Notify", args); +#else + auto c = Controller::getInstance(); + c->sendTrayNotification(text, title, timeout); +#endif +} diff --git a/flameshot-0.6.0/src/utils/systemnotification.h b/flameshot-0.6.0/src/utils/systemnotification.h new file mode 100644 index 0000000000000000000000000000000000000000..8b19699eee5b3a93009ea532eb1051dc7ff3e4ed --- /dev/null +++ b/flameshot-0.6.0/src/utils/systemnotification.h @@ -0,0 +1,37 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QDBusInterface; + +class SystemNotification : public QObject { + Q_OBJECT +public: + explicit SystemNotification(QObject *parent = nullptr); + + void sendMessage(const QString &text); + + void sendMessage(const QString &text, + const QString &title, + const int timeout = 5000); + +private: + QDBusInterface *m_interface; +}; diff --git a/flameshot-0.6.0/src/utils/waylandutils.cpp b/flameshot-0.6.0/src/utils/waylandutils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d06f5479677edc9811228764934d6b349ac64c3e --- /dev/null +++ b/flameshot-0.6.0/src/utils/waylandutils.cpp @@ -0,0 +1,10 @@ +#include "waylandutils.h" + +WaylandUtils::WaylandUtils() +{ + +} + +bool WaylandUtils::waylandDetected() { + +} diff --git a/flameshot-0.6.0/src/utils/waylandutils.h b/flameshot-0.6.0/src/utils/waylandutils.h new file mode 100644 index 0000000000000000000000000000000000000000..2811759c8b4068c7799773ab609bfd8daf0e7ce4 --- /dev/null +++ b/flameshot-0.6.0/src/utils/waylandutils.h @@ -0,0 +1,16 @@ +#ifndef WAYLANDUTILS_H +#define WAYLANDUTILS_H + + +class WaylandUtils +{ +public: + WaylandUtils(); + + static bool waylandDetected(); + +private: + +}; + +#endif // WAYLANDUTILS_H diff --git a/flameshot-0.6.0/src/widgets/capture/buttonhandler.cpp b/flameshot-0.6.0/src/widgets/capture/buttonhandler.cpp new file mode 100644 index 0000000000000000000000000000000000000000..71ff84d111bf8f751aedab4c13abc8ff2370da6d --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/buttonhandler.cpp @@ -0,0 +1,373 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "buttonhandler.h" +#include "src/utils/globalvalues.h" +#include +#include +#include + +// ButtonHandler is a habdler for every active button. It makes easier to +// manipulate the buttons as a unit. + +ButtonHandler::ButtonHandler(const QVector &v, + QObject *parent) : + QObject(parent) +{ + setButtons(v); + init(); +} + +ButtonHandler::ButtonHandler(QObject *parent) : + QObject(parent) +{ + init(); +} + +void ButtonHandler::hide() { + for (CaptureButton *b: m_vectorButtons) + b->hide(); +} + +void ButtonHandler::show() { + if (m_vectorButtons.isEmpty() || m_vectorButtons.first()->isVisible()) { + return; + } + for (CaptureButton *b: m_vectorButtons) + b->animatedShow(); +} + +bool ButtonHandler::isVisible() const { + bool ret = true; + for (const CaptureButton *b: m_vectorButtons) { + if (!b->isVisible()) { + ret = false; + break; + } + } + return ret; +} + +bool ButtonHandler::buttonsAreInside() const { + return m_buttonsAreInside; +} + +size_t ButtonHandler::size() const { + return m_vectorButtons.size(); +} + +// updatePosition updates the position of the buttons around the +// selection area. Ignores the sides blocked by the end of the screen. +// When the selection is too small it works on a virtual selection with +// the original in the center. +void ButtonHandler::updatePosition(const QRect &selection) { + resetRegionTrack(); + const int vecLength = m_vectorButtons.size(); + if (vecLength == 0) { + return; + } + // Copy of the selection area for internal modifications + m_selection = intersectWithAreas(selection); + updateBlockedSides(); + ensureSelectionMinimunSize(); + // Indicates the actual button to be moved + int elemIndicator = 0; + + while (elemIndicator < vecLength) { + + // Add them inside the area when there is no more space + if (m_allSidesBlocked) { + m_selection = selection; + positionButtonsInside(elemIndicator); + break; // the while + } + // Number of buttons per row column + int buttonsPerRow = (m_selection.width() + m_separator) / (m_buttonExtendedSize); + int buttonsPerCol = (m_selection.height() + m_separator) / (m_buttonExtendedSize); + // Buttons to be placed in the corners + int extraButtons = (vecLength - elemIndicator) - + (buttonsPerRow + buttonsPerCol) * 2; + int elemsAtCorners = extraButtons > 4 ? 4 : extraButtons; + int maxExtra = 2; + if (m_oneHorizontalBlocked) { + maxExtra = 1; + } else if (m_horizontalyBlocked) { + maxExtra = 0; + } + int elemCornersTop = qBound(0, elemsAtCorners, maxExtra); + elemsAtCorners -= elemCornersTop; + int elemCornersBotton = qBound(0, elemsAtCorners, maxExtra); + + // Add buttons at the button of the seletion + if (!m_blockedBotton) { + int addCounter = buttonsPerRow + elemCornersBotton; + // Don't add more than we have + addCounter = qBound(0, addCounter, vecLength - elemIndicator); + QPoint center = QPoint(m_selection.center().x(), + m_selection.bottom() + m_separator); + if (addCounter > buttonsPerRow) { + adjustHorizontalCenter(center); + } + // ElemIndicator, elemsAtCorners + QVector positions = horizontalPoints(center, addCounter, true); + moveButtonsToPoints(positions, elemIndicator); + } + // Add buttons at the right side of the seletion + if (!m_blockedRight && elemIndicator < vecLength) { + int addCounter = buttonsPerCol; + addCounter = qBound(0, addCounter, vecLength - elemIndicator); + + QPoint center = QPoint(m_selection.right() + m_separator, + m_selection.center().y()); + QVector positions = verticalPoints(center, addCounter, false); + moveButtonsToPoints(positions, elemIndicator); + } + // Add buttons at the top of the seletion + if (!m_blockedTop && elemIndicator < vecLength) { + int addCounter = buttonsPerRow + elemCornersTop; + addCounter = qBound(0, addCounter, vecLength - elemIndicator); + QPoint center = QPoint(m_selection.center().x(), + m_selection.top() - m_buttonExtendedSize); + if (addCounter == 1 + buttonsPerRow) { + adjustHorizontalCenter(center); + } + QVector positions = horizontalPoints(center, addCounter, false); + moveButtonsToPoints(positions, elemIndicator); + } + // Add buttons at the left side of the seletion + if (!m_blockedLeft && elemIndicator < vecLength) { + int addCounter = buttonsPerCol; + addCounter = qBound(0, addCounter, vecLength - elemIndicator); + + QPoint center = QPoint(m_selection.left() - m_buttonExtendedSize, + m_selection.center().y()); + QVector positions = verticalPoints(center, addCounter, true); + moveButtonsToPoints(positions, elemIndicator); + } + // If there are elements for the next cycle, increase the size of the + // base area + if (elemIndicator < vecLength && !(m_allSidesBlocked)) { + expandSelection(); + } + updateBlockedSides(); + } +} + +// horizontalPoints is an auxiliar method for the button position computation. +// starts from a known center and keeps adding elements horizontally +// and returns the computed positions. +QVector ButtonHandler::horizontalPoints( + const QPoint ¢er, const int elements, const bool leftToRight) const +{ + QVector res; + // Distance from the center to start adding buttons + int shift = 0; + if (elements % 2 == 0) { + shift = m_buttonExtendedSize * (elements / 2) - (m_separator / 2); + } else { + shift = m_buttonExtendedSize * ((elements-1) / 2) + m_buttonBaseSize / 2; + } + if (!leftToRight) { shift -= m_buttonBaseSize; } + int x = leftToRight ? center.x() - shift : + center.x() + shift; + QPoint i(x, center.y()); + while (elements > res.length()) { + res.append(i); + leftToRight ? i.setX(i.x() + m_buttonExtendedSize) : + i.setX(i.x() - m_buttonExtendedSize); + } + return res; +} + +// verticalPoints is an auxiliar method for the button position computation. +// starts from a known center and keeps adding elements vertically +// and returns the computed positions. +QVector ButtonHandler::verticalPoints( + const QPoint ¢er, const int elements, const bool upToDown) const +{ + QVector res; + // Distance from the center to start adding buttons + int shift = 0; + if (elements % 2 == 0) { + shift = m_buttonExtendedSize * (elements / 2) - (m_separator / 2); + } else { + shift = m_buttonExtendedSize * ((elements-1) / 2) + m_buttonBaseSize / 2; + } + if (!upToDown) { shift -= m_buttonBaseSize; } + int y = upToDown ? center.y() - shift : + center.y() + shift; + QPoint i(center.x(), y); + while (elements > res.length()) { + res.append(i); + upToDown ? i.setY(i.y() + m_buttonExtendedSize) : + i.setY(i.y() - m_buttonExtendedSize); + } + return res; +} + +QRect ButtonHandler::intersectWithAreas(const QRect &rect) { + QRect res; + for(const QRect &r : m_screenRegions.rects()) { + QRect temp = rect.intersected(r); + if (temp.height() * temp.width() > res.height() * res.width()) { + res = temp; + } + } + return res; +} + +void ButtonHandler::init() { + m_separator = GlobalValues::buttonBaseSize() / 4; +} + +void ButtonHandler::resetRegionTrack() { + m_buttonsAreInside = false; +} + +void ButtonHandler::updateBlockedSides() { + const int EXTENSION = m_separator * 2 + m_buttonBaseSize; + // Right + QPoint pointA(m_selection.right() + EXTENSION, + m_selection.bottom()); + QPoint pointB(pointA.x(), + m_selection.top()); + m_blockedRight = !(m_screenRegions.contains(pointA) && + m_screenRegions.contains(pointB)); + // Left + pointA.setX(m_selection.left() - EXTENSION); + pointB.setX(pointA.x()); + m_blockedLeft = !(m_screenRegions.contains(pointA) && + m_screenRegions.contains(pointB)); + // Botton + pointA = QPoint(m_selection.left(), + m_selection.bottom() + EXTENSION); + pointB = QPoint(m_selection.right(), + pointA.y()); + m_blockedBotton = !(m_screenRegions.contains(pointA) && + m_screenRegions.contains(pointB)); + // Top + pointA.setY(m_selection.top() - EXTENSION); + pointB.setY(pointA.y()); + m_blockedTop = !(m_screenRegions.contains(pointA) && + m_screenRegions.contains(pointB)); + // Auxiliar + m_oneHorizontalBlocked = (!m_blockedRight && m_blockedLeft) || + (m_blockedRight && !m_blockedLeft); + m_horizontalyBlocked = (m_blockedRight && m_blockedLeft); + m_allSidesBlocked = (m_blockedBotton && m_horizontalyBlocked && m_blockedTop); +} + +void ButtonHandler::expandSelection() { + int &s = m_buttonExtendedSize; + m_selection = m_selection + QMargins(s, s, s, s); + m_selection = intersectWithAreas(m_selection); +} + +void ButtonHandler::positionButtonsInside(int index) { + // Position the buttons in the botton-center of the main but inside of the + // selection. + QRect mainArea = m_selection; + mainArea = intersectWithAreas(mainArea); + const int buttonsPerRow = (mainArea.width()) / (m_buttonExtendedSize); + if (buttonsPerRow == 0) { + return; + } + QPoint center = QPoint(mainArea.center().x(), + mainArea.bottom() - m_buttonExtendedSize); + + while (m_vectorButtons.size() > index) { + int addCounter = buttonsPerRow; + addCounter = qBound(0, addCounter, m_vectorButtons.size() - index); + QVector positions = horizontalPoints(center, addCounter, true); + moveButtonsToPoints(positions, index); + center.setY(center.y() - m_buttonExtendedSize); + } + + m_buttonsAreInside = true; +} + +void ButtonHandler::ensureSelectionMinimunSize() { + // Detect if a side is smaller than a button in order to prevent collision + // and redimension the base area the the base size of a single button per side + if (m_selection.width() < m_buttonBaseSize) { + if (!m_blockedLeft) { + m_selection.setX(m_selection.x() - + (m_buttonBaseSize-m_selection.width()) / 2); + } + m_selection.setWidth(m_buttonBaseSize); + } + if (m_selection.height() < m_buttonBaseSize) { + if (!m_blockedTop) { + m_selection.setY(m_selection.y() - + (m_buttonBaseSize-m_selection.height()) / 2); + } + m_selection.setHeight(m_buttonBaseSize); + } +} + +void ButtonHandler::moveButtonsToPoints( + const QVector &points, int &index) +{ + for (const QPoint &p: points) { + auto button = m_vectorButtons[index]; + button->move(p); + ++index; + } +} + +void ButtonHandler::adjustHorizontalCenter(QPoint ¢er) { + if (m_blockedLeft) { + center.setX(center.x() + m_buttonExtendedSize/2); + } else if (m_blockedRight) { + center.setX(center.x() - m_buttonExtendedSize/2); + } +} + +// setButtons redefines the buttons of the button handler +void ButtonHandler::setButtons(const QVector v) { + if (v.isEmpty()) + return; + + for (CaptureButton *b: m_vectorButtons) + delete(b); + m_vectorButtons = v; + m_buttonBaseSize = GlobalValues::buttonBaseSize(); + m_buttonExtendedSize = m_buttonBaseSize + m_separator; +} + +bool ButtonHandler::contains(const QPoint &p) const { + QPoint first(m_vectorButtons.first()->pos()); + QPoint last(m_vectorButtons.last()->pos()); + bool firstIsTopLeft = (first.x() <= last.x() && first.y() <= last.y()); + QPoint topLeft = firstIsTopLeft ? first : last; + QPoint bottonRight = firstIsTopLeft ? last : first; + topLeft += QPoint(-m_separator, -m_separator); + bottonRight += QPoint(m_buttonExtendedSize, m_buttonExtendedSize); + QRegion r(QRect(topLeft, bottonRight).normalized()); + return r.contains(p); +} + +void ButtonHandler::updateScreenRegions(const QVector &rects) { + m_screenRegions = QRegion(); + for (const QRect &rect: rects) { + m_screenRegions += rect; + } +} + +void ButtonHandler::updateScreenRegions(const QRect &rect) { + m_screenRegions = QRegion(rect); +} diff --git a/flameshot-0.6.0/src/widgets/capture/buttonhandler.h b/flameshot-0.6.0/src/widgets/capture/buttonhandler.h new file mode 100644 index 0000000000000000000000000000000000000000..1db8812718b8d1b29031c7101d9038f0a36db900 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/buttonhandler.h @@ -0,0 +1,87 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "capturebutton.h" +#include +#include +#include + +class CaptureButton; +class QRect; +class QPoint; + +class ButtonHandler : public QObject { + Q_OBJECT +public: + ButtonHandler(const QVector&, QObject *parent = nullptr); + explicit ButtonHandler(QObject *parent = nullptr); + + void hideSectionUnderMouse(const QPoint &p); + + bool isVisible() const; + bool buttonsAreInside() const; + size_t size() const; + + void setButtons(const QVector); + bool contains(const QPoint &p) const; + void updateScreenRegions(const QVector &rects); + void updateScreenRegions(const QRect &rect); + +public slots: + void updatePosition(const QRect &selection); + void hide(); + void show(); + +private: + QVector horizontalPoints(const QPoint ¢er, const int elements, + const bool leftToRight) const; + QVector verticalPoints(const QPoint ¢er, const int elements, + const bool upToDown) const; + + QRect intersectWithAreas(const QRect &rect); + + QVector m_vectorButtons; + + QRegion m_screenRegions; + + QRect m_selection; + + int m_separator; + int m_buttonExtendedSize; + int m_buttonBaseSize; + + bool m_buttonsAreInside; + bool m_blockedRight; + bool m_blockedLeft; + bool m_blockedBotton; + bool m_blockedTop; + bool m_oneHorizontalBlocked; + bool m_horizontalyBlocked; + bool m_allSidesBlocked; + + // aux methods + void init(); + void resetRegionTrack(); + void updateBlockedSides(); + void expandSelection(); + void positionButtonsInside(int index); + void ensureSelectionMinimunSize(); + void moveButtonsToPoints(const QVector &points, int &index); + void adjustHorizontalCenter(QPoint ¢er); +}; diff --git a/flameshot-0.6.0/src/widgets/capture/capturebutton.cpp b/flameshot-0.6.0/src/widgets/capture/capturebutton.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6d2af48dd176b477fab0d2a07efea5f1e975b060 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/capturebutton.cpp @@ -0,0 +1,196 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "capturebutton.h" +#include "src/widgets/capture/capturewidget.h" +#include "src/utils/confighandler.h" +#include "src/tools/capturetool.h" +#include "src/tools/toolfactory.h" +#include "src/utils/globalvalues.h" +#include "src/utils/colorutils.h" +#include +#include +#include +#include +#include +#include + +// Button represents a single button of the capture widget, it can enable +// multiple functionality. + +CaptureButton::CaptureButton(const ButtonType t, QWidget *parent) : QPushButton(parent), + m_buttonType(t) +{ + initButton(); + if (t == TYPE_SELECTIONINDICATOR) { + QFont f = this->font(); + setFont(QFont(f.family(), 7, QFont::Bold)); + } else { + updateIcon(); + } + setCursor(Qt::ArrowCursor); +} + +void CaptureButton::initButton() { + m_tool = ToolFactory().CreateTool(m_buttonType, this); + + setFocusPolicy(Qt::NoFocus); + resize(GlobalValues::buttonBaseSize(), GlobalValues::buttonBaseSize()); + setMask(QRegion(QRect(-1,-1, GlobalValues::buttonBaseSize()+2, + GlobalValues::buttonBaseSize()+2), + QRegion::Ellipse)); + + setToolTip(m_tool->description()); + + m_emergeAnimation = new QPropertyAnimation(this, "size", this); + m_emergeAnimation->setEasingCurve(QEasingCurve::InOutQuad); + m_emergeAnimation->setDuration(80); + m_emergeAnimation->setStartValue(QSize(0, 0)); + m_emergeAnimation->setEndValue( + QSize(GlobalValues::buttonBaseSize(), GlobalValues::buttonBaseSize())); + + auto dsEffect = new QGraphicsDropShadowEffect(this); + dsEffect->setBlurRadius(5); + dsEffect->setOffset(0); + dsEffect->setColor(QColor(Qt::black)); + + setGraphicsEffect(dsEffect); + +} + +void CaptureButton::updateIcon() { + setIcon(icon()); + setIconSize(size()*0.6); +} + +QVector CaptureButton::getIterableButtonTypes() { + return iterableButtonTypes; +} + +QString CaptureButton::globalStyleSheet() { + QColor mainColor = ConfigHandler().uiMainColorValue(); + QString baseSheet = "CaptureButton { border-radius: %3;" + "background-color: %1; color: %4 }" + "CaptureButton:hover { background-color: %2; }" + "CaptureButton:pressed:!hover { " + "background-color: %1; }"; + // define color when mouse is hovering + QColor contrast = ColorUtils::contrastColor(m_mainColor); + + // foreground color + QString color = ColorUtils::colorIsDark(mainColor) ? "white" : "black"; + + return baseSheet.arg(mainColor.name()).arg(contrast.name()) + .arg(GlobalValues::buttonBaseSize()/2).arg(color); +} + +QString CaptureButton::styleSheet() const { + QString baseSheet = "CaptureButton { border-radius: %3;" + "background-color: %1; color: %4 }" + "CaptureButton:hover { background-color: %2; }" + "CaptureButton:pressed:!hover { " + "background-color: %1; }"; + // define color when mouse is hovering + QColor contrast = ColorUtils::contrastColor(m_mainColor); + // foreground color + QString color = ColorUtils::colorIsDark(m_mainColor) ? "white" : "black"; + + return baseSheet.arg(m_mainColor.name()).arg(contrast.name()) + .arg(GlobalValues::buttonBaseSize()/2).arg(color); +} + +// get icon returns the icon for the type of button +QIcon CaptureButton::icon() const { + return m_tool->icon(m_mainColor, true); +} + +void CaptureButton::mousePressEvent(QMouseEvent *e) { + if (e->button() == Qt::LeftButton) { + emit pressedButton(this); + emit pressed(); + } +} + +void CaptureButton::animatedShow() { + if(!isVisible()) { + show(); + m_emergeAnimation->start(); + connect(m_emergeAnimation, &QPropertyAnimation::finished, this, [this](){ + }); + } +} + +CaptureTool *CaptureButton::tool() const { + return m_tool; +} + +void CaptureButton::setColor(const QColor &c) { + m_mainColor = c; + setStyleSheet(styleSheet()); + updateIcon(); +} + +QColor CaptureButton::m_mainColor = ConfigHandler().uiMainColorValue(); + +static std::map buttonTypeOrder { + { CaptureButton::TYPE_PENCIL, 0 }, + { CaptureButton::TYPE_DRAWER, 1 }, + { CaptureButton::TYPE_ARROW, 2 }, + { CaptureButton::TYPE_SELECTION, 3 }, + { CaptureButton::TYPE_RECTANGLE, 4 }, + { CaptureButton::TYPE_CIRCLE, 5 }, + { CaptureButton::TYPE_MARKER, 6 }, + { CaptureButton::TYPE_TEXT, 7 }, + { CaptureButton::TYPE_BLUR, 8 }, + { CaptureButton::TYPE_SELECTIONINDICATOR, 9 }, + { CaptureButton::TYPE_MOVESELECTION, 10 }, + { CaptureButton::TYPE_UNDO, 11 }, + { CaptureButton::TYPE_REDO, 12 }, + { CaptureButton::TYPE_COPY, 13 }, + { CaptureButton::TYPE_SAVE, 14 }, + { CaptureButton::TYPE_EXIT, 15 }, + { CaptureButton::TYPE_IMAGEUPLOADER, 16 }, + { CaptureButton::TYPE_OPEN_APP, 17 }, + { CaptureButton::TYPE_PIN, 18 }, +}; + +int CaptureButton::getPriorityByButton(CaptureButton::ButtonType b) { + auto it = buttonTypeOrder.find(b); + return it == buttonTypeOrder.cend() ? (int)buttonTypeOrder.size() : it->second; +} + +QVector CaptureButton::iterableButtonTypes = { + CaptureButton::TYPE_PENCIL, + CaptureButton::TYPE_DRAWER, + CaptureButton::TYPE_ARROW, + CaptureButton::TYPE_SELECTION, + CaptureButton::TYPE_RECTANGLE, + CaptureButton::TYPE_CIRCLE, + CaptureButton::TYPE_MARKER, + CaptureButton::TYPE_TEXT, + CaptureButton::TYPE_BLUR, + CaptureButton::TYPE_SELECTIONINDICATOR, + CaptureButton::TYPE_MOVESELECTION, + CaptureButton::TYPE_UNDO, + CaptureButton::TYPE_REDO, + CaptureButton::TYPE_COPY, + CaptureButton::TYPE_SAVE, + CaptureButton::TYPE_EXIT, + CaptureButton::TYPE_IMAGEUPLOADER, + CaptureButton::TYPE_OPEN_APP, + CaptureButton::TYPE_PIN, +}; diff --git a/flameshot-0.6.0/src/widgets/capture/capturebutton.h b/flameshot-0.6.0/src/widgets/capture/capturebutton.h new file mode 100644 index 0000000000000000000000000000000000000000..a3a2396850064f86bf8daf6ab4c2b1685900fa62 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/capturebutton.h @@ -0,0 +1,92 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include +#include + +class QWidget; +class QPropertyAnimation; +class CaptureTool; + +class CaptureButton : public QPushButton { + Q_OBJECT + Q_ENUMS(ButtonType) + +public: + // Don't forget to add the new types to CaptureButton::iterableButtonTypes + // in the .cpp and the order value in the private array buttonTypeOrder + enum ButtonType { + TYPE_PENCIL = 0, + TYPE_DRAWER = 1, + TYPE_ARROW = 2, + TYPE_SELECTION = 3, + TYPE_RECTANGLE = 4, + TYPE_CIRCLE = 5, + TYPE_MARKER = 6, + TYPE_SELECTIONINDICATOR = 7, + TYPE_MOVESELECTION = 8, + TYPE_UNDO = 9, + TYPE_COPY = 10, + TYPE_SAVE = 11, + TYPE_EXIT = 12, + TYPE_IMAGEUPLOADER = 13, + TYPE_OPEN_APP = 14, + TYPE_BLUR = 15, + TYPE_REDO = 16, + TYPE_PIN = 17, + TYPE_TEXT = 18, + }; + + CaptureButton() = delete; + explicit CaptureButton(const ButtonType, QWidget *parent = nullptr); + + static QString globalStyleSheet(); + static QVector getIterableButtonTypes(); + static int getPriorityByButton(CaptureButton::ButtonType); + + QString name() const; + QString description() const; + QIcon icon() const; + QString styleSheet() const; + CaptureTool* tool() const; + + void setColor(const QColor &c); + void animatedShow(); + +protected: + virtual void mousePressEvent(QMouseEvent *); + static QVector iterableButtonTypes; + + CaptureTool *m_tool; + +signals: + void pressedButton(CaptureButton *); + +private: + CaptureButton(QWidget *parent = nullptr); + ButtonType m_buttonType; + + QPropertyAnimation *m_emergeAnimation; + + static QColor m_mainColor; + + void initButton(); + void updateIcon(); +}; diff --git a/flameshot-0.6.0/src/widgets/capture/capturewidget.cpp b/flameshot-0.6.0/src/widgets/capture/capturewidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a07fee7f94903c7a2622e37253142a11862fe7da --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/capturewidget.cpp @@ -0,0 +1,863 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// Based on Lightscreen areadialog.cpp, Copyright 2017 Christian Kaiser +// released under the GNU GPL2 + +// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007 Luca Gugelmann +// released under the GNU LGPL + +#include "capturewidget.h" +#include "src/widgets/capture/hovereventfilter.h" +#include "src/widgets/panel/colorpickerwidget.h" +#include "src/utils/colorutils.h" +#include "src/utils/globalvalues.h" +#include "src/widgets/capture/notifierbox.h" +#include "src/widgets/capture/colorpicker.h" +#include "src/utils/screengrabber.h" +#include "src/utils/systemnotification.h" +#include "src/utils/screenshotsaver.h" +#include "src/core/controller.h" +#include "src/widgets/capture/modificationcommand.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// CaptureWidget is the main component used to capture the screen. It contains an +// are of selection with its respective buttons. + +// enableSaveWIndow +CaptureWidget::CaptureWidget(const uint id, const QString &savePath, + bool fullScreen, QWidget *parent) : + QWidget(parent), m_mouseIsClicked(false), m_rightClick(false), + m_newSelection(false), m_grabbing(false), m_captureDone(false), + m_previewEnabled(true), m_activeButton(nullptr), + m_activeTool(nullptr), m_toolWidget(nullptr), + m_mouseOverHandle(SelectionWidget::NO_SIDE), m_id(id) +{ + // Base config of the widget + m_eventFilter = new HoverEventFilter(this); + connect(m_eventFilter, &HoverEventFilter::hoverIn, + this, &CaptureWidget::childEnter); + connect(m_eventFilter, &HoverEventFilter::hoverOut, + this, &CaptureWidget::childLeave); + setAttribute(Qt::WA_DeleteOnClose); + m_showInitialMsg = m_config.showHelpValue(); + m_opacity = m_config.contrastOpacityValue(); + setMouseTracking(true); + initContext(savePath, fullScreen); + initShortcuts(); + +#ifdef Q_OS_WIN + // Top left of the whole set of screens + QPoint topLeft(0,0); +#endif + if (fullScreen) { + // Grab Screenshot + bool ok = true; + m_context.screenshot = ScreenGrabber().grabEntireDesktop(ok); + if(!ok) { + SystemNotification().sendMessage(tr("Unable to capture screen")); + this->close(); + } + m_context.origScreenshot = m_context.screenshot; + +#ifdef Q_OS_WIN + setWindowFlags(Qt::WindowStaysOnTopHint + | Qt::FramelessWindowHint + | Qt::Popup); + + for (QScreen *const screen : QGuiApplication::screens()) { + QPoint topLeftScreen = screen->geometry().topLeft(); + if (topLeft.x() > topLeftScreen.x() || + topLeft.y() > topLeftScreen.y()) { + topLeft = topLeftScreen; + } + } + move(topLeft); +#else + setWindowFlags(Qt::BypassWindowManagerHint + | Qt::WindowStaysOnTopHint + | Qt::FramelessWindowHint + | Qt::Tool); +#endif + resize(pixmap().size()); + } + // Create buttons + m_buttonHandler = new ButtonHandler(this); + updateButtons(); + QVector areas; + if (m_context.fullscreen) { + for (QScreen *const screen : QGuiApplication::screens()) { + QRect r = screen->geometry(); +#ifdef Q_OS_WIN + r.moveTo(r.topLeft() - topLeft); +#endif + areas.append(r); + } + } else { + areas.append(rect()); + } + m_buttonHandler->updateScreenRegions(areas); + m_buttonHandler->hide(); + + initSelection(); + updateCursor(); + + // Init color picker + m_colorPicker = new ColorPicker(this); + connect(m_colorPicker, &ColorPicker::colorSelected, + this, &CaptureWidget::setDrawColor); + m_colorPicker->hide(); + + // Init notification widget + m_notifierBox = new NotifierBox(this); + m_notifierBox->hide(); + + connect(&m_undoStack, &QUndoStack::indexChanged, + this, [this](int){ this->update(); }); + initPanel(); +} + +CaptureWidget::~CaptureWidget() { + if (m_captureDone) { + emit captureTaken(m_id, this->pixmap()); + } else { + emit captureFailed(m_id); + } + m_config.setdrawThickness(m_context.thickness); +} + +// redefineButtons retrieves the buttons configured to be shown with the +// selection in the capture +void CaptureWidget::updateButtons() { + m_uiColor = m_config.uiMainColorValue(); + m_contrastUiColor = m_config.uiContrastColorValue(); + + auto buttons = m_config.getButtons(); + QVector vectorButtons; + + for (const CaptureButton::ButtonType &t: buttons) { + CaptureButton *b = new CaptureButton(t, this); + if (t == CaptureButton::TYPE_SELECTIONINDICATOR) { + m_sizeIndButton = b; + } + b->setColor(m_uiColor); + makeChild(b); + + connect(b, &CaptureButton::pressedButton, this, &CaptureWidget::setState); + connect(b->tool(), &CaptureTool::requestAction, + this, &CaptureWidget::handleButtonSignal); + vectorButtons << b; + } + m_buttonHandler->setButtons(vectorButtons); +} + +QPixmap CaptureWidget::pixmap() { + QPixmap p; + if (m_toolWidget && m_activeTool) { + p = m_context.selectedScreenshotArea().copy(); + QPainter painter(&p); + m_activeTool->process(painter, p); + } else { + p = m_context.selectedScreenshotArea(); + } + return m_context.selectedScreenshotArea(); +} + +void CaptureWidget::close() { + if (m_toolWidget) { + m_toolWidget->deleteLater(); + m_toolWidget = nullptr; + } else { + QWidget::close(); + } +} + +void CaptureWidget::paintEvent(QPaintEvent *) { + QPainter painter(this); + painter.drawPixmap(0, 0, m_context.screenshot); + + if (m_activeTool && m_mouseIsClicked) { + painter.save(); + m_activeTool->process(painter, m_context.screenshot); + painter.restore(); + } else if (m_activeButton && m_activeButton->tool()->showMousePreview() && + m_previewEnabled) + { + painter.save(); + m_activeButton->tool()->paintMousePreview(painter, m_context); + painter.restore(); + } + + QColor overlayColor(0, 0, 0, m_opacity); + painter.setBrush(overlayColor); + QRect r; + if (m_selection->isVisible()) { + r = m_selection->geometry().normalized().adjusted(0, 0, -1, -1); + } + QRegion grey(rect()); + grey = grey.subtracted(r); + + painter.setClipRegion(grey); + painter.drawRect(-1, -1, rect().width() + 1, rect().height() + 1); + painter.setClipRect(rect()); + + if (m_showInitialMsg) { + QRect helpRect = QGuiApplication::primaryScreen()->geometry(); + helpRect.moveTo(mapFromGlobal(helpRect.topLeft())); + + QString helpTxt = tr("Select an area with the mouse, or press Esc to exit." + "\nPress Enter to capture the screen." + "\nPress Right Click to show the color picker." + "\nUse the Mouse Wheel to change the thickness of your tool." + "\nPress Space to open the side panel."); + + // We draw the white contrasting background for the text, using the + //same text and options to get the boundingRect that the text will have. + QRectF bRect = painter.boundingRect(helpRect, Qt::AlignCenter, helpTxt); + + // These four calls provide padding for the rect + const int margin = QApplication::fontMetrics().height() / 2; + bRect.setWidth(bRect.width() + margin); + bRect.setHeight(bRect.height() + margin); + bRect.setX(bRect.x() - margin); + bRect.setY(bRect.y() - margin); + + QColor rectColor(m_uiColor); + rectColor.setAlpha(180); + QColor textColor((ColorUtils::colorIsDark(rectColor) ? + Qt::white : Qt::black)); + + painter.setBrush(QBrush(rectColor, Qt::SolidPattern)); + painter.setPen(QPen(textColor)); + + painter.drawRect(bRect); + painter.drawText(helpRect, Qt::AlignCenter, helpTxt); + } + + if (m_selection->isVisible()) { + // paint handlers + painter.setPen(m_uiColor); + painter.setRenderHint(QPainter::Antialiasing); + painter.setBrush(m_uiColor); + for(auto r: m_selection->handlerAreas()) { + painter.drawRoundRect(r, 100, 100); + } + } +} + +void CaptureWidget::mousePressEvent(QMouseEvent *e) { + if (e->button() == Qt::RightButton) { + m_rightClick = true; + m_colorPicker->move(e->pos().x()-m_colorPicker->width()/2, + e->pos().y()-m_colorPicker->height()/2); + m_colorPicker->show(); + } else if (e->button() == Qt::LeftButton) { + m_showInitialMsg = false; + m_mouseIsClicked = true; + // Click using a tool + if (m_activeButton) { + if (m_activeTool) { + if (m_activeTool->isValid() && m_toolWidget) { + pushToolToStack(); + } else { + m_activeTool->deleteLater(); + } + if (m_toolWidget) { + m_toolWidget->deleteLater(); + return; + } + } + m_activeTool = m_activeButton->tool()->copy(this); + + connect(this, &CaptureWidget::colorChanged, + m_activeTool, &CaptureTool::colorChanged); + connect(this, &CaptureWidget::thicknessChanged, + m_activeTool, &CaptureTool::thicknessChanged); + connect(m_activeTool, &CaptureTool::requestAction, + this, &CaptureWidget::handleButtonSignal); + m_activeTool->drawStart(m_context); + return; + } + + m_dragStartPoint = e->pos(); + m_selection->saveGeometry(); + // New selection + if (!m_selection->geometry().contains(e->pos()) && + m_mouseOverHandle == SelectionWidget::NO_SIDE) + { + m_selection->setGeometry(QRect(e->pos(), e->pos())); + m_selection->setVisible(false); + m_newSelection = true; + m_buttonHandler->hide(); + update(); + } else { + m_grabbing = true; + } + } + updateCursor(); +} + +void CaptureWidget::mouseMoveEvent(QMouseEvent *e) { + m_context.mousePos = e->pos(); + + if (m_mouseIsClicked && !m_activeButton) { + if (m_buttonHandler->isVisible()) { + m_buttonHandler->hide(); + } + if (m_newSelection) { + m_selection->setVisible(true); + m_selection->setGeometry( + QRect(m_dragStartPoint, m_context.mousePos).normalized()); + update(); + } else if (m_mouseOverHandle == SelectionWidget::NO_SIDE) { + // Moving the whole selection + QRect initialRect = m_selection->savedGeometry().normalized(); + QPoint newTopLeft = initialRect.topLeft() + (e->pos() - m_dragStartPoint); + QRect finalRect(newTopLeft, initialRect.size()); + + if (finalRect.left() < rect().left()) { + finalRect.setLeft(rect().left()); + } else if (finalRect.right() > rect().right()) { + finalRect.setRight(rect().right()); + } + if (finalRect.top() < rect().top()) { + finalRect.setTop(rect().top()); + } else if (finalRect.bottom() > rect().bottom()) { + finalRect.setBottom(rect().bottom()); + } + m_selection->setGeometry(finalRect.normalized().intersected(rect())); + update(); + } else { + // Dragging a handle + QRect r = m_selection->savedGeometry(); + QPoint offset = e->pos() - m_dragStartPoint; + bool symmetryMod = qApp->keyboardModifiers() & Qt::ShiftModifier; + + using sw = SelectionWidget; + if (m_mouseOverHandle == sw::TOPLEFT_SIDE + || m_mouseOverHandle == sw::TOP_SIDE + || m_mouseOverHandle == sw::TOPRIGHT_SIDE) + { // dragging one of the top handles + r.setTop(r.top() + offset.y()); + if (symmetryMod) { + r.setBottom(r.bottom() - offset.y()); + } + } + if (m_mouseOverHandle == sw::TOPLEFT_SIDE + || m_mouseOverHandle == sw::LEFT_SIDE + || m_mouseOverHandle == sw::BOTTONLEFT_SIDE) + { // dragging one of the left handles + r.setLeft(r.left() + offset.x()); + if (symmetryMod) { + r.setRight(r.right() - offset.x()); + } + } + if (m_mouseOverHandle == sw::BOTTONLEFT_SIDE + || m_mouseOverHandle == sw::BOTTON_SIDE + || m_mouseOverHandle == sw::BOTTONRIGHT_SIDE) + { // dragging one of the bottom handles + r.setBottom(r.bottom() + offset.y()); + if (symmetryMod) { + r.setTop(r.top() - offset.y()); + } + } + if (m_mouseOverHandle == sw::TOPRIGHT_SIDE + || m_mouseOverHandle == sw::RIGHT_SIDE + || m_mouseOverHandle == sw::BOTTONRIGHT_SIDE) + { // dragging one of the right handles + r.setRight(r.right() + offset.x()); + if (symmetryMod) { + r.setLeft(r.left() - offset.x()); + } + } + m_selection->setGeometry(r.intersected(rect()).normalized()); + update(); + } + } else if (m_mouseIsClicked && m_activeTool) { + // drawing with a tool + m_activeTool->drawMove(e->pos()); + update(); + // Hides the buttons under the mouse. If the mouse leaves, it shows them. + if (m_buttonHandler->buttonsAreInside()) { + const bool containsMouse = m_buttonHandler->contains(m_context.mousePos); + if (containsMouse) { + m_buttonHandler->hide(); + } else { + m_buttonHandler->show(); + } + } + } else if (m_activeButton && m_activeButton->tool()->showMousePreview()) { + update(); + } else { + if (!m_selection->isVisible()) { + return; + } + m_mouseOverHandle = m_selection->getMouseSide(m_context.mousePos); + updateCursor(); + } +} + +void CaptureWidget::mouseReleaseEvent(QMouseEvent *e) { + if (e->button() == Qt::RightButton) { + m_colorPicker->hide(); + m_rightClick = false; + // when we end the drawing we have to register the last point and + //add the temp modification to the list of modifications + } else if (m_mouseIsClicked && m_activeTool) { + m_activeTool->drawEnd(m_context.mousePos); + if (m_activeTool->isValid()) { + pushToolToStack(); + } else if (!m_toolWidget){ + m_activeTool->deleteLater(); + m_activeTool = nullptr; + } + } + + // Show the buttons after the resize of the selection or the creation + // of a new one. + if (!m_buttonHandler->isVisible() && m_selection->isVisible()) { + // Don't go outside + QRect newGeometry = m_selection->geometry().intersected(rect()); + // normalize + if (newGeometry.width() <= 0) { + int left = newGeometry.left(); + newGeometry.setLeft(newGeometry.right()); + newGeometry.setRight(left); + } + if (newGeometry.height() <= 0) { + int top = newGeometry.top(); + newGeometry.setTop(newGeometry.bottom()); + newGeometry.setBottom(top); + } + m_selection->setGeometry(newGeometry); + m_context.selection = extendedRect(&newGeometry); + updateSizeIndicator(); + m_buttonHandler->updatePosition(newGeometry); + m_buttonHandler->show(); + } + m_mouseIsClicked = false; + m_newSelection = false; + m_grabbing = false; + + updateCursor(); +} + +void CaptureWidget::keyPressEvent(QKeyEvent *e) { + if (!m_selection->isVisible()) { + return; + } else if (e->key() == Qt::Key_Up + && m_selection->geometry().top() > rect().top()) { + m_selection->move(QPoint(m_selection->x(), m_selection->y() -1)); + m_buttonHandler->updatePosition(m_selection->geometry()); + update(); + } else if (e->key() == Qt::Key_Down + && m_selection->geometry().bottom() < rect().bottom()) { + m_selection->move(QPoint(m_selection->x(), m_selection->y() +1)); + m_buttonHandler->updatePosition(m_selection->geometry()); + update(); + } else if (e->key() == Qt::Key_Left + && m_selection->geometry().left() > rect().left()) { + m_selection->move(QPoint(m_selection->x() -1, m_selection->y())); + m_buttonHandler->updatePosition(m_selection->geometry()); + update(); + } else if (e->key() == Qt::Key_Right + && m_selection->geometry().right() < rect().right()) { + m_selection->move(QPoint(m_selection->x() +1, m_selection->y())); + m_buttonHandler->updatePosition(m_selection->geometry()); + update(); + } +} + +void CaptureWidget::wheelEvent(QWheelEvent *e) { + m_context.thickness += e->delta() / 120; + m_context.thickness = qBound(0, m_context.thickness, 100); + QPoint topLeft = qApp->desktop()->screenGeometry( + qApp->desktop()->screenNumber(QCursor::pos())).topLeft(); + int offset = m_notifierBox->width() / 4; + m_notifierBox->move(mapFromGlobal(topLeft) + QPoint(offset, offset)); + m_notifierBox->showMessage(QString::number(m_context.thickness)); + if (m_activeButton && m_activeButton->tool()->showMousePreview()) { + update(); + } + emit thicknessChanged(m_context.thickness); +} + +void CaptureWidget::resizeEvent(QResizeEvent *e) { + QWidget::resizeEvent(e); + m_context.widgetDimensions = rect(); + m_context.widgetOffset = mapToGlobal(QPoint(0,0)); + m_panel->setFixedHeight(height()); + if (!m_context.fullscreen) { + m_buttonHandler->updateScreenRegions(rect()); + } +} + +void CaptureWidget::moveEvent(QMoveEvent *e) { + QWidget::moveEvent(e); + m_context.widgetOffset = mapToGlobal(QPoint(0,0)); +} + +void CaptureWidget::initContext(const QString &savePath, bool fullscreen) { + m_context.widgetDimensions = rect(); + m_context.color = m_config.drawColorValue(); + m_context.savePath = savePath; + m_context.widgetOffset = mapToGlobal(QPoint(0,0)); + m_context.mousePos= mapFromGlobal(QCursor::pos()); + m_context.thickness = m_config.drawThicknessValue(); + m_context.fullscreen = fullscreen; +} + +void CaptureWidget::initPanel() { + m_panel = new UtilityPanel(this); + makeChild(m_panel); + QRect panelRect = rect(); + if (m_context.fullscreen) { + panelRect = QGuiApplication::primaryScreen()->geometry(); + } + panelRect.moveTo(mapFromGlobal(panelRect.topLeft())); + panelRect.setWidth(m_colorPicker->width() * 3); + m_panel->setGeometry(panelRect); + + ColorPickerWidget *colorPicker = + new ColorPickerWidget(&m_context.screenshot); + connect(colorPicker, &ColorPickerWidget::colorChanged, + this, &CaptureWidget::setDrawColor); + connect(this, &CaptureWidget::colorChanged, + colorPicker, &ColorPickerWidget::updateColor); + connect(colorPicker, &ColorPickerWidget::togglePanel, + m_panel, &UtilityPanel::toggle); + colorPicker->colorChanged(m_context.color); + m_panel->pushWidget(colorPicker); + m_panel->pushWidget(new QUndoView(&m_undoStack, this)); +} + +void CaptureWidget::initSelection() { + m_selection = new SelectionWidget(m_uiColor, this); + connect(m_selection, &SelectionWidget::animationEnded, this, [this](){ + this->m_buttonHandler->updatePosition(this->m_selection->geometry()); + }); + m_selection->setVisible(false); + m_selection->setGeometry(QRect()); +} + +void CaptureWidget::setState(CaptureButton *b) { + if (!b) { + return; + } + if (m_toolWidget) { + m_toolWidget->deleteLater(); + if (m_activeTool->isValid()) { + pushToolToStack(); + } + } + if (m_activeButton != b) { + processTool(b->tool()); + } + // Only close activated from button + if (b->tool()->closeOnButtonPressed()) { + close(); + } + + if (b->tool()->isSelectable()) { + if (m_activeButton != b) { + QWidget *confW = b->tool()->configurationWidget(); + m_panel->addToolWidget(confW); + if (m_activeButton) { + m_activeButton->setColor(m_uiColor); + } + m_activeButton = b; + m_activeButton->setColor(m_contrastUiColor); + } else if (m_activeButton) { + m_panel->clearToolWidget(); + m_activeButton->setColor(m_uiColor); + m_activeButton = nullptr; + } + update(); // clear mouse preview + } +} + +void CaptureWidget::processTool(CaptureTool *t) { + auto backup = m_activeTool; + // The tool is active during the pressed(). + m_activeTool = t; + t->pressed(m_context); + m_activeTool = backup; +} + +void CaptureWidget::handleButtonSignal(CaptureTool::Request r) { + switch (r) { + case CaptureTool::REQ_CLEAR_MODIFICATIONS: + m_undoStack.setIndex(0); + update(); + break; + case CaptureTool::REQ_CLOSE_GUI: + close(); + break; + case CaptureTool::REQ_HIDE_GUI: + hide(); + break; + case CaptureTool::REQ_HIDE_SELECTION: + m_newSelection = true; + m_selection->setVisible(false); + updateCursor(); + break; + case CaptureTool::REQ_SELECT_ALL: + m_selection->setGeometryAnimated(rect()); + break; + case CaptureTool::REQ_UNDO_MODIFICATION: + m_undoStack.undo(); + break; + case CaptureTool::REQ_REDO_MODIFICATION: + m_undoStack.redo(); + break; + case CaptureTool::REQ_REDRAW: + update(); + break; + case CaptureTool::REQ_TOGGLE_SIDEBAR: + m_panel->toggle(); + break; + case CaptureTool::REQ_SHOW_COLOR_PICKER: + // TODO + break; + case CaptureTool::REQ_MOVE_MODE: + setState(m_activeButton); // Disable the actual button + break; + case CaptureTool::REQ_CAPTURE_DONE_OK: + m_captureDone = true; + break; + case CaptureTool::REQ_ADD_CHILD_WIDGET: + if (!m_activeTool) { + break; + } + if (m_toolWidget) { + m_toolWidget->deleteLater(); + } + m_toolWidget = m_activeTool->widget(); + if (m_toolWidget) { + makeChild(m_toolWidget); + m_toolWidget->move(m_context.mousePos); + m_toolWidget->show(); + m_toolWidget->setFocus(); + } + break; + case CaptureTool::REQ_ADD_CHILD_WINDOW: + if (!m_activeTool) { + break; + } else { + QWidget *w = m_activeTool->widget(); + connect(this, &CaptureWidget::destroyed, w, &QWidget::deleteLater); + w->show(); + } + break; + case CaptureTool::REQ_ADD_EXTERNAL_WIDGETS: + if (!m_activeTool) { + break; + } else { + QWidget *w = m_activeTool->widget(); + w->setAttribute(Qt::WA_DeleteOnClose); + w->show(); + } + break; + default: + break; + } +} + +void CaptureWidget::setDrawColor(const QColor &c) { + m_context.color = c; + ConfigHandler().setDrawColor(m_context.color); + emit colorChanged(c); +} + +void CaptureWidget::leftResize() { + if (m_selection->isVisible() && m_selection->geometry().right() > m_selection->geometry().left()) { + m_selection->setGeometry(m_selection->geometry() + QMargins(0, 0, -1, 0)); + m_buttonHandler->updatePosition(m_selection->geometry()); + updateSizeIndicator(); + update(); + } +} + +void CaptureWidget::rightResize() { + if (m_selection->isVisible() && m_selection->geometry().right() < rect().right()) { + m_selection->setGeometry(m_selection->geometry() + QMargins(0, 0, 1, 0)); + m_buttonHandler->updatePosition(m_selection->geometry()); + updateSizeIndicator(); + update(); + } +} + +void CaptureWidget::upResize() { + if (m_selection->isVisible() && m_selection->geometry().bottom() > m_selection->geometry().top()) { + m_selection->setGeometry(m_selection->geometry() + QMargins(0, 0, 0, -1)); + m_buttonHandler->updatePosition(m_selection->geometry()); + updateSizeIndicator(); + update(); + } +} + +void CaptureWidget::downResize() { + if (m_selection->isVisible() && m_selection->geometry().bottom() < rect().bottom()) { + m_selection->setGeometry(m_selection->geometry() + QMargins(0, 0, 0, 1)); + m_buttonHandler->updatePosition(m_selection->geometry()); + updateSizeIndicator(); + update(); + } +} + +void CaptureWidget::initShortcuts() { + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_S), this, SLOT(saveScreenshot())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C), this, SLOT(copyScreenshot())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z), this, SLOT(undo())); + new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z), this, SLOT(redo())); + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Right), this, SLOT(rightResize())); + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left), this, SLOT(leftResize())); + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Up), this, SLOT(upResize())); + new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down), this, SLOT(downResize())); + new QShortcut(Qt::Key_Space, this, SLOT(togglePanel())); + new QShortcut(Qt::Key_Escape, this, SLOT(close())); + new QShortcut(Qt::Key_Return, this, SLOT(copyScreenshot())); +} + +void CaptureWidget::updateSizeIndicator() { + if (m_sizeIndButton){ + const QRect &selection = extendedSelection(); + m_sizeIndButton->setText(QStringLiteral("%1\n%2") + .arg(selection.width()) + .arg(selection.height())); + } +} + +void CaptureWidget::updateCursor() { + if (m_rightClick) { + setCursor(Qt::ArrowCursor); + } else if (m_grabbing) { + setCursor(Qt::ClosedHandCursor); + } else if (!m_activeButton) { + using sw = SelectionWidget; + if (m_mouseOverHandle != sw::NO_SIDE){ + // cursor on the handlers + switch (m_mouseOverHandle) { + case sw::TOPLEFT_SIDE: case sw::BOTTONRIGHT_SIDE: + setCursor(Qt::SizeFDiagCursor); + break; + case sw::TOPRIGHT_SIDE: case sw::BOTTONLEFT_SIDE: + setCursor(Qt::SizeBDiagCursor); + break; + case sw::LEFT_SIDE: case sw::RIGHT_SIDE: + setCursor(Qt::SizeHorCursor); + break; + case sw::TOP_SIDE: case sw::BOTTON_SIDE: + setCursor(Qt::SizeVerCursor); + break; + default: + break; + } + } else if (m_selection->isVisible() && + m_selection->geometry().contains(m_context.mousePos)) + { + setCursor(Qt::OpenHandCursor); + } else { + setCursor(Qt::CrossCursor); + } + } else { + setCursor(Qt::CrossCursor); + } +} + +void CaptureWidget::pushToolToStack() { + auto mod = new ModificationCommand( + &m_context.screenshot, m_activeTool); + disconnect(this, &CaptureWidget::colorChanged, + m_activeTool, &CaptureTool::colorChanged); + disconnect(this, &CaptureWidget::thicknessChanged, + m_activeTool, &CaptureTool::thicknessChanged); + if (m_panel->toolWidget()) { + disconnect(m_panel->toolWidget(), nullptr, m_activeTool, nullptr); + } + m_undoStack.push(mod); + m_activeTool = nullptr; +} + +void CaptureWidget::makeChild(QWidget *w) { + w->setParent(this); + w->installEventFilter(m_eventFilter); +} + +void CaptureWidget::togglePanel() { + m_panel->toggle(); +} + +void CaptureWidget::childEnter() { + m_previewEnabled = false; + update(); +} + +void CaptureWidget::childLeave() { + m_previewEnabled = true; + update(); +} + +void CaptureWidget::copyScreenshot() { + m_captureDone = true; + ScreenshotSaver().saveToClipboard(pixmap()); + close(); +} + +void CaptureWidget::saveScreenshot() { + m_captureDone = true; + hide(); + if (m_context.savePath.isEmpty()) { + ScreenshotSaver().saveToFilesystemGUI(pixmap()); + } else { + ScreenshotSaver().saveToFilesystem(pixmap(), m_context.savePath); + } + close(); +} + +void CaptureWidget::undo() { + m_undoStack.undo(); +} + +void CaptureWidget::redo() { + m_undoStack.redo(); +} + +QRect CaptureWidget::extendedSelection() const { + if (!m_selection->isVisible()) + return QRect(); + QRect r = m_selection->geometry(); + return extendedRect(&r); +} + +QRect CaptureWidget::extendedRect(QRect *r) const { + auto devicePixelRatio = m_context.screenshot.devicePixelRatio(); + return QRect(r->left() * devicePixelRatio, + r->top() * devicePixelRatio, + r->width() * devicePixelRatio, + r->height() * devicePixelRatio); +} diff --git a/flameshot-0.6.0/src/widgets/capture/capturewidget.h b/flameshot-0.6.0/src/widgets/capture/capturewidget.h new file mode 100644 index 0000000000000000000000000000000000000000..97601d34bf6a6edf82762daeec1ec2bdcaf4bd37 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/capturewidget.h @@ -0,0 +1,153 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// Based on Lightscreen areadialog.h, Copyright 2017 Christian Kaiser +// released under the GNU GPL2 + +// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007 Luca Gugelmann +// released under the GNU LGPL + +#pragma once + +#include "capturebutton.h" +#include "src/tools/capturecontext.h" +#include "src/tools/capturetool.h" +#include "src/utils/confighandler.h" +#include "src/widgets/capture/selectionwidget.h" +#include "src/widgets/panel/utilitypanel.h" +#include "buttonhandler.h" +#include +#include +#include + +class QPaintEvent; +class QResizeEvent; +class QMouseEvent; +class CaptureModification; +class QNetworkAccessManager; +class QNetworkReply; +class ColorPicker; +class Screenshot; +class NotifierBox; +class HoverEventFilter; + +class CaptureWidget : public QWidget { + Q_OBJECT + +public: + + explicit CaptureWidget(const uint id = 0, + const QString &savePath = QString(), + bool fullScreen = true, + QWidget *parent = nullptr); + ~CaptureWidget(); + + + void updateButtons(); + QPixmap pixmap(); + +public slots: + void close(); + +signals: + void captureTaken(uint id, QPixmap p); + void captureFailed(uint id); + void colorChanged(const QColor &c); + void thicknessChanged(const int thickness); + +private slots: + + // TODO replace with tools + void copyScreenshot(); + void saveScreenshot(); + void undo(); + void redo(); + void togglePanel(); + void childEnter(); + void childLeave(); + + void leftResize(); + void rightResize(); + void upResize(); + void downResize(); + + void setState(CaptureButton *b); + void processTool(CaptureTool *t); + void handleButtonSignal(CaptureTool::Request r); + void setDrawColor(const QColor &c); + +protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void keyPressEvent(QKeyEvent *); + void wheelEvent(QWheelEvent *); + void resizeEvent(QResizeEvent *); + void moveEvent(QMoveEvent *); + + // Context information + CaptureContext m_context; + + // Main ui color + QColor m_uiColor; + // Secondary ui color + QColor m_contrastUiColor; + + // Outside selection opacity + int m_opacity; + // utility flags + bool m_mouseIsClicked; + bool m_rightClick; + bool m_newSelection; + bool m_grabbing; + bool m_showInitialMsg; + bool m_captureDone; + bool m_previewEnabled; + +private: + void initContext(const QString &savePath, bool fullscreen); + void initPanel(); + void initSelection(); + void initShortcuts(); + void updateSizeIndicator(); + void updateCursor(); + void pushToolToStack(); + void makeChild(QWidget *w); + + QRect extendedSelection() const; + QRect extendedRect(QRect *r) const; + + QUndoStack m_undoStack; + QPointer m_sizeIndButton; + // Last pressed button + QPointer m_activeButton; + QPointer m_activeTool; + QPointer m_toolWidget; + + ButtonHandler *m_buttonHandler; + UtilityPanel *m_panel; + ColorPicker *m_colorPicker; + ConfigHandler m_config; + NotifierBox *m_notifierBox; + HoverEventFilter *m_eventFilter; + SelectionWidget *m_selection; + + QPoint m_dragStartPoint; + SelectionWidget::SideType m_mouseOverHandle; + uint m_id; +}; diff --git a/flameshot-0.6.0/src/widgets/capture/colorpicker.cpp b/flameshot-0.6.0/src/widgets/capture/colorpicker.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0ed6d5f92af7af6a739cd50b9608c3afad59e90e --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/colorpicker.cpp @@ -0,0 +1,110 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "colorpicker.h" +#include "src/utils/confighandler.h" +#include "src/utils/globalvalues.h" +#include +#include + +ColorPicker::ColorPicker(QWidget *parent) : QWidget(parent) { + ConfigHandler config; + m_colorList = config.getUserColors(); + m_colorAreaSize = GlobalValues::buttonBaseSize() * 0.6; + setMouseTracking(true); + // save the color values in member variables for faster access + m_uiColor = config.uiMainColorValue(); + m_drawColor = config.drawColorValue(); + // extraSize represents the extra space needed for the highlight of the + // selected color. + const int extraSize = 6; + double radius = (m_colorList.size()*m_colorAreaSize/1.3)/(3.141592); + resize(radius*2 + m_colorAreaSize + extraSize, + radius*2 + m_colorAreaSize+ extraSize); + double degree = 360 / (m_colorList.size()); + double degreeAcum = degree; + // this line is the radius of the circle which will be rotated to add + // the color components. + QLineF baseLine = QLineF(QPoint(radius+extraSize/2, radius+extraSize/2), + QPoint(radius*2, radius)); + + for (int i = 0; i rects = handleMask(); + painter.setPen(QColor(Qt::black)); + for (int i = 0; i < rects.size(); ++i) { + // draw the highlight when we have to draw the selected color + if (m_drawColor == QColor(m_colorList.at(i))) { + QColor c = QColor(m_uiColor); + c.setAlpha(155); + painter.setBrush(c); + c.setAlpha(100); + painter.setPen(c); + QRect highlight = rects.at(i); + highlight.moveTo(highlight.x() - 3, highlight.y() - 3); + highlight.setHeight(highlight.height() + 6); + highlight.setWidth(highlight.width() + 6); + painter.drawRoundRect(highlight, 100, 100); + painter.setPen(QColor(Qt::black)); + } + painter.setBrush(QColor(m_colorList.at(i))); + painter.drawRoundRect(rects.at(i), 100, 100); + } +} + +void ColorPicker::mouseMoveEvent(QMouseEvent *e) { + for (int i = 0; i < m_colorList.size(); ++i) { + if (m_colorAreaList.at(i).contains(e->pos())) { + m_drawColor = m_colorList.at(i); + emit colorSelected(m_drawColor); + update(); + break; + } + } +} + +QVector ColorPicker::handleMask() const { + QVector areas; + for (const QRect &rect: m_colorAreaList) { + areas.append(rect); + } + return areas; +} diff --git a/flameshot-0.6.0/src/widgets/capture/colorpicker.h b/flameshot-0.6.0/src/widgets/capture/colorpicker.h new file mode 100644 index 0000000000000000000000000000000000000000..024fd7b1b85d323c30e865557eef2efe997c27b1 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/colorpicker.h @@ -0,0 +1,47 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class ColorPicker : public QWidget { + Q_OBJECT +public: + explicit ColorPicker(QWidget *parent = nullptr); + + QColor drawColor(); + + void show(); + void hide(); + +signals: + void colorSelected(QColor c); + +protected: + void paintEvent(QPaintEvent *); + void mouseMoveEvent(QMouseEvent *); + + QVector handleMask() const; + +private: + int m_colorAreaSize; + QVector m_colorAreaList; + QVector m_colorList; + + QColor m_uiColor, m_drawColor; +}; diff --git a/flameshot-0.6.0/src/widgets/capture/hovereventfilter.cpp b/flameshot-0.6.0/src/widgets/capture/hovereventfilter.cpp new file mode 100644 index 0000000000000000000000000000000000000000..69531fe319a6991f178c00f644cc75f9f23dd98b --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/hovereventfilter.cpp @@ -0,0 +1,44 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// Based on Lightscreen areadialog.h, Copyright 2017 Christian Kaiser +// released under the GNU GPL2 + +// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007 Luca Gugelmann +// released under the GNU LGPL + +#include "hovereventfilter.h" +#include + +HoverEventFilter::HoverEventFilter(QObject *parent) : QObject(parent) { + +} + +bool HoverEventFilter::eventFilter(QObject *watched, QEvent *event) { + QEvent::Type t = event->type(); + switch (t) { + case QEvent::Enter: + emit hoverIn(watched); + break; + case QEvent::Leave: + emit hoverOut(watched); + break; + default: + break; + } + return false; +} diff --git a/flameshot-0.6.0/src/widgets/capture/hovereventfilter.h b/flameshot-0.6.0/src/widgets/capture/hovereventfilter.h new file mode 100644 index 0000000000000000000000000000000000000000..2805f25b0b0a9e44094144182e6bab7594a9f7dd --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/hovereventfilter.h @@ -0,0 +1,40 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// Based on Lightscreen areadialog.h, Copyright 2017 Christian Kaiser +// released under the GNU GPL2 + +// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007 Luca Gugelmann +// released under the GNU LGPL + +#pragma once + +#include + +class HoverEventFilter : public QObject +{ + Q_OBJECT +public: + explicit HoverEventFilter(QObject *parent = nullptr); + +signals: + void hoverIn(QObject *); + void hoverOut(QObject *); + +protected: + bool eventFilter(QObject *watched, QEvent *event); +}; diff --git a/flameshot-0.6.0/src/widgets/capture/modificationcommand.cpp b/flameshot-0.6.0/src/widgets/capture/modificationcommand.cpp new file mode 100644 index 0000000000000000000000000000000000000000..faeaaee0dcc51917f80a3db863de80ce8c50ec2f --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/modificationcommand.cpp @@ -0,0 +1,35 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "modificationcommand.h" +#include + +ModificationCommand::ModificationCommand(QPixmap *p, CaptureTool *t) : + m_pixmap(p), m_tool(t) +{ + setText(t->name()); +} + +void ModificationCommand::undo() { + m_tool->undo(*m_pixmap); +} + +void ModificationCommand::redo() { + QPainter p(m_pixmap); + p.setRenderHint(QPainter::Antialiasing); + m_tool->process(p, *m_pixmap, true); +} diff --git a/flameshot-0.6.0/src/widgets/capture/modificationcommand.h b/flameshot-0.6.0/src/widgets/capture/modificationcommand.h new file mode 100644 index 0000000000000000000000000000000000000000..ab607f53315c593ea2a658d3a515447a04ce3a83 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/modificationcommand.h @@ -0,0 +1,33 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include "src/tools/capturetool.h" + +class ModificationCommand : public QUndoCommand { +public: + ModificationCommand(QPixmap *, CaptureTool *); + + virtual void undo() override; + virtual void redo() override; + +private: + QPixmap *m_pixmap; + QScopedPointer m_tool; +}; diff --git a/flameshot-0.6.0/src/widgets/capture/notifierbox.cpp b/flameshot-0.6.0/src/widgets/capture/notifierbox.cpp new file mode 100644 index 0000000000000000000000000000000000000000..a060267c19edb2a9615b48c1be6029e5f0e3e3cd --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/notifierbox.cpp @@ -0,0 +1,67 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "notifierbox.h" +#include "src/utils/confighandler.h" +#include "src/utils/colorutils.h" +#include "src/utils/globalvalues.h" +#include +#include +#include + +NotifierBox::NotifierBox(QWidget *parent) : QWidget(parent) { + m_timer = new QTimer(this); + m_timer->setSingleShot(true); + m_timer->setInterval(1200); + connect(m_timer, &QTimer::timeout, this, &NotifierBox::hide); + m_bgColor = ConfigHandler().uiMainColorValue(); + m_foregroundColor = (ColorUtils::colorIsDark(m_bgColor) ? + Qt::white : Qt::black); + m_bgColor.setAlpha(180); + const int size = (GlobalValues::buttonBaseSize() + + GlobalValues::buttonBaseSize()/2) * + qApp->devicePixelRatio(); + setFixedSize(QSize(size, size)); +} + +void NotifierBox::enterEvent(QEvent *) { + hide(); +} + +void NotifierBox::paintEvent(QPaintEvent *) { + QPainter painter(this); + // draw Elipse + painter.setRenderHint(QPainter::Antialiasing); + painter.setBrush(QBrush(m_bgColor, Qt::SolidPattern)); + painter.setPen(QPen(Qt::transparent)); + painter.drawEllipse(rect()); + // Draw the text: + painter.setPen(QPen(m_foregroundColor)); + painter.drawText(rect(), Qt::AlignCenter, m_message); +} + +void NotifierBox::showMessage(const QString &msg) { + m_message = msg; + update(); + show(); + m_timer->start(); +} + +void NotifierBox::showColor(const QColor &color) { + Q_UNUSED(color); + m_message = ""; +} diff --git a/flameshot-0.6.0/src/widgets/capture/notifierbox.h b/flameshot-0.6.0/src/widgets/capture/notifierbox.h new file mode 100644 index 0000000000000000000000000000000000000000..06b5a5946202aa2c868fc780d903c425a6cff635 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/notifierbox.h @@ -0,0 +1,42 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QTimer; + +class NotifierBox : public QWidget { + Q_OBJECT +public: + explicit NotifierBox(QWidget *parent = nullptr); + +protected: + virtual void enterEvent(QEvent *); + virtual void paintEvent(QPaintEvent *); + +public slots: + void showMessage(const QString &msg); + void showColor(const QColor &color); + +private: + QTimer *m_timer; + QString m_message; + QColor m_bgColor; + QColor m_foregroundColor; +}; diff --git a/flameshot-0.6.0/src/widgets/capture/selectionwidget.cpp b/flameshot-0.6.0/src/widgets/capture/selectionwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f82e53b1c7c1f86382431dd4d925b603b6ab3887 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/selectionwidget.cpp @@ -0,0 +1,128 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "selectionwidget.h" +#include "src/utils/globalvalues.h" +#include +#include + +SelectionWidget::SelectionWidget(const QColor &c, QWidget *parent) : + QWidget(parent), m_color(c) +{ + m_animation = new QPropertyAnimation(this, "geometry", this); + m_animation->setEasingCurve(QEasingCurve::InOutQuad); + m_animation->setDuration(200); + connect(m_animation, &QPropertyAnimation::finished, + this, &SelectionWidget::animationEnded); + + setAttribute(Qt::WA_TransparentForMouseEvents); + int sideVal = GlobalValues::buttonBaseSize() * 0.6; + int handleSide = sideVal / 2; + const QRect areaRect(0, 0, sideVal, sideVal); + const QRect handleRect(0, 0, handleSide, handleSide); + m_TLHandle = m_TRHandle = m_BLHandle = m_BRHandle = + m_LHandle = m_THandle = m_RHandle = m_BHandle= handleRect; + m_TLArea = m_TRArea = m_BLArea = m_BRArea = areaRect; + + m_areaOffset = QPoint(-sideVal/2, -sideVal/2); + m_handleOffset = QPoint(-handleSide/2, -handleSide/2); +} + +SelectionWidget::SideType SelectionWidget::getMouseSide(const QPoint &point) const { + if (m_TLArea.contains(point)) { + return TOPLEFT_SIDE; + } else if (m_TRArea.contains(point)) { + return TOPRIGHT_SIDE; + } else if (m_BLArea.contains(point)) { + return BOTTONLEFT_SIDE; + } else if (m_BRArea.contains(point)) { + return BOTTONRIGHT_SIDE; + } else if (m_LArea.contains(point)) { + return LEFT_SIDE; + } else if (m_TArea.contains(point)) { + return TOP_SIDE; + } else if (m_RArea.contains(point)) { + return RIGHT_SIDE; + } else if (m_BArea.contains(point)) { + return BOTTON_SIDE; + } else { + return NO_SIDE; + } +} + +QVector SelectionWidget::handlerAreas() { + QVector areas; + areas << m_TLHandle << m_TRHandle << m_BLHandle << m_BRHandle + <setStartValue(geometry()); + m_animation->setEndValue(r); + m_animation->start(); + } +} + +void SelectionWidget::saveGeometry() { + m_geometryBackup = geometry(); +} + +QRect SelectionWidget::savedGeometry() { + return m_geometryBackup; +} + +void SelectionWidget::paintEvent(QPaintEvent *) { + QPainter p(this); + p.setPen(m_color); + p.drawRect(rect() + QMargins(0, 0, -1, -1)); +} + +void SelectionWidget::resizeEvent(QResizeEvent *) { + updateAreas(); +} + +void SelectionWidget::moveEvent(QMoveEvent *) { + updateAreas(); +} + +void SelectionWidget::updateColor(const QColor &c) { + m_color = c; +} + +void SelectionWidget::updateAreas() { + QRect r = rect(); + m_TLArea.moveTo(m_areaOffset + pos()); + m_TRArea.moveTo(r.topRight() + m_areaOffset + pos()); + m_BLArea.moveTo(r.bottomLeft() + m_areaOffset + pos()); + m_BRArea.moveTo(r.bottomRight() + m_areaOffset + pos()); + + m_LArea = QRect(m_TLArea.bottomLeft(), m_BLArea.topRight()); + m_TArea = QRect(m_TLArea.topRight(), m_TRArea.bottomLeft()); + m_RArea = QRect(m_TRArea.bottomLeft(), m_BRArea.topRight()); + m_BArea = QRect(m_BLArea.topRight(), m_BRArea.bottomLeft()); + + m_TLHandle.moveTo(m_TLArea.center() + m_handleOffset); + m_BLHandle.moveTo(m_BLArea.center() + m_handleOffset); + m_TRHandle.moveTo(m_TRArea.center() + m_handleOffset); + m_BRHandle.moveTo(m_BRArea.center() + m_handleOffset); + m_LHandle.moveTo(m_LArea.center() + m_handleOffset); + m_THandle.moveTo(m_TArea.center() + m_handleOffset); + m_RHandle.moveTo(m_RArea.center() + m_handleOffset); + m_BHandle.moveTo(m_BArea.center() + m_handleOffset); +} diff --git a/flameshot-0.6.0/src/widgets/capture/selectionwidget.h b/flameshot-0.6.0/src/widgets/capture/selectionwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..df63c92d638a4facdd836aeb696e5a78181d5442 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/capture/selectionwidget.h @@ -0,0 +1,79 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QPropertyAnimation; + +class SelectionWidget : public QWidget +{ + Q_OBJECT +public: + enum SideType { + TOPLEFT_SIDE, + BOTTONLEFT_SIDE, + TOPRIGHT_SIDE, + BOTTONRIGHT_SIDE, + TOP_SIDE, + BOTTON_SIDE, + RIGHT_SIDE, + LEFT_SIDE, + NO_SIDE, + }; + + explicit SelectionWidget(const QColor &c, QWidget *parent = nullptr); + + SideType getMouseSide(const QPoint &point) const; + QVector handlerAreas(); + + void setGeometryAnimated(const QRect &r); + void saveGeometry(); + QRect savedGeometry(); + +protected: + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + void moveEvent(QMoveEvent *); + +signals: + void animationEnded(); + +public slots: + void updateColor(const QColor &c); + +private: + void updateAreas(); + + QPropertyAnimation *m_animation; + + QColor m_color; + QPoint m_areaOffset; + QPoint m_handleOffset; + QRect m_geometryBackup; + + // naming convention for handles + // T top, B bottom, R Right, L left + // 2 letters: a corner + // 1 letter: the handle on the middle of the corresponding side + QRect m_TLHandle, m_TRHandle, m_BLHandle, m_BRHandle; + QRect m_LHandle, m_THandle, m_RHandle, m_BHandle; + + QRect m_TLArea, m_TRArea, m_BLArea, m_BRArea; + QRect m_LArea, m_TArea, m_RArea, m_BArea; +}; diff --git a/flameshot-0.6.0/src/widgets/imagelabel.cpp b/flameshot-0.6.0/src/widgets/imagelabel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..aac22d495b4f0ce1dfe49e7ab7130b9b45423737 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/imagelabel.cpp @@ -0,0 +1,86 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// This code is a modified version of the KDE software Spectacle +// /src/Gui/KSImageWidget.cpp commit cbbd6d45f6426ccbf1a82b15fdf98613ccccbbe9 + +#include "imagelabel.h" + +ImageLabel::ImageLabel(QWidget *parent): + QLabel(parent), m_pixmap(QPixmap()) +{ + m_DSEffect = new QGraphicsDropShadowEffect(this); + + m_DSEffect->setBlurRadius(5); + m_DSEffect->setOffset(0); + m_DSEffect->setColor(QColor(Qt::black)); + + setGraphicsEffect(m_DSEffect); + setCursor(Qt::OpenHandCursor); + setAlignment(Qt::AlignCenter); + setMinimumSize(size()); +} + +void ImageLabel::setScreenshot(const QPixmap &pixmap) { + m_pixmap = pixmap; + const QString tooltip = QStringLiteral("%1x%2 px").arg(m_pixmap.width()) + .arg(m_pixmap.height()); + setToolTip(tooltip); + setScaledPixmap(); +} + +void ImageLabel::setScaledPixmap() { + const qreal scale = qApp->devicePixelRatio(); + QPixmap scaledPixmap = m_pixmap.scaled(size() * scale, Qt::KeepAspectRatio, + Qt::SmoothTransformation); + scaledPixmap.setDevicePixelRatio(scale); + setPixmap(scaledPixmap); +} + +// drag handlers + +void ImageLabel::mousePressEvent(QMouseEvent *event) { + if (event->button() == Qt::LeftButton) { + m_dragStartPosition = event->pos(); + setCursor(Qt::ClosedHandCursor); + } +} + +void ImageLabel::mouseReleaseEvent(QMouseEvent *event) { + if (event->button() == Qt::LeftButton) { + setCursor(Qt::OpenHandCursor); + } +} + +void ImageLabel::mouseMoveEvent(QMouseEvent *event) { + if (!(event->buttons() & Qt::LeftButton)) { + return; + } + if ((event->pos() - m_dragStartPosition).manhattanLength() < + QGuiApplication::styleHints()->startDragDistance()) + { + return; + } + setCursor(Qt::OpenHandCursor); + emit dragInitiated(); +} + +// resize handler +void ImageLabel::resizeEvent(QResizeEvent *event) { + Q_UNUSED(event); + setScaledPixmap(); +} diff --git a/flameshot-0.6.0/src/widgets/imagelabel.h b/flameshot-0.6.0/src/widgets/imagelabel.h new file mode 100644 index 0000000000000000000000000000000000000000..a52697ccf5628d84974cfb2aa13a993da5a9fbbd --- /dev/null +++ b/flameshot-0.6.0/src/widgets/imagelabel.h @@ -0,0 +1,54 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// This code is a modified version of the KDE software Spectacle +// /src/Gui/KSImageWidget.h commit cbbd6d45f6426ccbf1a82b15fdf98613ccccbbe9 + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class ImageLabel : public QLabel { + Q_OBJECT + +public: + explicit ImageLabel(QWidget *parent = nullptr); + void setScreenshot(const QPixmap &pixmap); + +signals: + void dragInitiated(); + +protected: + void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; + void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; + +private: + void setScaledPixmap(); + + QGraphicsDropShadowEffect *m_DSEffect; + QPixmap m_pixmap; + QPoint m_dragStartPosition; +}; diff --git a/flameshot-0.6.0/src/widgets/infowindow.cpp b/flameshot-0.6.0/src/widgets/infowindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6b29b2e1638fdbc5144ea10477d37c308a402906 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/infowindow.cpp @@ -0,0 +1,134 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "infowindow.h" +#include +#include +#include +#include +#include +#include + +// InfoWindow show basic information about the usage of Flameshot + +InfoWindow::InfoWindow(QWidget *parent) : QWidget(parent) { + setAttribute(Qt::WA_DeleteOnClose); + setWindowIcon(QIcon(":img/app/flameshot.svg")); + setWindowTitle(tr("About")); + + m_layout = new QVBoxLayout(this); + m_layout->setAlignment(Qt::AlignHCenter); + initLabels(); + initInfoTable(); + show(); +} + + +QVector InfoWindow::m_keys = { + "←↓↑→", + "SHIFT + ←↓↑→", + "ESC", + "CTRL + C", + "CTRL + S", + "CTRL + Z", + QT_TR_NOOP("Right Click"), + QT_TR_NOOP("Mouse Wheel") +}; + +QVector InfoWindow::m_description = { + QT_TR_NOOP("Move selection 1px"), + QT_TR_NOOP("Resize selection 1px"), + QT_TR_NOOP("Quit capture"), + QT_TR_NOOP("Copy to clipboard"), + QT_TR_NOOP("Save selection as a file"), + QT_TR_NOOP("Undo the last modification"), + QT_TR_NOOP("Show color picker"), + QT_TR_NOOP("Change the tool's thickness") +}; + +void InfoWindow::initInfoTable() { + QTableWidget *table = new QTableWidget(this); + table->setToolTip(tr("Available shortcuts in the screen capture mode.")); + + m_layout->addWidget(table); + + table->setColumnCount(2); + table->setRowCount(m_keys.size()); + table->setSelectionMode(QAbstractItemView::NoSelection); + table->setFocusPolicy(Qt::NoFocus); + table->verticalHeader()->hide(); + // header creation + QStringList names; + names << tr("Key") << tr("Description"); + table->setHorizontalHeaderLabels(names); + + //add content + for (int i= 0; i < m_keys.size(); ++i){ + table->setItem(i, 0, new QTableWidgetItem(tr(m_keys.at(i)))); + table->setItem(i, 1, new QTableWidgetItem(tr(m_description.at(i)))); + } + + // Read-only table items + for (int x = 0; x < table->rowCount(); ++x) { + for (int y = 0; y < table->columnCount(); ++y) { + QTableWidgetItem *item = table->item(x, y); + item->setFlags(item->flags() ^ Qt::ItemIsEditable); + } + } + + // adjust size + table->resizeColumnsToContents(); + table->resizeRowsToContents(); + table->setMinimumWidth(400); + table->setMaximumWidth(600); + + table->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); + table->horizontalHeader()->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Expanding); + m_layout->addStretch(); +} + +void InfoWindow::initLabels() { + m_layout->addStretch(); + QLabel *licenseTitleLabel = new QLabel(tr("License"), this); + licenseTitleLabel->setAlignment(Qt::AlignHCenter); + m_layout->addWidget(licenseTitleLabel); + QLabel *licenseLabel = new QLabel("GPLv3+", this); + licenseLabel->setAlignment(Qt::AlignHCenter); + m_layout->addWidget(licenseLabel); + m_layout->addStretch(); + + QLabel *versionTitleLabel = new QLabel(tr("Version"), this); + versionTitleLabel->setAlignment(Qt::AlignHCenter); + m_layout->addWidget(versionTitleLabel); + QString versionMsg = "Flameshot " + QString(APP_VERSION) + "\nCompiled with Qt " + + QT_VERSION_STR; + QLabel *versionLabel = new QLabel(versionMsg, this); + versionLabel->setAlignment(Qt::AlignHCenter); + m_layout->addWidget(versionLabel); + m_layout->addStretch(); + m_layout->addSpacing(10); + QLabel *shortcutsTitleLabel = new QLabel(tr("Shortcuts"), this); + shortcutsTitleLabel->setAlignment(Qt::AlignHCenter);; + m_layout->addWidget(shortcutsTitleLabel); +} + +void InfoWindow::keyPressEvent(QKeyEvent *e) { + if (e->key() == Qt::Key_Escape) { + close(); + } +} diff --git a/flameshot-0.6.0/src/widgets/infowindow.h b/flameshot-0.6.0/src/widgets/infowindow.h new file mode 100644 index 0000000000000000000000000000000000000000..38495a5a12e1b3b994076eae346fb6ebe5a929cf --- /dev/null +++ b/flameshot-0.6.0/src/widgets/infowindow.h @@ -0,0 +1,39 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QVBoxLayout; + +class InfoWindow : public QWidget { + Q_OBJECT +public: + explicit InfoWindow(QWidget *parent = nullptr); + +protected: + void keyPressEvent(QKeyEvent *); + +private: + void initInfoTable(); + void initLabels(); + QVBoxLayout *m_layout; + + static QVector m_keys; + static QVector m_description; +}; diff --git a/flameshot-0.6.0/src/widgets/loadspinner.cpp b/flameshot-0.6.0/src/widgets/loadspinner.cpp new file mode 100644 index 0000000000000000000000000000000000000000..44478ad592a408de203cb4e78c1fb02f698595eb --- /dev/null +++ b/flameshot-0.6.0/src/widgets/loadspinner.cpp @@ -0,0 +1,96 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "loadspinner.h" +#include +#include +#include +#include + +#define OFFSET 5 + +LoadSpinner::LoadSpinner(QWidget *parent) : + QWidget(parent), m_startAngle(0), m_span(0), m_growing(true) +{ + setAttribute(Qt::WA_TranslucentBackground); + const int size = QApplication::fontMetrics().height() * 8; + setFixedSize(size, size); + updateFrame(); + // init timer + m_timer = new QTimer(this); + connect(m_timer, SIGNAL(timeout()), this, SLOT(rotate())); + m_timer->setInterval(30); +} + +void LoadSpinner::setColor(const QColor &c) { + m_color = c; +} + +void LoadSpinner::setWidth(int w) { + setFixedSize(w, w); + updateFrame(); +} + +void LoadSpinner::setHeight(int h) { + setFixedSize(h, h); + updateFrame(); +} + +void LoadSpinner::start() { + m_timer->start(); +} + +void LoadSpinner::stop() { + m_timer->stop(); +} + +void LoadSpinner::paintEvent(QPaintEvent *) { + QPainter painter(this); + painter.setRenderHint(QPainter::Antialiasing, true); + auto pen = QPen(m_color); + + pen.setWidth(height()/10); + painter.setPen(pen); + painter.setOpacity(0.2); + painter.drawArc(m_frame, 0, 5760); + painter.setOpacity(1.0); + painter.drawArc(m_frame, (m_startAngle * 16), (m_span * 16)); + +} + +void LoadSpinner::rotate() { + const int advance = 3; + const int grow = 8; + if (m_growing) { + m_startAngle = (m_startAngle + advance) % 360; + m_span += grow; + if(m_span > 260) { + m_growing = false; + } + } else { + m_startAngle = (m_startAngle + grow) % 360; + m_span = m_span + advance - grow; + if(m_span < 10) { + m_growing = true; + } + } + update(); +} + +void LoadSpinner::updateFrame() { + m_frame = QRect(OFFSET, OFFSET, width() - OFFSET*2, height() - OFFSET*2); +} diff --git a/flameshot-0.6.0/src/widgets/loadspinner.h b/flameshot-0.6.0/src/widgets/loadspinner.h new file mode 100644 index 0000000000000000000000000000000000000000..dc295575214d2d47f21ad81ba309c06a1abfe466 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/loadspinner.h @@ -0,0 +1,49 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class LoadSpinner : public QWidget { + Q_OBJECT +public: + explicit LoadSpinner(QWidget *parent = nullptr); + + void setColor(const QColor &c); + void setWidth(int w); + void setHeight(int h); + void start(); + void stop(); + +protected: + void paintEvent(QPaintEvent *); + +private slots: + void rotate(); + +private: + QColor m_color; + QTimer *m_timer; + + int m_startAngle = 0; + int m_span =180; + bool m_growing; + + QRect m_frame; + void updateFrame(); +}; diff --git a/flameshot-0.6.0/src/widgets/notificationwidget.cpp b/flameshot-0.6.0/src/widgets/notificationwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f0a64867098e93a2285e6a8825528b8369a21e68 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/notificationwidget.cpp @@ -0,0 +1,72 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "notificationwidget.h" +#include +#include +#include +#include +#include +#include +#include + +NotificationWidget::NotificationWidget(QWidget *parent) : QWidget(parent) { + m_timer = new QTimer(this); + m_timer->setSingleShot(true); + m_timer->setInterval(7000); + connect(m_timer, &QTimer::timeout, this, &NotificationWidget::animatedHide); + + m_content = new QFrame(); + m_layout = new QVBoxLayout(); + m_label = new QLabel(m_content); + m_label->hide(); + + m_showAnimation = new QPropertyAnimation(m_content, "geometry", this); + m_showAnimation->setDuration(300); + + m_hideAnimation = new QPropertyAnimation(m_content, "geometry", this); + m_hideAnimation->setDuration(300); + connect(m_hideAnimation, &QPropertyAnimation::finished, m_label, &QLabel::hide); + + auto mainLayout = new QVBoxLayout(); + setLayout(mainLayout); + + mainLayout->addWidget(m_content); + m_layout->addWidget(m_label, 0, Qt::AlignHCenter); + m_content->setLayout(m_layout); + + setFixedHeight(40); +} + +void NotificationWidget::showMessage(const QString &msg) { + m_label->setText(msg); + m_label->show(); + animatedShow(); +} + +void NotificationWidget::animatedShow() { + m_showAnimation->setStartValue(QRect(0, 0, width(), 0)); + m_showAnimation->setEndValue(QRect(0, 0, width(), height())); + m_showAnimation->start(); + m_timer->start(); +} + +void NotificationWidget::animatedHide() { + m_hideAnimation->setStartValue(QRect(0, 0, width(), height())); + m_hideAnimation->setEndValue(QRect(0, 0, width(), 0)); + m_hideAnimation->start(); +} diff --git a/flameshot-0.6.0/src/widgets/notificationwidget.h b/flameshot-0.6.0/src/widgets/notificationwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..cb7ce2c7bfd2baf9024ce88da761de5b2e28fbb5 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/notificationwidget.h @@ -0,0 +1,45 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include + +class QLabel; +class QTimer; +class QPropertyAnimation; +class QVBoxLayout; +class QFrame; + +class NotificationWidget : public QWidget { + Q_OBJECT +public: + explicit NotificationWidget(QWidget *parent = nullptr); + + void showMessage(const QString &msg); + +private: + QLabel *m_label; + QPropertyAnimation *m_showAnimation; + QPropertyAnimation *m_hideAnimation; + QVBoxLayout *m_layout; + QFrame *m_content; + QTimer *m_timer; + + void animatedShow(); + void animatedHide(); +}; diff --git a/flameshot-0.6.0/src/widgets/panel/colorpickerwidget.cpp b/flameshot-0.6.0/src/widgets/panel/colorpickerwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..30fe48f4fd11780f612148b926a3b7f365e39e34 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/panel/colorpickerwidget.cpp @@ -0,0 +1,168 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "colorpickerwidget.h" +#include "src/utils/pathinfo.h" +#include "src/utils/colorutils.h" +#include +#include +#include +#include +#include + +class QColorPickingEventFilter : public QObject { +public: + + explicit QColorPickingEventFilter( + ColorPickerWidget *pw, QObject *parent = 0) : + QObject(parent), m_pw(pw) {} + + bool eventFilter(QObject *, QEvent *event) override { + event->accept(); + switch (event->type()) { + case QEvent::MouseMove: + return m_pw->handleMouseMove(static_cast(event)); + case QEvent::MouseButtonPress: + return m_pw->handleMouseButtonPressed( + static_cast(event)); + case QEvent::KeyPress: + return m_pw->handleKeyPress(static_cast(event)); + default: + break; + } + return false; + } + +private: + ColorPickerWidget *m_pw; +}; + +//////////////////////// + +ColorPickerWidget::ColorPickerWidget(QPixmap *p, QWidget *parent) : + QWidget(parent), m_pixmap(p), m_eventFilter(nullptr) +{ + m_layout = new QVBoxLayout(this); + + QFormLayout *colorForm = new QFormLayout(); + m_colorLabel = new QLabel(); + m_colorLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + colorForm->addRow(tr("Active color:"), m_colorLabel); + m_layout->addLayout(colorForm); + + QColor background = this->palette().background().color(); + bool isDark = ColorUtils::colorIsDark(background); + QString modifier = isDark ? PathInfo::whiteIconPath() : + PathInfo::blackIconPath(); + QIcon grabIcon(modifier + "colorize.svg"); + m_colorGrabButton = new QPushButton(grabIcon, ""); + updateGrabButton(false); + connect(m_colorGrabButton, &QPushButton::pressed, + this, &ColorPickerWidget::colorGrabberActivated); + m_layout->addWidget(m_colorGrabButton); + + m_colorWheel = new color_widgets::ColorWheel(this); + m_colorWheel->setColor(m_color); + connect(m_colorWheel, &color_widgets::ColorWheel::mouseReleaseOnColor, this, + &ColorPickerWidget::colorChanged); + connect(m_colorWheel, &color_widgets::ColorWheel::colorChanged, this, + &ColorPickerWidget::updateColorNoWheel); + m_layout->addWidget(m_colorWheel); +} + +void ColorPickerWidget::updateColor(const QColor &c) { + m_color = c; + m_colorLabel->setStyleSheet( + QString("QLabel { background-color : %1; }").arg(c.name())); + m_colorWheel->setColor(m_color); +} + +void ColorPickerWidget::updateColorNoWheel(const QColor &c) { + m_color = c; + m_colorLabel->setStyleSheet( + QString("QLabel { background-color : %1; }").arg(c.name())); +} + +void ColorPickerWidget::colorGrabberActivated() { + grabKeyboard(); + grabMouse(Qt::CrossCursor); + setMouseTracking(true); + m_colorBackup = m_color; + if (!m_eventFilter) { + m_eventFilter = new QColorPickingEventFilter(this, this); + } + installEventFilter(m_eventFilter); + updateGrabButton(true); +} + +void ColorPickerWidget::releaseColorGrab() { + setMouseTracking(false); + removeEventFilter(m_eventFilter); + releaseMouse(); + releaseKeyboard(); + setFocus(); + updateGrabButton(false); +} + +QColor ColorPickerWidget::grabPixmapColor(const QPoint &p) { + QColor c; + if (m_pixmap) { + QPixmap pixel = m_pixmap->copy(QRect(p, p)); + c = pixel.toImage().pixel(0,0); + } + return c; +} + +bool ColorPickerWidget::handleKeyPress(QKeyEvent *e) { + if (e->key() == Qt::Key_Space) { + emit togglePanel(); + } else if (e->key() == Qt::Key_Escape) { + releaseColorGrab(); + updateColor(m_colorBackup); + } else if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) { + updateColor(grabPixmapColor(QCursor::pos())); + releaseColorGrab(); + emit colorChanged(m_color); + } + return true; +} + +bool ColorPickerWidget::handleMouseButtonPressed(QMouseEvent *e) { + if (m_colorGrabButton->geometry().contains(e->pos()) || + e->button() == Qt::RightButton) + { + updateColorNoWheel(m_colorBackup); + } else if (e->button() == Qt::LeftButton) { + updateColor(grabPixmapColor(QCursor::pos())); + } + releaseColorGrab(); + emit colorChanged(m_color); + return true; +} + +bool ColorPickerWidget::handleMouseMove(QMouseEvent *e) { + updateColorNoWheel(grabPixmapColor(e->globalPos())); + return true; +} + +void ColorPickerWidget::updateGrabButton(const bool activated) { + if (activated) { + m_colorGrabButton->setText(tr("Press ESC to cancel")); + } else { + m_colorGrabButton->setText(tr("Grab Color")); + } +} diff --git a/flameshot-0.6.0/src/widgets/panel/colorpickerwidget.h b/flameshot-0.6.0/src/widgets/panel/colorpickerwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..6cd5544a17d92b22cf28fdc2c16c0dd653390d98 --- /dev/null +++ b/flameshot-0.6.0/src/widgets/panel/colorpickerwidget.h @@ -0,0 +1,67 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include +#include "color_wheel.hpp" + +class QVBoxLayout; +class QPushButton; +class QLabel; +class QColorPickingEventFilter; + +class ColorPickerWidget : public QWidget { + Q_OBJECT + + friend class QColorPickingEventFilter; +public: + explicit ColorPickerWidget(QPixmap *p, QWidget *parent = nullptr); + +signals: + void colorChanged(const QColor &c); + void togglePanel(); + +public slots: + void updateColor(const QColor &c); + +private slots: + void updateColorNoWheel(const QColor &c); + +private slots: + void colorGrabberActivated(); + void releaseColorGrab(); + +private: + QColor grabPixmapColor(const QPoint &p); + + bool handleKeyPress(QKeyEvent *e); + bool handleMouseButtonPressed(QMouseEvent *e); + bool handleMouseMove(QMouseEvent *e); + + void updateGrabButton(const bool activated); + + QVBoxLayout *m_layout; + QPushButton *m_colorGrabButton; + color_widgets::ColorWheel *m_colorWheel; + QLabel *m_colorLabel; + QPixmap *m_pixmap; + QColor m_colorBackup; + QColor m_color; + QColorPickingEventFilter *m_eventFilter; + +}; diff --git a/flameshot-0.6.0/src/widgets/panel/utilitypanel.cpp b/flameshot-0.6.0/src/widgets/panel/utilitypanel.cpp new file mode 100644 index 0000000000000000000000000000000000000000..48b4a7aa5a6dd59d183752ce043c6a754935c00b --- /dev/null +++ b/flameshot-0.6.0/src/widgets/panel/utilitypanel.cpp @@ -0,0 +1,104 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// Based on Lightscreen areadialog.h, Copyright 2017 Christian Kaiser +// released under the GNU GPL2 + +// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007 Luca Gugelmann +// released under the GNU LGPL + +#include "utilitypanel.h" +#include +#include +#include +#include +#include + +UtilityPanel::UtilityPanel(QWidget *parent) : QWidget(parent) { + initInternalPanel(); + setAttribute(Qt::WA_TransparentForMouseEvents); + setCursor(Qt::ArrowCursor); + + m_showAnimation = new QPropertyAnimation(m_internalPanel, "geometry", this); + m_showAnimation->setEasingCurve(QEasingCurve::InOutQuad); + m_showAnimation->setDuration(300); + + m_hideAnimation = new QPropertyAnimation(m_internalPanel, "geometry", this); + m_hideAnimation->setEasingCurve(QEasingCurve::InOutQuad); + m_hideAnimation->setDuration(300); + + connect(m_hideAnimation, &QPropertyAnimation::finished, + m_internalPanel, &QWidget::hide); +} + +QWidget *UtilityPanel::toolWidget() const { + return m_toolWidget; +} + +void UtilityPanel::addToolWidget(QWidget *w) { + if (m_toolWidget) { + m_toolWidget->deleteLater(); + } + if (w) { + m_toolWidget = w; + m_upLayout->addWidget(w); + } +} + +void UtilityPanel::clearToolWidget() { + if (m_toolWidget) { + m_toolWidget->deleteLater(); + } +} + +void UtilityPanel::pushWidget(QWidget *w) { + m_layout->addWidget(w); +} + +void UtilityPanel::toggle() { + if (m_internalPanel->isHidden()) { + setAttribute(Qt::WA_TransparentForMouseEvents, false); + m_showAnimation->setStartValue(QRect(-width(), 0, 0, height())); + m_showAnimation->setEndValue(QRect(0, 0, width(), height())); + m_internalPanel->show(); + m_showAnimation->start(); + } else { + setAttribute(Qt::WA_TransparentForMouseEvents); + m_hideAnimation->setStartValue(QRect(0, 0, width(), height())); + m_hideAnimation->setEndValue(QRect(-width(), 0, 0, height())); + m_hideAnimation->start(); + } +} + +void UtilityPanel::initInternalPanel() { + m_internalPanel = new QScrollArea(this); + m_internalPanel->setAttribute(Qt::WA_NoMousePropagation); + QWidget *widget = new QWidget(); + m_internalPanel->setWidget(widget); + m_internalPanel->setWidgetResizable(true); + + m_layout = new QVBoxLayout(); + m_upLayout = new QVBoxLayout(); + m_layout->addLayout(m_upLayout); + widget->setLayout(m_layout); + + QColor bgColor = palette().background().color(); + bgColor.setAlphaF(0.0); + m_internalPanel->setStyleSheet(QString("QScrollArea {background-color: %1}") + .arg(bgColor.name())); + m_internalPanel->hide(); +} diff --git a/flameshot-0.6.0/src/widgets/panel/utilitypanel.h b/flameshot-0.6.0/src/widgets/panel/utilitypanel.h new file mode 100644 index 0000000000000000000000000000000000000000..e3edce59be09b3a1045f1d00f751e1b4b42f8c5d --- /dev/null +++ b/flameshot-0.6.0/src/widgets/panel/utilitypanel.h @@ -0,0 +1,59 @@ +// Copyright(c) 2017-2018 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +// Based on Lightscreen areadialog.h, Copyright 2017 Christian Kaiser +// released under the GNU GPL2 + +// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007 Luca Gugelmann +// released under the GNU LGPL + +#pragma once + +#include +#include + +class QVBoxLayout; +class QPropertyAnimation; +class QScrollArea; + +class UtilityPanel : public QWidget { + Q_OBJECT +public: + explicit UtilityPanel(QWidget *parent = nullptr); + + QWidget* toolWidget() const; + void addToolWidget(QWidget *w); + void clearToolWidget(); + void pushWidget(QWidget *w); + +signals: + void mouseEnter(); + void mouseLeave(); + +public slots: + void toggle(); + +private: + void initInternalPanel(); + + QPointer m_toolWidget; + QScrollArea *m_internalPanel; + QVBoxLayout *m_upLayout; + QVBoxLayout *m_layout; + QPropertyAnimation *m_showAnimation; + QPropertyAnimation *m_hideAnimation; +}; diff --git a/flameshot-0.6.0/translations/Internationalization_ca.ts b/flameshot-0.6.0/translations/Internationalization_ca.ts new file mode 100644 index 0000000000000000000000000000000000000000..81b2738a8459368bdf3154d49f6edf28c4a3691a --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_ca.ts @@ -0,0 +1,899 @@ + + + + + AppLauncher + + + App Launcher + Llançador d'aplicacions + + + + Choose an app to open the capture + Trieu una aplicació per obrir la captura + + + + AppLauncherWidget + + + Open With + Obrir Amb + + + + Launch in terminal + Llançament a la terminal + + + + Keep open after selection + Segueix obert després de la selecció + + + + + Error + Error + + + + Unable to launch in terminal. + No es pot iniciar a la terminal. + + + + Unable to write in + No es pot escriure a + + + + ArrowTool + + + Arrow + Fletxa + + + + Sets the Arrow as the paint tool + Estableix la fletxa com a eina de dibuix + + + + BlurTool + + + Blur + Desenfocament + + + + Sets the Blur as the paint tool + Estableix el desenfocament com a eina de dibuix + + + + CaptureWidget + + + Unable to capture screen + Impossible capturar la pantalla + Imposible capturar la pantalla + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + + + + + CircleTool + + + Circle + Cercle + + + + Sets the Circle as the paint tool + Estableix el cercle com a eina de dibuix + + + + ColorPickerWidget + + + Active color: + + + + + Press ESC to cancel + + + + + Grab Color + + + + + ConfigWindow + + + Configuration + Configuració + + + + Interface + Interfície + + + + Filename Editor + Editor de noms + + + + General + General + + + + Controller + + + &Configuration + &Configuració + + + + &Information + &Informació + + + + &Quit + &Ix + + + + &Take Screenshot + + + + + CopyTool + + + Copy + Copia + + + + Copies the selection into the clipboard + + + + + DBusUtils + + + Unable to connect via DBus + Impossible connectar mitjançant DBus + + + + ExitTool + + + Exit + Ix + + + + Leave the capture screen + Ix de la pantalla de captura + + + + FileNameEditor + + + Edit the name of your captures: + Editeu el nom de les vostres captures: + + + + Edit: + Edita: + + + + Preview: + Previsualització: + + + + Save + Guarda + + + + Saves the pattern + Guarda el patró + + + + Reset + Reinicialitza + + + + Restores the saved pattern + Restaura el patró guardat + + + + Clear + Neteja + + + + Deletes the name + Elimina el patró + + + + GeneneralConf + + + Show help message + Mostra el missatge d'ajuda + + + + Show the help message at the beginning in the capture mode. + Mostra el missatge d'ajuda en iniciar el mode de captura. + + + + + Show desktop notifications + Mostra les notificacions d'escriptori + + + + Show tray icon + Mostra la icona en la barra de tasques + + + + Show the systemtray icon + Mostra la icona en la barra de tasques + + + + + Import + Importar + + + + + + Error + Error + + + + Unable to read file. + Impossible llegir el fitxer. + + + + + Unable to write file. + Impossible escriure al fitxer. + + + + Save File + Guardar Arxiu + + + + Confirm Reset + Confirmar Reset + + + + Are you sure you want to reset the configuration? + Esteu segur que voleu reiniciar la configuració? + + + + Configuration File + Fitxer de Configuració + + + + Export + Exportar + + + + Reset + Reset + + + + Launch at startup + Llançament a l'inici + + + + Launch Flameshot + + + + + ImgurUploader + + + Upload to Imgur + Puja a Imgur + + + + Uploading Image + S'està pujant la imatge + + + + Copy URL + Copia l'URL + + + + Open URL + Obri l'URL + + + + Image to Clipboard. + Imatge al porta-retalls. + + + + + Unable to open the URL. + No es pot obrir l'URL. + + + + URL copied to clipboard. + L'URL s'ha copiat al porta-retalls. + + + + Screenshot copied to clipboard. + La captura s'ha copiat al porta-retalls. + + + + Delete image + + + + + ImgurUploaderTool + + + Image Uploader + Puja la imatge + + + + Uploads the selection to Imgur + Puja la selecció a Imgur + + + + InfoWindow + + + About + Quant a + + + + Right Click + Clic dret + + + + Mouse Wheel + Roda del ratolí + + + + Move selection 1px + Mou la selecció 1 px + + + + Resize selection 1px + Redimensiona la selecció 1 px + + + + Quit capture + Ix de la captura + + + + Copy to clipboard + Copia al porta-retalls + + + + Save selection as a file + Guarda la selecció com a fitxer + + + + Undo the last modification + Desfés l'última modificació + + + + Show color picker + Mostra el selector de color + + + + Change the tool's thickness + Canvia el gruix de l'eina + + + + Key + Tecla + + + + Description + Descripció + + + + <u><b>License</b></u> + <u><b>Llicència</b></u> + + + + <u><b>Version</b></u> + <u><b>Versió</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>Dreceres</b></u> + + + + Available shortcuts in the screen capture mode. + Dreceres disponibles en el mode de captura de pantalla. + + + + LineTool + + + Line + Línia + + + + Sets the Line as the paint tool + Estableix la línia com a eina de dibuix + + + + MarkerTool + + + Marker + Marcador + + + + Sets the Marker as the paint tool + Estableix el marcador com a eina de dibuix + + + + MoveTool + + + Move + Mou + + + + Move the selection area + Mou la selecció + + + + PencilTool + + + Pencil + Llapis + + + + Sets the Pencil as the paint tool + Estableix el llapis com a eina de dibuix + + + + PinTool + + + Pin Tool + + + + + Pin image on the desktop + + + + + QObject + + + Save Error + S'ha produït un error en guardar + + + + + Capture saved as + Anomena i guarda la captura + + + + + Error trying to save as + S'ha produït un error en anomenar i guardar + + + + + + + Unable to connect via DBus + No es pot connectar mitjançant DBus + + + + Error + Error + + + + Unable to write in + No es pot escriure a + + + + Capture saved to clipboard + + + + + RectangleTool + + + Rectangle + Rectangle + + + + Sets the Rectangle as the paint tool + Estableix el rectangle com a eina de dibuix + + + + RedoTool + + + Redo + + + + + Redo the next modification + + + + + SaveTool + + + Save + Guarda + + + + Save the capture + Guarda la captura + + + + ScreenGrabber + + + Unable to capture screen + Imposible capturar la pantalla + + + + SelectionTool + + + Rectangular Selection + Selecció rectangular + + + + Sets the Selection as the paint tool + Estableix la selecció com a eina de dibuix + + + + SizeIndicatorTool + + + Selection Size Indicator + Indicador de mida de selecció + + + + Shows the dimensions of the selection (X Y) + Mostra les mides de la selecció (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + Segle (00-99) + + + + Year (00-99) + Any (00-99) + + + + Year (2000) + Any (2000) + + + + Month Name (jan) + Nom del mes (jul) + + + + Month Name (january) + Nom del mes (juliol) + + + + Month (01-12) + Mes (01-12) + + + + Week Day (1-7) + Dia de la setmana (1-7) + + + + Week (01-53) + Setmana (01-53) + + + + Day Name (mon) + Nom del dia (dg) + + + + Day Name (monday) + Nom del dia (diumenge) + + + + Day (01-31) + Dia (01-31) + + + + Day of Month (1-31) + Dia del mes (1-31) + + + + Day (001-366) + Dia (001-366) + + + + Hour (00-23) + Hora (00-23) + + + + Hour (01-12) + Hora (01-12) + + + + Minute (00-59) + Minut (00-59) + + + + Second (00-59) + Segon (00-59) + + + + Full Date (%m/%d/%y) + Data (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + Data (%Y-%m-%d) + + + + Time (%H-%M-%S) + + + + + Time (%H-%M) + + + + + SystemNotification + + + Flameshot Info + + + + + TextConfig + + + StrikeOut + + + + + Underline + + + + + Bold + + + + + Italic + + + + + TextTool + + + Text + + + + + Add text to your capture + + + + + UIcolorEditor + + + UI Color Editor + Editor de color de la interfície + + + + Change the color moving the selectors and see the changes in the preview buttons. + Canvieu el color movent els selectors i observeu els canvis en els botons de previsualització. + + + + Select a Button to modify it + Seleccioneu un botó per a modificar-lo + + + + Main Color + Color principal + + + + Click on this button to set the edition mode of the main color. + Feu clic en aquest botó per a aplicar el mode d'edició per al color principal. + + + + Contrast Color + Color de contrast + + + + Click on this button to set the edition mode of the contrast color. + Feu clic en aquest botó per a aplicar el mode d'edició per al color de contrast. + + + + UndoTool + + + Undo + Desfés + + + + Undo the last modification + Desfés l'última modificació + + + + VisualsEditor + + + Opacity of area outside selection: + Opacitat de la zona fora de la selecció: + + + + Button Selection + Selecció de botó + + + + Select All + Selecciona-ho tot + + + diff --git a/flameshot-0.6.0/translations/Internationalization_es.ts b/flameshot-0.6.0/translations/Internationalization_es.ts new file mode 100644 index 0000000000000000000000000000000000000000..06ddf62e79dcb49a5cd517f9974487f9e2f1fcb7 --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_es.ts @@ -0,0 +1,902 @@ + + + + + AppLauncher + + + App Launcher + Lanzador de Aplicaciones + + + + Choose an app to open the capture + Elije una aplicación con la que abrir la captura + + + + AppLauncherWidget + + + Open With + Abrir Con + + + + Launch in terminal + Lanzar en terminal + + + + Keep open after selection + Mantener abierto tras la selección + + + + + Error + Error + + + + Unable to write in + Imposible escribir en + + + + Unable to launch in terminal. + Imposible lanzar en terminal. + + + + ArrowTool + + + Arrow + Flecha + + + + Sets the Arrow as the paint tool + Establece la Flecha como herramienta de dibujo + + + + BlurTool + + + Blur + Desenfoque + + + + Sets the Blur as the paint tool + Establece el Desenfoque como herramienta de dibujo + + + + CaptureWidget + + + Unable to capture screen + Imposible capturar la pantalla + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + Selecciona un área con el ratón, o presiona Esc para salir. +Presiona Enter para capturar la pantalla. +Presion Click Derecho para mostrar el selector de color. +Usa la rueda del ratón para cambiar el grosor de la herramienta. +Presiona Espacion para abrir el panel lateral. + + + + CircleTool + + + Circle + Círculo + + + + Sets the Circle as the paint tool + Establece el Círculo como herramienta de dibujo + + + + ColorPickerWidget + + + Active color: + Color activo: + + + + Press ESC to cancel + Presiona Esc para cancelar + + + + Grab Color + Tomar Color + + + + ConfigWindow + + + Configuration + Configuración + + + + Interface + Interfaz + + + + Filename Editor + Editor de Nombre + + + + General + General + + + + Controller + + + &Take Screenshot + &Tomar captura de pantalla + + + + &Configuration + &Configuración + + + + &Information + &Información + + + + &Quit + &Salir + + + + CopyTool + + + Copy + Copiar + + + + Copies the selection into the clipboard + Copia la selección al portapapeles + + + + DBusUtils + + + Unable to connect via DBus + Imposible conectarse mediante DBus + + + + ExitTool + + + Exit + Salir + + + + Leave the capture screen + Salir de la pantalla de captura + + + + FileNameEditor + + + Edit the name of your captures: + Edita el nombre de tus capturas: + + + + Edit: + Editar: + + + + Preview: + Previsualización: + + + + Save + Guardar + + + + Saves the pattern + Guarda el patrón + + + + Reset + Reiniciar + + + + Restores the saved pattern + Restaura el patrón guardado + + + + Clear + Limpiar + + + + Deletes the name + Borra el patrón + + + + GeneneralConf + + + + Import + Importar + + + + + + Error + Error + + + + Unable to read file. + Imposible leer el archivo. + + + + + Unable to write file. + Imposible escribir el archivo. + + + + Save File + Guardar Archivo + + + + Confirm Reset + Confirmar Reset + + + + Are you sure you want to reset the configuration? + ¿Estás seguro de que quieres reiniciar la configuración? + + + + Show help message + Mostrar mensaje de ayuda + + + + Show the help message at the beginning in the capture mode. + Muestra el mensaje de ayuda al iniciar el modo de captura. + + + + + Show desktop notifications + Mostrar notificaciones del escritorio + + + + Show tray icon + Mostrar icono en la barra de tareas + + + + Show the systemtray icon + Mostrar el icono en la barra de tareas + + + + Configuration File + Archivo de Configuración + + + + Export + Exportar + + + + Reset + Reset + + + + Launch at startup + Lanzar en el arranque + + + + Launch Flameshot + Lanzar Flameshot + + + + ImgurUploader + + + Upload to Imgur + Subir a Imgur + + + + Uploading Image + Subiendo Imagen + + + + Copy URL + Copiar URL + + + + Open URL + Abrir URL + + + + Delete image + Borrar imagen + + + + Image to Clipboard. + Imagen al Portapapeles. + + + + + Unable to open the URL. + No puede abrir la URL. + + + + URL copied to clipboard. + URL copiada al portapapeles. + + + + Screenshot copied to clipboard. + Captura copiada al portapapeles. + + + + ImgurUploaderTool + + + Image Uploader + Subir Imagen + + + + Uploads the selection to Imgur + Sube la selección a Imgur + + + + InfoWindow + + + About + Información + + + + Right Click + Click Derecho + + + + Mouse Wheel + Rueda del Ratón + + + + Move selection 1px + Mueve la selección 1px + + + + Resize selection 1px + Redimensiona la selección 1px + + + + Quit capture + Salir de la captura + + + + Copy to clipboard + Copiar al portapapeles + + + + Save selection as a file + Guarda la selección como un archivo + + + + Undo the last modification + Deshacer la última modificación + + + + Show color picker + Muestra el selector de color + + + + Change the tool's thickness + Cambiar el grosor de la herramienta + + + + Available shortcuts in the screen capture mode. + Atajos disponibles en el modo captura de pantalla. + + + + Key + Tecla + + + + Description + Descripción + + + + <u><b>License</b></u> + <u><b>Licencia</b></u> + + + + <u><b>Version</b></u> + <u><b>Versión</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>Atajos</b></u> + + + + LineTool + + + Line + Línea + + + + Sets the Line as the paint tool + Establece la Línea como herramienta de dibujo + + + + MarkerTool + + + Marker + Marcador + + + + Sets the Marker as the paint tool + Establece el Marcador como herramienta de dibujo + + + + MoveTool + + + Move + Mover Selección + + + + Move the selection area + Mueve la selección + + + + PencilTool + + + Pencil + Lápiz + + + + Sets the Pencil as the paint tool + Establece el Lápiz como herramienta de dibujo + + + + PinTool + + + Pin Tool + Chincheta + + + + Pin image on the desktop + Fija la imagen sobre el escritorio + + + + QObject + + + Save Error + Error al Guardar + + + + + Capture saved as + Captura guardada como + + + + Capture saved to clipboard + Captura guardada en el portapapeles + + + + + Error trying to save as + Error intentando guardar como + + + + + + + Unable to connect via DBus + Imposible conectar mediante DBus + + + + Error + Error + + + + Unable to write in + Imposible escribir en + + + + RectangleTool + + + Rectangle + Rectángulo + + + + Sets the Rectangle as the paint tool + Establece el Rectángulo como herramienta de dibujo + + + + RedoTool + + + Redo + Rehacer + + + + Redo the next modification + Rehacer la siguiente modificación + + + + SaveTool + + + Save + Guardar + + + + Save the capture + Guarda la captura + + + + ScreenGrabber + + + Unable to capture screen + Imposible capturar la pantalla + + + + SelectionTool + + + Rectangular Selection + Selección Rectangular + + + + Sets the Selection as the paint tool + Establece la Selección como herramienta de dibujo + + + + SizeIndicatorTool + + + Selection Size Indicator + Indicador de Tamaño de Selección + + + + Shows the dimensions of the selection (X Y) + Muestra la dimensión de la selección (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + Siglo (00-99) + + + + Year (00-99) + Año (00-99) + + + + Year (2000) + Año (2000) + + + + Month Name (jan) + Nombre del Mes (jul) + + + + Month Name (january) + Nombre del Mes (julio) + + + + Month (01-12) + Mes (01-12) + + + + Week Day (1-7) + Día de la Semana (1-7) + + + + Week (01-53) + Semana (01-53) + + + + Day Name (mon) + Nombre del Día (dom) + + + + Day Name (monday) + Nombre del Día (domingo) + + + + Day (01-31) + Día (01-31) + + + + Day of Month (1-31) + Día del Mes (1-31) + + + + Day (001-366) + Día (001-366) + + + + Time (%H-%M-%S) + Tiempo (%H-%M-%S) + + + + Time (%H-%M) + Tiempo (%H-%M) + + + + Hour (00-23) + Hora (00-23) + + + + Hour (01-12) + Hora (01-12) + + + + Minute (00-59) + Minuto (00-59) + + + + Second (00-59) + Segundo (00-59) + + + + Full Date (%m/%d/%y) + Fecha (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + Fecha (%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + Información de Flameshot + + + + TextConfig + + + StrikeOut + Tachado + + + + Underline + Subrayado + + + + Bold + Negrita + + + + Italic + Cursiva + + + + TextTool + + + Text + Texto + + + + Add text to your capture + Agregar texto a la captura + + + + UIcolorEditor + + + UI Color Editor + Editor de Color de Interfaz + + + + Change the color moving the selectors and see the changes in the preview buttons. + Cambia el color moviendo los selectores y observa los cambios en los botones de previsualización. + + + + Select a Button to modify it + Selecciona un Botón para modificarlo + + + + Main Color + Color Principal + + + + Click on this button to set the edition mode of the main color. + Clica en este botón para aplicar el modo edición para el color primario. + + + + Contrast Color + Color de Contraste + + + + Click on this button to set the edition mode of the contrast color. + Clica en este botón para aplicar el modo edición para el color de contraste. + + + + UndoTool + + + Undo + Deshacer + + + + Undo the last modification + Borra la última modificación + + + + VisualsEditor + + + Opacity of area outside selection: + Opacidad del area fuera de la selección: + + + + Button Selection + Selección de Botón + + + + Select All + Seleccionar Todos + + + diff --git a/flameshot-0.6.0/translations/Internationalization_fr.ts b/flameshot-0.6.0/translations/Internationalization_fr.ts new file mode 100644 index 0000000000000000000000000000000000000000..7edac7822df7fdd908547757651d9e98d752c8ac --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_fr.ts @@ -0,0 +1,898 @@ + + + + + AppLauncher + + + App Launcher + Lanceur d'applications + + + + Choose an app to open the capture + Sélectionner une application pour ouvrir la capture + + + + AppLauncherWidget + + + Open With + Ouvrir Avec + + + + Launch in terminal + Lancer dans le terminal + + + + Keep open after selection + Maintenir ouvert après la sélection + + + + + Error + Erreur + + + + Unable to write in + Imposible d'écrire dessus + + + + Unable to launch in terminal. + Imposible de lancer dans le terminal. + + + + ArrowTool + + + Arrow + Flèche + + + + Sets the Arrow as the paint tool + Sélectionner l'outil Flèche + + + + BlurTool + + + Blur + Flou + + + + Sets the Blur as the paint tool + Sélectionner l'outil Flou + + + + CaptureWidget + + + Unable to capture screen + Imposible de capturer l'écran + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + + + + + CircleTool + + + Circle + Ellipse + + + + Sets the Circle as the paint tool + Sélectionner l'outil Ellipse + + + + ColorPickerWidget + + + Active color: + + + + + Press ESC to cancel + + + + + Grab Color + + + + + ConfigWindow + + + Configuration + Configuration + + + + Interface + Interface + + + + Filename Editor + Editeur de Noms + + + + General + Général + + + + Controller + + + &Take Screenshot + &Capturer l'écran + + + + &Configuration + &Configuration + + + + &Information + &Informations + + + + &Quit + &Quitter + + + + CopyTool + + + Copy + Copier + + + + Copies the selection into the clipboard + + + + + DBusUtils + + + Unable to connect via DBus + Imposible de se connecter via DBus + + + + ExitTool + + + Exit + Sortir + + + + Leave the capture screen + Quitter l'écran de capture + + + + FileNameEditor + + + Edit the name of your captures: + Editer le nom des captures: + + + + Edit: + Editer: + + + + Preview: + Prévisualisation: + + + + Save + Sauvegarder + + + + Saves the pattern + Sauvegarder le modèle + + + + Reset + Réinitialiser + + + + Restores the saved pattern + Réstaurer le modèle sauvegardé + + + + Clear + Purger + + + + Deletes the name + Supprime le nom + + + + GeneneralConf + + + + Import + Importer + + + + + + Error + Erreur + + + + Unable to read file. + Impossible de lire le fichier. + + + + + Unable to write file. + Impossible d'écrire le fichier. + + + + Save File + Sauvegarder le fichier + + + + Confirm Reset + Confirmer la Réinitialisation + + + + Are you sure you want to reset the configuration? + Êtes-vous sûr de vouloir réinitialiser la configuration ? + + + + Show help message + Montrer le message d'aide + + + + Show the help message at the beginning in the capture mode. + Afficher ce message au lancement du mode capture. + + + + + Show desktop notifications + Afficher les notifications du bureau + + + + Show tray icon + Afficher les icones de la barre d'état + + + + Show the systemtray icon + Afficher l'icône dans la barre de tâches + + + + Configuration File + Fichier de Configuration + + + + Export + Exporter + + + + Reset + Réinitialiser + + + + Launch at startup + Lancer au démarrage + + + + Launch Flameshot + Démarrer Flameshot + + + + ImgurUploader + + + Upload to Imgur + Mettre en ligne vers Imgur + + + + Uploading Image + Mise en ligne de l'image + + + + Copy URL + Copier l'URL + + + + Open URL + Ouvrir l'URL + + + + Delete image + + + + + Image to Clipboard. + Image dans le Presse-papier. + + + + + Unable to open the URL. + Impossible d'ouvrir l'URL. + + + + URL copied to clipboard. + URL copiée dans le Presse-papier. + + + + Screenshot copied to clipboard. + Capture d'écran copiée dans le Presse-papier. + + + + ImgurUploaderTool + + + Image Uploader + Mise en ligne d'images + + + + Uploads the selection to Imgur + Mettre en ligne la sélection vers Imgur + + + + InfoWindow + + + About + À propos + + + + Right Click + Clic Droit + + + + Mouse Wheel + Molette de la Souris + + + + Move selection 1px + Déplacer la sélection 1px + + + + Resize selection 1px + Redimensionner la sélection 1px + + + + Quit capture + Quitter la capture d'écran + + + + Copy to clipboard + Copier vers le Presse-papier + + + + Save selection as a file + Sauvegarder la sélection vers un fichier + + + + Undo the last modification + Annuler la dernière modification + + + + Show color picker + Afficher la palette de couleurs + + + + Change the tool's thickness + Changer l'épaisseur des outils + + + + Available shortcuts in the screen capture mode. + Raccourcis disponibles en mode capture d'écran. + + + + Key + Clé + + + + Description + Description + + + + <u><b>License</b></u> + <u><b>Licences</b></u> + + + + <u><b>Version</b></u> + <u><b>Version</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>Raccourci</b></u> + + + + LineTool + + + Line + Ligne + + + + Sets the Line as the paint tool + Sélectionner l'outil Ligne + + + + MarkerTool + + + Marker + Surligneur + + + + Sets the Marker as the paint tool + Sélectionner l'outil Surligneur + + + + MoveTool + + + Move + Déplacer + + + + Move the selection area + Déplacer la sélection + + + + PencilTool + + + Pencil + Crayon + + + + Sets the Pencil as the paint tool + Sélectionner l'outil Crayon + + + + PinTool + + + Pin Tool + Outil Épinglage + + + + Pin image on the desktop + Épingler l'image sur le bureau + + + + QObject + + + Save Error + Erreur lors de la sauvegarde + + + + + Capture saved as + Capture d'écran sauvegardée sous + + + + Capture saved to clipboard + Capture d'écran copiée dans le Presse-papier + + + + + Error trying to save as + Erreur lors de la sauvegarde sous + + + + + + + Unable to connect via DBus + Impossible de se connecter via DBus + + + + Error + Erreur + + + + Unable to write in + Imposible d'écrire par dessus + + + + RectangleTool + + + Rectangle + Rectangle plein + + + + Sets the Rectangle as the paint tool + Sélectionner l'outil Rectangle plein + + + + RedoTool + + + Redo + Rétablir + + + + Redo the next modification + + + + + SaveTool + + + Save + Sauvegarder + + + + Save the capture + Sauvegarder la capture d'écran + + + + ScreenGrabber + + + Unable to capture screen + Imposible de capturer l'écran + + + + SelectionTool + + + Rectangular Selection + Rectangle + + + + Sets the Selection as the paint tool + Sélectionner l'outil Rectangle + + + + SizeIndicatorTool + + + Selection Size Indicator + Indicateur de la taille de la sélection + + + + Shows the dimensions of the selection (X Y) + Montre les dimmensions de la sélection (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + Siècle (00-99) + + + + Year (00-99) + Année (00-99) + + + + Year (2000) + Année (2000) + + + + Month Name (jan) + Nom des Mois (jan) + + + + Month Name (january) + nom des Mois (janvier) + + + + Month (01-12) + Mois (01-12) + + + + Week Day (1-7) + Jour de la Semaine (1-7) + + + + Week (01-53) + Semaine (01-53) + + + + Day Name (mon) + Nom du Jour (lun) + + + + Day Name (monday) + Nom du Jour (lundi) + + + + Day (01-31) + Jour (01-31) + + + + Day of Month (1-31) + Jour du Mois (1-31) + + + + Day (001-366) + Jour de l'année (001-366) + + + + Time (%H-%M-%S) + + + + + Time (%H-%M) + + + + + Hour (00-23) + Heure (00-23) + + + + Hour (01-12) + Heure (01-12) + + + + Minute (00-59) + Minute (00-59) + + + + Second (00-59) + Seconde (00-59) + + + + Full Date (%m/%d/%y) + Date (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + Date Complête (%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + Info Flameshot + + + + TextConfig + + + StrikeOut + + + + + Underline + + + + + Bold + + + + + Italic + + + + + TextTool + + + Text + + + + + Add text to your capture + + + + + UIcolorEditor + + + UI Color Editor + Editeur de la Couleur de l'interface + + + + Change the color moving the selectors and see the changes in the preview buttons. + Modifiez la couleur en déplaçant les sélecteur et voir les changements dans les boutons de prévisualisation. + + + + Select a Button to modify it + Sélectionner un bouton pour le modifier + + + + Main Color + Couleur Principale + + + + Click on this button to set the edition mode of the main color. + Cliquer sur ce boutton pour définir le mode édition de la couleur principale. + + + + Contrast Color + Couleur de Contraste + + + + Click on this button to set the edition mode of the contrast color. + Cliquer sur ce boutton pour définir le mode édition de la couleur de contraste. + + + + UndoTool + + + Undo + Annuler + + + + Undo the last modification + Annuler la dernière modification + + + + VisualsEditor + + + Opacity of area outside selection: + Opacité de la zone en dehors de la sélection: + + + + Button Selection + Boutton de sélection + + + + Select All + Sélectionner Tout + + + diff --git a/flameshot-0.6.0/translations/Internationalization_hu.ts b/flameshot-0.6.0/translations/Internationalization_hu.ts new file mode 100644 index 0000000000000000000000000000000000000000..f040e7b64ab954d2f97cbd90c0d76d85e263ee24 --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_hu.ts @@ -0,0 +1,667 @@ + + + + + AppLauncher + + App Launcher + Alkalmazás indító + + + Choose an app to open the capture + Válassz egy alkalmazást hogy elinduljon a felvétel + + + + AppLauncherWidget + + Open With + Megnyitás ezzel + + + Launch in terminal + Futtatás terminálban + + + Keep open after selection + Kiválasztás után maradjon nyitva + + + Error + Hiba + + + Unable to launch in terminal. + Nem lehet megnyitni a terminálban. + + + Unable to write in + Nem lehet írni + + + + ArrowTool + + Arrow + Nyíl + + + Sets the Arrow as the paint tool + Beállítja a nyíl eszközt festő eszközként + + + + BlurTool + + Blur + Homályosítás + + + Sets the Blur as the paint tool + Beállítja a Homályosítás eszközt festő eszközként + + + + CaptureWidget + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. + Válassz egy területet egérrel, vagy nyomj Esc-et a kilépéshez. +Nyomj entert a felvételhez. +Kattints job egérgombal a szín választásához. +Használd a görgőt az eszköz vastagságának állítására. + + + Unable to capture screen + Nem lehet felvételt készíteni + + + + CircleTool + + Circle + Kör + + + Sets the Circle as the paint tool + Beálítja a Kör eszközt festő eszközként + + + + ConfigWindow + + Configuration + Beállítások + + + Interface + Interfész + + + Filename Editor + Fájlnév szerkesztő + + + General + Általános + + + + Controller + + &Configuration + &Konfiguráció + + + &Information + &Információ + + + &Quit + &Bezár + + + + CopyTool + + Copy + Másol + + + Copies the selecion into the clipboard + Másolja a kiválasztott területet + + + + DBusUtils + + Unable to connect via DBus + Nem lehet csatlakozni DBus-al + + + + ExitTool + + Exit + Bezár + + + Leave the capture screen + Bezárja a felvevőt + + + + FileNameEditor + + Edit the name of your captures: + Szerkeszd a nevét a felvételeidnek: + + + Edit: + Szerkeszt: + + + Preview: + Előnézet: + + + Save + Mentés + + + Saves the pattern + Minta mentése + + + Reset + Visszaállítás + + + Restores the saved pattern + Visszaállítja a mentett mintát + + + Clear + Töröl + + + Deletes the name + Törli a nevet + + + + FileNameHandler + + screenshot + Képernyőmentés + + + + FlameshotDBusAdapter + + Unable to capture screen + Nem lehet képernyőképet készíteni + + + + GeneneralConf + + Show help message + Mutassa a segítséget + + + Show the help message at the beginning in the capture mode. + Mutassa a segítséget a felvevő mód kezdetekor. + + + Show desktop notifications + Mutassa az asztali üzeneteket + + + Show tray icon + Tray ikon mutatása + + + Show the systemtray icon + Systemtray ikon mutatása + + + Import + Importálás + + + Error + Hiba + + + Unable to read file. + Nem lehet olvasni a fájlt. + + + Unable to write file. + Nem lehet írni a fájlt. + + + Save File + Fájl mentése + + + Confirm Reset + Visszaállítás elfogadása + + + Are you sure you want to reset the configuration? + Biztos vagy benne hogy viszaállítod a beállításokat? + + + Configuration File + Konfigurációs fájl + + + Export + Export + + + Reset + Visszaállítás + + + Launch at startup + Indítás rendszerinduláskor + + + Launch Flameshot + Flameshot indítása + + + + ImgurUploader + + Upload to Imgur + Feltöltés Imgur -ra + + + Uploading Image + Kép felötlése + + + Copy URL + URL másolása + + + Open URL + URL megnyitása + + + Image to Clipboard. + Kép a vágolapra. + + + Unable to open the URL. + Nem lehet az URL-t megnyitni. + + + URL copied to clipboard. + URL másolva a vágólapra. + + + Screenshot copied to clipboard. + Képernyőmentés másolva a vágólapra. + + + + ImgurUploaderTool + + Image Uploader + Kép feltöltő + + + Uploads the selection to Imgur + Feltölti a kiválasztott képet az Imgur -ra + + + + InfoWindow + + About + Információ + + + Right Click + jobb egérgomb + + + Mouse Wheel + Görgő + + + Move selection 1px + Kijelölés mozgatása 1px + + + Resize selection 1px + Kijelölés méretezése 1 px + + + Quit capture + Felvétel bezárása + + + Copy to clipboard + Másolás vágólapra + + + Save selection as a file + Kijelölés mentése fájlba + + + Undo the last modification + Utolsó módosítás visszavonása + + + Show color picker + Színválasztó mutatása + + + Change the tool's thickness + Vastagság állítása + + + Key + Kulcs + + + Description + Leírás + + + <u><b>License</b></u> + <u><b>License</b></u> + + + <u><b>Version</b></u> + <u><b>Verzió</b></u> + + + <u><b>Shortcuts</b></u> + <u><b>Gyorsbillentyűk</b></u> + + + Available shortcuts in the screen capture mode. + Elérhető gyorsbillentyűk a képernyőfelvétel módban. + + + + LineTool + + Line + Vonal + + + Sets the Line as the paint tool + Beállítja a Vonal eszközt festő eszközként + + + + MarkerTool + + Marker + Jelölő + + + Sets the Marker as the paint tool + Beállítja a Jelölő eszközt festő eszközként + + + + MoveTool + + Move + Mozgató + + + Move the selection area + Mozgatja a kiválasztott területet + + + + PencilTool + + Pencil + Ceruza + + + Sets the Pencil as the paint tool + Beállítja a Ceruza eszközt festő eszközként + + + + QObject + + Save Error + Mentési hiba + + + Capture saved as + It is hard to esxpress such stence in hungary eg. Capture saved as JPG in hungary : A felvétel JPG -ben mentve lett. (Better solution using expressions in string like: Capture saved as %s ) + Felvétel mentve a következőként + + + Error trying to save as + Hiba a mentés közben a következőként + + + Unable to connect via DBus + Nem lehet D-Bus -on keresztül csatlakozni + + + Error + Hiba + + + Unable to write in + Nem írni + + + Capture saved to clipboard + Felvétel mentve a vágólapra + + + + RectangleTool + + Rectangle + Téglalap + + + Sets the Rectangle as the paint tool + Beállítja a Téglalap eszközt festő eszközként + + + + RedoTool + + Redo + Újra + + + + SaveTool + + Save + Mentés + + + Save the capture + Menti a felvételt + + + + SelectionTool + + Rectangular Selection + Téglalapos kijelölő + + + Sets the Selection as the paint tool + Beállítja a Téglalapos kijelölő eszközt Festő eszközként + + + + SizeIndicatorTool + + Selection Size Indicator + Kiválasztott terület méretének indikátora + + + Shows the dimensions of the selection (X Y) + Mutatja a dimenzióját a kijelölésnek (X Y) + + + + StrftimeChooserWidget + + Century (00-99) + Század (00-99) + + + Year (00-99) + Év (00-99) + + + Year (2000) + Év (2000) + + + Month Name (jan) + Hónapnév (Jan) + + + Month Name (january) + Hónapnév (Január) + + + Month (01-12) + Hónap (01-12) + + + Week Day (1-7) + Hét napja (1-7) + + + Week (01-53) + Hét (01-53) + + + Day Name (mon) + Nap neve (Csüt) + + + Day Name (monday) + Nap neve (Csütörtök) + + + Day (01-31) + Nap (01-31) + + + Day of Month (1-31) + Nap a hónapban (1-31) + + + Day (001-366) + Nap (001-366) + + + Time (%H:%M:%S) + Idő (%H:%M:%S) + + + Time (%H:%M) + Idő (%H:%M) + + + Hour (00-23) + Óra (00-23) + + + Hour (01-12) + Óra (01-12) + + + Minute (00-59) + Perc (00-59) + + + Second (00-59) + Másodperc (00-59) + + + Full Date (%m/%d/%y) + Teljes dátum (%m/%d/%y) + + + Full Date (%Y-%m-%d) + Teljes dátum (%Y-%m-%d) + + + + UIcolorEditor + + UI Color Editor + UI Szín szerkesztő + + + Change the color moving the selectors and see the changes in the preview buttons. + Válassz színt az egér mozgatásával és nézd a változást az előnézeti gombokon. + + + Select a Button to modify it + Válassz gombot módosítani + + + Main Color + Fő szín + + + Click on this button to set the edition mode of the main color. + Kattints a gombra hogy beállítsd a szerkesztő módját a fő színnek. + + + Contrast Color + Kontraszt szín + + + Click on this button to set the edition mode of the contrast color. + Kattints erre a gombra hogy beállítsd a szerkesztő módját a kontraszt színnek. + + + + UndoTool + + Undo + Vissza + + + Undo the last modification + Visszavonja az utolsó módosítást + + + + VisualsEditor + + Opacity of area outside selection: + Átlátszósága a kijelölésen kívüli területnek: + + + Button Selection + Gomb választás + + + Select All + Összes kiválasztása + + + diff --git a/flameshot-0.6.0/translations/Internationalization_ka.ts b/flameshot-0.6.0/translations/Internationalization_ka.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6f4435fbede2b6baaaee9b59d3faa69c954523b --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_ka.ts @@ -0,0 +1,898 @@ + + + + + AppLauncher + + + App Launcher + აპლიკაციის გამშვები + + + + Choose an app to open the capture + აირჩიეთ აპლიკაცია სურათის გასახსნელად + + + + AppLauncherWidget + + + Open With + გახსნა პროგრამით + + + + Launch in terminal + ტერმინალში გაშვება + + + + Keep open after selection + არ დახურო დიალოგი არჩევის შემდეგ + + + + + Error + შეცდომა + + + + Unable to write in + შემდეგ მისამართზე ჩაწერა ვერ მოხერხდა: + + + + Unable to launch in terminal. + ტერმინალში გაშვება ვერ მოხერხდა. + + + + ArrowTool + + + Arrow + ისარი + + + + Sets the Arrow as the paint tool + ისრის ხელსაწყოს არჩევა სახატავად + + + + BlurTool + + + Blur + გაბუნდოვნება + + + + Sets the Blur as the paint tool + გაბუნდოვნების ხელსაწყოს არჩევა სახატავად + + + + CaptureWidget + + + Unable to capture screen + ეკრანის გადაღება ვერ მოხერხდა + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + + + + + CircleTool + + + Circle + წრე + + + + Sets the Circle as the paint tool + წრის ხელსაწყოს არჩევა სახატავად + + + + ColorPickerWidget + + + Active color: + + + + + Press ESC to cancel + + + + + Grab Color + + + + + ConfigWindow + + + Configuration + პარამეტრები + + + + Interface + ინტერფეისი + + + + Filename Editor + ფაილის სახელის რედაქტორი + + + + General + ზოგადი + + + + Controller + + + &Take Screenshot + + + + + &Configuration + &პარამეტრები + + + + &Information + &ინფორმაცია + + + + &Quit + &გამოსვლა + + + + CopyTool + + + Copy + კოპირება + + + + Copies the selection into the clipboard + + + + + DBusUtils + + + Unable to connect via DBus + DBus-ით დაკავშირება ვერ მოხერხდა + + + + ExitTool + + + Exit + გამოსვლა + + + + Leave the capture screen + ეკრანის გადაღების დატოვება + + + + FileNameEditor + + + Edit the name of your captures: + შეცვალეთ თქვენი სურათების სახელი: + + + + Edit: + თარგი: + + + + Preview: + გადახედვა: + + + + Save + შენახვა + + + + Saves the pattern + თარგის შენახვა + + + + Reset + განულება + + + + Restores the saved pattern + შენახული შაბლონის განულება + + + + Clear + გაწმენდა + + + + Deletes the name + სახელის წაშლა + + + + GeneneralConf + + + + Import + იმპორტირება + + + + + + Error + შეცდომა + + + + Unable to read file. + ფაილის წაკითხვა ვერ მოხერხდა. + + + + + Unable to write file. + ფაილის ჩაწერა ვერ მოხერხდა. + + + + Save File + ფაილის შენახვა + + + + Confirm Reset + განულების დადასტურება + + + + Are you sure you want to reset the configuration? + დარწმუნებული ხართ, რომ გსურთ პარამეტრების განულება? + + + + Show help message + დახმარების შეტყობინების ნახვა + + + + Show the help message at the beginning in the capture mode. + დახმარების შეტყობინების ნახვა გადაღების რეჟიმის დაწყებისას. + + + + + Show desktop notifications + ცნობების ჩვენება სამუშაო მაგიდაზე + + + + Show tray icon + ხატულის ჩვენება სისტემურ პანელზე + + + + Show the systemtray icon + ხატულის ჩვენება სისტემურ პანელზე + + + + Configuration File + პარამეტრების ფაილი + + + + Export + ექსპორტირება + + + + Reset + განულება + + + + Launch at startup + გაშვება სისტემის ჩატვირთვისას + + + + Launch Flameshot + + + + + ImgurUploader + + + Upload to Imgur + Imgur-ზე ატვირთვა + + + + Uploading Image + სურათის ატვირთვა + + + + Copy URL + URL-ის კოპირება + + + + Open URL + URL-ის გახსნა + + + + Delete image + + + + + Image to Clipboard. + სურათის გაცვლის ბუფერში გაგზავნა + + + + + Unable to open the URL. + URL-ის გახსნა ვერ მოხერხდა. + + + + URL copied to clipboard. + URL დაკოპირდა გაცვლის ბუფერში. + + + + Screenshot copied to clipboard. + სურათი დაკოპირდა გაცვლის ბუფერში. + + + + ImgurUploaderTool + + + Image Uploader + სურათის ამტვირთველი + + + + Uploads the selection to Imgur + შერჩეულის Imgur-ზე ატვირთვა + + + + InfoWindow + + + About + პროგრამის შესახებ + + + + Right Click + მაუსის მარჯვენა ღილაკი + + + + Mouse Wheel + მაუსის გორგოლაჭი + + + + Move selection 1px + შერჩეულის გადაადგილება 1px-ით + + + + Resize selection 1px + შერჩეულის ზომის შეცვლა 1px-ით + + + + Quit capture + გადაღებიდან გამოსვლა + + + + Copy to clipboard + გაცვლის ბუფერში კოპირება + + + + Save selection as a file + შერჩეულის ფაილად შენახვა + + + + Undo the last modification + ბოლო ცვლილების გაუქმება + + + + Show color picker + ფერის შესარჩევის ჩვენება + + + + Change the tool's thickness + ხელსაწყოს სისქის შეცვლა + + + + Available shortcuts in the screen capture mode. + გადაღების რეჟიმში ხელმისაწვდომი მალსახმობები. + + + + Key + კლავიში + + + + Description + აღწერა + + + + <u><b>License</b></u> + <u><b>ლიცენზია</b></u> + + + + <u><b>Version</b></u> + <u><b>ვერსია</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>მალსახმობები</b></u> + + + + LineTool + + + Line + ხაზი + + + + Sets the Line as the paint tool + ხაზის ხელსაწყოს არჩევა სახატავად + + + + MarkerTool + + + Marker + მარკერი + + + + Sets the Marker as the paint tool + მარკერის ხელსაწყოს არჩევა სახატავად + + + + MoveTool + + + Move + გადაადგილება + + + + Move the selection area + შერჩეული არის გადაადგილება + + + + PencilTool + + + Pencil + ფანქარი + + + + Sets the Pencil as the paint tool + ფანქრის ხელსაწყოს არჩევა სახატავად + + + + PinTool + + + Pin Tool + + + + + Pin image on the desktop + + + + + QObject + + + Save Error + შეცდომა შენახვისას + + + + + Capture saved as + სურათი შენახულია როგორც: + + + + Capture saved to clipboard + + + + + + Error trying to save as + შეცდომა მცდელობისას შენახულიყო როგორც: + + + + + + + Unable to connect via DBus + DBus-ით დაკავშირება ვერ მოხერხდა + + + + Error + შეცდომა + + + + Unable to write in + შემდეგ მისამართზე ჩაწერა ვერ მოხერხდა: + + + + RectangleTool + + + Rectangle + მართკუთხედი + + + + Sets the Rectangle as the paint tool + მართკუთხედის ხელსაწყოს არჩევა სახატავად + + + + RedoTool + + + Redo + + + + + Redo the next modification + + + + + SaveTool + + + Save + შენახვა + + + + Save the capture + სურათის შენახვა + + + + ScreenGrabber + + + Unable to capture screen + ეკრანის გადაღება ვერ მოხერხდა + + + + SelectionTool + + + Rectangular Selection + მართკუთხა შერჩევა + + + + Sets the Selection as the paint tool + შერჩევის ხელსაწყოს არჩევა სახატავად + + + + SizeIndicatorTool + + + Selection Size Indicator + შერჩეულის ზომის მაჩვენებელი + + + + Shows the dimensions of the selection (X Y) + აჩვენებს შერჩეული არის განზომილებებს (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + საუკუნე (00-99) + + + + Year (00-99) + წელი (00-99) + + + + Year (2000) + წელი (2000) + + + + Month Name (jan) + თვის სახელი (იან) + + + + Month Name (january) + თვის სახელი (იანვარი) + + + + Month (01-12) + თვე (01-12) + + + + Week Day (1-7) + კვირის დღე (1-7) + + + + Week (01-53) + კვირა (01-53) + + + + Day Name (mon) + დღის სახელი (ორშ) + + + + Day Name (monday) + დღის სახელი (ორშაბათი) + + + + Day (01-31) + დღე (01-31) + + + + Day of Month (1-31) + თვის დღე (1-31) + + + + Day (001-366) + დღე (001-366) + + + + Time (%H-%M-%S) + + + + + Time (%H-%M) + + + + + Hour (00-23) + საათი (00-23) + + + + Hour (01-12) + საათი (01-12) + + + + Minute (00-59) + წუთი (00-59) + + + + Second (00-59) + წამი (00-59) + + + + Full Date (%m/%d/%y) + სრული თარიღი (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + სრული თარიღი (%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + + + + + TextConfig + + + StrikeOut + + + + + Underline + + + + + Bold + + + + + Italic + + + + + TextTool + + + Text + + + + + Add text to your capture + + + + + UIcolorEditor + + + UI Color Editor + ინტერფეისის ფერის რედაქტორი + + + + Change the color moving the selectors and see the changes in the preview buttons. + შეცვალეთ ფერი ნიშნულის გადაადგილებით და შეხედეთ ცვლილებებს გადასახედ ღილაკებზე. + + + + Select a Button to modify it + აირჩიეთ ღილაკი მის შესაცვლელად + + + + Main Color + ძირითადი ფერი + + + + Click on this button to set the edition mode of the main color. + დააწექით ამ ღილაკს ძირითადი ფერის არჩევის რეჟიმის ჩასართავად. + + + + Contrast Color + კონტრასტული ფერი + + + + Click on this button to set the edition mode of the contrast color. + დააწექით ამ ღილაკს კონტრასტული ფერის არჩევის რეჟიმის ჩასართავად. + + + + UndoTool + + + Undo + უკუქმნა + + + + Undo the last modification + ბოლო ცვლილების გაუქმება + + + + VisualsEditor + + + Opacity of area outside selection: + შერჩეულის გარე არეს გაუმჭვირვალობა + + + + Button Selection + ღილაკის არჩევა + + + + Select All + ყველაფრის შერჩევა + + + diff --git a/flameshot-0.6.0/translations/Internationalization_pl.ts b/flameshot-0.6.0/translations/Internationalization_pl.ts new file mode 100644 index 0000000000000000000000000000000000000000..56e027d14c3b5fbcb65af895cf431b119c09cad1 --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_pl.ts @@ -0,0 +1,901 @@ + + + + + AppLauncher + + + App Launcher + Uruchamianie aplikacji + + + + Choose an app to open the capture + Wybierz aplikację do otwierania zrzutu + + + + AppLauncherWidget + + + Open With + Otwórz w + + + + Launch in terminal + Otwórz w terminalu + + + + Keep open after selection + Pozostaw otwarte po zaznaczeniu + + + + + Error + Błąd + + + + Unable to write in + Nie można zapisać + + + + Unable to launch in terminal. + Nie można uruchomić w terminalu. + + + + ArrowTool + + + Arrow + Strzałka + + + + Sets the Arrow as the paint tool + Rysowanie strzałek + + + + BlurTool + + + Blur + Rozmycie + + + + Sets the Blur as the paint tool + Rozmywanie obszarów + + + + CaptureWidget + + + Unable to capture screen + Nie można przechwycić ekranu + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + Wybierz obszar za pomocą myszy lub wciśnij Esc aby wyjść. +Wciśnij Enter, aby wykonać zrzut ekranu. +Prawy klik, aby pokazać próbnik kolorów. +Spacja, aby pokazać panel boczny. + + + + CircleTool + + + Circle + Okręgi + + + + Sets the Circle as the paint tool + Rysowanie okręgów i elips + + + + ColorPickerWidget + + + Active color: + Aktywny kolor: + + + + Press ESC to cancel + Wciśnij ESC, aby anulować + + + + Grab Color + Pobierz kolor + + + + ConfigWindow + + + Configuration + Konfiguracja + + + + Interface + Interfejs + + + + Filename Editor + Edytor nazw plików + + + + General + Ogólne + + + + Controller + + + &Take Screenshot + &Zrzut ekranu + + + + &Configuration + &Konfiguracja + + + + &Information + &Informacje + + + + &Quit + &Wyjdź + + + + CopyTool + + + Copy + Kopiuj + + + + Copies the selection into the clipboard + + + + + DBusUtils + + + Unable to connect via DBus + Nie można się połączyć za pomocą DBus + + + + ExitTool + + + Exit + Wyjdź + + + + Leave the capture screen + Opuść ekran przechwytywania + + + + FileNameEditor + + + Edit the name of your captures: + Edycja wzorca nazwy plików: + + + + Edit: + Edytuj: + + + + Preview: + Podgląd: + + + + Save + Zapisz + + + + Saves the pattern + Zapisuje wzorzec + + + + Reset + Reset + + + + Restores the saved pattern + Resetuje wzorzec + + + + Clear + Wyczyść + + + + Deletes the name + Czyści wzorzec + + + + GeneneralConf + + + + Import + Import + + + + + + Error + Błąd + + + + Unable to read file. + Nie można odczytać pliku. + + + + + Unable to write file. + Nie można zapisać pliku. + + + + Save File + Zapisz plik + + + + Confirm Reset + Potwierdź Reset + + + + Are you sure you want to reset the configuration? + Czy na pewno chcesz zresetować konfigurację? + + + + Show help message + Pokaż podpowiedzi + + + + Show the help message at the beginning in the capture mode. + Pokaż podpowiedzi na początku trybu przechwytywania. + + + + + Show desktop notifications + Pokaż powiadomienia ekranowe + + + + Show tray icon + Pokaż ikonę w trayu + + + + Show the systemtray icon + Pokaż ikonę w zasobniku systemowym + + + + Configuration File + Plik konfiguracyjny + + + + Export + Export + + + + Reset + Reset + + + + Launch at startup + Uruchom podczas startu + + + + Launch Flameshot + Uruchom Flameshot + + + + ImgurUploader + + + Upload to Imgur + Wyślij do Imgur + + + + Uploading Image + Wysyłanie obrazka + + + + Copy URL + Kopiuj URL + + + + Open URL + Otwórz URL + + + + Delete image + Usuń obrazek + + + + Image to Clipboard. + Obrazek do schowka. + + + + + Unable to open the URL. + Nie można otworzyć adresu URL. + + + + URL copied to clipboard. + URL skopiowany do schowka. + + + + Screenshot copied to clipboard. + Zrzut ekranu skopiowany do schowka. + + + + ImgurUploaderTool + + + Image Uploader + Uploader obrazów + + + + Uploads the selection to Imgur + Wyślij zaznaczenie do Imgur + + + + InfoWindow + + + About + O programie + + + + Right Click + Prawy klik + + + + Mouse Wheel + Kółko myszy + + + + Move selection 1px + Przesuń zaznaczenie o 1px + + + + Resize selection 1px + Zmień rozmiar zaznaczenia o 1px + + + + Quit capture + Zakończ przechwytywanie + + + + Copy to clipboard + Kopiuj do schowka + + + + Save selection as a file + Zapisz zaznaczenie jako plik + + + + Undo the last modification + Cofnij ostatnią modyfikację + + + + Show color picker + Pokaż próbnik kolorów + + + + Change the tool's thickness + Zmień grubość narzędzia + + + + Available shortcuts in the screen capture mode. + Dostępne skróty w trybie przechwytywania obrazu. + + + + Key + Klawisz + + + + Description + Działanie + + + + <u><b>License</b></u> + <u><b>Licencja</b></u> + + + + <u><b>Version</b></u> + <u><b>Wersja</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>Skróty klawiszowe</b></u> + + + + LineTool + + + Line + Linia + + + + Sets the Line as the paint tool + Ustawia linię jako narzędzie do rysowania + + + + MarkerTool + + + Marker + Marker + + + + Sets the Marker as the paint tool + Ustawia Marker jako narzędzie rysowania + + + + MoveTool + + + Move + Przesuwanie + + + + Move the selection area + Przesuwa zaznaczenie + + + + PencilTool + + + Pencil + Ołówek + + + + Sets the Pencil as the paint tool + Ustawia ołówek jako narzędzie do rysowania + + + + PinTool + + + Pin Tool + Narzędzie przypinania + + + + Pin image on the desktop + Przypnij obrazek do pulpitu + + + + QObject + + + Save Error + Błąd zapisu + + + + + Capture saved as + Zaznaczenie zapisano jako + + + + Capture saved to clipboard + Zrzut skopiowano do schowka + + + + + Error trying to save as + Błąd przy próbie zapisu jako + + + + + + + Unable to connect via DBus + Nie udało się połączyć za pomocą DBus + + + + Error + Błąd + + + + Unable to write in + Nie można zapisać w + + + + RectangleTool + + + Rectangle + Prostokąt + + + + Sets the Rectangle as the paint tool + Ustawia prostokąt jako narzędzie do rysowania + + + + RedoTool + + + Redo + Cofnij + + + + Redo the next modification + + + + + SaveTool + + + Save + Zapisz + + + + Save the capture + Zapisz zaznaczenie + + + + ScreenGrabber + + + Unable to capture screen + Nie można przechwycić ekranu + + + + SelectionTool + + + Rectangular Selection + Zaznaczenie prostokątne + + + + Sets the Selection as the paint tool + Ustawia zaznaczenie prostokątne jako narzędzie do rysowania + + + + SizeIndicatorTool + + + Selection Size Indicator + Miernik zaznaczenia + + + + Shows the dimensions of the selection (X Y) + Pokazuje wymiary zaznaczenia (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + Wiek (00-99) + + + + Year (00-99) + Rok (00-99) + + + + Year (2000) + Rok (2000) + + + + Month Name (jan) + Nazwa miesiąca (cze) + + + + Month Name (january) + Nazwa miesiąca (czerwiec) + + + + Month (01-12) + Miesiąc (01-12) + + + + Week Day (1-7) + Dzień tygodnia (1-7) + + + + Week (01-53) + Tydzień (01-53) + + + + Day Name (mon) + Nazwa dniaa (pią) + + + + Day Name (monday) + Nazwa dnia (piątek) + + + + Day (01-31) + Dzień (01-31) + + + + Day of Month (1-31) + Dzień miesiąca (1-31) + + + + Day (001-366) + Dzień (001-366) + + + + Time (%H-%M-%S) + Czas (%H-%M-%S) + + + + Time (%H-%M) + Czas (%H-%M) + + + + Hour (00-23) + Godzina (00-23) + + + + Hour (01-12) + Godzina (01-12) + + + + Minute (00-59) + Minuta (00-59) + + + + Second (00-59) + Sekunda (00-59) + + + + Full Date (%m/%d/%y) + Data (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + Data (%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + Flameshot Info + + + + TextConfig + + + StrikeOut + Przekreślenie + + + + Underline + Podkreślenie + + + + Bold + Pogrubienie + + + + Italic + Kursywa + + + + TextTool + + + Text + Tekst + + + + Add text to your capture + Dodaje tekst do zrzutu + + + + UIcolorEditor + + + UI Color Editor + Edytor kolorów interfejsu + + + + Change the color moving the selectors and see the changes in the preview buttons. + Zmień kolor przesuwając selektory i obserwując podgląd przycisków. + + + + Select a Button to modify it + Wybierz przycisk do zmodyfikowania + + + + Main Color + Kolor główny + + + + Click on this button to set the edition mode of the main color. + Kliknij na przycisk aby móc modyfikować kolor główny. + + + + Contrast Color + Kolor kontrastowy + + + + Click on this button to set the edition mode of the contrast color. + Kliknij na przycisk aby móc modyfikować kolor kontrastowy. + + + + UndoTool + + + Undo + Cofnij + + + + Undo the last modification + Cofnij ostatnią zmianę + + + + VisualsEditor + + + Opacity of area outside selection: + Przezroczystość obszaru poza zaznaczeniem: + + + + Button Selection + Wybór przycisków + + + + Select All + Wybierz wszystkie + + + diff --git a/flameshot-0.6.0/translations/Internationalization_ru.ts b/flameshot-0.6.0/translations/Internationalization_ru.ts new file mode 100644 index 0000000000000000000000000000000000000000..7a21b38993938f7c5c955f28d4af47c79f853bfd --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_ru.ts @@ -0,0 +1,898 @@ + + + + + AppLauncher + + + App Launcher + Запуск приложения + + + + Choose an app to open the capture + Выберите приложение, которым открыть снимок + + + + AppLauncherWidget + + + Open With + Открыть с помощью + + + + Launch in terminal + Запустить в терминале + + + + Keep open after selection + Оставить запущенным после выделения + + + + + Error + Ошибка + + + + Unable to write in + Не удалось сохранить + + + + Unable to launch in terminal. + Не удалось запустить в терминале. + + + + ArrowTool + + + Arrow + Стрелка + + + + Sets the Arrow as the paint tool + Выбрать Стрелку инструментом для рисования + + + + BlurTool + + + Blur + Размытие + + + + Sets the Blur as the paint tool + Выбрать Размытие инструментом для рисования + + + + CaptureWidget + + + Unable to capture screen + Не удалось захватить экран + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + + + + + CircleTool + + + Circle + Окружность + + + + Sets the Circle as the paint tool + Выбрать Окружность инструментом для рисования + + + + ColorPickerWidget + + + Active color: + + + + + Press ESC to cancel + + + + + Grab Color + + + + + ConfigWindow + + + Configuration + Настройка + + + + Interface + Интерфейс + + + + Filename Editor + Редактор имен файлов + + + + General + Общие + + + + Controller + + + &Take Screenshot + + + + + &Configuration + &Настройка + + + + &Information + &Информация + + + + &Quit + &Выход + + + + CopyTool + + + Copy + Скопировать + + + + Copies the selection into the clipboard + + + + + DBusUtils + + + Unable to connect via DBus + Не удалось подключиться через DBus + + + + ExitTool + + + Exit + Выход + + + + Leave the capture screen + Покинуть захват экрана + + + + FileNameEditor + + + Edit the name of your captures: + Отредактируйте имя ваших снимков: + + + + Edit: + Шаблон: + + + + Preview: + Предпросмотр: + + + + Save + Сохранить + + + + Saves the pattern + Сохранить шаблон + + + + Reset + Сбросить + + + + Restores the saved pattern + Восстанавливает сохраненный шаблон + + + + Clear + Очистить + + + + Deletes the name + Удаляет имя + + + + GeneneralConf + + + + Import + Импорт + + + + + + Error + Ошибка + + + + Unable to read file. + Не удалось прочитать файл. + + + + + Unable to write file. + Не удалось записать файл. + + + + Save File + Сохранить файл + + + + Confirm Reset + Подтвердить сброс + + + + Are you sure you want to reset the configuration? + Вы действительно хотите сбросить настройки? + + + + Show help message + Показывать справочное сообщение + + + + Show the help message at the beginning in the capture mode. + Показывать справочное сообщение перед началом захвата экрана. + + + + + Show desktop notifications + Показывать уведомления + + + + Show tray icon + Показывать значок в трее + + + + Show the systemtray icon + Показать значок в системном трее + + + + Configuration File + Файл конфигурации + + + + Export + Экспорт + + + + Reset + Сброс + + + + Launch at startup + Запускать при старте системы + + + + Launch Flameshot + Запустить Flameshot + + + + ImgurUploader + + + Upload to Imgur + Загрузить в Imgur + + + + Uploading Image + Загрузка изображения + + + + Copy URL + Скопировать URL + + + + Open URL + Открыть URL + + + + Delete image + + + + + Image to Clipboard. + Изображение в буфер обмена. + + + + + Unable to open the URL. + Не удалось открыть URL. + + + + URL copied to clipboard. + URL скопирован в буфер обмена. + + + + Screenshot copied to clipboard. + Снимок скопирован в буфер обмена. + + + + ImgurUploaderTool + + + Image Uploader + Отправка изображений + + + + Uploads the selection to Imgur + Загрузить выделение на Imgur + + + + InfoWindow + + + About + Информация + + + + Right Click + ПКМ + + + + Mouse Wheel + Колесико мыши + + + + Move selection 1px + Переместить выделение на 1px + + + + Resize selection 1px + Изменить размер выделения на 1px + + + + Quit capture + Выйти из захвата экрана + + + + Copy to clipboard + Скопировать в буфер обмена + + + + Save selection as a file + Сохранить выделение в файл + + + + Undo the last modification + Отменить последнее изменение + + + + Show color picker + Показать выбор цвета + + + + Change the tool's thickness + Изменить толщину инструмента + + + + Available shortcuts in the screen capture mode. + Доступные горячие клавиши в режиме захвата экрана. + + + + Key + Клавиша + + + + Description + Описание + + + + <u><b>License</b></u> + <u><b>Лицензия</b></u> + + + + <u><b>Version</b></u> + <u><b>Версия</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>Горячие клавиши</b></u> + + + + LineTool + + + Line + Линия + + + + Sets the Line as the paint tool + Выбрать Линию инструментом для рисования + + + + MarkerTool + + + Marker + Маркер + + + + Sets the Marker as the paint tool + Выбрать Маркер инструментом для рисования + + + + MoveTool + + + Move + Перемещение + + + + Move the selection area + Выбрать Перемещение инструментом для рисования + + + + PencilTool + + + Pencil + Карандаш + + + + Sets the Pencil as the paint tool + Выбрать Карандаш инструментом для рисования + + + + PinTool + + + Pin Tool + + + + + Pin image on the desktop + + + + + QObject + + + Save Error + Ошибка сохранения + + + + + Capture saved as + Сохранить снимок как + + + + Capture saved to clipboard + + + + + + Error trying to save as + Ошибка при попытке сохранить как + + + + + + + Unable to connect via DBus + Не удалось подключиться через DBus + + + + Error + Ошибка + + + + Unable to write in + Не удалось сохранить + + + + RectangleTool + + + Rectangle + Прямоугольник + + + + Sets the Rectangle as the paint tool + Выбрать Прямоугольник инструментом для рисования + + + + RedoTool + + + Redo + + + + + Redo the next modification + + + + + SaveTool + + + Save + Сохранить + + + + Save the capture + Сохранить снимок + + + + ScreenGrabber + + + Unable to capture screen + Не удалось захватить экран + + + + SelectionTool + + + Rectangular Selection + Прямоугольное выделение + + + + Sets the Selection as the paint tool + Выбрать Прямоугольное выделение инструментом для рисования + + + + SizeIndicatorTool + + + Selection Size Indicator + Индикатор размера выделения + + + + Shows the dimensions of the selection (X Y) + Показывает размер выделения (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + Век (00-99) + + + + Year (00-99) + Год (00-99) + + + + Year (2000) + Год (2000) + + + + Month Name (jan) + Название месяца (янв) + + + + Month Name (january) + Название месяца (январь) + + + + Month (01-12) + Месяц (01-12) + + + + Week Day (1-7) + День недели (1-7) + + + + Week (01-53) + Неделя (01-53) + + + + Day Name (mon) + День недели (пн) + + + + Day Name (monday) + День недели (понедельник) + + + + Day (01-31) + День (01-31) + + + + Day of Month (1-31) + День месяца (1-31) + + + + Day (001-366) + День (001-366) + + + + Time (%H-%M-%S) + + + + + Time (%H-%M) + + + + + Hour (00-23) + Час (00-23) + + + + Hour (01-12) + Час (01-12) + + + + Minute (00-59) + Минута (00-59) + + + + Second (00-59) + Секунда (00-59) + + + + Full Date (%m/%d/%y) + Полная дата (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + Полная дата (%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + + + + + TextConfig + + + StrikeOut + + + + + Underline + + + + + Bold + + + + + Italic + + + + + TextTool + + + Text + + + + + Add text to your capture + + + + + UIcolorEditor + + + UI Color Editor + Редактор цвета интерфейса + + + + Change the color moving the selectors and see the changes in the preview buttons. + Измените цвет, перемещая выделение, и посмотрите изменения в кнопках предварительного просмотра. + + + + Select a Button to modify it + Выберите кнопку, чтобы изменить ее + + + + Main Color + Основной цвет + + + + Click on this button to set the edition mode of the main color. + Нажмите на эту кнопку, чтобы перейти в режим редактирования основного цвета. + + + + Contrast Color + Контрастный цвет + + + + Click on this button to set the edition mode of the contrast color. + Нажмите на эту кнопку, чтобы перейти в режим редактирования контрастного цвета. + + + + UndoTool + + + Undo + Отменить + + + + Undo the last modification + Отменить последнее изменение + + + + VisualsEditor + + + Opacity of area outside selection: + Затемнение невыделенной области: + + + + Button Selection + Выбор кнопок + + + + Select All + Выбрать все + + + diff --git a/flameshot-0.6.0/translations/Internationalization_tr.ts b/flameshot-0.6.0/translations/Internationalization_tr.ts new file mode 100644 index 0000000000000000000000000000000000000000..a676c66ed5990034f7523ea2d38bab78736eac59 --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_tr.ts @@ -0,0 +1,902 @@ + + + + + AppLauncher + + + App Launcher + Uygulama Başlatıcı + + + + Choose an app to open the capture + Yakalamayı açmak için bir uygulama seçin + + + + AppLauncherWidget + + + Open With + ile Aç + + + + Launch in terminal + Terminalde aç + + + + Keep open after selection + Seçimden sonra açık tutun + + + + + Error + Hata + + + + Unable to write in + Yazma mümkün değil + + + + Unable to launch in terminal. + Terminalde başlatılamadı. + + + + ArrowTool + + + Arrow + Ok + + + + Sets the Arrow as the paint tool + Oku çizim aracı olarak ayarlar + + + + BlurTool + + + Blur + Bulanıklık + + + + Sets the Blur as the paint tool + Bulnıklığı boyama aracı olarak ayarlar + + + + CaptureWidget + + + Unable to capture screen + Ekran resmi alınamadı + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + Fareyle bir alan seçin veya çıkmak için Esc tuşuna basın. +Ekranı yakalamak için Enter tuşuna basın. +Renk seçiciyi göstermek için farenin sağ tuşuna tıklayın. +Aracınızın kalınlığını değiştirmek için Fare Tekerleğini kullanın. +Yan paneli açmak için Boşluk tuşuna basın. + + + + CircleTool + + + Circle + Çember + + + + Sets the Circle as the paint tool + Çemberi boyama aracı olarak ayarlar + + + + ColorPickerWidget + + + Active color: + Aktif Renk: + + + + Press ESC to cancel + Çıkmak için ESC'ye tıklayın + + + + Grab Color + + + + + ConfigWindow + + + Configuration + Ayarlar + + + + Interface + Arayüz + + + + Filename Editor + Dosya Adı Düzenleyici + + + + General + Genel + + + + Controller + + + &Take Screenshot + &Ekran Resmi Al + + + + &Configuration + &Ayarlar + + + + &Information + &Bilgi + + + + &Quit + &Çıkış + + + + CopyTool + + + Copy + Kopyala + + + + Copies the selection into the clipboard + Seçimi panoya kopyalar + + + + DBusUtils + + + Unable to connect via DBus + DBus ile bağlanılamadı + + + + ExitTool + + + Exit + Çıkış + + + + Leave the capture screen + Yakalama ekranından ayrıl + + + + FileNameEditor + + + Edit the name of your captures: + Çekimlerinizin adını düzenleyin: + + + + Edit: + Düzenle: + + + + Preview: + Önizleme: + + + + Save + Kaydet + + + + Saves the pattern + Desenini kaydeder + + + + Reset + Sıfırla + + + + Restores the saved pattern + Kaydedilen deseni geri yükler + + + + Clear + Temizle + + + + Deletes the name + İsmi siler + + + + GeneneralConf + + + + Import + Dışa aktar + + + + + + Error + Hata + + + + Unable to read file. + Dosya okunamıyor. + + + + + Unable to write file. + Dosya yazılamıyor. + + + + Save File + Dosyayı Kaydet + + + + Confirm Reset + Sıfırlamayı Onayla + + + + Are you sure you want to reset the configuration? + Ayarları sıfırlamak istediğinizden emin misiniz? + + + + Show help message + Yardım mesajını göster + + + + Show the help message at the beginning in the capture mode. + Yakalama modunda başında yardım mesajını gösterin. + + + + + Show desktop notifications + Masaüstü bildirimlerini göster + + + + Show tray icon + Tepsi simgesini göster + + + + Show the systemtray icon + Sistem tepsisi simgesini göster + + + + Configuration File + Yapılandırma Dosyası + + + + Export + Dışa aktar + + + + Reset + Sıfırla + + + + Launch at startup + Başlangıçta başlatın + + + + Launch Flameshot + Flameshot'ı başlat + + + + ImgurUploader + + + Upload to Imgur + Imgur'a yükle + + + + Uploading Image + Resim Yükleniyor + + + + Copy URL + URL Kopyala + + + + Open URL + URL Aç + + + + Delete image + Resmi sil + + + + Image to Clipboard. + Resim Pano'ya. + + + + + Unable to open the URL. + URL açılamıyor. + + + + URL copied to clipboard. + URL panoya kopyalandı. + + + + Screenshot copied to clipboard. + Ekran görüntüsü panoya kopyalandı. + + + + ImgurUploaderTool + + + Image Uploader + Resim Yükleme Aracı + + + + Uploads the selection to Imgur + Seçimi Imgur'a yükler + + + + InfoWindow + + + About + Hakkında + + + + Right Click + Sağ Tık + + + + Mouse Wheel + Fare Tekerleği + + + + Move selection 1px + 1px seçimini hareket ettir + + + + Resize selection 1px + 1px seçimini yeniden boyutlandır + + + + Quit capture + Çıkış + + + + Copy to clipboard + Panoya kopyala + + + + Save selection as a file + Seçimi dosya olarak kaydet + + + + Undo the last modification + Son değişikliği geri al + + + + Show color picker + Renk seçici göster + + + + Change the tool's thickness + Araç kalınlığını değiştirin + + + + Available shortcuts in the screen capture mode. + Ekran yakalama modunda kullanılabilir kısayollar. + + + + Key + Anahtar + + + + Description + Tanım + + + + <u><b>License</b></u> + <u><b>Lisans</b></u> + + + + <u><b>Version</b></u> + <u><b>Sürüm</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>Kısayollar</b></u> + + + + LineTool + + + Line + Çizgi + + + + Sets the Line as the paint tool + Çizgiyi boyama aracı olarak ayarlar + + + + MarkerTool + + + Marker + İşaretleyici + + + + Sets the Marker as the paint tool + İşaretleyiciyi boyama aracı olarak ayarlar + + + + MoveTool + + + Move + Oynat + + + + Move the selection area + Seçim alanını hareket ettir + + + + PencilTool + + + Pencil + Kurşun Kalem + + + + Sets the Pencil as the paint tool + Kurşun Kalemi çizim aracı olarak ayarlar + + + + PinTool + + + Pin Tool + Pin Aracı + + + + Pin image on the desktop + Masaüstündeki PIN resmi + + + + QObject + + + Save Error + Kaydetme Hatası + + + + + Capture saved as + Yakalama farklı kaydedildi + + + + Capture saved to clipboard + Yakalama panoya kaydedildi + + + + + Error trying to save as + Farklı kaydetmeye çalışılırken hata oluştu + + + + + + + Unable to connect via DBus + DBus ile bağlanılamadı + + + + Error + Hata + + + + Unable to write in + Yazma mümkün değil + + + + RectangleTool + + + Rectangle + Dikdörtgen + + + + Sets the Rectangle as the paint tool + Dikdörtgeni boyama aracı olarak ayarlar + + + + RedoTool + + + Redo + Yeniden + + + + Redo the next modification + + + + + SaveTool + + + Save + Kaydet + + + + Save the capture + Yakalamayı kaydet + + + + ScreenGrabber + + + Unable to capture screen + Ekran resmi alınamadı + + + + SelectionTool + + + Rectangular Selection + Dikdörtgen Seçim + + + + Sets the Selection as the paint tool + Seçimi boyama aracı olarak ayarlar + + + + SizeIndicatorTool + + + Selection Size Indicator + Seçim Boyutu Göstergesi + + + + Shows the dimensions of the selection (X Y) + Seçimin boyutlarını gösterir (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + Ülke (00-99) + + + + Year (00-99) + Yıl (00-99) + + + + Year (2000) + Yıl (2000) + + + + Month Name (jan) + Ay Adı (Oca) + + + + Month Name (january) + Ay Adı (Ocak) + + + + Month (01-12) + Ay (01-12) + + + + Week Day (1-7) + Haftanın Günü (1-7) + + + + Week (01-53) + Hafta (01-53) + + + + Day Name (mon) + Gün Adı (pzt) + + + + Day Name (monday) + Gün Adı (pazartesi) + + + + Day (01-31) + Gün (01-31) + + + + Day of Month (1-31) + Ayın Günü (1-31) + + + + Day (001-366) + Gün (001-366) + + + + Time (%H-%M-%S) + + + + + Time (%H-%M) + + + + + Hour (00-23) + Saat (00-23) + + + + Hour (01-12) + Saat (01-12) + + + + Minute (00-59) + Dakika (00-59) + + + + Second (00-59) + Saniye (00-59) + + + + Full Date (%m/%d/%y) + Tam Tarih (%d/%m/%y) + + + + Full Date (%Y-%m-%d) + Tam Tarih (%d-%m-%Y) + + + + SystemNotification + + + Flameshot Info + Flameshot Hakkında + + + + TextConfig + + + StrikeOut + + + + + Underline + Altçizgi + + + + Bold + Kalın + + + + Italic + Eğik + + + + TextTool + + + Text + Metin + + + + Add text to your capture + Bilgisayardan yazı ekle + + + + UIcolorEditor + + + UI Color Editor + UI Renk Editörü + + + + Change the color moving the selectors and see the changes in the preview buttons. + Seçicileri hareket ettiren rengi değiştirin ve önizleme düğmelerindeki değişiklikleri görün. + + + + Select a Button to modify it + Değiştirmek için bir buton seçin + + + + Main Color + Ana Renk + + + + Click on this button to set the edition mode of the main color. + Ana rengin baskı modunu ayarlamak için bu butonu tıklayın. + + + + Contrast Color + Kontrast Renk + + + + Click on this button to set the edition mode of the contrast color. + Kontrast renginin baskı modunu ayarlamak için bu butonu tıklayın. + + + + UndoTool + + + Undo + Geri + + + + Undo the last modification + Son değişikliği geri al + + + + VisualsEditor + + + Opacity of area outside selection: + Seçimin dışındaki alanın opaklığı: + + + + Button Selection + Buton Seçimi + + + + Select All + Tümünü Seç + + + diff --git a/flameshot-0.6.0/translations/Internationalization_zh_CN.ts b/flameshot-0.6.0/translations/Internationalization_zh_CN.ts new file mode 100644 index 0000000000000000000000000000000000000000..a822dfb115da8bd1980bdd263b28fc5078850b84 --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_zh_CN.ts @@ -0,0 +1,903 @@ + + + + + AppLauncher + + + App Launcher + 应用启动器 + + + + Choose an app to open the capture + 选择一个应用打开此截图 + + + + AppLauncherWidget + + + Open With + 打开 + + + + Launch in terminal + 在终端中启动 + + + + Keep open after selection + 选择后保持此窗口打开 + + + + + Error + 错误 + + + + Unable to launch in terminal. + 无法在终端中启动。 + + + + Unable to write in + 无法写入 + + + + ArrowTool + + + Arrow + 箭头 + + + + Sets the Arrow as the paint tool + 选择箭头作为绘画工具 + + + + BlurTool + + + Blur + 模糊 + + + + Sets the Blur as the paint tool + 选择模糊作为绘画工具 + + + + CaptureWidget + + + Unable to capture screen + 无法捕获屏幕 + 无法捕获屏幕 + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + 用鼠标选择一个区域,或按 Esc 退出。 +按 Enter 键捕捉屏幕。 +按住鼠标右键显示颜色选择器。 +使用鼠标滚轮来改变绘画工具的宽度。 +按下空格键以打开侧边面板。 + + + + CircleTool + + + Circle + 圆环 + + + + Sets the Circle as the paint tool + 选择圆环作为绘画工具 + + + + ColorPickerWidget + + + Active color: + 活动颜色: + + + + Press ESC to cancel + 按下 ESC 键以取消 + + + + Grab Color + 获取颜色 + + + + ConfigWindow + + + Configuration + 配置 + + + + Interface + 界面 + + + + Filename Editor + 文件名编辑器 + + + + General + 常规 + + + + Controller + + + &Take Screenshot + 进行截图(&T) + + + + &Configuration + 配置(&C) + + + + &Information + 信息(&I) + + + + &Quit + 退出(&Q) + + + + CopyTool + + + Copy + 复制 + + + + Copies the selection into the clipboard + 复制选择到剪贴板 + + + + DBusUtils + + + Unable to connect via DBus + 无法通过 DBus 进行连接 + + + + ExitTool + + + Exit + 退出 + + + + Leave the capture screen + 离开屏幕捕获 + + + + FileNameEditor + + + Edit the name of your captures: + 编辑您的截图名称: + + + + Edit: + 编辑器: + + + + Preview: + 预览: + + + + Save + 保存 + + + + Saves the pattern + 保存样式 + + + + Reset + 恢复 + + + + Restores the saved pattern + 恢复保存的样式 + + + + Clear + 清空 + + + + Deletes the name + 删除这个名字 + + + + GeneneralConf + + + Show help message + 显示帮助文档 + + + + Show the help message at the beginning in the capture mode. + 在捕获之前显示帮助信息。 + + + + + Show desktop notifications + 显示桌面通知 + + + + Show tray icon + 显示托盘图标 + + + + Show the systemtray icon + 显示任务栏图标 + + + + + Import + 导入 + + + + + + Error + 错误 + + + + Unable to read file. + 无法读取文件。 + + + + + Unable to write file. + 无法写入文件。 + + + + Save File + 保存到文件 + + + + Confirm Reset + 确定重置 + + + + Are you sure you want to reset the configuration? + 你确定你想要重置配置? + + + + Configuration File + 配置文件 + + + + Export + 导出 + + + + Reset + 重置 + + + + Launch at startup + 开机时启动 + + + + Launch Flameshot + 启动 Flameshot + + + + ImgurUploader + + + Upload to Imgur + 上传到Imgur + + + + Uploading Image + 正在上传 + + + + Copy URL + 复制链接 + + + + Open URL + 打开链接 + + + + Delete image + 删除图像 + + + + Image to Clipboard. + 保存文件到剪贴板。 + + + + + Unable to open the URL. + 无法打开此链接。 + + + + URL copied to clipboard. + 复制链接到剪贴板。 + + + + Screenshot copied to clipboard. + 截图复制到剪贴板。 + + + + ImgurUploaderTool + + + Image Uploader + 上传图片 + + + + Uploads the selection to Imgur + 上传选择到 Imgur + + + + InfoWindow + + + About + 关于 + + + + Right Click + 右键 + + + + Mouse Wheel + 鼠标滑轮 + + + + Move selection 1px + 移动选择 1 px + + + + Resize selection 1px + 调整选择大小 1 px + + + + Quit capture + 退出捕获 + + + + Copy to clipboard + 复制到剪贴板 + + + + Save selection as a file + 将选择保存为文件 + + + + Undo the last modification + 撤消上次修改 + + + + Show color picker + 显示颜色选择器 + + + + Change the tool's thickness + 改变工具的厚度 + + + + Key + + + + + Description + 描述 + + + + <u><b>License</b></u> + <u><b>许可证</b></u> + + + + <u><b>Version</b></u> + <u><b>版本</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>快捷键</b></u> + + + + Available shortcuts in the screen capture mode. + 屏幕捕捉模式中的可用快捷键。 + + + + LineTool + + + Line + 直线 + + + + Sets the Line as the paint tool + 将直线线设置为绘画工具 + + + + MarkerTool + + + Marker + 标记 + + + + Sets the Marker as the paint tool + 将标记设置为绘画工具 + + + + MoveTool + + + Move + 移动 + + + + Move the selection area + 移动选择区域 + + + + PencilTool + + + Pencil + 铅笔 + + + + Sets the Pencil as the paint tool + 将铅笔设置为绘画工具 + + + + PinTool + + + Pin Tool + 贴图工具 + + + + Pin image on the desktop + 在桌面上固定图像 + + + + QObject + + + Save Error + 保存错误 + + + + + Capture saved as + 捕获已保存为 + + + + Capture saved to clipboard + 捕获已保存至剪贴板 + + + + + Error trying to save as + 尝试另存为时出错 + + + + + + + Unable to connect via DBus + 无法通过DBus进行连接 + + + + Error + 错误 + + + + Unable to write in + 无法写入 + + + + RectangleTool + + + Rectangle + 实心矩形 + + + + Sets the Rectangle as the paint tool + 将实心矩形设置为绘画工具 + + + + RedoTool + + + Redo + 重做 + + + + Redo the next modification + 重做上次修改 + + + + SaveTool + + + Save + 保存 + + + + Save the capture + 保存捕获 + + + + ScreenGrabber + + + Unable to capture screen + 无法捕获屏幕 + + + + SelectionTool + + + Rectangular Selection + 矩形选择 + + + + Sets the Selection as the paint tool + 将矩形选择设置为绘画工具 + + + + SizeIndicatorTool + + + Selection Size Indicator + 选择尺寸指示 + + + + Shows the dimensions of the selection (X Y) + 显示选择的尺寸 (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + 世纪(00-99) + + + + Year (00-99) + 年(00-99) + + + + Year (2000) + 年(2000) + + + + Month Name (jan) + 月(1月 - 12月) + + + + Month Name (january) + 月(一月 - 十二月) + + + + Month (01-12) + 月 (01-12) + + + + Week Day (1-7) + 周内的日(1-7) + + + + Week (01-53) + 周(01-53) + + + + Day Name (mon) + 星期(一 - 七) + + + + Day Name (monday) + 星期(星期一 - 星期日) + + + + Day (01-31) + 天(01-31) + + + + Day of Month (1-31) + 一月中的某天(1-31) + + + + Day (001-366) + 天(001-366) + + + + Time (%H-%M-%S) + 时间(%H-%M-%S) + + + + Time (%H-%M) + 时间(%H-%M) + + + + Hour (00-23) + 小时(00-23) + + + + Hour (01-12) + 小时(01-12) + + + + Minute (00-59) + 分钟(00-59) + + + + Second (00-59) + 秒(00-59) + + + + Full Date (%m/%d/%y) + 完整日期(%m/%d/%y) + + + + Full Date (%Y-%m-%d) + 完整日期(%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + Flameshot 消息 + + + + TextConfig + + + StrikeOut + 删除线 + + + + Underline + 下划线 + + + + Bold + 粗体 + + + + Italic + 斜体 + + + + TextTool + + + Text + 文本 + + + + Add text to your capture + 在您的捕获中添加文本 + + + + UIcolorEditor + + + UI Color Editor + 用户界面颜色编辑器 + + + + Change the color moving the selectors and see the changes in the preview buttons. + 移动颜色选择并在预览按钮查看。 + + + + Select a Button to modify it + 选择一个按钮以进行修改 + + + + Main Color + 主色 + + + + Click on this button to set the edition mode of the main color. + 点击按钮设置主色。 + + + + Contrast Color + 对比色 + + + + Click on this button to set the edition mode of the contrast color. + 点击按钮设置对比色。 + + + + UndoTool + + + Undo + 撤消 + + + + Undo the last modification + 撤消上次修改 + + + + VisualsEditor + + + Opacity of area outside selection: + 选中区域之外的不透明度: + + + + Button Selection + 按钮选择 + + + + Select All + 全选 + + + diff --git a/flameshot-0.6.0/translations/Internationalization_zh_TW.ts b/flameshot-0.6.0/translations/Internationalization_zh_TW.ts new file mode 100644 index 0000000000000000000000000000000000000000..e7d997e818d9f4fa35581d0a30aa98168293fc53 --- /dev/null +++ b/flameshot-0.6.0/translations/Internationalization_zh_TW.ts @@ -0,0 +1,898 @@ + + + + + AppLauncher + + + App Launcher + 應用程式啟動器 + + + + Choose an app to open the capture + 選擇一個程式打開此截圖 + + + + AppLauncherWidget + + + Open With + 打開 + + + + Launch in terminal + 在終端機中啟動 + + + + Keep open after selection + 選擇後維持此視窗開啟 + + + + + Error + 錯誤 + + + + Unable to launch in terminal. + 無法在終端機中啟動 + + + + Unable to write in + 無法寫入 + + + + ArrowTool + + + Arrow + 箭頭 + + + + Sets the Arrow as the paint tool + 選擇箭頭作為繪製工具 + + + + BlurTool + + + Blur + 模糊 + + + + Sets the Blur as the paint tool + 選擇模糊作為繪製工具 + + + + CaptureWidget + + + Unable to capture screen + 無法擷取螢幕 + + + + Select an area with the mouse, or press Esc to exit. +Press Enter to capture the screen. +Press Right Click to show the color picker. +Use the Mouse Wheel to change the thickness of your tool. +Press Space to open the side panel. + + + + + CircleTool + + + Circle + 圈型 + + + + Sets the Circle as the paint tool + 選擇圈型作為繪畫工具 + + + + ColorPickerWidget + + + Active color: + + + + + Press ESC to cancel + + + + + Grab Color + + + + + ConfigWindow + + + Configuration + 設定 + + + + Interface + 介面 + + + + Filename Editor + 檔案名稱編輯器 + + + + General + 一般 + + + + Controller + + + &Take Screenshot + + + + + &Configuration + &設定 + + + + &Information + &資訊 + + + + &Quit + &結束 + + + + CopyTool + + + Copy + 複製 + + + + Copies the selection into the clipboard + + + + + DBusUtils + + + Unable to connect via DBus + 無法透過 DBus 進行連接 + + + + ExitTool + + + Exit + 離開 + + + + Leave the capture screen + 離開螢幕擷取 + + + + FileNameEditor + + + Edit the name of your captures: + 編輯您的截圖名稱: + + + + Edit: + 編輯器: + + + + Preview: + 預覽: + + + + Save + 存檔 + + + + Saves the pattern + 儲存樣式 + + + + Reset + 重設 + + + + Restores the saved pattern + 恢復儲存的樣式 + + + + Clear + 清空 + + + + Deletes the name + 刪除這個名稱 + + + + GeneneralConf + + + Show help message + 顯示説明資訊 + + + + Show the help message at the beginning in the capture mode. + 在擷取之前顯示説明資訊 + + + + + Show desktop notifications + 顯示桌面通知 + + + + Show tray icon + 顯示託盤圖示 + + + + Show the systemtray icon + 顯示工作列圖示 + + + + + Import + 匯入 + + + + + + Error + 錯誤 + + + + Unable to read file. + 無法讀取檔案 + + + + + Unable to write file. + 無法寫入檔案 + + + + Save File + 存檔 + + + + Confirm Reset + 確認重設 + + + + Are you sure you want to reset the configuration? + 你確定你想要重設? + + + + Configuration File + 設定檔 + + + + Export + 匯出 + + + + Reset + 重設 + + + + Launch at startup + 自動啟動 + + + + Launch Flameshot + + + + + ImgurUploader + + + Upload to Imgur + 上傳到 Imgur + + + + Uploading Image + 正在上傳 + + + + Copy URL + 複製連結 + + + + Open URL + 打開連結 + + + + Delete image + + + + + Image to Clipboard. + 將檔案複製到剪貼簿 + + + + + Unable to open the URL. + 無法打開此連結 + + + + URL copied to clipboard. + 連結已複製到剪貼簿 + + + + Screenshot copied to clipboard. + 截圖已複製到剪貼簿 + + + + ImgurUploaderTool + + + Image Uploader + 上傳圖片 + + + + Uploads the selection to Imgur + 上傳到 Imgur + + + + InfoWindow + + + About + 關於 + + + + Right Click + 右鍵 + + + + Mouse Wheel + 滑鼠滑輪 + + + + Move selection 1px + 移動 1px + + + + Resize selection 1px + 調整大小 1px + + + + Quit capture + 結束擷取 + + + + Copy to clipboard + 複製到剪貼簿 + + + + Save selection as a file + 將選擇範圍另存新檔 + + + + Undo the last modification + 復原上次修改 + + + + Show color picker + 顯示顏色選擇器 + + + + Change the tool's thickness + 改變工具的寬度 + + + + Key + + + + + Description + 描述 + + + + <u><b>License</b></u> + <u><b>授權條款</b></u> + + + + <u><b>Version</b></u> + <u><b>版本</b></u> + + + + <u><b>Shortcuts</b></u> + <u><b>快速鍵</b></u> + + + + Available shortcuts in the screen capture mode. + 螢幕擷取模式中的可用快速鍵 + + + + LineTool + + + Line + 直線 + + + + Sets the Line as the paint tool + 將直線線設定為繪畫工具 + + + + MarkerTool + + + Marker + 標記 + + + + Sets the Marker as the paint tool + 將標記設定為繪畫工具 + + + + MoveTool + + + Move + 移動 + + + + Move the selection area + 移動選擇區域 + + + + PencilTool + + + Pencil + 鉛筆 + + + + Sets the Pencil as the paint tool + 將鉛筆設定為繪畫工具 + + + + PinTool + + + Pin Tool + + + + + Pin image on the desktop + + + + + QObject + + + Save Error + 存檔錯誤 + + + + + Capture saved as + 截圖已另存為 + + + + Capture saved to clipboard + + + + + + Error trying to save as + 嘗試另存新檔時發生錯誤 + + + + + + + Unable to connect via DBus + 無法透過 DBus 進行連接 + + + + Error + 錯誤 + + + + Unable to write in + 無法寫入 + + + + RectangleTool + + + Rectangle + 實心矩形 + + + + Sets the Rectangle as the paint tool + 將實心矩形設定為繪畫工具 + + + + RedoTool + + + Redo + + + + + Redo the next modification + + + + + SaveTool + + + Save + 儲存 + + + + Save the capture + 儲存擷取 + + + + ScreenGrabber + + + Unable to capture screen + 無法擷取螢幕 + + + + SelectionTool + + + Rectangular Selection + 矩形選擇 + + + + Sets the Selection as the paint tool + 將矩形選擇設定為繪畫工具 + + + + SizeIndicatorTool + + + Selection Size Indicator + 選擇尺寸指示 + + + + Shows the dimensions of the selection (X Y) + 顯示選擇的尺寸 (X Y) + + + + StrftimeChooserWidget + + + Century (00-99) + 世紀 (00-99) + + + + Year (00-99) + 年 (00-99) + + + + Year (2000) + 年 (2000) + + + + Month Name (jan) + 月 (jul) + + + + Month Name (january) + 月 (juliol) + + + + Month (01-12) + 月 (01-12) + + + + Week Day (1-7) + 平常日 (1-7) + + + + Week (01-53) + 周 (01-53) + + + + Day Name (mon) + 星期 (dg) + + + + Day Name (monday) + 星期 (diumenge) + + + + Day (01-31) + 天 (01-31) + + + + Day of Month (1-31) + 一月中的某天 (1-31) + + + + Day (001-366) + 天 (001-366) + + + + Time (%H-%M-%S) + + + + + Time (%H-%M) + + + + + Hour (00-23) + 小時 (00-23) + + + + Hour (01-12) + 小時 (01-12) + + + + Minute (00-59) + 分鐘 (00-59) + + + + Second (00-59) + 秒 (00-59) + + + + Full Date (%m/%d/%y) + 日期 (%m/%d/%y) + + + + Full Date (%Y-%m-%d) + 日期 (%Y-%m-%d) + + + + SystemNotification + + + Flameshot Info + + + + + TextConfig + + + StrikeOut + + + + + Underline + + + + + Bold + + + + + Italic + + + + + TextTool + + + Text + + + + + Add text to your capture + + + + + UIcolorEditor + + + UI Color Editor + UI 顏色編輯器 + + + + Change the color moving the selectors and see the changes in the preview buttons. + 移動顏色選擇並在預覽按鈕檢視 + + + + Select a Button to modify it + 選擇一個按鈕來修改它 + + + + Main Color + 主色 + + + + Click on this button to set the edition mode of the main color. + 點選按鈕設定主色 + + + + Contrast Color + 對比色 + + + + Click on this button to set the edition mode of the contrast color. + 點選按鈕設定對比色 + + + + UndoTool + + + Undo + 復原 + + + + Undo the last modification + 復原上次修改 + + + + VisualsEditor + + + Opacity of area outside selection: + 選擇區域以外的不透明度 + + + + Button Selection + 按鈕選擇 + + + + Select All + 全選 + + + diff --git a/flameshot-0.6.0/travis/linux_after_success.sh b/flameshot-0.6.0/travis/linux_after_success.sh new file mode 100644 index 0000000000000000000000000000000000000000..4a2e2711c46f53a68b016be19cb8eb62bd30baae --- /dev/null +++ b/flameshot-0.6.0/travis/linux_after_success.sh @@ -0,0 +1,27 @@ +#!/bin/bash -- + +set -e + +DIST_PATH=dist + +if [[ "${DIST}" == "trusty" ]]; then + travis_retry curl \ + --upload-file \ + "${DIST_PATH}"/flameshot_${ARCH}_${VERSION}.${EXTEN} \ + "https://transfer.sh/flameshot_${ARCH}_${VERSION}.${EXTEN}" +else + case "${OS}" in + "ubuntu"|"debian") + travis_retry curl \ + --upload-file \ + "${DIST_PATH}"/flameshot_${VERSION}-${DIST}-${ARCH}_${ARCH}.${EXTEN} \ + "https://transfer.sh/flameshot_${VERSION}-${DIST}-${ARCH}_${ARCH}.${EXTEN}" + ;; + "fedora") + travis_retry curl \ + --upload-file \ + "${DIST_PATH}"/flameshot_${VERSION}-fedora${DIST}-${ARCH}_${ARCH}.${EXTEN} \ + "https://transfer.sh/flameshot_${VERSION}-fedora${DIST}-${ARCH}_${ARCH}.${EXTEN}" + ;; + esac +fi diff --git a/flameshot-0.6.0/travis/linux_before_install.sh b/flameshot-0.6.0/travis/linux_before_install.sh new file mode 100644 index 0000000000000000000000000000000000000000..f6bfcebc11e98feb4440300f588c5e340db9e9a3 --- /dev/null +++ b/flameshot-0.6.0/travis/linux_before_install.sh @@ -0,0 +1,15 @@ +#!/bin/bash -- + +set -e + +if [[ "${DIST}" == "trusty" ]]; then + travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + travis_retry sudo add-apt-repository -y ppa:beineri/opt-qt532-trusty + travis_retry sudo apt-get -qq update + + # Get linuxdeployqt tool + travis_retry wget \ + -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" \ + -O linuxdeployqt + chmod +x linuxdeployqt +fi diff --git a/flameshot-0.6.0/travis/linux_install.sh b/flameshot-0.6.0/travis/linux_install.sh new file mode 100644 index 0000000000000000000000000000000000000000..d712c7b63dac3f2eb85edeb230a2c15eea8174f4 --- /dev/null +++ b/flameshot-0.6.0/travis/linux_install.sh @@ -0,0 +1,27 @@ +#!/bin/bash -- + +set -e + +if [[ "${DIST}" == "trusty" ]]; then + travis_retry sudo apt-get install -qq build-essential git + + travis_retry sudo -E apt-get -yq \ + --no-install-suggests --no-install-recommends --force-yes \ + install openssl libssl-dev + + #travis_retry sudo -E apt-get -yq \ + # --no-install-suggests --no-install-recommends --force-yes \ + # install libgl1-mesa-dev + + travis_retry sudo -E apt-get -yq \ + --no-install-suggests --no-install-recommends --force-yes \ + install tree + + travis_retry sudo apt-get install -qq gcc-4.9 g++-4.9 + + # Install qt5.3.2 + travis_retry sudo apt-get -y install qt53base qt53tools qt53svg + + # Install fcitx-frontend-qt5 + travis_retry sudo apt-get -y install fcitx-frontend-qt5 +fi diff --git a/flameshot-0.6.0/travis/linux_script.sh b/flameshot-0.6.0/travis/linux_script.sh new file mode 100644 index 0000000000000000000000000000000000000000..40f9f7c648419c5805d44bd473df93f0add263d7 --- /dev/null +++ b/flameshot-0.6.0/travis/linux_script.sh @@ -0,0 +1,131 @@ +#!/bin/bash -- + +set -e + +DIST_PATH=dist + +if [[ ! -d "${DIST_PATH}" ]]; then + mkdir "${DIST_PATH}" +fi + +if [[ "${DIST}" == "trusty" ]]; then + project_dir="$(pwd)" + BUILD_DST_PATH=build-test + APPIMAGE_DST_PATH=build-appimage + + #source /opt/qt53/bin/qt53-env.sh + QT_BASE_DIR=/opt/qt53 + export QTDIR="${QT_BASE_DIR}" + export PATH="${QT_BASE_DIR}"/bin:"${PATH}" + export LD_LIBRARY_PATH="${QT_BASE_DIR}"/lib/x86_64-linux-gnu:"${QT_BASE_DIR}"/lib:"${LD_LIBRARY_PATH}" + export PKG_CONFIG_PATH="${QT_BASE_DIR}"/lib/pkgconfig:"${PKG_CONFIG_PATH}" + + qmake --version + export CC=gcc-4.9 CXX=g++-4.9 + + mkdir "${BUILD_DST_PATH}" + qmake QMAKE_CXX="${CXX}" QMAKE_CC="${CC}" QMAKE_LINK="${CXX}" DESTDIR="${BUILD_DST_PATH}" + # Building flameshot + make -j$(nproc) + # Running flameshot tests + make check -j$(nproc) + ls -alhR + + # + # Packaging AppImage using linuxdeployqt + # + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/bin + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/interfaces + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/services + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/metainfo + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/bash-completion/completions + mkdir -p "${APPIMAGE_DST_PATH}"/appdir/usr/share/flameshot/translations + cp \ + "${BUILD_DST_PATH}"/flameshot \ + "${APPIMAGE_DST_PATH}"/appdir/usr/bin/ + cp \ + "${project_dir}"/dbus/org.dharkael.Flameshot.xml \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/interfaces/ + cp \ + "${project_dir}"/dbus/package/org.dharkael.Flameshot.service \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/dbus-1/services/ + cp \ + "${project_dir}"/docs/appdata/flameshot.appdata.xml \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/metainfo/ + cp \ + "${project_dir}"/docs/bash-completion/flameshot \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/bash-completion/completions/ + cp \ + "${project_dir}"/translations/*.qm \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/flameshot/translations/ + cp \ + "${project_dir}"/docs/desktopEntry/package/* \ + "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications/ + cp \ + "${project_dir}"/img/app/flameshot.png \ + "${APPIMAGE_DST_PATH}"/appdir/ + ls -alhR "${APPIMAGE_DST_PATH}"/appdir + + # Copy other project files + cp "${project_dir}"/README.md "${APPIMAGE_DST_PATH}"/appdir/README.md + cp "${project_dir}"/LICENSE "${APPIMAGE_DST_PATH}"/appdir/LICENSE + echo "${VERSION}" > "${APPIMAGE_DST_PATH}"/appdir/version + echo "${TRAVIS_COMMIT}" >> "${APPIMAGE_DST_PATH}"/appdir/version + + # Configure env vars + unset QTDIR + unset QT_PLUGIN_PATH + unset LD_LIBRARY_PATH + tree "${APPIMAGE_DST_PATH}"/appdir + + # Packaging + # -verbose=2 + ./linuxdeployqt "${APPIMAGE_DST_PATH}"/appdir/usr/bin/flameshot -bundle-non-qt-libs + + rm -f "${APPIMAGE_DST_PATH}"/appdir/usr/lib/libatk-1.0.so.0 + cp \ + /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \ + "${APPIMAGE_DST_PATH}"/appdir/usr/plugins/platforminputcontexts/ + cd "${APPIMAGE_DST_PATH}"/appdir/usr/bin + ln -sf ../plugins/platforms/ . # An unknown bug + ln -sf ../share/flameshot/translations/ . # add translation soft link + cd "${project_dir}" + + # -verbose=2 + ./linuxdeployqt "${APPIMAGE_DST_PATH}"/appdir/usr/share/applications/flameshot.desktop -appimage + + ls -alhR -- *.AppImage + cp -- *.AppImage "${APPIMAGE_DST_PATH}"/ + + tree "${APPIMAGE_DST_PATH}"/ + + ls -l "${APPIMAGE_DST_PATH}"/*.AppImage + + # Rename AppImage and move AppImage to DIST_PATH + cd "${APPIMAGE_DST_PATH}" + mv Flameshot-${VERSION}-${ARCH}.AppImage flameshot_${ARCH}_${VERSION}.AppImage + cd .. + cp \ + "${APPIMAGE_DST_PATH}"/flameshot_${ARCH}_${VERSION}.AppImage \ + "${DIST_PATH}"/flameshot_${ARCH}_${VERSION}.${EXTEN} + pwd +else + travis_retry git clone https://github.com/packpack/packpack.git + travis_retry packpack/packpack + pwd && ls + + case "${OS}" in + "ubuntu"|"debian") + # copy deb to dist path for distribution + cp \ + build/flameshot_*_*.deb \ + "${DIST_PATH}"/flameshot_${VERSION}-${DIST}-${ARCH}_${ARCH}.${EXTEN} + ;; + "fedora") + cp \ + build/flameshot-${VERSION}-${RELEASE}.*.${ARCH}.rpm \ + "${DIST_PATH}"/flameshot_${VERSION}-fedora${DIST}-${ARCH}_${ARCH}.${EXTEN} + ;; + esac +fi diff --git a/flameshot-0.6.0/travis/osx_script.sh b/flameshot-0.6.0/travis/osx_script.sh new file mode 100644 index 0000000000000000000000000000000000000000..18a3ac3fd394d0d4a96c23712911a9edadfff482 --- /dev/null +++ b/flameshot-0.6.0/travis/osx_script.sh @@ -0,0 +1,55 @@ +#!/bin/bash -- + +set -e + +project_dir="$(pwd)" + +brew update > /dev/null +brew install qt +QTDIR=/usr/local/opt/qt +PATH="${QTDIR}"/bin:"${PATH}" +LDFLAGS=-L"${QTDIR}"/lib +CPPFLAGS=-I"${QTDIR}"/include + +# Build your app +cd "${project_dir}" +mkdir dist +mkdir build +cd build +qmake -version +qmake CONFIG-=debug CONFIG+=release CONFIG+=packaging ../flameshot.pro +make -j$(nproc) + +git clone https://github.com/aurelien-rainone/macdeployqtfix.git +pwd +ls + +ls /Users/travis/build/ZetaoYang/flameshot + +# Package DMG from build/flamshot.app directory +"${QTDIR}"/bin/macdeployqt flameshot.app +python \ + "${project_dir}"/build/macdeployqtfix/macdeployqtfix.py \ + flameshot.app/Contents/MacOS/flameshot \ + "${QTDIR}" + +cd "${project_dir}"/build +mkdir -p distrib/Flameshot +cd distrib/Flameshot +mv "${project_dir}"/build/flameshot.app "${project_dir}"/build/distrib/Flameshot/ +cp "${project_dir}"/LICENSE LICENSE +cp "${project_dir}"/README.md README.md +echo "${VERSION}" > version +echo "${TRAVIS_COMMIT}" >> version + +ln -s /Applications ./Applications + +cd .. +hdiutil create -srcfolder ./Flameshot -format UDBZ ./flameshot.dmg +mv flameshot.dmg flameshot_X64_${VERSION}.dmg +mv flameshot_X64_${VERSION}.dmg "${project_dir}"/dist/flameshot_X64_$VERSION.dmg +curl \ + --upload-file \ + flameshot_X64_$VERSION.dmg \ + "https://transfer.sh/flameshot_X64_$VERSION.dmg" +cd .. diff --git a/flameshot.spec b/flameshot.spec new file mode 100644 index 0000000000000000000000000000000000000000..2b44ef89eb8beeee530ea0eeb21874e688ae33a7 --- /dev/null +++ b/flameshot.spec @@ -0,0 +1,90 @@ +Name: flameshot +Version: 0.6.0 +Release: 4.6%{?dist} + +# Main code: GPLv3 +# Logo: Free Art License v1.3 +# Button icons: Apache License 2.0 +# capture/capturewidget.cpp and capture/capturewidget.h: GPLv2 +# regiongrabber.cpp: LGPL +# Qt-Color-Widgets: LGPL/GPL +# More information: https://github.com/lupoDharkael/flameshot#license +License: GPLv3+ and ASL 2.0 and GPLv2 and LGPLv3 and Free Art +Summary: Powerful and simple to use screenshot software + +URL: https://github.com/lupoDharkael/flameshot +Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz + +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(Qt5Network) +BuildRequires: pkgconfig(Qt5Multimedia) +BuildRequires: pkgconfig(Qt5Concurrent) +BuildRequires: pkgconfig(Qt5DBus) +BuildRequires: cmake(Qt5Svg) + +BuildRequires: desktop-file-utils +BuildRequires: libappstream-glib +BuildRequires: qt5-linguist +BuildRequires: gcc-c++ +BuildRequires: gcc + +Requires: hicolor-icon-theme +Requires: qt5-qtsvg%{?_isa} + +%description +Powerful and simple to use screenshot software with built-in +editor with advanced features. + +%prep +%autosetup -p1 +mkdir %{_target_platform} + +%build +pushd %{_target_platform} + %qmake_qt5 PREFIX=%{_prefix} CONFIG+=packaging .. +popd + +%make_build -C %{_target_platform} + +%install +%make_install INSTALL_ROOT=%{buildroot} -C %{_target_platform} +%find_lang Internationalization --with-qt +chmod +x %{_builddir}/%{name}-%{version}/flameshotgui.sh +cp %{_builddir}/%{name}-%{version}/flameshotgui.sh %{buildroot}/%{_bindir}/ + +%check +appstream-util validate-relax --nonet "%{buildroot}%{_datadir}/metainfo/%{name}.appdata.xml" +desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop + +%files -f Internationalization.lang +%doc README.md +%license LICENSE img/app/flameshotLogoLicense.txt +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/translations +%{_bindir}/%{name} +%{_bindir}/flameshotgui.sh +%{_datadir}/applications/*.desktop +%{_datadir}/metainfo/%{name}.appdata.xml +%{_datadir}/bash-completion/completions/%{name} +%{_datadir}/dbus-1/interfaces/*.xml +%{_datadir}/dbus-1/services/*.service +%{_datadir}/icons/hicolor/*/apps/%{name}.* + +%changelog +* Tue Sep 22 2020 Zhou Tuan - 0.6.0-4.6 +- 按照flameshot官方说明修改截图快捷键命令 + +* Mon Sep 14 2020 Zhou Tuan - 0.6.0-4.5 +- 修复保存截图不能切换输入法bug + +* Wed Sep 09 2020 Zhou Tuan - 0.6.0-4.4 +- 修复保存截图不能切换输入法问题 + +* Fri Jul 17 2020 Zhou Tuan - 0.6.0-4.3 +- 合入flameshot-0.6.0-4版本 + +* Thu Jul 16 2020 Zhou Tuan - 0.6.0-4.2 +- 屏蔽图片上传入口 + +* Thu Jul 16 2020 Zhou Tuan - 0.6.0-4.1 +- 修改主色调