Git commit c969f9cb83d60d79ebb0514291861be908e213be by Nicolas Fella. Committed on 03/06/2026 at 10:17. Pushed by nicolasfella into branch 'master'.
Remove content, replace with Readme This was only used on X11, which we don't support any more D +0 -70 CMakeLists.txt D +0 -54 ChangeLog D +0 -121 LICENSES/CC0-1.0.txt D +0 -319 LICENSES/GPL-2.0-or-later.txt A +3 -0 README.md D +0 -1 doc/CMakeLists.txt D +0 -164 doc/index.docbook D +0 -22 kcmkgamma/CMakeLists.txt D +0 -2 kcmkgamma/Messages.sh D +0 -54 kcmkgamma/displaynumber.cpp D +0 -34 kcmkgamma/displaynumber.h D +0 -131 kcmkgamma/gammactrl.cpp D +0 -69 kcmkgamma/gammactrl.h D +0 -194 kcmkgamma/kcm_kgamma.json D +0 -618 kcmkgamma/kgamma.cpp D +0 -65 kcmkgamma/kgamma.h D +0 -10 kcmkgamma/pics/CMakeLists.txt D +- -- kcmkgamma/pics/background.png D +- -- kcmkgamma/pics/cmyscale.png D +- -- kcmkgamma/pics/darkgrey.png D +- -- kcmkgamma/pics/greyscale.png D +- -- kcmkgamma/pics/lightgrey.png D +- -- kcmkgamma/pics/midgrey.png D +- -- kcmkgamma/pics/rgbscale.png D +0 -51 kcmkgamma/xf86configpath.cpp D +0 -31 kcmkgamma/xf86configpath.h D +0 -177 kcmkgamma/xvidextwrap.cpp D +0 -52 kcmkgamma/xvidextwrap.h D +0 -6 xf86gammacfg/CMakeLists.txt D +0 -119 xf86gammacfg/xf86gammacfg.cpp https://invent.kde.org/plasma/kgamma/-/commit/c969f9cb83d60d79ebb0514291861be908e213be diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 6aace57..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -cmake_minimum_required(VERSION 3.16) - -project(kgamma) -set(PROJECT_VERSION "6.7.80") - -set(QT_MIN_VERSION "6.10.0") -set(KF6_MIN_VERSION "6.26.0") -set(KDE_COMPILERSETTINGS_LEVEL "5.82") - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - -include(KDEInstallDirs) -include(KDECMakeSettings) -include(KDECompilerSettings NO_POLICY_SCOPE) -include(FeatureSummary) -include(KDEClangFormat) -include(KDEGitCommitHooks) -include(ECMDeprecationSettings) - -option(BUILD_DOC "Whether to build the documentation" ON) - -find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) - -find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS - Config - ConfigWidgets - I18n - KCMUtils -) - -if (BUILD_DOC) - find_package(KF6DocTools ${KF6_MIN_VERSION}) - set_package_properties(KF6DocTools PROPERTIES - DESCRIPTION "Tools to generate documentation" - TYPE REQUIRED - ) -endif() - -find_package(X11 REQUIRED COMPONENTS xf86vmode) - -# X11_xf86vmode discovery is done by FindX11 -add_feature_info("X11_xf86vmode" X11_xf86vmode_FOUND "Required to build kgamma.") - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -ecm_set_disabled_deprecation_versions(QT 6.11.0 - KF 6.23.0 -) - - -add_subdirectory(kcmkgamma) -# add_subdirectory(xf86gammacfg) - -if (BUILD_DOC) - add_subdirectory(doc) - kdoctools_install(po) -endif() - -# add clang-format target for all our real source files -file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) -kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) -kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT) - -ki18n_install(po) - -feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/ChangeLog b/ChangeLog deleted file mode 100644 index 6ffc823..0000000 --- a/ChangeLog +++ /dev/null @@ -1,54 +0,0 @@ -KGamma 0.9.9: - -* Add multi-head support (fix bug #321) -* Add screen selector -* Add screen synchronisation -* Change kgammarc format (old user settings are lost) -* Fix a localisation bug in class GammaCtrl -* Add class XF86ConfigPath -* Add Dutch translation (by Rinse de Vries) -* Add Czech translation (by Daniel Prynych) - -KGamma 0.9.2: - -* Fix compile errors with configure option --enable-final (again) -* Cancel the split into two parts (admin and user mode), add a - checkbox to choose where to store the settings (user config file - or XF86Config) - -KGamma 0.9.1: - -* Fix compile errors with configure option --enable-final -* French and spanish translation update -* Install script update - -KGamma 0.9: - -* Add admin mode (in this mode, gamma settings are stored to XF86Config) -* Add spec file for RPM based distributions (Dominik Seichter) -* Remove class RGBCtrl, handle the widgets in main widget -* Add check for XFree86-VidModeExtension to configure.in.in -* Add wrapper class XVidExtWrap to access XFree86-VidModeExtension directly, - KGamma no longer needs xgamma as a backend - -KGamma 0.2.3: - -* Minor install script changes, should compile with KDE2 and KDE3 now - -KGamma 0.2.2: - -* Ported to KDE3 - -KGamma 0.2.1: - -* Code clean up -* Converted all strings to QString to avoid copying between QString and char* -* Add french localisation (Pierre Jarillon) -* Add italian localization (Daniele Medri) - -KGamma 0.2: - -* Add spanish translation (Miguel Novas) -* Change behavior of "Use Defaults" button to be compliant with kcontrol standard -* Partial rewrite to make it a KDE control center plugin -* Create new logo diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt deleted file mode 100644 index 0e259d4..0000000 --- a/LICENSES/CC0-1.0.txt +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. diff --git a/LICENSES/GPL-2.0-or-later.txt b/LICENSES/GPL-2.0-or-later.txt deleted file mode 100644 index 1d80ac3..0000000 --- a/LICENSES/GPL-2.0-or-later.txt +++ /dev/null @@ -1,319 +0,0 @@ -GNU GENERAL PUBLIC LICENSE - -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. - -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to share -and change it. By contrast, the GNU General Public License is intended to -guarantee your freedom to share and change free software--to make sure the -software is free for all its users. This General Public License applies to -most of the Free Software Foundation's software and to any other program whose -authors commit to using it. (Some other Free Software Foundation software -is covered by the GNU Lesser General Public License instead.) You can apply -it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom -to distribute copies of free software (and charge for this service if you -wish), that you receive source code or can get it if you want it, that you -can change the software or use pieces of it in new free programs; and that -you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to -deny you these rights or to ask you to surrender the rights. These restrictions -translate to certain responsibilities for you if you distribute copies of -the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or -for a fee, you must give the recipients all the rights that you have. You -must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) -offer you this license which gives you legal permission to copy, distribute -and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that -everyone understands that there is no warranty for this free software. If -the software is modified by someone else and passed on, we want its recipients -to know that what they have is not the original, so that any problems introduced -by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We -wish to avoid the danger that redistributors of a free program will individually -obtain patent licenses, in effect making the program proprietary. To prevent -this, we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification -follow. - -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. - -<one line to give the program's name and an idea of what it does.> - -Copyright (C) <yyyy> <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 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. - -<signature of Ty Coon>, 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/README.md b/README.md new file mode 100644 index 0000000..35e830e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +This project is no longer maintained since it was only relevant in an X11 session. + +The last maintained version is in the Plasma/6.7 branch. diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt deleted file mode 100644 index e299046..0000000 --- a/doc/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -kdoctools_create_handbook(index.docbook INSTALL_DESTINATION ${KDE_INSTALL_DOCBUNDLEDIR}/en SUBDIR kcontrol/kgamma) diff --git a/doc/index.docbook b/doc/index.docbook deleted file mode 100644 index ac0b20b..0000000 --- a/doc/index.docbook +++ /dev/null @@ -1,164 +0,0 @@ -<?xml version="1.0" ?> -<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.5-Based Variant V1.1//EN" - "dtd/kdedbx45.dtd" [ - <!ENTITY % addindex "IGNORE"> - <!ENTITY % English "INCLUDE"><!-- change language only here --> -]> - -<article id="kgamma" lang="&language;"> -<title>Monitor Gamma</title> - -<articleinfo> -<authorgroup> -<author> -<firstname>Michael</firstname> -<surname>v.Ostheim</surname> -<affiliation> -<address><email>[email protected]</email></address> -</affiliation> -</author> -<!-- TRANS:ROLES_OF_TRANSLATORS --> -</authorgroup> - -<date>2015-07-31</date> -<releaseinfo>Plasma 5.4</releaseinfo> - -<keywordset> -<keyword>KDE</keyword> -<keyword>System Settings</keyword> -<keyword>Monitor</keyword> -<keyword>Calibration</keyword> -<keyword>Gamma</keyword> -</keywordset> - -</articleinfo> - -<sect1 id="introduction"> -<title>Introduction</title> - -<para>This module is a tool for monitor gamma correction. With proper gamma -settings, your display (websites, images, &etc;) will look the same on your -monitor as on other monitors.</para> -<para>It allows you to alter the monitor's gamma correction of the -&X-Server;. But that's not all to do. For good results you have to set the -correct brightness, contrast and color balance of your monitor. This -may be difficult and you have to repeat every step several times. -For perfect results you need really good (and expensive) hardware.</para> -<para>Use the four sliders to define the gamma correction either as a single -value, or separately for the red, green and blue components. The &X-Server; -default setting for gamma is 1.00 (&Mac; 1.80, WinXX 2.20). The test images help -you to find proper settings.</para> -<para>To store the gamma settings system wide, enable the option <guilabel>Save -settings system wide</guilabel>. The system settings will be restored at next &X-Server; -startup. You need root access to use this option. Use this if you want to -correct the gamma settings for all users and graphical environments on this -machine.</para> -<para>To store the gamma settings to your personal &plasma; configuration, do not -enable that option. The user settings will be restored at next &plasma; startup and -replace temporary the system gamma settings. The system settings are not removed by -that and will be restored at next &X-Server; startup.</para> -<para>On multi head systems, select the screen you want to alter with the combo -box. This will also work with xinerama enabled. If you want to set all screens -to the same gamma values, enable the <guilabel>Sync screens</guilabel> option. On systems with only -one screen this option will take no effect.</para> -</sect1> - -<sect1 id="using_test_images"> -<title>Using the Test Images</title> -<para>This module provides six different test pictures selectable from the drop down box at the top of the window.</para> -<sect2 id="grey"> -<title>Grey Scale Test Image</title> -<para>You should be able to see the following:</para> -<itemizedlist> -<listitem> -<para>A grayscale with 20 different sections</para> -</listitem> -<listitem> -<para>The darkest section pure black</para> -</listitem> -<listitem> -<para>The lightest section pure white</para> -</listitem> -<listitem> -<para>No hint of any color in the gray tones</para> -</listitem> -</itemizedlist> - -<para>If you cannot see all of the 20 sections, use your monitors contrast settings -or the <guilabel>Gamma:</guilabel> slider to correct this. If black is not pure black, -try to darken the monitor, if white is not pure white, try to lighten -it. If you see any colors in the gray tones alter the color balance settings of -your monitor or the <guilabel>Red:</guilabel>, <guilabel>Green:</guilabel> and <guilabel>Blue:</guilabel> sliders.</para> -</sect2> - -<sect2 id="RGB-Scale"> -<title>RGB Scale Test Picture</title> -<para> -You should be able to see three strips, each with 16 sections of red, -green or blue tones. The darkest sections should be pure black, the brightest -should be pure red, green or blue. If you don't see all sections of -a color strip, try to lighten or darken this color.</para> -</sect2> - -<sect2 id="CMY-Scale"> -<title>CMY Scale Test Picture</title> -<para> -You should be able to see three strips, each with 11 sections of cyan, -magenta or yellow tones. The brightest sections should be pure white, the darkest -should be pure cyan, magenta or yellow.</para> - -<itemizedlist> -<listitem> -<para>If you cannot see all cyan sections, try to lighten or darken red</para> -</listitem> -<listitem> -<para>If you cannot see all magenta sections, try to lighten or darken green</para> -</listitem> -<listitem> -<para>If you cannot see all yellow sections, try to lighten or darken blue</para> -</listitem> -</itemizedlist> -</sect2> - -<sect2 id="advanced"> -<title>Advanced Test Pictures</title> -<para> -The following three pictures show you the abilities of your monitor at -three points of the gray spectrum. If you cannot see all of the details, -don't be worry, or buy better hardware. -</para> -<sect3 id="dark-gray"> -<title>Dark Gray Test Picture</title> -<para> -You should be able to see 10 different rectangles of dark gray within a -black box. The chart shows you 1% steps from black. -</para> -</sect3> -<sect3 id="mid-gray"> -<title>Mid Gray Test Picture</title> -<para> -This picture shows you 11 gray rectangles within a 50% gray box. You should be -able to see all of the rectangles except the middle one. The rectangles represent -the steps from 45% to 55% gray. -</para> -</sect3> -<sect3 id="light-gray"> -<title>Light Gray Test Picture</title> -<para> -You should be able to see 10 different rectangles of light gray within a white box. -The chart shows you 1% steps from white. -</para> -</sect3> -</sect2> -</sect1> - -</article> -<!-- -Local Variables: -mode: sgml -sgml-minimize-attributes:nil -sgml-general-insert-case:lower -sgml-indent-step:0 -sgml-indent-data:nil -End: ---> diff --git a/kcmkgamma/CMakeLists.txt b/kcmkgamma/CMakeLists.txt deleted file mode 100644 index 8cc10e8..0000000 --- a/kcmkgamma/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -add_definitions(-DTRANSLATION_DOMAIN=\"kcmkgamma\") - -add_subdirectory(pics) - -kcoreaddons_add_plugin(kcm_kgamma INSTALL_NAMESPACE "plasma/kcms/systemsettings_qwidgets") -kcmutils_generate_desktop_file(kcm_kgamma) - -target_sources(kcm_kgamma PRIVATE - xf86configpath.cpp xf86configpath.h - xvidextwrap.cpp xvidextwrap.h - displaynumber.cpp displaynumber.h - gammactrl.cpp gammactrl.h - kgamma.cpp kgamma.h -) - -target_link_libraries(kcm_kgamma ${X11_Xxf86vm_LIB} ${X11_LIBRARIES} Qt6::Core Qt6::Widgets KF6::ConfigCore KF6::KCMUtils KF6::I18n) - -add_custom_command(TARGET kcm_kgamma POST_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink ../kcms/systemsettings_qwidgets/kcm_kgamma.so kcm_kgamma_init.so) - -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kcm_kgamma_init.so DESTINATION ${KDE_INSTALL_PLUGINDIR}/plasma/kcminit) - diff --git a/kcmkgamma/Messages.sh b/kcmkgamma/Messages.sh deleted file mode 100644 index 3e1caf1..0000000 --- a/kcmkgamma/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -$XGETTEXT *.cpp -o $podir/kcmkgamma.pot diff --git a/kcmkgamma/displaynumber.cpp b/kcmkgamma/displaynumber.cpp deleted file mode 100644 index 3c9af25..0000000 --- a/kcmkgamma/displaynumber.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2003 Michael v.Ostheim <[email protected]> - */ - -#include <QDebug> -#include <QFontMetrics> -#include <QFrame> -#include <QLabel> -#include <QString> - -#include "displaynumber.h" - -DisplayNumber::DisplayNumber(QWidget *parent, int digits, int prec) - : QLabel(parent) -{ - setPrecision(prec); - setWidth(digits); - setAlignment(Qt::AlignCenter); - setFocusPolicy(Qt::NoFocus); -} - -DisplayNumber::~DisplayNumber() -{ -} - -void DisplayNumber::setFont(const QFont &f) -{ - QLabel::setFont(f); - setWidth(dg); -} - -void DisplayNumber::setWidth(int digits) -{ - QFontMetrics fm(font()); - QString s(QStringLiteral("0123456789.+-")); - int width = 0, charWidth = 0; - - for (int i = 0; i < 11; i++, width = fm.boundingRect(s[i]).width()) { - charWidth = (width > charWidth) ? width : charWidth; - } - - dg = digits; - setMinimumWidth(dg * charWidth + charWidth / 2); -} - -void DisplayNumber::setNum(double num) -{ - QString text; - setText(text.setNum(num, 'f', precision)); -} - -#include "moc_displaynumber.cpp" diff --git a/kcmkgamma/displaynumber.h b/kcmkgamma/displaynumber.h deleted file mode 100644 index 6ae51b1..0000000 --- a/kcmkgamma/displaynumber.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2003 Michael v.Ostheim <[email protected]> - */ - -#ifndef DISPLAYNUMBER_H -#define DISPLAYNUMBER_H - -#include <qlabel.h> - -/** - *@author Michael v.Ostheim - */ - -class DisplayNumber : public QLabel -{ - Q_OBJECT -public: - explicit DisplayNumber(QWidget *parent = nullptr, int digits = 0, int prec = 0); - ~DisplayNumber() override; - void setFont(const QFont &f); - void setNum(double num); - void setWidth(int digits); - void setPrecision(int prec) - { - precision = prec; - } - -private: - int dg, precision; -}; - -#endif diff --git a/kcmkgamma/gammactrl.cpp b/kcmkgamma/gammactrl.cpp deleted file mode 100644 index 2063221..0000000 --- a/kcmkgamma/gammactrl.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2001 Michael v.Ostheim <[email protected]> - */ - -#include "gammactrl.h" - -#include <QHBoxLayout> -#include <qlabel.h> -#include <qlineedit.h> -#include <qstring.h> - -#include "displaynumber.h" -#include "xvidextwrap.h" - -GammaCtrl::GammaCtrl(QWidget *parent, XVidExtWrap *xvid, int channel, const QString &mingamma, const QString &maxgamma, const QString &setgamma) - : QWidget(parent) -{ - int maxslider = (int)((maxgamma.toDouble() - mingamma.toDouble() + 0.0005) * 20); - int setslider = (int)((setgamma.toDouble() - mingamma.toDouble() + 0.0005) * 20); - setslider = (setslider > maxslider) ? maxslider : setslider; - setslider = (setslider < 0) ? 0 : setslider; - - suspended = false; - changed = false; - ming = mingamma.toFloat(); - mgamma = mingamma; - oldpos = setslider; - gchannel = channel; - xv = xvid; - - QHBoxLayout *layout = new QHBoxLayout(this); - - slider = new QSlider(Qt::Horizontal, this); - slider->setTickPosition(QSlider::TicksBelow); - slider->setRange(0, maxslider); - slider->setTickInterval(2); - slider->setValue(setslider); - layout->addWidget(slider); - connect(slider, &QAbstractSlider::valueChanged, this, QOverload<int>::of(&GammaCtrl::setGamma)); - connect(slider, &QAbstractSlider::sliderPressed, this, &GammaCtrl::pressed); - - textfield = new DisplayNumber(this, 4, 2); - textfield->setText(setgamma); - layout->addWidget(textfield); -} - -GammaCtrl::~GammaCtrl() -{ -} - -/** set gamma, slider and textfield */ -void GammaCtrl::setGamma(const QString &gamma) -{ - int sliderpos; - - sliderpos = (int)((gamma.toDouble() - mgamma.toDouble() + 0.0005) * 20); - changed = true; - slider->setValue(sliderpos); - - setGamma(sliderpos); - if (suspended) { - suspended = false; - textfield->setDisabled(false); - } -} - -/** set slider and textfield */ -void GammaCtrl::setControl(const QString &gamma) -{ - int sliderpos; - - sliderpos = (int)((gamma.toDouble() - mgamma.toDouble() + 0.0005) * 20); - setCtrl(sliderpos); -} - -/** Return the current gamma value with precision prec */ -QString GammaCtrl::gamma(int prec) -{ - QString gammatext; - gammatext.setNum(xv->getGamma(gchannel) + 0.0005, 'f', prec); - - return (gammatext); -} - -/** Slot: set gamma and textfield */ -void GammaCtrl::setGamma(int sliderpos) -{ - if (sliderpos != oldpos || changed) { - xv->setGamma(gchannel, ming + (float)(slider->value()) * 0.05); - textfield->setNum(xv->getGamma(gchannel)); - oldpos = sliderpos; - changed = false; - Q_EMIT gammaChanged(sliderpos); - } -} - -/** Slot: set slider and textfield */ -void GammaCtrl::setCtrl(int sliderpos) -{ - if (suspended) { - suspended = false; - textfield->setDisabled(false); - } - oldpos = sliderpos; - slider->setValue(sliderpos); - textfield->setNum(xv->getGamma(gchannel)); -} - -/** Slot: disable textfield */ -void GammaCtrl::suspend() -{ - if (!suspended) { - suspended = true; - textfield->setDisabled(true); - } -} - -/** Slot: Change status of GammaCtrl when pressed */ -void GammaCtrl::pressed() -{ - if (suspended) { - suspended = false; - textfield->setDisabled(false); - changed = true; - setGamma(slider->value()); - } -} - -#include "moc_gammactrl.cpp" diff --git a/kcmkgamma/gammactrl.h b/kcmkgamma/gammactrl.h deleted file mode 100644 index e691b12..0000000 --- a/kcmkgamma/gammactrl.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * A horizontal slider and a text field for the gamma value. - * - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2001 Michael v.Ostheim <MvOstheim@web> - */ - -#ifndef GAMMACTRL_H -#define GAMMACTRL_H - -#include <qslider.h> - -class QString; -class DisplayNumber; -class XVidExtWrap; - -class GammaCtrl : public QWidget -{ - Q_OBJECT -public: - /** construktor */ - explicit GammaCtrl(QWidget *parent = nullptr, - XVidExtWrap *xvid = nullptr, - int channel = 0, - const QString &mingamma = QStringLiteral("0.40"), - const QString &maxgamma = QStringLiteral("3.50"), - const QString &setgamma = QStringLiteral("1.00")); - /** destruktor */ - ~GammaCtrl() override; - /** Return the current gamma value with precision prec */ - QString gamma(int); - /** Set gamma, slider and textfield */ - void setGamma(const QString &); - /** Set slider and textfield */ - void setControl(const QString &); - /** Disable the slider */ - void disableSlider() - { - slider->setDisabled(true); - } - -private: - QString mgamma; - QSlider *slider; - DisplayNumber *textfield; - bool suspended, changed; - int gchannel, oldpos; - double ming; - XVidExtWrap *xv; - -public Q_SLOTS: - /** Disable textfield */ - void suspend(); - -protected Q_SLOTS: - /** Set slider and textfield */ - void setCtrl(int); - /** Set gamma and textfield */ - void setGamma(int); - /** Change status of GammaCtrl when pressed */ - void pressed(); - -Q_SIGNALS: - /** Gamma change signal */ - void gammaChanged(int); -}; - -#endif diff --git a/kcmkgamma/kcm_kgamma.json b/kcmkgamma/kcm_kgamma.json deleted file mode 100644 index 4462613..0000000 --- a/kcmkgamma/kcm_kgamma.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "KPlugin": { - "Description": "A monitor calibration tool", - "Description[ar]": "أداة مراقب المعايرة", - "Description[ast]": "Una ferramienta pa calibrar monitores", - "Description[be]": "Інструмент для калібравання манітора", - "Description[bg]": "Инструмент за калибриране на монитора", - "Description[ca@valencia]": "Una eina de calibratge per al monitor", - "Description[ca]": "Una eina de calibratge per al monitor", - "Description[cs]": "Nástroj pro kalibraci monitoru", - "Description[de]": "Kalibrierungswerkzeug für Monitore", - "Description[el]": "Ένα εργαλείο βαθμονόμησης της οθόνης", - "Description[en_GB]": "A monitor calibration tool", - "Description[eo]": "Ekrana kalibrilo", - "Description[es]": "Herramienta de calibración del monitor", - "Description[eu]": "Monitoreak kalibratzeko tresna bat", - "Description[fi]": "Näytön kalibrointityökalu", - "Description[fr]": "Un outil d'étalonnage d'écran", - "Description[gl]": "Unha utilidade para calibrar o monitor", - "Description[he]": "כלי לכיול צג", - "Description[hu]": "Monitorbeállító program", - "Description[ia]": "Instrumento de calibration de monitor", - "Description[is]": "Verkfæri til að stilla skjáinn", - "Description[it]": "Uno strumento di calibrazione del monitor", - "Description[ka]": "ეკრანის კალიბრაციის პროგრამა", - "Description[ko]": "모니터 보정 도구", - "Description[lt]": "Monitoriaus kalibravimo įrankis", - "Description[lv]": "Monitora kalibrēšanas rīks", - "Description[nl]": "Een hulpmiddel voor het kalibreren van de monitor", - "Description[nn]": "Eit verktøy for å kalibrera skjermen", - "Description[pl]": "Narzędzie do kalibracji monitora", - "Description[pt_BR]": "Ferramenta de calibração do monitor", - "Description[ro]": "Un utilitar de calibrat monitorul", - "Description[ru]": "Калибровка монитора", - "Description[sa]": "एकं पटलमापनसाधनम्", - "Description[sk]": "Nástroj na kalibráciu monitora", - "Description[sl]": "Orodje za umerjanje zaslonov", - "Description[sv]": "Ett kalibreringsverktyg för bildskärmar", - "Description[ta]": "திரை நிறச்சீரமைப்பு செயலி", - "Description[tr]": "Bir monitör kalibrasyon aracı", - "Description[ug]": "كۆزەتكۈچ توغرىلاش قورالى", - "Description[uk]": "Засіб для калібрування монітора", - "Description[zh_CN]": "简易显示器校准工具", - "Description[zh_TW]": "顯示器校準工具", - "Icon": "preferences-desktop-display-color", - "Name": "Gamma", - "Name[ar]": "جاما", - "Name[az]": "Qamma", - "Name[be]": "Гама", - "Name[bg]": "Гама", - "Name[br]": "Gamma", - "Name[bs]": "Gama", - "Name[ca@valencia]": "Gamma", - "Name[ca]": "Gamma", - "Name[cs]": "Gama", - "Name[cy]": "Gama", - "Name[da]": "Gamma", - "Name[de]": "Gamma", - "Name[el]": "Γάμμα", - "Name[en_GB]": "Gamma", - "Name[eo]": "Gamma", - "Name[es]": "Gamma", - "Name[et]": "Gamma", - "Name[eu]": "Gamma", - "Name[fa]": "گاما", - "Name[fi]": "Gamma", - "Name[fr]": "Gamma", - "Name[ga]": "Gáma", - "Name[gl]": "Gamma", - "Name[he]": "גאמה", - "Name[hi]": "गामा", - "Name[hne]": "गामा", - "Name[hr]": "Gama", - "Name[hu]": "Gamma-korrekció", - "Name[ia]": "Gamma", - "Name[id]": "Gamma", - "Name[is]": "Litróf (gamma)", - "Name[it]": "Gamma", - "Name[ja]": "ガンマ", - "Name[ka]": "გამა", - "Name[kk]": "Гамма", - "Name[km]": "ហ្គាម៉ា", - "Name[ko]": "Gamma", - "Name[ku]": "Gamma", - "Name[lt]": "Gamma", - "Name[lv]": "Gamma", - "Name[mr]": "गामा", - "Name[ms]": "Gamma", - "Name[nb]": "Gamma", - "Name[nds]": "Gamma", - "Name[ne]": "गामा", - "Name[nl]": "Gamma", - "Name[nn]": "Gamma", - "Name[oc]": "Gammà", - "Name[pa]": "ਗ਼ਾਮਾ", - "Name[pl]": "Gamma", - "Name[pt]": "'Gama'", - "Name[pt_BR]": "Gama", - "Name[ro]": "Gamma", - "Name[ru]": "Цветовая коррекция", - "Name[sa]": "इवर्ण (Gamma)", - "Name[se]": "Gamma", - "Name[si]": "ගැමා", - "Name[sk]": "Gamma", - "Name[sl]": "Gama", - "Name[sr@ijekavian]": "Гама", - "Name[sr@ijekavianlatin]": "Gama", - "Name[sr@latin]": "Gama", - "Name[sr]": "Гама", - "Name[sv]": "Gamma", - "Name[ta]": "காமா", - "Name[tg]": "Дараҷаи якдигарӣ", - "Name[th]": "แกมมา", - "Name[tr]": "Gama", - "Name[ug]": "گامما", - "Name[uk]": "Гама", - "Name[uz@cyrillic]": "Гамма", - "Name[uz]": "Gamma", - "Name[vi]": "Gamma", - "Name[xh]": "Unobumba wesithathu konoobumba besiGrike", - "Name[zh_CN]": "伽马", - "Name[zh_HK]": "伽馬(Gamma)", - "Name[zh_TW]": "Gamma" - }, - "X-DocPath": "kcontrol/kgamma/index.html", - "X-KDE-Init-Phase": 1, - "X-KDE-Keywords": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[ar]": "كغاما,غاما,جاما", - "X-KDE-Keywords[az]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[be]": "KGamma, kgamma, Gamma, гама", - "X-KDE-Keywords[bg]": "KGamma, kgamma, Gamma, гама", - "X-KDE-Keywords[bs]": "KGamma, kgamma, Gamma, gamma,gama", - "X-KDE-Keywords[ca@valencia]": "KGamma,kgamma,Gamma,gamma", - "X-KDE-Keywords[ca]": "KGamma,kgamma,Gamma,gamma", - "X-KDE-Keywords[cs]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[da]": "KGamma,kgamma,Gamma,gamma", - "X-KDE-Keywords[de]": "gamma", - "X-KDE-Keywords[el]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[en_GB]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[eo]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[es]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[et]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[eu]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[fa]": "KGamma, kgamma, گاما, گاما", - "X-KDE-Keywords[fi]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[fr]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[ga]": "KGamma, kgamma, Gamma, gamma, Gáma", - "X-KDE-Keywords[gl]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[he]": "KGamma, kgamma, Gamma, gamma, גאמה", - "X-KDE-Keywords[hi]": "के-गामा,केगामा,गामा,गामा", - "X-KDE-Keywords[hu]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[ia]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[id]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[is]": "KGamma, kgamma, Gamma, gamma,litstilling", - "X-KDE-Keywords[it]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[ka]": "KGamma, kgamma, გამა, კგამა", - "X-KDE-Keywords[kk]": "KGamma, kgamma, Gamma, gamma, гамма, Гамма", - "X-KDE-Keywords[km]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[ko]": "KGamma, kgamma, Gamma, gamma,감마", - "X-KDE-Keywords[lt]": "KGamma, kgamma, Gama, gama", - "X-KDE-Keywords[lv]": "KGamma, kgamma, gamma", - "X-KDE-Keywords[mr]": "केगामा, केगामा, गामा, गामा", - "X-KDE-Keywords[nb]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[nds]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[nl]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[nn]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[pa]": "KGamma, kgamma, Gamma, gamma,ਗਾਮਾ,ਕੇਗਾਮਾ", - "X-KDE-Keywords[pl]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[pt]": "KGamma, kgamma, Gamma, gamma, Gama, gama", - "X-KDE-Keywords[pt_BR]": "KGamma, kgamma, Gama, gama", - "X-KDE-Keywords[ro]": "KGamma, kgamma, gama, gamma", - "X-KDE-Keywords[ru]": "KGamma,kgamma,Gamma,gamma,гамма,монитор", - "X-KDE-Keywords[sa]": "क्गम्मा, क्ग्म्मा, गाम्मा, गाम्मा", - "X-KDE-Keywords[sk]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[sl]": "KGamma,kgamma,Gamma,gamma,gama", - "X-KDE-Keywords[sr@ijekavian]": "KGamma, kgamma, Gamma, gamma,К‑гама,гама", - "X-KDE-Keywords[sr@ijekavianlatin]": "KGamma, kgamma, Gamma, gamma,K‑gama,gama", - "X-KDE-Keywords[sr@latin]": "KGamma, kgamma, Gamma, gamma,K‑gama,gama", - "X-KDE-Keywords[sr]": "KGamma, kgamma, Gamma, gamma,К‑гама,гама", - "X-KDE-Keywords[sv]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-Keywords[ta]": "KGamma, kgamma, Gamma, gamma, கேகாமா, கேகாம்மா, காமா, காம்மா", - "X-KDE-Keywords[tg]": "KGamma, kgamma, Дараҷаи якдигарӣ, дараҷаи якдигарӣ", - "X-KDE-Keywords[tr]": "KGamma, kgamma, gamma, gama", - "X-KDE-Keywords[ug]": "KGamma, kgamma, Gamma, gamma, گامما", - "X-KDE-Keywords[uk]": "KGamma,kgamma,Gamma,gamma,гама,рівень,контрастність,рівень контрастності", - "X-KDE-Keywords[vi]": "KGamma,kgamma,Gamma,gamma", - "X-KDE-Keywords[zh_CN]": "KGamma, kgamma, Gamma, gamma, gama, gamazhi, 伽马, 伽玛, 伽马值", - "X-KDE-Keywords[zh_TW]": "KGamma, kgamma, Gamma, gamma", - "X-KDE-OnlyShowOnQtPlatforms": [ - "xcb" - ], - "X-KDE-System-Settings-Parent-Category": "display", - "X-KDE-Test-Module": "true" -} diff --git a/kcmkgamma/kgamma.cpp b/kcmkgamma/kgamma.cpp deleted file mode 100644 index ed42a3e..0000000 --- a/kcmkgamma/kgamma.cpp +++ /dev/null @@ -1,618 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2001 Michael v.Ostheim <[email protected]> - */ - -#include "kgamma.h" - -#include "gammactrl.h" -#include "xf86configpath.h" -#include <unistd.h> - -#include <QBoxLayout> -#include <QCheckBox> -#include <QComboBox> -#include <QDir> -#include <QFormLayout> -#include <QFrame> -#include <QGridLayout> -#include <QHBoxLayout> -#include <QLabel> -#include <QLayout> -#include <QPixmap> -#include <QProcess> -#include <QStackedWidget> -#include <QStandardPaths> -#include <QString> -#include <QStringList> -#include <QTextStream> -#include <QVBoxLayout> - -#include <KConfig> -#include <KConfigGroup> -#include <KLocalizedString> -#include <KPluginFactory> - -#include "xvidextwrap.h" - -extern "C" { -bool test_kgamma() -{ - bool retval; - (void)new XVidExtWrap(&retval, nullptr); - return retval; -} -} - -K_PLUGIN_CLASS_WITH_JSON(KGamma, "kcm_kgamma.json") - -KGamma::KGamma(QObject *parent, const KPluginMetaData &data) - : KCModule(parent, data) - , rootProcess(nullptr) -{ - bool ok; - GammaCorrection = false; - xv = new XVidExtWrap(&ok, nullptr); - if (ok) { /* KDE 4: Uneccessary test, when all KCM wrappers do conditional loading */ - xv->getGamma(XVidExtWrap::Red, &ok); - if (ok) { - ScreenCount = xv->_ScreenCount(); - currentScreen = xv->getScreen(); - xv->setGammaLimits(0.4, 3.5); - - for (int i = 0; i < ScreenCount; i++) { - assign << 0; - rgamma << QString(); - ggamma << QString(); - bgamma << QString(); - - // Store the current gamma values - xv->setScreen(i); - rbak << xv->getGamma(XVidExtWrap::Red); - gbak << xv->getGamma(XVidExtWrap::Green); - bbak << xv->getGamma(XVidExtWrap::Blue); - } - xv->setScreen(currentScreen); - - rootProcess = new QProcess; - GammaCorrection = true; - setupUI(); - saved = false; - - if (!loadSettings()) { // try to load gamma values from config file - // if failed, take current gamma values - for (int i = 0; i < ScreenCount; i++) { - rgamma[i].setNum(rbak[i], 'f', 2); - ggamma[i].setNum(gbak[i], 'f', 2); - bgamma[i].setNum(bbak[i], 'f', 2); - } - } - load(); - } - } - if (!GammaCorrection) { // something is wrong, show only error message - setupUI(); - } -} - -KGamma::~KGamma() -{ - delete xv; -} - -/** User interface */ -void KGamma::setupUI() -{ - QBoxLayout *topLayout = new QVBoxLayout(widget()); - - if (GammaCorrection) { - QHBoxLayout *hbox = new QHBoxLayout(); - topLayout->addLayout(hbox); - QLabel *label = new QLabel(i18n("&Select test picture:"), widget()); - QComboBox *combo = new QComboBox(widget()); - label->setBuddy(combo); - - QStringList list; - list << i18n("Gray Scale") << i18n("RGB Scale") << i18n("CMY Scale") << i18n("Dark Gray") << i18n("Mid Gray") << i18n("Light Gray"); - combo->addItems(list); - - hbox->addWidget(label); - hbox->addWidget(combo); - hbox->addStretch(); - - QStackedWidget *stack = new QStackedWidget(widget()); - - connect(combo, QOverload<int>::of(&QComboBox::activated), stack, &QStackedWidget::setCurrentIndex); - - QLabel *pic1 = new QLabel(stack); - pic1->setMinimumSize(530, 171); - pic1->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kgamma/pics/greyscale.png")))); - pic1->setAlignment(Qt::AlignCenter); - stack->insertWidget(0, pic1); - - QLabel *pic2 = new QLabel(stack); - pic2->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kgamma/pics/rgbscale.png")))); - pic2->setAlignment(Qt::AlignCenter); - stack->insertWidget(1, pic2); - - QLabel *pic3 = new QLabel(stack); - pic3->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kgamma/pics/cmyscale.png")))); - pic3->setAlignment(Qt::AlignCenter); - stack->insertWidget(2, pic3); - - QLabel *pic4 = new QLabel(stack); - pic4->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kgamma/pics/darkgrey.png")))); - pic4->setAlignment(Qt::AlignCenter); - stack->insertWidget(3, pic4); - - QLabel *pic5 = new QLabel(stack); - pic5->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kgamma/pics/midgrey.png")))); - pic5->setAlignment(Qt::AlignCenter); - stack->insertWidget(4, pic5); - - QLabel *pic6 = new QLabel(stack); - pic6->setPixmap(QPixmap(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kgamma/pics/lightgrey.png")))); - pic6->setAlignment(Qt::AlignCenter); - stack->insertWidget(5, pic6); - - topLayout->addWidget(stack, 10); - - auto horizontalSeparator = new QFrame(); - horizontalSeparator->setFrameStyle(QFrame::HLine); - topLayout->addWidget(horizontalSeparator); - - // Sliders for gamma correction - - QLabel *gammalabel = new QLabel(widget()); - gammalabel->setText(i18n("Gamma:")); - - QLabel *redlabel = new QLabel(widget()); - redlabel->setText(i18n("Red:")); - - QLabel *greenlabel = new QLabel(widget()); - greenlabel->setText(i18n("Green:")); - - QLabel *bluelabel = new QLabel(widget()); - bluelabel->setText(i18n("Blue:")); - - gctrl = new GammaCtrl(widget(), xv); - connect(gctrl, &GammaCtrl::gammaChanged, this, &KCModule::markAsChanged); - connect(gctrl, &GammaCtrl::gammaChanged, this, &KGamma::SyncScreens); - gammalabel->setBuddy(gctrl); - - rgctrl = new GammaCtrl(widget(), xv, XVidExtWrap::Red); - connect(rgctrl, &GammaCtrl::gammaChanged, this, &KCModule::markAsChanged); - connect(rgctrl, &GammaCtrl::gammaChanged, this, &KGamma::SyncScreens); - connect(gctrl, SIGNAL(gammaChanged(int)), rgctrl, SLOT(setCtrl(int))); - connect(rgctrl, &GammaCtrl::gammaChanged, gctrl, &GammaCtrl::suspend); - redlabel->setBuddy(rgctrl); - - ggctrl = new GammaCtrl(widget(), xv, XVidExtWrap::Green); - connect(ggctrl, &GammaCtrl::gammaChanged, this, &KCModule::markAsChanged); - connect(ggctrl, &GammaCtrl::gammaChanged, this, &KGamma::SyncScreens); - connect(gctrl, SIGNAL(gammaChanged(int)), ggctrl, SLOT(setCtrl(int))); - connect(ggctrl, &GammaCtrl::gammaChanged, gctrl, &GammaCtrl::suspend); - greenlabel->setBuddy(ggctrl); - - bgctrl = new GammaCtrl(widget(), xv, XVidExtWrap::Blue); - connect(bgctrl, &GammaCtrl::gammaChanged, this, &KCModule::markAsChanged); - connect(bgctrl, &GammaCtrl::gammaChanged, this, &KGamma::SyncScreens); - connect(gctrl, SIGNAL(gammaChanged(int)), bgctrl, SLOT(setCtrl(int))); - connect(bgctrl, &GammaCtrl::gammaChanged, gctrl, &GammaCtrl::suspend); - bluelabel->setBuddy(bgctrl); - - QFormLayout *form = new QFormLayout; - form->addRow(gammalabel, gctrl); - form->addItem(new QSpacerItem(0, gammalabel->sizeHint().height() / 3)); - form->addRow(redlabel, rgctrl); - form->addRow(greenlabel, ggctrl); - form->addRow(bluelabel, bgctrl); - - topLayout->addLayout(form); - - // Options - QWidget *options = new QWidget(widget()); - QHBoxLayout *optionsHBoxLayout = new QHBoxLayout(options); - - xf86cfgbox = new QCheckBox(i18n("Save settings system wide"), options); - optionsHBoxLayout->addWidget(xf86cfgbox); - connect(xf86cfgbox, &QAbstractButton::clicked, this, &KGamma::changeConfig); - - syncbox = new QCheckBox(i18n("Sync screens"), options); - optionsHBoxLayout->addWidget(syncbox); - connect(syncbox, &QAbstractButton::clicked, this, &KGamma::SyncScreens); - connect(syncbox, &QAbstractButton::clicked, this, &KCModule::markAsChanged); - - screenselect = new QComboBox(options); - optionsHBoxLayout->addWidget(screenselect); - for (int i = 0; i < ScreenCount; i++) { - screenselect->addItem(i18n("Screen %1", i + 1)); - } - screenselect->setCurrentIndex(currentScreen); - if (ScreenCount <= 1) { - screenselect->setEnabled(false); - } else { - connect(screenselect, QOverload<int>::of(&QComboBox::activated), this, &KGamma::changeScreen); - } - - optionsHBoxLayout->setSpacing(10); - optionsHBoxLayout->setStretchFactor(xf86cfgbox, 10); - optionsHBoxLayout->setStretchFactor(syncbox, 1); - optionsHBoxLayout->setStretchFactor(screenselect, 1); - - topLayout->addWidget(options); - } else { - QLabel *error = new QLabel(widget()); - error->setText( - i18n("Gamma correction is not supported by your" - " graphics hardware or driver.")); - error->setAlignment(Qt::AlignCenter); - topLayout->addWidget(error); - } -} - -/** Restore latest saved gamma values */ -void KGamma::load() -{ - if (GammaCorrection) { - KConfig *config = new KConfig(QStringLiteral("kgammarc")); - KConfigGroup group = config->group("ConfigFile"); - - // save checkbox status - if (xf86cfgbox->isChecked()) { - group.writeEntry("use", "XF86Config"); - } else { - group.writeEntry("use", "kgammarc"); - } - - // load syncbox status - group = config->group("SyncBox"); - if (group.readEntry("sync") == QLatin1String("yes")) { - syncbox->setChecked(true); - } else { - syncbox->setChecked(false); - } - - config->sync(); - delete config; - - for (int i = 0; i < ScreenCount; i++) { - xv->setScreen(i); - if (rgamma[i] == ggamma[i] && rgamma[i] == bgamma[i]) { - if (i == currentScreen) { - gctrl->setGamma(rgamma[i]); - } else { - xv->setGamma(XVidExtWrap::Value, rgamma[i].toFloat()); - } - } else { - if (i == currentScreen) { - rgctrl->setGamma(rgamma[i]); - ggctrl->setGamma(ggamma[i]); - bgctrl->setGamma(bgamma[i]); - gctrl->suspend(); - } else { - xv->setGamma(XVidExtWrap::Red, rgamma[i].toFloat()); - xv->setGamma(XVidExtWrap::Green, ggamma[i].toFloat()); - xv->setGamma(XVidExtWrap::Blue, bgamma[i].toFloat()); - } - } - } - xv->setScreen(currentScreen); - - setNeedsSave(false); - } -} - -void KGamma::save() -{ - if (GammaCorrection) { - for (int i = 0; i < ScreenCount; i++) { - xv->setScreen(i); - rgamma[i] = rgctrl->gamma(2); - ggamma[i] = ggctrl->gamma(2); - bgamma[i] = bgctrl->gamma(2); - } - xv->setScreen(currentScreen); - - KConfig *config = new KConfig(QStringLiteral("kgammarc")); - KConfigGroup group = config->group("SyncBox"); - if (syncbox->isChecked()) { - group.writeEntry("sync", "yes"); - } else { - group.writeEntry("sync", "no"); - } - - if (!xf86cfgbox->isChecked()) { // write gamma settings to the users config - for (int i = 0; i < ScreenCount; i++) { - KConfigGroup screenGroup = config->group(QStringLiteral("Screen %1").arg(i)); - screenGroup.writeEntry("rgamma", rgamma[i]); - screenGroup.writeEntry("ggamma", ggamma[i]); - screenGroup.writeEntry("bgamma", bgamma[i]); - } - KConfigGroup confGroup = config->group("ConfigFile"); - confGroup.writeEntry("use", "kgammarc"); - } else { // write gamma settings to section "Monitor" of XF86Config - KConfigGroup x86group = config->group("ConfigFile"); - x86group.writeEntry("use", "XF86Config"); - - if (!(rootProcess->state() == QProcess::Running)) { - QString Arguments = QStringLiteral("xf86gammacfg "); - for (int i = 0; i < ScreenCount; i++) { - Arguments += rgamma[assign[i]] + QLatin1Char(' ') + ggamma[assign[i]] + QLatin1Char(' ') + bgamma[assign[i]] + QLatin1Char(' '); - } - rootProcess->setProgram(QStandardPaths::findExecutable(QStringLiteral("kdesu"))); - rootProcess->setArguments(Arguments.split(QLatin1Char(' '))); - rootProcess->start(); - } - } - config->sync(); - delete config; - saved = true; - setNeedsSave(false); - } -} - -void KGamma::defaults() -{ - if (GammaCorrection) { - for (int i = 0; i < ScreenCount; i++) { - xv->setScreen(i); - gctrl->setGamma(QStringLiteral("1.00")); - } - xv->setScreen(currentScreen); - } - xf86cfgbox->setChecked(false); - syncbox->setChecked(false); -} - -bool KGamma::loadSettings() -{ - KConfig *config = new KConfig(QStringLiteral("kgammarc")); - KConfigGroup grp = config->group("ConfigFile"); - QString ConfigFile(grp.readEntry("use")); - KConfigGroup syncGroup = config->group("SyncBox"); - if (syncGroup.readEntry("sync") == QLatin1String("yes")) { - syncbox->setChecked(true); - } - delete config; - - if (ConfigFile == QLatin1String("XF86Config")) { // parse XF86Config - bool validGlobalConfig = loadSystemSettings(); - xf86cfgbox->setChecked(validGlobalConfig); - return (validGlobalConfig); - } else { // get gamma settings from user config - return (loadUserSettings()); - } -} - -bool KGamma::loadUserSettings() -{ - KConfig *config = new KConfig(QStringLiteral("kgammarc")); - - for (int i = 0; i < ScreenCount; i++) { - KConfigGroup screenGroup = config->group(QStringLiteral("Screen %1").arg(i)); - rgamma[i] = screenGroup.readEntry("rgamma"); - ggamma[i] = screenGroup.readEntry("ggamma"); - bgamma[i] = screenGroup.readEntry("bgamma"); - } - delete config; - - return (validateGammaValues()); -} - -bool KGamma::loadSystemSettings() -{ - QStringList Monitor, Screen, ScreenLayout, ScreenMonitor, Gamma; - QList<int> ScreenNr; - QString Section; - XF86ConfigPath Path; - QFile f(QString::fromUtf8(Path.get())); - if (f.open(QIODevice::ReadOnly)) { - QTextStream t(&f); - QString s; - int sn = 0; - bool gm = false; - - // Analyze Screen<->Monitor assignments of multi-head configurations - while (!t.atEnd()) { - s = (t.readLine()).simplified(); - QStringList words = s.split(QLatin1Char(' ')); - if (!words.empty()) { - if (words[0] == QLatin1String("Section") && words.size() > 1) { - if ((Section = words[1]) == QLatin1String("\"Monitor\"")) { - gm = false; - } - } else if (words[0] == QLatin1String("EndSection")) { - if (Section == QLatin1String("\"Monitor\"") && !gm) { - Gamma << QString(); - gm = false; - } - Section = QString(); - } else if (words[0] == QLatin1String("Identifier") && words.size() > 1) { - if (Section == QLatin1String("\"Monitor\"")) { - Monitor << words[1]; - } else if (Section == QLatin1String("\"Screen\"")) { - Screen << words[1]; - } - } else if (words[0] == QLatin1String("Screen") && words.size() > 1) { - if (Section == QLatin1String("\"ServerLayout\"")) { - bool ok; - int i = words[1].toInt(&ok); - if (ok && words.size() > 2) { - ScreenNr << i; - ScreenLayout << words[2]; - } else { - ScreenNr << sn++; - ScreenLayout << words[1]; - } - } - } else if (words[0] == QLatin1String("Monitor") && words.size() > 1) { - if (Section == QLatin1String("\"Screen\"")) { - ScreenMonitor << words[1]; - } - } else if (words[0] == QLatin1String("Gamma")) { - if (Section == QLatin1String("\"Monitor\"")) { - Gamma << s; - gm = true; - } - } - } - } // End while - f.close(); - if (!Monitor.isEmpty() && !ScreenMonitor.isEmpty() && !ScreenLayout.isEmpty()) { - for (int i = 0; i < ScreenCount; i++) { - for (int j = 0; j < ScreenCount; j++) { - if (ScreenLayout[i] == Screen[j]) { - for (int k = 0; k < ScreenCount; k++) { - if (Monitor[k] == ScreenMonitor[j]) { - assign[ScreenNr[i]] = k; - } - } - } - } - } - // Extract gamma values - if (gm) { - for (int i = 0; i < ScreenCount; i++) { - rgamma[i] = ggamma[i] = bgamma[i] = QString(); - - QStringList words = Gamma[assign[i]].split(QLatin1Char(' ')); - QStringList::ConstIterator it = words.constBegin(); - if (words.size() < 4) { - rgamma[i] = ggamma[i] = bgamma[i] = *(++it); // single gamma value - } else { - rgamma[i] = *(++it); // eventually rgb gamma values - ggamma[i] = *(++it); - bgamma[i] = *(++it); - } - } - } - } - } - return (validateGammaValues()); -} - -bool KGamma::validateGammaValues() -{ - bool rOk, gOk, bOk, result; - - result = true; - for (int i = 0; i < ScreenCount; i++) { - rgamma[i].toFloat(&rOk); - ggamma[i].toFloat(&gOk); - bgamma[i].toFloat(&bOk); - - if (!(rOk && gOk && bOk)) { - if (rOk) { - ggamma[i] = bgamma[i] = rgamma[i]; - } else { - result = false; - } - } - } - return (result); -} - -void KGamma::changeConfig() -{ - bool Ok = false; - - if (xf86cfgbox->isChecked()) { - Ok = loadSystemSettings(); - } else { - Ok = loadUserSettings(); - } - - if (!Ok) { - for (int i = 0; i < ScreenCount; i++) { - xv->setScreen(i); - rgamma[i].setNum(xv->getGamma(XVidExtWrap::Red), 'f', 2); - ggamma[i].setNum(xv->getGamma(XVidExtWrap::Green), 'f', 2); - bgamma[i].setNum(xv->getGamma(XVidExtWrap::Blue), 'f', 2); - } - xv->setScreen(currentScreen); - } - load(); -} - -void KGamma::SyncScreens() -{ - if (syncbox->isChecked()) { - float rg = xv->getGamma(XVidExtWrap::Red); - float gg = xv->getGamma(XVidExtWrap::Green); - float bg = xv->getGamma(XVidExtWrap::Blue); - - for (int i = 0; i < ScreenCount; i++) { - if (i != currentScreen) { - xv->setScreen(i); - xv->setGamma(XVidExtWrap::Red, rg); - xv->setGamma(XVidExtWrap::Green, gg); - xv->setGamma(XVidExtWrap::Blue, bg); - } - } - xv->setScreen(currentScreen); - } -} - -void KGamma::changeScreen(int sn) -{ - QString red, green, blue; - - xv->setScreen(sn); - currentScreen = sn; - - red.setNum(xv->getGamma(XVidExtWrap::Red), 'f', 2); - green.setNum(xv->getGamma(XVidExtWrap::Green), 'f', 2); - blue.setNum(xv->getGamma(XVidExtWrap::Blue), 'f', 2); - - gctrl->setControl(red); - rgctrl->setControl(red); - ggctrl->setControl(green); - bgctrl->setControl(blue); - if (red != green || red != blue) { - gctrl->suspend(); - } -} - -int KGamma::buttons() -{ - return Default | Apply | Help; -} - -// ------------------------------------------------------------------------ - -extern "C" { -// Restore the user gamma settings -Q_DECL_EXPORT void kcminit() -{ - bool ok; - XVidExtWrap xv(&ok); - - if (ok) { - xv.setGammaLimits(0.4, 3.5); - float rgamma, ggamma, bgamma; - KConfig *config = new KConfig(QStringLiteral("kgammarc")); - - for (int i = 0; i < xv._ScreenCount(); i++) { - xv.setScreen(i); - KConfigGroup screenGroup = config->group(QStringLiteral("Screen %1").arg(i)); - - if ((rgamma = screenGroup.readEntry("rgamma").toFloat())) { - xv.setGamma(XVidExtWrap::Red, rgamma); - } - if ((ggamma = screenGroup.readEntry("ggamma").toFloat())) { - xv.setGamma(XVidExtWrap::Green, ggamma); - } - if ((bgamma = screenGroup.readEntry("bgamma").toFloat())) { - xv.setGamma(XVidExtWrap::Blue, bgamma); - } - } - delete config; - } -} -} - -#include "kgamma.moc" - -#include "moc_kgamma.cpp" diff --git a/kcmkgamma/kgamma.h b/kcmkgamma/kgamma.h deleted file mode 100644 index efa180d..0000000 --- a/kcmkgamma/kgamma.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2001 Michael v.Ostheim <[email protected]> - */ - -#ifndef KGAMMA_H_ -#define KGAMMA_H_ - -#include <KCModule> -// Added by qt3to4: -#include <QList> - -class GammaCtrl; -class QCheckBox; -class QComboBox; -class QProcess; -class XVidExtWrap; - -class KGamma : public KCModule -{ - Q_OBJECT -public: - KGamma(QObject *parent, const KPluginMetaData &data); - ~KGamma() override; - - void load() override; - void save() override; - void defaults() override; - int buttons(); - -protected: // Protected methods - /** The user interface */ - void setupUI(); - /** Decides if to load settings from user or system config */ - bool loadSettings(); - /** Load settings from kgammarc */ - bool loadUserSettings(); - /** Load settings from XF86Config */ - bool loadSystemSettings(); - /** Validate the loaded gamma values */ - bool validateGammaValues(); - -private Q_SLOTS: - /** Called if the user marked or unmarked the XF86Config checkbox */ - void changeConfig(); - /** Called if the user marked or unmarked the sync screen checkbox */ - void SyncScreens(); - /** Called if the user chooses a new screen */ - void changeScreen(int sn); - -private: - bool saved, GammaCorrection; - int ScreenCount, currentScreen; - QStringList rgamma, ggamma, bgamma; - QList<int> assign; - QList<float> rbak, gbak, bbak; - GammaCtrl *gctrl, *rgctrl, *ggctrl, *bgctrl; - QCheckBox *xf86cfgbox, *syncbox; - QComboBox *screenselect; - QProcess *rootProcess; - XVidExtWrap *xv; -}; - -#endif diff --git a/kcmkgamma/pics/CMakeLists.txt b/kcmkgamma/pics/CMakeLists.txt deleted file mode 100644 index 23f0abb..0000000 --- a/kcmkgamma/pics/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -install(FILES - background.png - cmyscale.png - darkgrey.png - greyscale.png - lightgrey.png - midgrey.png - rgbscale.png - DESTINATION ${KDE_INSTALL_DATADIR}/kgamma/pics) - diff --git a/kcmkgamma/pics/background.png b/kcmkgamma/pics/background.png deleted file mode 100644 index 94828e9..0000000 Binary files a/kcmkgamma/pics/background.png and /dev/null differ diff --git a/kcmkgamma/pics/cmyscale.png b/kcmkgamma/pics/cmyscale.png deleted file mode 100644 index 7154529..0000000 Binary files a/kcmkgamma/pics/cmyscale.png and /dev/null differ diff --git a/kcmkgamma/pics/darkgrey.png b/kcmkgamma/pics/darkgrey.png deleted file mode 100644 index dd62276..0000000 Binary files a/kcmkgamma/pics/darkgrey.png and /dev/null differ diff --git a/kcmkgamma/pics/greyscale.png b/kcmkgamma/pics/greyscale.png deleted file mode 100644 index 5c3efa1..0000000 Binary files a/kcmkgamma/pics/greyscale.png and /dev/null differ diff --git a/kcmkgamma/pics/lightgrey.png b/kcmkgamma/pics/lightgrey.png deleted file mode 100644 index 0e72fae..0000000 Binary files a/kcmkgamma/pics/lightgrey.png and /dev/null differ diff --git a/kcmkgamma/pics/midgrey.png b/kcmkgamma/pics/midgrey.png deleted file mode 100644 index b46b127..0000000 Binary files a/kcmkgamma/pics/midgrey.png and /dev/null differ diff --git a/kcmkgamma/pics/rgbscale.png b/kcmkgamma/pics/rgbscale.png deleted file mode 100644 index 0d28383..0000000 Binary files a/kcmkgamma/pics/rgbscale.png and /dev/null differ diff --git a/kcmkgamma/xf86configpath.cpp b/kcmkgamma/xf86configpath.cpp deleted file mode 100644 index 3793fce..0000000 --- a/kcmkgamma/xf86configpath.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2002 Michael v.Ostheim <[email protected]> - */ - -#include <stdlib.h> -#include <unistd.h> - -#include <vector> - -#include "xf86configpath.h" - -using namespace std; - -XF86ConfigPath::XF86ConfigPath() -{ - vector<string> searchPaths; - searchPaths.push_back("/etc/X11/XF86Config-4"); - searchPaths.push_back("/etc/X11/XF86Config"); - searchPaths.push_back("/etc/XF86Config"); - searchPaths.push_back("/usr/X11R6/etc/X11/XF86Config-4"); - searchPaths.push_back("/usr/X11R6/etc/X11/XF86Config"); - searchPaths.push_back("/usr/X11R6/lib/X11/XF86Config-4"); - searchPaths.push_back("/usr/X11R6/lib/X11/XF86Config"); - - searchPaths.push_back("/etc/X11/xorg.conf-4"); - searchPaths.push_back("/etc/X11/xorg.conf"); - searchPaths.push_back("/etc/xorg.conf"); - searchPaths.push_back("/usr/X11R6/etc/X11/xorg.conf-4"); - searchPaths.push_back("/usr/X11R6/etc/X11/xorg.conf"); - searchPaths.push_back("/usr/X11R6/lib/X11/xorg.conf-4"); - searchPaths.push_back("/usr/X11R6/lib/X11/xorg.conf"); - - vector<string>::iterator it = searchPaths.begin(); - for (; it != searchPaths.end(); ++it) { - if (!access((Path = *it).c_str(), F_OK)) { - break; - } - } -} - -XF86ConfigPath::~XF86ConfigPath() -{ -} - -/** Returns path */ -const char *XF86ConfigPath::get() -{ - return (Path.c_str()); -} diff --git a/kcmkgamma/xf86configpath.h b/kcmkgamma/xf86configpath.h deleted file mode 100644 index bead6aa..0000000 --- a/kcmkgamma/xf86configpath.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2002 Michael v.Ostheim <[email protected]> - */ - -#ifndef XF86CONFIGPATH_H -#define XF86CONFIGPATH_H - -#include <string> - -/**Search for XF86Config or XF86Config-4 which can be located at different - places. - *@author Michael v.Ostheim - */ - -class XF86ConfigPath -{ -public: - XF86ConfigPath(); - ~XF86ConfigPath(); - - /** Returns Path variable */ - const char *get(); - -private: // Private attributes - /** Contains the path of XF86Config file */ - std::string Path; -}; - -#endif diff --git a/kcmkgamma/xvidextwrap.cpp b/kcmkgamma/xvidextwrap.cpp deleted file mode 100644 index 07df5ba..0000000 --- a/kcmkgamma/xvidextwrap.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2002 Michael v.Ostheim <[email protected]> - */ - -#include <QDebug> - -#include <fstream> -#include <iostream> -#include <stdlib.h> - -#include <sstream> -#include <string> -#include <vector> - -#include "xf86configpath.h" - -#include <X11/Xlib.h> -#include <X11/Xos.h> -#include <X11/extensions/xf86vmode.h> - -// #include <fixx11h.h> -#include "xvidextwrap.h" - -using namespace std; - -XVidExtWrap::XVidExtWrap(bool *OK, const char *displayname) -{ - if ((dpy = XOpenDisplay(displayname))) { - screen = DefaultScreen(dpy); - setGammaLimits(0.1, 10.0); - *OK = true; - } else { - qDebug() << "KGamma: unable to open display " << displayname; - *OK = false; - } -} - -XVidExtWrap::~XVidExtWrap() -{ - if (dpy) { - XCloseDisplay(dpy); - } -} - -int XVidExtWrap::_DefaultScreen() -{ - return DefaultScreen(dpy); -} - -/** We have to parse XF86Config to get the number of screens, because */ -/** ScreenCount() from X11/Xlib.h does not count correctly with xinerama */ -int XVidExtWrap::_ScreenCount() -{ - int count = 0; - bool section = false; - XF86ConfigPath Path; - - std::ifstream in(Path.get()); - - if (in.is_open()) { - std::string s, buf; - std::vector<string> words; - - while (getline(in, s, '\n')) { - words.clear(); - istringstream ss(s.c_str()); - while (ss >> buf) { - words.push_back(buf); // Split "s" into words - } - - if (!words.empty()) { - if (words[0] == "Section" && words.size() > 1) { - if (words[1] == "\"ServerLayout\"") { - section = true; - } - } else if (words[0] == "EndSection") { - section = false; - } - if (section && words[0] == "Screen") { - ++count; - } - } - } // end while - in.close(); - } - - if (!count) { - count = 1; // If failed,fill count with a valid value; - } - - return (count); -} - -const char *XVidExtWrap::DisplayName() -{ - return DisplayString(dpy); -} - -void XVidExtWrap::setGamma(int channel, float gam, bool *OK) -{ - XF86VidModeGamma gamma; - - if (gam >= mingamma && gam <= maxgamma) { - if (!XF86VidModeGetGamma(dpy, screen, &gamma)) { - qDebug() << "KGamma: Unable to query gamma correction"; - if (OK) { - *OK = false; - } - } else { - switch (channel) { - case Value: - gamma.red = gam; - gamma.green = gam; - gamma.blue = gam; - break; - case Red: - gamma.red = gam; - break; - case Green: - gamma.green = gam; - break; - case Blue: - gamma.blue = gam; - }; - if (!XF86VidModeSetGamma(dpy, screen, &gamma)) { - qDebug() << "KGamma: Unable to set gamma correction"; - if (OK) { - *OK = false; - } - } else { - XFlush(dpy); - if (OK) { - *OK = true; - } - } - } - } -} - -float XVidExtWrap::getGamma(int channel, bool *OK) -{ - XF86VidModeGamma gamma; - float gam = 0; - - if (!XF86VidModeGetGamma(dpy, screen, &gamma)) { - qDebug() << "KGamma: Unable to query gamma correction"; - if (OK) { - *OK = false; - } - } else { - switch (channel) { - case Value: - gam = gamma.red; - break; - case Red: - gam = gamma.red; - break; - case Green: - gam = gamma.green; - break; - case Blue: - gam = gamma.blue; - }; - if (OK) { - *OK = true; - } - } - return (gam); -} - -void XVidExtWrap::setGammaLimits(float min, float max) -{ - mingamma = (min < 0.1) ? 0.1 : min; - maxgamma = (max > 10.0) ? 10.0 : max; -} diff --git a/kcmkgamma/xvidextwrap.h b/kcmkgamma/xvidextwrap.h deleted file mode 100644 index 2fdf68a..0000000 --- a/kcmkgamma/xvidextwrap.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2002 Michael v.Ostheim <[email protected]> - */ - -#ifndef XVIDEXTWRAP_H -#define XVIDEXTWRAP_H - -#include <X11/Xutil.h> - -/**A wrapper for XF86VidMode Extension - *@author Michael v.Ostheim - */ - -class XVidExtWrap -{ -public: - enum GammaChannel { Value = 0, Red = 1, Green = 2, Blue = 3 }; - explicit XVidExtWrap(bool *OK, const char *displayname = nullptr); - ~XVidExtWrap(); - - /** Returns the default screen */ - int _DefaultScreen(); - /** Returns the number of screens (extracted from XF86Config) */ - int _ScreenCount(); - /** Returns the displayname */ - const char *DisplayName(); - /** Sets the screen actions are take effect */ - void setScreen(int scrn) - { - screen = scrn; - } - /** Returns the current screen */ - int getScreen() - { - return screen; - } - /** Sets the gamma value on the current screen */ - void setGamma(int channel, float gam, bool *OK = nullptr); - /** Gets the gamma value of the current screen */ - float getGamma(int channel, bool *OK = nullptr); - /** Limits the possible gamma values (default 0.1-10.0) */ - void setGammaLimits(float min, float max); - -private: - float mingamma, maxgamma; - int screen; - Display *dpy; -}; - -#endif diff --git a/xf86gammacfg/CMakeLists.txt b/xf86gammacfg/CMakeLists.txt deleted file mode 100644 index 51d1f74..0000000 --- a/xf86gammacfg/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set(xf86gammacfg_SRCS xf86gammacfg.cpp) - -add_executable(xf86gammacfg ${xf86gammacfg_SRCS}) - -install(TARGETS xf86gammacfg ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) - diff --git a/xf86gammacfg/xf86gammacfg.cpp b/xf86gammacfg/xf86gammacfg.cpp deleted file mode 100644 index e6fe1e3..0000000 --- a/xf86gammacfg/xf86gammacfg.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-2.0-or-later - * - * SPDX-FileCopyrightText: 2002 Michael v.Ostheim <[email protected]> - */ - -#include <stdio.h> - -#include <stdlib.h> - -#include <fstream> -#include <iostream> -#include <sstream> -#include <string> -#include <vector> - -using namespace std; - -int main(int argc, char *argv[]) -{ - bool cpyonly, secmon, success; - - cpyonly = secmon = success = false; - - if (!((argc - 1) % 3)) { - int Screen = 0; - int ScreenCount = (argc - 1) / 3; - - vector<string> searchPaths; - - // Xorg.conf file (the default config file now) - searchPaths.push_back("/etc/X11/xorg.conf-4"); - searchPaths.push_back("/etc/X11/xorg.conf"); - searchPaths.push_back("/etc/xorg.conf"); - searchPaths.push_back("/usr/X11R6/etc/X11/xorg.conf-4"); - searchPaths.push_back("/usr/X11R6/etc/X11/xorg.conf"); - searchPaths.push_back("/usr/X11R6/lib/X11/xorg.conf-4"); - searchPaths.push_back("/usr/X11R6/lib/X11/xorg.conf"); - - // Deprecated XF86Config file (Xfree86 times) - searchPaths.push_back("/etc/X11/XF86Config-4"); - searchPaths.push_back("/etc/X11/XF86Config"); - searchPaths.push_back("/etc/XF86Config"); - searchPaths.push_back("/usr/X11R6/etc/X11/XF86Config-4"); - searchPaths.push_back("/usr/X11R6/etc/X11/XF86Config"); - searchPaths.push_back("/usr/X11R6/lib/X11/XF86Config-4"); - searchPaths.push_back("/usr/X11R6/lib/X11/XF86Config"); - - std::vector<string>::iterator it = searchPaths.begin(); - for (; it != searchPaths.end(); ++it) { - // Try to open file - std::ifstream in((*it).c_str()); - - if (in.is_open()) { - std::ofstream out(((*it) + ".tmp").c_str()); - if (out.is_open()) { - std::string s, buf; - std::vector<string> words; - - while (getline(in, s, '\n')) { - if (!cpyonly) { - words.clear(); - std::istringstream ss(s.c_str()); - while (ss >> buf) { - words.push_back(buf); - } - - if (!words.empty()) { - if (words[0] == "Section" && words.size() > 1) { - if (words[1] == "\"Monitor\"") { - secmon = true; - out << s << endl; - continue; - } - } - if (secmon) { - if (words[0] == "Gamma") { - out << " Gamma " << argv[3 * Screen + 1] << " " << argv[3 * Screen + 2] << " " << argv[3 * Screen + 3]; - out << " # created by KGamma" << endl; - cpyonly = success = (++Screen == ScreenCount); - secmon = false; - continue; - } - if (words[0] == "EndSection") { - out << " Gamma " << argv[3 * Screen + 1] << " " << argv[3 * Screen + 2] << " " << argv[3 * Screen + 3]; - out << " # created by KGamma" << endl; - out << s << endl; - cpyonly = success = (++Screen == ScreenCount); - secmon = false; - continue; - } - } - } - } - out << s << endl; - } // endwhile - - in.close(); - out.close(); - - if (success) { - rename((*it).c_str(), (*it + ".kgammaorig").c_str()); - rename((*it + ".tmp").c_str(), (*it).c_str()); - } else { - remove((*it + ".tmp").c_str()); - } - break; - } - } - } - } - if (!success) { - cerr << "Usage: xf86gammacfg RGAMMA GGAMMA " - "BGAMMA [RGAMMA GGAMMA BGAMMA [...]]" - << endl; - } - - return !success; -}
