diff options
45 files changed, 17721 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..803ff67 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,57 @@ +project(QtCurve-KDE3) +cmake_minimum_required(VERSION 2.4.0) + +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README") +set(CPACK_GENERATOR "DEB;RPM;TGZ") +set(DEBIAN_PACKAGE_DESCRIPTION "QtCurve for Qt3/KDE3") +set(DEBIAN_PACKAGE_SECTION "kde") +set(CPACK_SOURCE_GENERATOR "TBZ2") +set(CPACK_PACKAGE_VERSION_MAJOR "0") +set(CPACK_PACKAGE_VERSION_MINOR "55") +set(CPACK_PACKAGE_VERSION_PATCH "2") +set(CPACK_PACKAGE_CONTACT "Craig Drummond <[email protected]>") +set(QTCURVE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}") +set(QTCURVE_VERSION_FULL "${QTCURVE_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${QTCURVE_VERSION_FULL}") +set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${QTCURVE_VERSION_FULL}") +include(CPack) + +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) + +find_package(KDE3 REQUIRED) +include(KDE3Macros) + +exec_program(kde-config + ARGS --prefix + OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX) + +file(TO_CMAKE_PATH "$ENV{KDEDIRS}" _KDEDIRS) + +# For KDE4 kde-config has been renamed to kde4-config +find_program(KDE4_KDECONFIG_EXECUTABLE + NAMES kde4-config + PATHS ${CMAKE_INSTALL_PREFIX}/bin ${_KDEDIRS} /usr/local/bin /usr/bin /opt/kde4/bin NO_DEFAULT_PATH) + +if (NOT KDE4_KDECONFIG_EXECUTABLE) + find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config ) +endif (NOT KDE4_KDECONFIG_EXECUTABLE) + +if(KDE4_KDECONFIG_EXECUTABLE) + exec_program(${KDE4_KDECONFIG_EXECUTABLE} + ARGS --prefix + OUTPUT_VARIABLE KDE4PREFIX) +endif(KDE4_KDECONFIG_EXECUTABLE) + +if(NOT KDE4PREFIX) + set(KDE4PREFIX ${KDE3PREFIX}) +endif(NOT KDE4PREFIX) + +configure_file (config.h.cmake ${CMAKE_BINARY_DIR}/config.h) +add_definitions(${QT_DEFINITIONS} ${KDE3_DEFINITIONS}) +include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE3_INCLUDES}) + +set(DATA_INSTALL_DIR ${KDE3PREFIX}/share/apps) +add_subdirectory(style) +add_subdirectory(config) +add_subdirectory(themes) + @@ -0,0 +1,340 @@ + 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 Library 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. + + <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 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 Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..6d6fb0f --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1040 @@ +0.55.2 +------ +1. Add ability to import qtc_*.themerc settings into config dialog. +2. Lighten dockwidget titlebars. + +0.55.1 +------ +1. Only allow coloured selected tabs if tab appearance is set to gradient. +2. Allow triangular sliders when not rounding. +3. Fix appearance of flat/raised disabled scrollbar buttons - more + consistent with Gtk2 and KDE4 +4. Fix potential infinte loop when elliditiding title string. +5. Also eliditude vertical titlebars. + +0.55 +---- + 1. Ability to create custom themes. See Theme details in 'README' file. + 2. Supply a 'Klearlooks' QtCurve theme. + 3. Allow 'flat' lines in scrollbar handles, toolbar handles, toolbar + separators, and splitters. + 4. Option for 'X' style checkmarks. + 5. Option to have colour the selcted tab. + 6. Optional diagonal progressbar sripes. + 7. Use alternating dark/light for dashed toolbar handles. + 8. New 'split' style gradient. + 9. Option to specift slider style: plain, round (only when appearance=round), + and triangular (plastik-ish) +10. Modify default style: flat splitter lines, flat slider thumbs, no + toolbar separators, triangular slider, diagonal progressbar stripes. + +0.54.1 +------ +1. Supply a simple 'mkpkg' script to create packages with checkinstall. + +0.54 +---- +1. Converted buildsystem to CMake. +2. New option 'inactiveHighlight', if set then use a mix of highlight and background + colour as highlight for inactive windows/elements. +3. Set KDE3 colours from Qt4 settings if running under KDE4. +4. Read in Qt3's inactive palette settings for highlight and highlightedText. +5. If an inactive palette is set (e.g. via qtconfig), ensure that progress + bar text is unaffected. +6. Remove frames from source/destination labels of kio progress dialogs. +7. Add gui to set shading option. +8. Nicer look for selected tab highlight. + +0.53 +---- +1. Removed 'Shadow buttons' option, and replaced with none/shadow/etch setting + - default to 'none'. +2. Added 'passwordChar' option to set character used for password entries. +3. Option to have frameless groupboxes - Gtk like. +4. Add an 'Advanced' tab to config dialog. +5. Add config item gtkButtonOrder set to 'true' to use Gtk/GNOME button order. +6. Modified contrast settings to be more varied. +7. Gradient background of checks and radios, if appearance is not flat/raised. + +0.52.3 +------ +1. Don't lighten border of disabled check/radio buttons. +2. Lighten trough of disabled slider. +3. Modify khtml check to also check to see if widget name == "__khtml" +4. Store khtml widgets in a map, to speed up checking. +5. Fix shadow on comboboxes. +6. Draw background of checked menuitem icons as per KDE4. + +0.52.2 +------ +1. Fix crash when slider colour == button. + +0.52.1 +------ +1. Draw emphasis around menus when not lightening. +2. Use button colours to border entry fields. +3. Dont allow scrollbars to be recoloured. +4. Fix amarok menus! + +0.52 +---- + 1. Use 'dull glass' as the default gradient - previous default is now + called 'Clean'. + 2. Darken slider mouse over colour if slider is not shaded. + 3. Use thinner slider mouse over sections if slider is not shaded. + 4. Improve look of small V arrows. + 5. Even duller dull glass, but much more useable. + 6. Fix setting of check/radio colour. + 7. Only highlight editable combo arrow when mouse over arrow, not over + edit field - more Gtk like. + 8. Added one config file option (no gui): + gtkScrollViews set to 'true' to have the scrollbars drawn outside + of scrollviews. (However, doesn't look very good) + 9. Lighten combo list frame. +10. Dont round MDI buttons. +11. Fix opera's MDI buttons within menubars. +12. Always assume PE_ButtonBevel is enabled - used for QtConfig's colour buttons. + +0.51 +---- + 1. Changed shading to use HSL colour space. This can be altered by + editing $XDG_CONFIG_HOME/qtcurvestylerc and setting 'shading=simple' + for the previous method, or 'shading=hsv' to use HSV. + 2. Add options: + Border all of menu/toolbars. + Darker borders. + 'V' arrows. + 3. Fix raised listview headers. + 4. Fix glass style menuitem appearance. + 5. Modifed look of dullglass, looks "softer" + 6. Improve look of plastik mouse-over for non coloured scrollbars. + 7. For disabled buttons, use standard fill but lighten border. + 8. Use darker colours for mouse-over and default button - helps with + light colour schemes. + 9. Dont draw sunken panel around checked menuitems. +10. Fix karm (and others?) statusbar icon. +11. Fix for radio buttons in apps where QApplication::NormalColor!=QApplication::colorSpec() + (e.g. designer) + +0.50 +---- +1. Add settings for: + Fill used slider + Round menubar item top only + Menuitem appearance + Border menuitems + Progressbar appearance + Gradient progressbar groove + Use standard buttons for sidebar buttons + Check/radio colour + Plastik style mouse-over +2. Dont colour menubar items on mouse over if not colouring menubars. +3. When drawing menubar borders, only draw bottom line. +4. When drawing toolbar borders, only draw top/bottom or left/right + - depending upon orientation. +5. Draw checks/radios within listviews the same as standard. +6. Use 'foreground' colour for menu text. +7. Draw dock window titles, and darken background, to be more consistent + with Qt/KDE4. + +0.49 +---- +1. Add settings for: + Tab appearance + Listview appearance + Slider appearance +2. If KDE_SESSION_VERSION is set to >=4, then read settings from + $XDG_CONFIG_HOME/TrollTech.conf. This only affects Qt-only + applications - KDE apps should not be affected. +3. Lighten focus rectangle. + +0.48.5 +------ +1. Fix slight slider drawing errors. +2. Fix crash on mouse-over. + +0.48.4 +------ +1. Fix slight drawing errors in corner of lineedits on toolbars. +2. Fix scrollbar borders on certain apps - notably konsole. This was + caused by an attempt to fix KHTML's scrollbars - that fix will + now only be applied to konqueror and kontact (akregator uses khtml) + +0.48.3 +------ +1. Fix look of +/- spin buttons when etching. + +0.48.2 +------ +1. Modifed the glass variants. Dull is a bit 'duller' in the top 1/2, and + fades away at the bottom. Shiny is now more like dull, but with more + pronounced gradients. +2. Fix borders of selected menubar item when colouring menubar. +3. Only darken menubar colour when using selcted backgound colour, if + using glass gradients. +4. Only write settings to config file if differ from default. +5. Improve look of OpenOffice.org tabbars - not perfect, but better. +6. Fix some RTL issues. +7. Fix menubar drawing in kontact if shading only active windows. + +0.48.1 +------ +1. Draw light border around all of progressbar. +2. Fix squared checkboxes in khtml. +3. Fix drawing of menubar border for inactive windows. +4. Fix OpenOffice.org scrollbars. + +0.48 +---- +1. Fix coloured mouse over for glass styles. +2. Re-introduce the following options: + Roundedness + List view lines + Striped progress bars + Drawing of statusbar frames +3. Draw light border around progressbar elements + when not in flat/raised/inverted mode. +4. Oval shaped sliders when fully round, otherwise rectangular +5. Fix redraw problems with ">>" buttons on toolbars. (The buttons + that appear when an app is shrunk too much.) +6. Fix slider redraw errors when using scroll wheel. + +0.47 +---- + 1. Always draw light border around glass elements. + 2. Removed the following config options: + Custom light border colour + Fill used slider groove - always filled. + Stripped progress - always striped + V Arrows + Check/radio background highlight + Round menubar item top only + Draw statusbar frames - never drawn. + Highlight selected text fields - always. + Standard highlight for inactive windows - always + Listview lines are either on/off, not off/dotted/solid + Scrollbars and sliders share same config options + Check radio colour setting - always text colour + Border/round menubar/items - always rounded/bordered. + Roundedness - always rounded. + Listview settings - always arrows, no lines, and header + follows general appearance. + Tab appearance - set from general appearace. + Draw dock window titles - never. + Colored sidebar buttons - always. + 3. Changed appearance of check/radios - now filled with base + colour. + 4. Etch look for button, combos, line edits, and spin boxes. + 5. Fill check/radio background on mouse over. + 6. Remove --enable-old-shading + 7. Modify shade settings so that what was "Shade selected" becomes + "Shade blended selected", and add a new "Shade selected" that just + uses the selected background colour without blending. + 8. Round slider thumbs. + 9. Option to draw a shadow underneath buttons. +10. Draw a rounded gray rectangle for focus - option to set this to + windows-like focus. +11. Only set min button width for buttons whose text is not "...". +12. Removed save/load functionality from config dialog - only import/export + left. +13. Re-fix kaffeine's sliders. +14. Hacky fix for scrollbars within khtml. +15. Remove main frame that surounds kontact. +16. Fix search field/results in systemsettings. + +0.46.4 +------ +1. Only draw gradients if width>0 && height>0 + +0.46.3 +------ +1. Fix look of flat/raised style menuitems and progressbars. +2. Fix look of read-only KLineEdits. + +0.46.2 +------ +1. Remove rgb2Hls() and hls2Rgb() unless using old style shading. +2. Don't mouse-over disabled tabs! +3. Fix look of flat style tabs. + +0.46.1 +------ +1. Fix location of arrows on secondary scrollbar buttons. +2. New shading routine - works *much* better with dark colour + schemes. This is enabled for all colours be default, to + enable only for dark colours (i.e. where red, green, + and blue < 96), then configure with --enable-old-shading + +0.46 +---- +1. Allow negative highlight factors. +2. Allow usage of light borders on menuitems and progressbars, + as well as a custom colour setting. Patch by Frederic Van Assche +3. Dont fill in slider grooves of disabled sliders. Patch by Frederic Van Assche +4. Dont allow OO.o menubar shading if this would require swapping + text colours - cant do this in OO.o. + +0.45.3 +------ +1. Correctly place check and radio buttons. +2. Improve drawing of very small progress. + +0.45.2 +------ +1. Make kaffeine's sidebar buttons consistent when coloured. +2. Fix look of dvd authoring wizard buttons. + +0.45.1 +------ +1. Restore pre 0.45 inactive window highlight. Option is + still there to re-activate. +2. Fix dark text appearing on progressbars. +3. Use KStyle to draw status bar elements - if enabled. + +0.45 +---- +1. Option to control whether highlighted items should use + the highlight color in inactive windows. +2. Option to control whether menubars should be shaded in + inactive windows. +3. Fix loading / selection of options. + +0.44.3 +------ +1. Dont colour sliders when disabled/maxed-out. +2. When drawing light slider border, draw around all 4 sides. +3. Fix gambas toolbar. +4. Use Qt's qconfig.h to determine endianess. +5. Slight code clean-up. + +0.44.2 +------ +1. Restore 0.43 scrollbar trough shade. +2. Fix slight redraw errors when no scrollbar buttons. +3. Fix redraw problems with pathbar. + +0.44.1 +------ +1. Fix errors when drawing status bar frames. +2. If using lighter popup menu backgrounds, correctly adjust to + palette changes. +3. When exporting the current or default style, prompt user + for style name. + +0.44 +---- + 1. Specifiable colours for check and radio indicators. + 2. Options to control whether menu items should be rounded. + 3. Options to control whether menu items should be bordered. + 4. Option to enable mouse-over for menubar items. + 5. Option to have thinner menu items. + 6. More pronounced gradients for menuitems and progressbars. + 7. Option to use large dots. + 8. Option to set scrollbar button type: kde, windows, platinum, + next, or none. + 9. Slightly better radios in khtml. +10. Slightly smaller buttons. +11. Option to have colored side-bar buttons - e.g. the buttons on the + edge of kate's windows. +12. Improvement to Opera's MDI buttons in menubar area. Not + perfect, but better. +13. Draw menubar item pixmaps - e.g. page icon in opera. +14. Possible fix for pixmap recolouring on big endian systems. + +0.43.2 +------ +1. Fix the config dialog to notice changes in menu text color settings. +2. Dont draw menubar text twice! + +0.43.1 +------ +1. Supplied pre-compiled pixmaps. + +0.43 +---- + 1. Option to draw light border around sliders. + 2. Tab mouse-over is now always enabled. + 3. Dialog fix is now a config option, not compile option. + 4. 'AA' slider handles in slight rounded mode. + 5. Really fix KDE 3.5.5 taskbar flicker... + 6. Slight improvement to combobox when right-to-left + 7. Seperate specification of scollbar slider, and range slider, settings. + 8. Option to specify menubar text colors. + 9. New 'flat' appearance. +10. Options to use a coloured border for mouse-over. +11. Nicer looking check and radio buttons - using pixmaps. +12. Fix ./configure problems - by setting a default prefix. + +0.42.3 +------ +1. Fix flickering of taskbar buttons in KDE 3.5.5 - thanks to + Patrice Tremblay +2. Don't fill slider groove if min value == max value +3. Apply modal 'hack' to kdialog as well - but only if not embedded. +4. When applying modal hack to kdialog and kprinter, remove " - KPrinter" + and " - KDialog" from captions. + +0.42.2 +------ +1. Fix slider focus rect. +2. Fix problem with selected bottom tab when tab highlighting is off. + +0.42.1 +------ +1. Revert checkbox mask. +2. Fix loading of custom themes. +3. Fix progress always being striped. +4. Fix not being able to delete custom styles. + +0.42 +---- + 1. Optimisation to some drawing routines. + 2. Removal of sunken gradients for progress and menubar items. + 3. Progressbar and menuitem look now set via appearance setting. + 4. Flat style check/radios match non-flat style more. + 5. Remove "Border Splitters" option. + 6. Removal of "Light Gradient" and "Gradient" -> replaced with just + "Gradient" (which is the previous "light Gradient") + 7. Nicer progressbar style - options to have striped and animated. + 8. Option to have dots for slider thumb. + 9. Configurable splitter style - sunken lines, raised lines, dashes, + dots. +10. Apply --enable-parentless-dialogs-fix to non-modal dialogs as well. + These will now not get a taskbar entry. +11. Selected/normal tab appearance selectable. +12. Option to control the roundedness. +13. Option to fill in the used portion of slider groove. +14. Gradient slider and scrollbar troughs. +15. Draw gradients into a pixmap, and then cache this for later use. +16. Display dock window titles. +17. Make OO.os file dialog have no taksbar/pager entry (if + --enable-parentless-dialogs-fix is specified). +18. Better rounded look for KHTML widgets. + +0.41.1 +------ +1. Compile fix if --enable-tab-mouse-over is not specified. + +0.41 +---- + 1. Fix glass gradient match between toolbar button and empty area. + 2. Dont limit the max area of glass gradient. + 3. Discover home folder via getpwuid(geteuid()) before $HOME + 4. For root, check $XDG_CONFIG_HOME is in ~root - if not, then + set to ~/.config + 5. Improve appearance of widgets that derive from KTabCtl + 6. Apply parentless dialog fix to windows created at app startup. + e.g. guidance config modules. + 7. Option to have a coloured border for default button + 8. Fix some tabs text not moving when selected. + 9. Don't mouse-over highlight the selected tab. +10. Show 0% -> 50% in config ui, not 100% -> 150% +11. Fix look of disabled tab widgets +12. Rounded headers + +0.40 +---- +1. Better rounded tabs +2. Configurable highlight factor - 0% to 50% +3. Experimental hack to fix parentless modal dialogs (i.e. kate's + close warnings, most kaffeine dialogs). Disabled by default, + enable with --enable-parentless-dialogs-fix +4. Move scrollbar, and spinbutton, arrows down/left when pressed +5. Depress combos when active +6. Enable mouse-over highlights for tabs, with --enable-tab-mouse-over + ./configure option. Note, this currently *only* works for KDE and not + Gtk - hence why it is disaled by default. +7. Improve the appearance of KTabCtl widgets - not perfect, but better. +8. Fix slider focus rect +9. Default style is set from: + a. Coded settings + b. Settings read from /etc/qt/qtcurvestylerc + c. Settings read from /etc/qt3/qtcurvestylerc + d. Settings read from /etc/qt4/qtcurvestylerc + + e.g. to make "Shiny Glass" the default style, copy + Glass1.qtcurve to /etc/qt3/qtcurvestylerc + +0.39.1 +------ +1. Fix for sunken frames +2. Fix slight drawing errors on 1st non selected tab +3. Fix reading of custom slider colour +4. OpenOffice.org frame fixes +5. Fix focus rect on sliders +6. Draw border around pressed kicker buttons - e.g. KMenu +7. Only draw line under main konqueror tabs, not settings tabs +8. Proper listview headers for dialogs coming from kicker + +0.39 +---- + 1. KDE: Really theme dock window handles - i.e. no more text. Forgot + to actually include this in 0.37! + 2. KDE: Nice dock window resize handles. + 3. KDE: On konqueror's active tab, draw light line at bottom. + 4. ALL: Dont round the focus rect, seems to cause problems. + 5. ALL: Dont shrink focus rect for listview entries. + 6. ALL: Split into KDE and Gtk packages. + 7. ALL: Option to not gradient selected tab. + 8. ALL: Store/read config settings from $XDG_CONFIG_HOME/qtcurvestylerc + 9. KDE: Use a '-' for tristate checkboxes +10. GTK: Implement tristate for checkboxes and radios +11. ALL: Round tab widgets +12. ALL: Round frames +13. ALL: Rounder progress bars +14. ALL: Wider splitters +15. ALL: Remove non-bordered option. + +0.38 +---- +1. GTK1: Compile fix. +2. GTK2: Don't turn firefox text white when mouse over! +3. ALL: Inverted gradients option. + +0.37 +---- + 1. KDE: Better +/- spinbuttons. + 2. ALL: Better bevelled gradients. + 3. ALL: Option to draw a coloured focus rectangle. + 4. ALL: Modified default: + Bevelled gradient + Coloured focus + Dotted handles/serparators + Normal arrows + No listview lines + 5. ALL: Make glass extend to full width and height of widgets + - no 3d border. + 6. ALL: In listviews, draw focus rectangle within item. + 7. KDE: Use dots also for general handles - more consistent. + 8. KDE: Theme dock window handles - i.e. no more text. + 9. KDE: Fix/hack look of MDI window buttons. +10. GTK2: Hackish fix for firefox and KDE's "apply colors to non-KDE apps" + setting. +11. GTK: Fix for tear of menu background. + +0.36 +---- +1. KDE: Fix for "Search" label in ksysguard, etc. +2. KDE: Fix pixmap based menu items - e.g. Kig's colour sub-menu. +3. KDE: Use a slider width of 16 for kpresenter, it seems to assume + this regardless of the style used :-( +4. GTK: Fix line-edits always being rounded. +5. GTK2: Fix for OO.o?? + +0.35 +---- + 1. KDE: Prevent MainActor from using its horrible colour scheme. + 2. GTK2: Fix for larger "Help" buttons in GIMP. + 3. KDE: Extend gradients to border when border level set to none + for toolbars and menubars. + 4. KDE: Fix for non-rounded +/- buttons on Karbon toolbar. + 5. ALL: Remove "border" form default button options. + 6. KDE: Fix possible crash with hover widgets. + 7. GTK2: Supply a QtCurve.css file for FireFox 1.5.x, which will: + * Fix Firefox 1.5.x's button order. The xml file + needed to do this is taken from PlastikFox - thanks + to VÃÂctor Fernández + * Disable emboldening of text on selected tab + * Use KDE's message/info/error/question icons in dialogs. + * Move button/toolbar contents when pressed. + 8. GTK2: Custom user.js file to modify FireFox's behaviour: + * Remove 'instant apply' + * Use KDE's prefered email client + This can be enabeld via + --enable-mozilla-userjs + ./configure option. Disabled by default. + 9. GTK2: Fix check marks in FireFox menus. +10. KDE: Use similar style for table headers as for listview headers. + +0.34 +---- +1. GTK: Fix for darkening of menubars. +2. GTK: Fix progressbar text. +3. KDE: Hack to get white selected menu item text in OO.o2. Still can't + do coloured menubars... +4. ALL: Option to disable drawing of statusbar frames. +5. KDE: Dont use dots or dashes for general handles - only for toolbar + handles. +6. GTK: Fix for not colouting flat menubars. +7. KDE: Slight improvement to tab highlighting. + +0.33 +---- + 1. ALL: Use lighter shading for glass. + 2. GTK2: Use default.kde as KDE icon folder. + 3. KDE: Fix for listview lines sometims drawing over arrows. + 4. KDE: Dont lighten konqueror's status bar - copied from lipstik. + 5. ALL: Allow seperate specification of menubar item and progress + bar looks. + 6. ALL: New gradient style: bevelled - gradient top/bot, and plain in the + middle. Affects listview headers, buttons, and combos. + 7. ALL: Allow setting of listview appearance. + 8. ALL: Allow setting of listview header color - background, button, or + custom. + 9. ALL: Option to only round top of selected menubar items. +10. ALL: New toolbar handle style: dashes +11. ALL: Remove Gtk1 dependancy for debian .deb file + +0.32 +---- +1. ALL: "Thinner" looking non-selected tabs for glass styles. +2. GTK2: Add ./configure argument + --disable-mozilla-mods Dont alter user's userChrome.css +3. KDE: Support saving, and loading, of custom schemes. +4. KDE: Predefiend styles are now read in from .qtcurve files +5. ALL: New scheme with old glass look, flat toolbars, and normal arrows. +6. KDE: Re-design of config dialog. +7. ALL: Remove "V?" style naming. + +0.31.1 +------ +1. GTK2: added 2 ./configure arguments: + + --disable-gtk-icons Dont do KDE-Gtk icon mapping + --enable-kde-event-filter Add the event filter to intercept KDE + style changes. + + (Thanks to Vaclav Slavik for the "--disable-gtk-icons" patch) + +0.31 +---- +1. ALL: Better "glass" gradients. +2. ALL: Dont use highlighted text colour to border selected menubar items. +3. GTL2: Remove event filter added in 0.29, this seems to cause problems + for some people with some apps. So, colour, font, etc. changes + wont happen in Gtk2 apps until they are restarted. +4. GTK: Dont draw dividers in listview headers, unless header is >10 pixels +5. ALL: Gradient non-selected tabs as well as selected. +6. GTK2: Also look in "hicolor" for icons. Search order will be: + <chosen theme>, crystalsvg, hicolor +7. GTK2: Map gt-add and gtk-remove stock icons + +0.30 +---- +1. KDE: Shrink menu entries by 1 pixel - to align with Gtk. +2. GTK2: If switch from coloured menus to non-coloured, remove from userChrome.css +3. GTK: Fix for slight redraw error on the top of toolbar buttons. +4. GTK: Better toolbar buttons, etc. + +0.29.1 +------ +1. GTK1: Compile fix. + +0.29 +---- + 1. KDE: More consistent, with Gtk, menu separators. + 2. GTK1: Dont force to flat appearance! (Only menubars are forced to flat, + as I havnt got round to implementing menubar shading on Gtk1) + 3. GTK2: When looking for firefox/thunderbird's userChrome.css, look for + <blah blah>.default and default.<blah blah> + 4. KDE: Move handle section into menu bar tab. + 5. ALL: Allow dotted handles - default for V6. + 6. ALL: Allow dotted (V6 default), or no toolbar separators. + 7. GTK: React to KDE style changes - i.e. update colours, fonts, options, + etc. + 8. GTK2: Fix for text on combos turning white on mouse over. + 9. GTK: Use same menu colour as KDE when shading! +10. ALL: Fix for vertical toolbars. +11. GTK2: Also look in ~/.kde (or $KDEHOME) for user icons. +12. GTK2: Only write userChrome.css if made changes. + +0.28 +---- +1. KDE: Remove some debug. +2. KDE: If selected colour is too dark, just don't recolour OO.o menubars + - lightening the background colour doesn't look good. +3. ALL: When using glass gradient, round all corners of menubar entry + selection. +4. KDE: Allow vArrow to be disabled. + +0.27.1 +------ +1. GTK2: Allow to compile with Gtk <= 2.2 + +0.27 +---- + 1. ALL: Slightly lighter non-selected tab, and scrollbar groove, shading. + 2. KDE: Fix for sliders in kaffeine. + 3. KDE: Finally fixed 'V' arrows! + 4. GTK2: Firefox & thunderbird - edit user's userChrome.css file to set + KDE buton order, and adjust menu text if using a dark background. + 5. ALL: If using selected for background on menus, automatically use selected + text colour - as opposed to try to see if its too dark. + 6. GTK: Consistent menubar shade with KDE. + 7. GTK2: Try to set toolbar style, icon size, icons-on-buttons from KDE + settings. + 8. GTK2: Set alternative button order. + 9. GTK2: Map some KDE icons to GTK icons. +10. KDE: Increase OO.o menu selection brightness if selected colour is 'too dark' +11. GTK: Better AA'ing around edit fields. +12. GTK: Better toolbar borders with inkscape. +13. ALL: Only round menubar items on top. +14. GTK: Read /etc/qt3/qtrc, /etc/qt3/qtcurvestylerc, /etc/qt/qtrc, + /etc/qt/qtcurvestylerc before reading $HOME/.qt/qtrc, etc. +15. KDE: More consistent, with Gtk, menu check boxes. +16. GTK2: Smaller toolbars for AbiWord +17. ALL: Un-revert header changes. Fixed KDE table look, and seem to have + fixed listview redraw! + +0.26 +---- + 1. GTK2: Fix for combobox separator not always re-drawing. + 2. GTK2: More KDE-like comboboxes + 3. GTK: Use black dashes for focus. + 4. GTK2: Fix for button of some editable comboboxes. + 5. KDE: Better combobox metrics, etc. + 6. ALL: Option to gradient toolbars. + 7. KDE: Fix for "Search" label in systemsettings toolbar. + 8. ALL: Allow custom menubar and slider colours. + 9. GTK: Fix for not drawing coloured slider when flat. +10. ALL: Revert the header changes - had redraw problems. +11. ALL: Fix for tab-bar highlight when using light selection colours. +12. KDE: Fix for non-bordered gradient radio buttons. +13. GTK: More KDE like menu sizing. +14. KDE: Fix/hack for OO.o2.x menubars. If the selected menu color is toodark, + then lighten. This is required as OO.o always draws the menu text + dark! It seems to have a check for plastik style though, and then + it draws selected popup menu items white. + +0.25 +---- + 1. ALL: V5 - Gradient menubar. + 2. KDE: Polish disabled palette, so that all frames, etc. use the theme. + 3. KDE: When press 'Defaults' on settings dialog, set the version correctly, + and disable the options frame. + 4: ALL: Code cleanup. + 5. ALL: New V6 - Glass like gradients. Not default for the moment. + 6. ALL: Dont gradient non selected tabs. + 7. KDE: Respect setting of "dark lines" for list views. + 8. ALL: Better listview headers. + 9. ALL: Only round 1 side of spinbuttons. +10. ALL: Rounded entry fields (lineedits, spinwidgets, comboboxes) +11. ALL: Highlight entry boxes, spin widget entry, and combobox entry on focus. +12. KDE: More consistent with Gtk toolbar separators +13. ALL: When using light popup menu background, also use a lighter colour + for the background of checked menu items. +14. GTK: Use same base shade for menus/progress bars as for KDE. +15. GTK2: More KDE-like combobox lines +16. GTK: Fix for some combo box variants having a 1-pixel white border. +17. ALL: If light gradient and no border, need to add edges to buttons, etc. +18. KDE: Only highlight spinbutton that mouse is over - Gtk like. + +0.24.2 +------ +1. KDE: Compile fix. + +0.24.1 +------ +1. GTK1: Compile fix. + +0.24 +---- +1. ALL: Lighter background for pressed buttons, etc. +2. ALL: Use KDE's buttont text colour for buttons! +3. Remove seperate V1, V2, etc style files (.themerc, and gtkrc files), + => needs KControl to switch variant. +4. ALL: New V5 style - has the follwing differences from V4: + Darker menubar background + Lighter popup menu background + Flatter gradient in probress bar and selected menu items + 'V' arrows + Highlight strip on selected tabs + Shade sliders to the 'selected' colour +5. KDE: Fixed (actually implememented!) drawing of spinbox +/- buttons. +6. KDE: Fixed drawing of V arrows - sometimes were not filled in. +7. GTK: Make default font & colours match KDE3.5's defaults. + +0.23.1 +------ +1. Compile fix. + +0.23 +---- + 1. GTK: Fix colouring of check/radios. + 2. GTK: Fix bonobo toolbars - e.g. on nautilus 2.4. + 3. GTK: Draw handles on GNOME panel 2.4. + 4. GTK: Fix arrows going white when kde exports colours. + 5. GTK: Fix for some menu items in Gaim. + 6. GTK: Fix V1 style check/radios sometimes having the selected colour as + background + 7. GTK: Fix anti-aliasing on rounded radios when using gradient but no border. + 8. GTK2: Fix for rendering of toggle buttons in lists/cells - patch from + Alfons Hoogervorst + 9. ALL: Draw "pressed" background on all checked menu items, not just those with + icons. +10. ALL: Highlight splitters on mouse-over +11. ALL: New V4 (default) style, with the following: + Flatter gradient + Font colour used to border default buttons + No bold text on default button + Raised gradient (like buttons) for progress and menu bar selections + Rounded menubar selections + No border on splitters, use dots instead +12. KDE: Polish application palette, so that all frames, etc. use the theme. +13. KDE: Align kicker's handles better with the little arrows. +14. KDE: Support mouse over for kicker taskbar buttons >= 3.4 +15. KDE: Mouse over for spin widgets. +16. KDE: Increase toolbar button size - match GTK better. + +0.22 +---- +1. KDE: Remove scrollbar groove flicker. +2. KDE: Remove editable combo-box flicker. +3. ALL: New check/radio list code. +4. KDE: Custom checklist controller. +5. ALL: List view expanders - +/- (V1/V2), or arrows (V3) +6. KDE: List view lines - none, dotted (V1/V2), solid (V3) + (GTK does not (?) support lines between elements - so this setting will + not affect GTK apps) +7. KDE: Dark (V1/V2) or light (V3) list view lines. (Ditto) + +0.21 +---- +1. ALL: Adjust contrast settings to make lower-contrast the default. +2. ALL: Toolbar and menubar borders: none, light, and dark (previous default) +3: ALL: V3 now uses "light" toolbar/menubar borders. +4. KDE: Don't AA radiobuttons on HTML pages. +5. KDE: Squared-off splitters. +6. GTK: Fix base/prelight colour. +7. GTK: gcc 3.4 compile fix - thanks to Adam Gorzkiewicz +8. KDE: Make tabs more GTK like. +9: KDE: More GTK-like positioning of pushbutton icons - looks *much* nicer :-) + +0.20 +---- +1. GTK: Compile fix when compiled with KDE<3.2 +2. KDE: Slightly thinner menuitems. +3. GTK: Match KDE's menuitem size better. +4. GTK: Allow checks and radios to be re-coloured. +5. ALL: Better AA for the edges of checks and radios - not perfect tho. +6. GTK: If $HOME is not set, then try to ascertain from passwd entry. +7. KDE: 5 pixel border around pushbutton contents. + +0.19 +---- + 1. KDE: Fix for KDE not setting autoDefault() property of button - assume all + buttons can be default, leaving space for indicator. + 2. ALL: Optional triangle as default button indicator. + 3. GTK: Match KDE's export gtkrc colours. + 4. GTK2: Fix check/radio highlight so that it is not overridden by KDE's + export colours setting. + 5. ALL: Add option to enable/disable highlighting of check/radio labels. + 6: ALL: V3 - disable check/radio label highlight. + 7: ALL: V3 - use triangle as default button indicator. + 8: KDE: Fix menu button icon on konqueror's sidebar. + 9: ALL: Allow setting of slider thumbs: raised, sunken, or none. +10: ALL: Allow setting of handles: raised or sunken. +11: ALL: V3 - use sunken handles. +12: KDE: Fix for korn. +13: KDE: Fix for titlebutton on floating Qt windows - e.g. docks. +14: KDE: Fix for amaroK - buttons in player window were too large! + +0.18 +---- +1. KDE: Fix for colouring of kicker's task buttons - i.e. these should have highlight + colour when an app is opened in the background. +2. KDE: Use ::qt_cast<type *>(widget) as opposed to widget->inherits("type") whenever + possible. +3. GTK2: Compile fix. + +0.17.2 +------ +1. GTK: Compile fix when compiled with KDE<3.2 + +0.17.1 +------ +1. KDE: Use Qt 3.1 for ui file - so that will compile with Qt3.2, etc... + (Using 3.1 as I only have 3.1 and 3.3 installed...) + +0.17 +---- +1. GTK: Compile fix - used C++ syntax in C code, oops... +2. GTK2: Make focus rects more like KDE's +3. KDE: Allow combo-boxes and scrollbars to be recoloured. +4: ALL: If compiled with KDE3.2 then there is only 1 style "QtCurve", and + only 1 set of GTK gtkrc files installed. Variation (V1, V2, V3, or + custom) can then be selected via KControl. + + (NOTE: When upgrading from KDE3.1, you may wish to uninstall the + previous QtCurve release - to remove the old V2 and V3 config files) +5: ALL: Better non-bordered gradient radio/checks. +6: ALL: Option to use non gradient progress/menu bar indicator. +7: GTK: Don't shade paned widgets! +8: ALL: V1 has flat progress bar and menuitems - i.e. no gradient effect. +9: ALL: If no borders are selected and gradient selected, then use thin border + for progress bar and menuitems. +10: KDE: Better AA'ing of edges of round buttons. +11: GTK: Fix for background colour of selected text, thanks to David Rodr�uez Garc� +12: ALL: Use KDE's contrast setting. +13: KDE: Implement tri-state checkmarks. +14: ALL: Better bottom/right tab gradients. +15: KDE: (Qt>=3.2) the text/icon of a selected bottom tab moves down 1 pixel. +16: KDE: (Qt>=3.2) Only highlight text/check label if mouse is over sensitive area. +17: KDE: Mimic GTK's scrollbar highlighting. i.e. only highlight slider if mouse is + over slider area, and likewise for the buttons. +18: KDE: When kicker is set to transparent (may need to restart kicker), use "harsh" + rounded buttons in round mode. (i.e. don't AA the corners) +19: KDE: Modified button size code - KDE3.2's kcalc is smaller now! +20: KDE: Don't flatten combo box arrow area when selected - more GTK like. +21: KDE: Highlight clickable listview headers on mouse over - more GTK like. +22: GTK: HScrollBar fix. +23: KDE: More Gtk like shading of buttons - i.e. always dark when pressed. +24: ALL: Slight change to look of combo-box. +25: KDE: Fix for tabwidgets in konqueror, etc. + +0.16 +---- +1: ALL: Use "button text" colour for default button indicator, apart from when in + rounded mode (i.e. V3) +2: ALL: V3 - Embolden font of default button. +3: ALL: V3 - Lighter background for disabled check/radios. +4: ALL: V3 - Correct AA colour for radio indicator. +5: KDE: Draw triangular tabs the same as rounded - prevous versions defaulted to + KStyle. +6: KDE: Add 10pix (2*10) border to non-default buttons. +7: KDE: Implement masks for checks and radios - helps with khtml. + +0.15 +---- +1. KDE: Smaller, more Gtk-like toolbar separators. +2. ALL: When drawing rounded, use background colour for corner pixels. +3. ALL: V2, use a shade of the button colour for the default indicator. +4. ALL: V3, as for V2 above, but "round" the indicator. +5. KDE: When compiled for Qt 3.2, only highlight pixmap and text on mouse over + for radio and checkboxes - as these are the only sensitive parts. (Qt < 3.2 + the whole widget is sensitive - and this can expand past text.) +6. KDE: Fix bottom tabs - i.e. movement of text/icon. (Qt >= 3.2 !) +7. GTK: Fix bottom tabs on V1 +8. ALL: More rounded buttons, etc. +9: ALL: Rounded indicator boxes in rounded mode. +10: ALL: Better radio buttons. +11: KDE: Use rounded buttons for Kicker taskbar as well - looks OK now buttons are more + rounded. +12: GTK: Fix gradient rendering bug - seemed to affect GTK1 glade buttons. (When a partial + button had to be re-drawn, the whole button was re-drawn instead - clearing out the + text!) +13: GTK: Use "check" for check and radio's in menus - more Qt like. +14: ALL: V3 - Gradient radio's and checks. + +0.14 +---- +1. GTK2: Set slider width to 16 pixels to better match KDE. +2. GTK: Draw border around toolbar buttons 1 pixel smaller - saves overlap with frame. +3. GTK: Better tabs - GIMP 1.3's tab icons should now move. (GIMP's tabs are shaded + tho, hmm...) +4. ALL: V3 style uses "pyramid" (i.e. non "V" like) arrows. +5. KDE: Fix for menubar background if button colour != background colour. +6. KDE: Fix for background of "Location:" on konqueror. +7. GTK: Better lsitview headers - smaller, more KDE like. +8. GTK: Reduce differences in V1, V2, and V3 gtkrc files to the bare minimum - ready + for only 1 (KControl) configurable style. +9. GTK1: Fix (hack really) for range grooves. For some reason these were not being + drawn when first displayed. Works ok for ranges - but scrollbar grooves are still + messed up! The redraw only happens after you leave the widget! + +0.13 +---- +1. ALL: New V3 style - has rounded buttons, and uses gradient effect on buttons, tabs, + scrollbars, etc. +2. ALL: Code clean-up. + +0.12 +---- +1. KDE: Don't have flat buttons - i.e in printmgr, and kscd. +2. KDE: Default frame width of 1. +3. KDE: Fix mouse-over for some toolbar buttons - the on/off type. Affects most KDE styles, + but a real KDE fix should be in KDE3.2 +4. GTK2: Fix bug where V2 style options were being ignored. +5. GTK2 and KDE: When highlight a depressed button, use a lighter + shade of the depressed colour - and not the standard + highlight colour. +6. GTK: Active tab bar text is 1 pixel higher - a la KDE. +7. KDE: Fix for borded bottom tabs. + +0.11 +---- +1. GTK2: Fix possible memory corruption. +2. ALL: Square off splitter - more consistent. +3. GTK2: Fix for 2.2.x combo-boxes. + +0.10 +---- +1. GTK2: Better match of menubar height with KDE. +2. GTK: Fix up/down/left/right arrows. + +0.09 +---- +1. GTK2: Fix scrollbars for 2.2.x - scrolled 1 pixel too much. +2. GTK1: Fix lower spinbutton height. This was OK, so maybe its a Gtk + change. But from which version? I'm at 1.2.10 + +0.08 +---- +1. GTK: Better menu selection. + +0.07 +---- +1. KDE: Reduce min-size of combo-boxes. +2. GTK: Fixes for sodipodi - works with V1, not too good wrt V2... +3. GTK2: Fix for GTK2.2 font setting. + +0.06 +---- +1. GTK: Make combo-boxes thinner. +2. GTK: Allow ussage of GTK1 font substitution file, either + /etc/X11/qt_gtk_fnt2fntrc or ~/.qt/gtk_fnt2fntrc, and format: + + <replace from> <with> + + e.g. + + Arial=Helvetica + + This would cause GTK1 apps to use Helvetica, even if KDE/KControl + has specified Arial. Idea (& patch) supplied by Adrian Schroeter. + +0.05 +---- +1. ALL: Don't draw lines on scrollbars if less than 20 pixels. +2. GTK1: Allow to specify x and y thickness's in gtkrc file - as + happens in GTK2. Fixes bug with small menu entries. +3. GTK2: Remove 1 pixel border from menus - more consistent with GTK1, + and KDE - not for V2. +4. GTK: More KDE-like menu bar entries. +5. GTK: Re-do weight ranges - would mean 48 is accecpted as "Normal" +6. ALL: Now 2 styles: + QtCurve No borders around buttons, menus, and tab bars + QtCurve V2 Has borders - more like original B???/FreeCurve +7. ALL: Number of lines on toolbar handles is now 2, and 4 for scrollbars + and sliders. +8. ALL: Dark scrollbar, slider, and progress background - window colour +9. GTK1: Fix for slider background. +10. GTK2: Fix error with overlapping check/radio highlight on frame. +11. GTK2: Fix spinbuttons. + +0.04 +---- +1. KDE: Draw box around checked checkable menu item pixmaps. +2. KDE: Only use small arrows on spinbuttons, and only if size is + too small for larger. +3. KDE: Set min button size to 54 and not 70. +4. ALL: Remove progress bar border. + +0.03 +---- +1. KDE: Don't highlight disabled menu items - mimics GTK behaviour. +2. KDE: Progress bar background now matches GTK's. +3. GTK: Progress bar gradient is now the same as menu bar items - as + was KDE. +4. GTK: Progress bar contents now have 1 pixel border like KDE. +5. GTK: Better spinbutton boxes. +6. KDE: More GTK like spinbuttons. + +0.02 +---- +1. Use gtk-config and pkg-config to determine install location for + GTK 1 and 2 files. + +0.01 +---- +Initial release. @@ -0,0 +1,58 @@ +Installation +------------ +To build and install: + +1. mkdir build +2. cd build +3. cmake .. +4. make +5. make install + + +Themes +------ +As of v0.55, you can create QtCurve based themes. These will appear with KDE's style +control panel's combobox of styles. To create a new theme, select 'QtCurve' from +within KDE's style panel, then configure QtCurve as required. After this, in QtCurve's +config dialog, select 'Export theme' from the options menu button. You will then be +prompted to give your new 'theme' a name, and a comment. QtCurve will then create a file +named 'qtc_<name>.themerc (e.g. qtc_klearlooks.themerc) - this will have the following +format: + + [Misc] + Name=KlearLooks + Comment=Clearlooks inspired style + [KDE] + WidgetStyle=qtc_klearlooks + [Settings] + animatedProgress=false + appearance=gradient + ....rest of qtcurve settings... + +To use this theme, either copy qtc_<name>.themerc to +$KDEHOME/share/apps/kstyle/themes/ (usually ~/.kde/share/apps/kstyle/themes/) +or copy to <kde install prefix>/share/apps/kstyle/themes/ (usually +/usr/share/apps/kstyle/themes/) + +When KDE's style panel is restarted, your new theme should appear in the list. + + +Creating Distribution Packages +------------------------------ + +CMake (as of v2.4.x) does not support building rpm or deb packages, and a simple +checkinstall will not work. CMake 2.6 should support rpm and deb packages, but until +then I have supplied a simple shell script to build a package with checkinstall. +To use this: + +1. Install QtCurve as described above +2. From within the 'build' folder from step 2 above, call ../common/mkpkg +3. Answer the checkinstall questions. + + +pixmaps.h +--------- + +To regenerate this, run the following: + + qembed radio_frame.png radio_light.png radio_on.png check_on.png slider.png slider_light.png slider_v.png slider_light_v.png check_x_on.png > pixmaps.h
\ No newline at end of file @@ -0,0 +1,18 @@ +--new-- + +KDE: Better konqueror active (?) icon border. +KDE: Combobox popup should be drawn as a popup menu - ala Gtk. +ALL: Highlight tab bar? Not sure Gtk can do this :-( (qt gtk theme engine doesn't!) +--app specific-- + +OO.o: +KDE: 2.x no highlight on combofocus. + +KDE: Combo box has a lighter grey when disabled +KDE: Slight re-draw error on tabs if width of all tabs= width of tab bar -- but + all KDE themes seem to suffer from this. +KDE: Mising white pixel when last tab is selected, if its added then the above + suffers even more! +KDE: V3 Combobox list needs to be rounded in rounded mode - missing pixels, etc. + Also take into account scrollbar pos? i.e. draw line 1 pixel less on right? +ALL: GTK/KDE have different disabled text behaviour when contrast setting changed! diff --git a/common/check_on.png b/common/check_on.png Binary files differnew file mode 100644 index 0000000..4f28ac6 --- /dev/null +++ b/common/check_on.png diff --git a/common/check_x_on.png b/common/check_x_on.png Binary files differnew file mode 100644 index 0000000..dfc62df --- /dev/null +++ b/common/check_x_on.png diff --git a/common/common.h b/common/common.h new file mode 100644 index 0000000..21f6bae --- /dev/null +++ b/common/common.h @@ -0,0 +1,955 @@ +#ifndef __COMMON_H__ +#define __COMMON_H__ + +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + This program is free software; you can redistr ibute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +/* This file is quite 'hacky' as it contains lots of static function definitions - but I want to share the code + between Qt and Gtk, but not polute the namespace with exported functions... */ + +#include <string.h> +#include <math.h> +#include "config.h" + +/* + The following #define disables the rounding when scrollbar type==none. +#define QTC_SIMPLE_SCROLLBARS +*/ + +/* + The following #define disables the custom focus rectangle +#define QTC_PLAIN_FOCUS_ONLY +*/ + +/* + The following #define controls whether a scrollbar's slider should overlap + the scrollbar buttons when at min/max. This removes the thick looking line + between the slider and the buttons. +*/ +#define QTC_INCREASE_SB_SLIDER + +/* + Enable this to do focus highlighting for scrollviews... NOTE: Gtk2 currently does not do this. +#define QTC_HIGHLIGHT_SCROLVIEWS +*/ + +/* + Control shading used for glass variants. + 0 => As used in 0.51.1 + + 1 => As used in 0.51 + 2 => As used in <0.51 +*/ +#define QTC_GLASS_SHADING 0 + +typedef enum +{ + SHADING_SIMPLE=0, + SHADING_HSL=1, + SHADING_HSV=2 +} EShading; + +#if (!defined QTC_CONFIG_DIALOG) && (!defined QTC_KWIN) +static EShading shading=SHADING_HSL; +#endif + +#ifdef __cplusplus +#include <qconfig.h> +#ifdef QTC_CONFIG_DIALOG +#include <qapplication.h> +#endif +#else +#include <glib.h> +#endif + +#ifdef __cplusplus +typedef QColor color; +#else +typedef gboolean bool; +typedef GdkColor color; +#define true TRUE +#define false FALSE +#endif + +#define QTC_GROUP "Settings" +/*#define QTC_DESCR_GROUP "Description"*/ + +/* qtc_<theme name>.themerc support */ +#define KDE_PREFIX(V) ((4==(V)) ? KDE4PREFIX : KDE3PREFIX) +#define QTC_THEME_DIR "/share/apps/kstyle/themes/" +#define QTC_THEME_PREFIX "qtc_" +#define QTC_THEME_SUFFIX ".themerc" + + +#define QTC_CHECK_SIZE 13 +#define QTC_RADIO_SIZE 13 +#define QTC_MIN_BTN_SIZE 8 +#define QTC_LV_SIZE 7 + +#define LARGE_ARR_WIDTH 7 +#define LARGE_ARR_HEIGHT 4 +#define SMALL_ARR_WIDTH 5 +#define SMALL_ARR_HEIGHT 3 + +#define NUM_STD_SHADES 6 +#define NUM_EXTRA_SHADES 3 + +#define TOTAL_SHADES NUM_STD_SHADES+NUM_EXTRA_SHADES +#define ORIGINAL_SHADE TOTAL_SHADES + +#define SHADE_ORIG_HIGHLIGHT NUM_STD_SHADES +#define SHADE_4_HIGHLIGHT NUM_STD_SHADES+1 +#define SHADE_2_HIGHLIGHT NUM_STD_SHADES+2 + +/* 3d effect - i.e. buttons, etc */ +#define QTC_SHADES \ + static const double shades[2][11][NUM_STD_SHADES]=\ + { \ + { /* HSV & HSL */ \ + { 1.05, 1.04, 0.90, 0.800, 0.830, 0.82 }, \ + { 1.06, 1.04, 0.90, 0.790, 0.831, 0.78 }, \ + { 1.07, 1.04, 0.90, 0.785, 0.832, 0.75 }, \ + { 1.08, 1.05, 0.90, 0.782, 0.833, 0.72 }, \ + { 1.09, 1.05, 0.90, 0.782, 0.834, 0.70 }, \ + { 1.10, 1.06, 0.90, 0.782, 0.836, 0.68 }, \ + { 1.12, 1.06, 0.90, 0.782, 0.838, 0.63 }, \ + { 1.16, 1.07, 0.90, 0.782, 0.840, 0.62 }, /* default */ \ + { 1.18, 1.07, 0.90, 0.783, 0.842, 0.60 }, \ + { 1.20, 1.08, 0.90, 0.784, 0.844, 0.58 }, \ + { 1.22, 1.08, 0.90, 0.786, 0.848, 0.55 } \ + }, \ + { /* SIMPLE */ \ + { 1.07, 1.03, 0.91, 0.780, 0.834, 0.75 }, \ + { 1.08, 1.03, 0.91, 0.781, 0.835, 0.74 }, \ + { 1.09, 1.03, 0.91, 0.782, 0.836, 0.73 }, \ + { 1.10, 1.04, 0.91, 0.783, 0.837, 0.72 }, \ + { 1.11, 1.04, 0.91, 0.784, 0.838, 0.71 }, \ + { 1.12, 1.05, 0.91, 0.785, 0.840, 0.70 }, \ + { 1.13, 1.05, 0.91, 0.786, 0.842, 0.69 }, \ + { 1.14, 1.06, 0.91, 0.787, 0.844, 0.68 }, /* default */ \ + { 1.16, 1.06, 0.91, 0.788, 0.846, 0.66 }, \ + { 1.18, 1.07, 0.91, 0.789, 0.848, 0.64 }, \ + { 1.20, 1.07, 0.91, 0.790, 0.850, 0.62 } \ + } \ + } ; + +#define QTC_SIMPLE_SHADING (!shading) + +#define QT_STD_BORDER 5 +#define QT_DISABLED_BORDER QT_STD_BORDER /*3*/ +#define QT_BORDER(E) (/*(E) ?*/ QT_STD_BORDER/* : QT_DISABLED_BORDER*/) + +#define QT_FRAME_DARK_SHADOW 2 +#define QT_FOCUS 3 + +#define QTC_SHADE(c, s) \ + (c>10 || c<0 || s>=NUM_STD_SHADES || s<0 \ + ? 1.0 \ + : opts.darkerBorders && (QT_STD_BORDER==i || QT_DISABLED_BORDER==i) \ + ? shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] - 0.1 \ + : shades[SHADING_SIMPLE==shading ? 1 : 0][c][s] ) + +#define TAB_APPEARANCE(A) (A) /* (APPEARANCE_GLASS==(A) ? APPEARANCE_GRADIENT : (A)) */ +#define QTC_COLOR_SEL_TAB_FACTOR 1.2 + +#define QTC_ROUNDED (ROUND_NONE!=opts.round) + +#define QTC_ETCHED_DARK 0.95 +#define SHADE_BEVEL_GRAD_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07) +#define SHADE_BEVEL_GRAD_DARK (QTC_SIMPLE_SHADING ? 0.93 : 0.91) +#define SHADE_BEVEL_GRAD_SEL_LIGHT (QTC_SIMPLE_SHADING ? 1.05 : 1.07) +#define SHADE_BEVEL_GRAD_SEL_DARK (QTC_SIMPLE_SHADING ? 0.95 : 0.93) + +#define SHADE_BEVEL_MENU_ITEM_LIGHT (QTC_SIMPLE_SHADING ? 1.07 : 1.09) +#define SHADE_BEVEL_MENU_ITEM_DARK (QTC_SIMPLE_SHADING ? 0.85 : 0.83) + +#define SHADE_SLIDER_LIGHT 1.1 +#define SHADE_SLIDER_DARK 0.8 + +#define SHADE_SBAR_LIGHT 1.02 +#define SHADE_SBAR_DARK 0.95 + +#define SHADE_MENU_LIGHT 1.02 +#define SHADE_MENU_DARK 0.96 + +#define SHADE_TAB_SEL_LIGHT 1.1 +#define SHADE_TAB_SEL_DARK 1.0 + +#define SHADE_BOTTOM_TAB_SEL_LIGHT 1.0 +#define SHADE_BOTTOM_TAB_SEL_DARK 0.96 + +#define SPLIT_GRADIENT_FACTOR 0.415 + +#if !defined QTC_GLASS_SHADING || QTC_GLASS_SHADING==0 + + #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \ + ? (WIDGET_DEF_BUTTON==W ? 0.99 : 0.98) \ + : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.55)) + #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A \ + ? (WIDGET_DEF_BUTTON==W ? 0.94 : 0.92) \ + : 0.92) + #define SHADE_GLASS_BOT_A(A) (APPEARANCE_DULL_GLASS==A ? 1.02 : 0.99) + #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.10 : 1.16) + +#elif QTC_GLASS_SHADING==1 + + #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \ + ? (WIDGET_DEF_BUTTON==W ? 1.0 : 1.0) \ + : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7)) + #define SHADE_GLASS_TOP_B(A, W) (APPEARANCE_DULL_GLASS==A ? 0.96 : 0.96) + #define SHADE_GLASS_BOT_A(A) 0.99 + #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16) + +#else + + #define SHADE_GLASS_TOP_A(A, W) (APPEARANCE_DULL_GLASS==A \ + ? (WIDGET_DEF_BUTTON==W ? 1.05 : 1.05) \ + : (WIDGET_DEF_BUTTON==W ? 1.08 : 1.7)) + #define SHADE_GLASS_TOP_B(A, W) 0.96 + #define SHADE_GLASS_BOT_A(A) 0.99 + #define SHADE_GLASS_BOT_B(A) (APPEARANCE_DULL_GLASS==A ? 1.08 : 1.16) + +#endif + +#define IS_GLASS(A) (APPEARANCE_DULL_GLASS==A || APPEARANCE_SHINY_GLASS==A) +#define IS_FLAT(A) (APPEARANCE_FLAT==A || APPEARANCE_RAISED==A) +#define SHADE_SELECTION_TOP 1.15 +#define SHADE_SELECTION_BOT 0.9 + +#ifdef __cplusplus +#define MENUBAR_DARK_LIMIT 160 +#define TOO_DARK(A) ((A).red()<MENUBAR_DARK_LIMIT || (A).green()<MENUBAR_DARK_LIMIT || (A).blue()<MENUBAR_DARK_LIMIT) +#else +#define MENUBAR_DARK_LIMIT (160<<8) +#define TOO_DARK(A) ((A).red<MENUBAR_DARK_LIMIT || (A).green<MENUBAR_DARK_LIMIT || (A).blue<MENUBAR_DARK_LIMIT) +#endif + +#define DEFAULT_HIGHLIGHT_FACTOR 1.05 +#define MAX_HIGHLIGHT_FACTOR 50 +#define MIN_HIGHLIGHT_FACTOR -50 +#define MENUBAR_DARK_FACTOR 0.97 +#define POPUPMENU_LIGHT_FACTOR 1.15 +#define INACTIVE_HIGHLIGHT_FACTOR 1.20 + +#define USE_SHADED_MENU_BAR_COLORS (SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars) +#define MENUBAR_GLASS_SELECTED_DARK_FACTOR 0.9 +#define GLASS_BORDER 0.4 +#define BEVEL_BORDER(w) (WIDGET_LISTVIEW_HEADER==w ? 6 : 4) +#define SHADE_BEVEL_TOP 1.07 +#define SHADE_BEVEL_MID_TOP 1.03 +#define SHADE_BEVEL_MID_BOT 0.975 +#define SHADE_BEVEL_BOT(w) (WIDGET_LISTVIEW_HEADER==(w) ? 0.88 : 0.90) + +#define NUM_SPLITTER_DASHES 21 + +#define WIDGET_BUTTON(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || WIDGET_CHECKBOX==w) +#ifdef __cplusplus +#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w) +#else +#define ETCH_WIDGET(w) (WIDGET_STD_BUTTON==w || WIDGET_DEF_BUTTON==w || WIDGET_TOGGLE_BUTTON==w || \ + WIDGET_SPIN_UP==w || WIDGET_SPIN_DOWN==w) +#endif +#define COLORED_BORDER_SIZE 3 +#define PROGRESS_CHUNK_WIDTH 10 +#define QTC_DRAW_LIGHT_BORDER(SUKEN, WIDGET, APP) \ + ((!SUKEN && IS_GLASS(APP) && WIDGET_MENU_ITEM!=WIDGET && WIDGET_DEF_BUTTON!=WIDGET) || \ + (WIDGET_PROGRESSBAR==WIDGET && APPEARANCE_FLAT!=APP && \ + APPEARANCE_RAISED!=APP && APPEARANCE_INVERTED!=APP)) + +#define PROGRESS_ANIMATION 100 +#define MIN_SLIDER_SIZE(A) (LINE_DOTS==A ? 24 : 20) + +#define QTC_NORM_TAB_APP (APPEARANCE_BEVELLED==opts.tabAppearance || APPEARANCE_SPLIT_GRADIENT==opts.appearance \ + ? APPEARANCE_GRADIENT : opts.tabAppearance) +#define QTC_SEL_TAB_APP (APPEARANCE_INVERTED==opts.tabAppearance ? APPEARANCE_FLAT : (QTC_NORM_TAB_APP)) +#define QTC_SLIDER_MO_SHADE (SHADE_SELECTED==opts.shadeSliders ? 1 : (SHADE_BLEND_SELECTED==opts.shadeSliders ? 0 : ORIGINAL_SHADE)) +#define QTC_SLIDER_MO_BORDER (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 2 : 1) +#define QTC_SLIDER_MO_LEN (SLIDER_TRIANGULAR==opts.sliderStyle ? 2 : (SHADE_SELECTED==opts.shadeSliders || SHADE_BLEND_SELECTED==opts.shadeSliders ? 4 : 3)) +#define QTC_SB_SLIDER_MO_LEN(A) ((A)<22 && ROUND_FULL!=opts.round \ + ? 2 \ + : ((A)<32 || (SHADE_SELECTED!=opts.shadeSliders && SHADE_BLEND_SELECTED!=opts.shadeSliders) \ + ? 4 \ + : 6)) + +#define QTC_CR_MO_FILL (SHADE_BLEND_SELECTED==opts.shadeCheckRadio || SHADE_SELECTED==opts.shadeCheckRadio ? 1 : 2) +#define QTC_MO_DEF_BTN 2 +#define QTC_MO_PLASTIK_DARK(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 3 : 2) /*? 2 : 1) */ +#define QTC_MO_PLASTIK_LIGHT(W) (WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) /*? 2 : 0) */ + +#define QTC_MO_STD_DARK(W) QTC_MO_PLASTIK_DARK(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 4 : 1) */ +#define QTC_MO_STD_LIGHT(W, S) QTC_MO_PLASTIK_LIGHT(W) /*(WIDGET_DEF_BUTTON==W && IND_COLORED==opts.defBtnIndicator ? 2 : (S ? 1 : 0))*/ + +#define QTC_DO_EFFECT (ROUND_FULL==opts.round && EFFECT_NONE!=opts.buttonEffect) + +#ifdef __cplusplus +#include <qstyle.h> +typedef enum +{ + QtC_Round = QStyle::PM_CustomBase +} QtCMetrics; +#endif + +typedef enum +{ + EFFECT_NONE, + EFFECT_ETCH, + EFFECT_SHADOW +} EEffect; + +typedef enum +{ + PIX_RADIO_BORDER, + PIX_RADIO_LIGHT, + PIX_RADIO_ON, + PIX_CHECK, + PIX_SLIDER, + PIX_SLIDER_LIGHT, + PIX_SLIDER_V, + PIX_SLIDER_LIGHT_V +} EPixmap; + +typedef enum +{ + WIDGET_TAB_TOP, + WIDGET_TAB_BOT, + WIDGET_STD_BUTTON, + WIDGET_DEF_BUTTON, + WIDGET_LISTVIEW_HEADER, + WIDGET_SLIDER, + WIDGET_SLIDER_TROUGH, + WIDGET_SB_SLIDER, + WIDGET_SB_BUTTON, + WIDGET_TROUGH, + WIDGET_CHECKBOX, + WIDGET_TOGGLE_BUTTON, + WIDGET_MENU_ITEM, + WIDGET_PROGRESSBAR, +#ifndef __cplusplus + WIDGET_SPIN_UP, + WIDGET_SPIN_DOWN, +#endif + WIDGET_SPIN, +#ifdef __cplusplus + WIDGET_CHECKBUTTON, // Qt4 only + WIDGET_MDI_WINDOW, // Qt4 only + WIDGET_MDI_WINDOW_TITLE, // Qt4 only + WIDGET_ENTRY, + WIDGET_FRAME, + WIDGET_NO_ETCH_BTN, +#endif + WIDGET_OTHER +} EWidget; + +typedef enum +{ + APPEARANCE_FLAT, + APPEARANCE_RAISED, + APPEARANCE_DULL_GLASS, + APPEARANCE_SHINY_GLASS, + APPEARANCE_GRADIENT, + APPEARANCE_INVERTED, + APPEARANCE_SPLIT_GRADIENT, + APPEARANCE_BEVELLED +} EAppearance; + +#define IS_SLIDER(W) (WIDGET_SLIDER==W || WIDGET_SB_SLIDER==W) +#define IS_TOGGLE_BUTTON(W) (WIDGET_TOGGLE_BUTTON==W || WIDGET_CHECKBOX==W) + +typedef enum +{ + CORNER_TL = 0x1, + CORNER_TR = 0x2, + CORNER_BR = 0x4, + CORNER_BL = 0x8 +} ECornerBits; + +#define ROUNDED_NONE 0x0 +#define ROUNDED_TOP (CORNER_TL|CORNER_TR) +#define ROUNDED_BOTTOM (CORNER_BL|CORNER_BR) +#define ROUNDED_LEFT (CORNER_TL|CORNER_BL) +#define ROUNDED_RIGHT (CORNER_TR|CORNER_BR) +#define ROUNDED_TOPRIGHT CORNER_TR +#define ROUNDED_BOTTOMRIGHT CORNER_BR +#define ROUNDED_TOPLEFT CORNER_TL +#define ROUNDED_BOTTOMLEFT CORNER_BL +#define ROUNDED_ALL (CORNER_TL|CORNER_TR|CORNER_BR|CORNER_BL) + +typedef enum +{ + IND_CORNER, + IND_FONT_COLOR, + IND_COLORED, + IND_NONE +} EDefBtnIndicator; + +typedef enum +{ + LINE_SUNKEN, + LINE_FLAT, + LINE_DOTS, + LINE_DASHES +} ELine; + +#define LINE_NONE LINE_DASHES + +typedef enum +{ + TB_NONE, + TB_LIGHT, + TB_DARK, + TB_LIGHT_ALL, + TB_DARK_ALL, +} ETBarBorder; + +typedef enum +{ + BORDER_FLAT, + BORDER_RAISED, + BORDER_SUNKEN +} EBorder; + +/* + This whole EShade enum is a complete mess! + For menubars, we dont blend - so blend is selected, and selected is darken + For check/radios - we dont blend, so blend is selected, and we dont allow darken +*/ +typedef enum +{ + SHADE_NONE, + SHADE_CUSTOM, + SHADE_BLEND_SELECTED, /* In the case of check/radios this is SHADE_SELECTED */ + SHADE_SELECTED, + SHADE_DARKEN = SHADE_SELECTED , /* For menubar only! */ +} EShade; + +typedef enum +{ + ROUND_NONE, + ROUND_SLIGHT, + ROUND_FULL +} ERound; + +typedef enum +{ + SCROLLBAR_KDE, + SCROLLBAR_WINDOWS, + SCROLLBAR_PLATINUM, + SCROLLBAR_NEXT, + SCROLLBAR_NONE +} EScrollbar; + +typedef enum +{ + MO_NONE, + MO_COLORED, + MO_PLASTIK +} EMouseOver; + +typedef enum +{ + STRIPE_NONE, + STRIPE_PLAIN, + STRIPE_DIAGONAL +} EStripe; + +typedef enum +{ + SLIDER_PLAIN, + SLIDER_ROUND, + SLIDER_TRIANGULAR, +} ESliderStyle; + +#define DEF_IND_STR "fontcolor" +#define DEF_LINE_STR "dots" +#define DEF_TB_BORDER "none" +#define DEF_APPEARANCE_STR "bevelled" +#define DEF_MENU_APPEARANCE_STR "gradient" +#define DEF_TOOLBAR_APPEARANCE_STR "gradient" +#define DEF_SLIDER_SHADE_STR "selected" +#define DEF_TBS_STR "dots" +#define DEF_COLOR_STR "background" +#define DEF_TOOLBAR_SHADE_STR "none" + +#ifdef QTC_COMMON_FUNCTIONS +static double getWidgetShade(EWidget w, bool light, bool sunken, EAppearance app) +{ + switch(w) + { + case WIDGET_TROUGH: + return light ? SHADE_SBAR_LIGHT : SHADE_SBAR_DARK; + case WIDGET_SLIDER_TROUGH: + return light ? SHADE_SLIDER_LIGHT : SHADE_SLIDER_DARK; + case WIDGET_MENU_ITEM: + if(APPEARANCE_DULL_GLASS!=app && APPEARANCE_SHINY_GLASS!=app) + return light ? SHADE_BEVEL_MENU_ITEM_LIGHT : SHADE_BEVEL_MENU_ITEM_DARK; + default: + return light + ? sunken + ? SHADE_BEVEL_GRAD_SEL_LIGHT + : SHADE_BEVEL_GRAD_LIGHT + : sunken + ? SHADE_BEVEL_GRAD_SEL_DARK + : SHADE_BEVEL_GRAD_DARK; + } +} + +#define QTC_MIN(a, b) ((a) < (b) ? (a) : (b)) +#define QTC_MAX(a, b) ((b) < (a) ? (a) : (b)) + +static bool equal(double d1, double d2) +{ + return (fabs(d1 - d2) < 0.0001); +} + +/* Taken from rgb->hsl routines taken from KColor + Copyright 2007 Matthew Woehlke <[email protected]> +*/ +static inline double normalize(double a) +{ + return (a < 0.0 ? 0.0 : a > 1.0 ? 1.0 : a); +} + +static inline double mix(double a, double b, double k) +{ + return a + ( ( b - a ) * k ); +} + +static inline double wrap(double a, double d) +{ + register double r = fmod( a, d ); + return ( r < 0.0 ? d + r : ( r > 0.0 ? r : 0.0 ) ); +} + +static inline double h2c(double h, double m1, double m2) +{ + h = wrap( h, 6.0 ); + + if ( h < 1.0 ) + return mix( m1, m2, h ); + if ( h < 3.0 ) + return m2; + if ( h < 4.0 ) + return mix( m1, m2, 4.0 - h ); + return m1; +} + +static inline void rgbToHsl(double r, double g, double b, double *h, double *s, double *l) +{ + double min=QTC_MIN(QTC_MIN(r, g), b), + max=QTC_MAX(QTC_MAX(r, g), b); + + *l = 0.5 * (max + min); + *s = 0.0; + *h = 0.0; + + if (max != min) + { + double delta = max - min; + + if ( *l <= 0.5 ) + *s = delta / ( max + min ); + else + *s = delta / ( 2.0 - max - min ); + + if ( r == max ) + *h = ( g - b ) / delta; + else if ( g == max ) + *h = 2.0 + ( b - r ) / delta; + else if ( b == max ) + *h = 4.0 + ( r - g ) / delta; + + *h /= 6.0; + if ( *h < 0.0 ) + (*h) += 1.0; + } +} + +static inline void hslToRgb(double h, double s, double l, double *r, double *g, double *b) +{ + double m1, m2; + + // TODO h2rgb( h, r, g, b ); + h *= 6.0; + + if ( l <= 0.5 ) + m2 = l * ( 1.0 + s ); + else + m2 = l + s * ( 1.0 - l ); + m1 = 2.0 * l - m2; + + *r = h2c( h + 2.0, m1, m2 ); + *g = h2c( h, m1, m2 ); + *b = h2c( h - 2.0, m1, m2 ); +} + +static void rgbToHsv(double r, double g, double b, double *h, double *s, double *v) +{ + double min=QTC_MIN(QTC_MIN(r, g), b), + max=QTC_MAX(QTC_MAX(r, g), b), + delta=max - min; + + *v=max; + if(max != 0) + *s=delta / max; + else + { + /* r=g=b=0 s=0, v is undefined */ + *s=0; + *h=-1; + return; + } + if(r == max) + *h=(g - b) / delta; /* between yellow & magenta */ + else if(g == max) + *h=2 + (b - r) / delta; /* between cyan & yellow */ + else + *h=4 + (r - g) / delta; /* between magenta & cyan */ + *h *= 60; /* degrees */ + if(*h < 0) + *h += 360; +} + +static void hsvToRgb(double *r, double *g, double *b, double h, double s, double v) +{ + if(0==s) + *r=*g=*b=v; + else + { + int i; + double f, + p; + + h /= 60; /* sector 0 to 5 */ + i=(int)floor(h); + f=h - i; /* factorial part of h */ + p=v * (1 - s); + switch(i) + { + case 0: + *r=v; + *g=v * (1 - s * (1 - f)); + *b=p; + break; + case 1: + *r=v * (1 - s * f); + *g=v; + *b=p; + break; + case 2: + *r=p; + *g=v; + *b=v * (1 - s * (1 - f)); + break; + case 3: + *r=p; + *g=v * (1 - s * f); + *b=v; + break; + case 4: + *r=v * (1 - s * (1 - f)); + *g=p; + *b=v; + break; + /* case 5: */ + default: + *r=v; + *g=p; + *b=v * (1 - s * f); + break; + } + } +} + +#ifdef __cplusplus +inline int limit(double c) +{ + return c < 0.0 ? 0 : (c > 255.0 ? 255 : (int)c); +} +#else +inline int limit(double c) +{ + return c < 0.0 + ? 0 + : c > 65535.0 + ? 65535 + : (int)c; +} +#endif + +#ifdef __cplusplus +static void shade(const color &ca, color *cb, double k) +#else +static void shade(const color *ca, color *cb, double k) +#endif +{ + if(equal(k, 1.0)) + { +#ifdef __cplusplus + *cb=ca; +#else + cb->red = ca->red; + cb->green = ca->green; + cb->blue = ca->blue; +#endif + } + else + switch(shading) + { + case SHADING_SIMPLE: + { + #ifdef __cplusplus + int v=(int)(255.0*(k-1.0)); + + cb->setRgb(limit(ca.red()+v), limit(ca.green()+v), limit(ca.blue()+v)); + #else + double v=65535.0*(k-1.0); + + cb->red = limit(ca->red+v); + cb->green = limit(ca->green+v); + cb->blue = limit(ca->blue+v); + #endif + break; + } + case SHADING_HSL: + { + #ifdef __cplusplus + double r(ca.red()/255.0), + g(ca.green()/255.0), + b(ca.blue()/255.0); + #else + double r=ca->red/65535.0, + g=ca->green/65535.0, + b=ca->blue/65535.0; + #endif + double h, s, l; + + rgbToHsl(r, g, b, &h, &s, &l); + l=normalize(l*k); + s=normalize(s*k); + hslToRgb(h, s, l, &r, &g, &b); + #ifdef __cplusplus + cb->setRgb(limit(r*255.0), limit(g*255.0), limit(b*255.0)); + #else + cb->red=limit(r*65535.0); + cb->green=limit(g*65535.0); + cb->blue=limit(b*65535.0); + #endif + break; + } + case SHADING_HSV: + { + #ifdef __cplusplus + double r(ca.red()/255.0), + g(ca.green()/255.0), + b(ca.blue()/255.0); + #else + double r=ca->red/65535.0, + g=ca->green/65535.0, + b=ca->blue/65535.0; + #endif + double h, s, v; + + rgbToHsv(r, g, b, &h, &s, &v); + + v*=k; + if (v > 1.0) + { + s -= v - 1.0; + if (s < 0) + s = 0; + v = 1.0; + } + hsvToRgb(&r, &g, &b, h, s, v); + #ifdef __cplusplus + cb->setRgb(limit(r*255.0), limit(g*255.0), limit(b*255.0)); + #else + cb->red=limit(r*65535.0); + cb->green=limit(g*65535.0); + cb->blue=limit(b*65535.0); + #endif + } + } +} + +static unsigned char checkBounds(int num) +{ + return num < 0 ? 0 : + num > 255 ? 255 : + num; +} + +static void adjustPix(unsigned char *data, int numChannels, int w, int h, int stride, + int ro, int go, int bo, double shade) +{ + int width=w*numChannels, + offset=0, + row, + r=(int)((ro*shade)+0.5), + g=(int)((go*shade)+0.5), + b=(int)((bo*shade)+0.5); + + for(row=0; row<h; ++row) + { + int column; + + for(column=0; column<width; column+=numChannels) + { + unsigned char source=data[offset+column+1]; + +#if defined __cplusplus +#if Q_BYTE_ORDER == Q_BIG_ENDIAN + /* ARGB */ + data[offset+column+1] = checkBounds(r-source); + data[offset+column+2] = checkBounds(g-source); + data[offset+column+3] = checkBounds(b-source); +#else + /* BGRA */ + data[offset+column] = checkBounds(b-source); + data[offset+column+1] = checkBounds(g-source); + data[offset+column+2] = checkBounds(r-source); +#endif +#else + /* GdkPixbuf is RGBA */ + data[offset+column] = checkBounds(r-source); + data[offset+column+1] = checkBounds(g-source); + data[offset+column+2] = checkBounds(b-source); +#endif + + } + offset+=stride; + } +} +#endif /* QTC_COMMON_NO_FUNCTIONS */ + +#ifdef __cplusplus +struct Options +#else +typedef struct +#endif +{ + int contrast, + passwordChar; + double highlightFactor; + ERound round; + bool embolden, + lighterPopupMenuBgnd, + highlightTab, + colorSelTab, + animatedProgress, + fixParentlessDialogs, + customMenuTextColor, + menubarMouseOver, + shadeMenubarOnlyWhenActive, + thinnerMenuItems, +#ifndef QTC_PLAIN_FOCUS_ONLY + stdFocus, +#endif + lvLines, + drawStatusBarFrames, + fillSlider, + roundMbTopOnly, + gradientPbGroove, +#ifdef __cplusplus + stdSidebarButtons, + gtkScrollViews, + gtkComboMenus, +/* +#else + setDialogButtonOrder, +*/ +#endif +#if !defined __cplusplus || defined QTC_CONFIG_DIALOG + mapKdeIcons, +#endif +#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus + gtkButtonOrder, +#endif + borderMenuitems, + colorMenubarMouseOver, + darkerBorders, + vArrows, + xCheck, + framelessGroupBoxes, + inactiveHighlight; + EStripe stripedProgress; + ESliderStyle sliderStyle; + EMouseOver coloredMouseOver; + ETBarBorder toolbarBorders; + EDefBtnIndicator defBtnIndicator; + ELine sliderThumbs, + handles, + toolbarSeparators, + splitters; + EAppearance appearance, + menubarAppearance, + menuitemAppearance, + toolbarAppearance, + lvAppearance, + tabAppearance, + sliderAppearance, + progressAppearance; + EShade shadeSliders, + shadeMenubars, + shadeCheckRadio; + EEffect buttonEffect; + EScrollbar scrollbarType; + color customMenubarsColor, + customSlidersColor, + customMenuNormTextColor, + customMenuSelTextColor, + customCheckRadioColor; + #ifdef QTC_CONFIG_DIALOG + EShading shading; + #endif +#ifndef __cplusplus +} Options; +#else +}; +#endif + +#if defined QTC_COMMON_FUNCTIONS && !defined QTC_CONFIG_DIALOG +static EAppearance widgetApp(EWidget w, const Options *opts) +{ + switch(w) + { + case WIDGET_LISTVIEW_HEADER: + return opts->lvAppearance; + case WIDGET_SB_BUTTON: + case WIDGET_SLIDER: + case WIDGET_SB_SLIDER: + return opts->sliderAppearance; + case WIDGET_TAB_TOP: + case WIDGET_TAB_BOT: + return opts->tabAppearance; + case WIDGET_MENU_ITEM: + return opts->menuitemAppearance; + case WIDGET_PROGRESSBAR: + return opts->progressAppearance; + case WIDGET_SLIDER_TROUGH: + return APPEARANCE_FLAT==opts->appearance || APPEARANCE_RAISED==opts->appearance + ? APPEARANCE_FLAT : APPEARANCE_GRADIENT; + default: + break; + } + + return opts->appearance; +}; +#endif + +#endif diff --git a/common/config_file.c b/common/config_file.c new file mode 100644 index 0000000..930ce21 --- /dev/null +++ b/common/config_file.c @@ -0,0 +1,1238 @@ +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include "common.h" +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <pwd.h> +#include <sys/types.h> + +#define QTC_MAX_FILENAME_LEN 1024 +#define QTC_MAX_INPUT_LINE_LEN 256 +#define QTC_FILE "qtcurvestylerc" + +#ifdef CONFIG_READ +static int c2h(char ch) +{ + return (ch>='0' && ch<='9') ? ch-'0' : + (ch>='a' && ch<='f') ? 10+(ch-'a') : + (ch>='A' && ch<='F') ? 10+(ch-'A') : + 0; +} + +#define ATOH(str) ((c2h(*str)<<4)+c2h(*(str+1))) + +static void setRgb(color *col, const char *str) +{ + if(str && strlen(str)>6) + { + int offset='#'==str[0] ? 1 : 0; +#ifdef __cplusplus + col->setRgb(ATOH(&str[offset]), ATOH(&str[offset+2]), ATOH(&str[offset+4])); +#else + col->red=ATOH(&str[offset])<<8; + col->green=ATOH(&str[offset+2])<<8; + col->blue=ATOH(&str[offset+4])<<8; + col->pixel=0; +#endif + } + else +#ifdef __cplusplus + col->setRgb(0, 0, 0); +#else + col->red=col->green=col->blue=col->pixel=0; +#endif +} + +static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def) +{ + if(str) + { + if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6)) + return IND_FONT_COLOR; + if(0==memcmp(str, "none", 4)) + return IND_NONE; + if(0==memcmp(str, "corner", 6)) + return IND_CORNER; + if(0==memcmp(str, "colored", 7)) + return IND_COLORED; + } + + return def; +} + +static ELine toLine(const char *str, ELine def) +{ + if(str) + { + if(0==memcmp(str, "dashes", 6)) + return LINE_DASHES; + if(0==memcmp(str, "none", 4)) + return LINE_NONE; + if(0==memcmp(str, "sunken", 6)) + return LINE_SUNKEN; + if(0==memcmp(str, "dots", 4)) + return LINE_DOTS; + if(0==memcmp(str, "flat", 4)) + return LINE_FLAT; + } + return def; +} + +static ETBarBorder toTBarBorder(const char *str, ETBarBorder def) +{ + if(str) + { + if(0==memcmp(str, "dark", 4)) + return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; + if(0==memcmp(str, "none", 4)) + return TB_NONE; + if(0==memcmp(str, "light", 5)) + return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; + } + return def; +} + +static EMouseOver toMouseOver(const char *str, EMouseOver def) +{ + if(str) + { + if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7)) + return MO_COLORED; + if(0==memcmp(str, "plastik", 7)) + return MO_PLASTIK; + if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4)) + return MO_NONE; + } + return def; +} + +static EAppearance toAppearance(const char *str, EAppearance def) +{ + if(str) + { + if(0==memcmp(str, "flat", 4)) + return APPEARANCE_FLAT; + if(0==memcmp(str, "raised", 6)) + return APPEARANCE_RAISED; + if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13)) + return APPEARANCE_GRADIENT; + if(0==memcmp(str, "splitgradient", 13)) + return APPEARANCE_SPLIT_GRADIENT; + if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10)) + return APPEARANCE_SHINY_GLASS; + if(0==memcmp(str, "dullglass", 9)) + return APPEARANCE_DULL_GLASS; + if(0==memcmp(str, "inverted", 8)) + return APPEARANCE_INVERTED; + if(0==memcmp(str, "bevelled", 8)) + return APPEARANCE_BEVELLED; + } + return def; +} + +static EShade toShade(const char *str, bool allowDarken, EShade def) +{ + if(str) + { + /* true/false is from 0.25... */ + if(0==memcmp(str, "true", 4) || 0==memcmp(str, "selected", 8)) + return SHADE_BLEND_SELECTED; + if(0==memcmp(str, "origselected", 12)) + return SHADE_SELECTED; + if(allowDarken && 0==memcmp(str, "darken", 6)) + return SHADE_DARKEN; + if(0==memcmp(str, "custom", 6)) + return SHADE_CUSTOM; + if(0==memcmp(str, "none", 4)) + return SHADE_NONE; + } + + return def; +} + +/* Prior to 0.42 round was a bool - so need to read 'false' as 'none' */ +static ERound toRound(const char *str, ERound def) +{ + if(str) + { + if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + return ROUND_NONE; + if(0==memcmp(str, "slight", 6)) + return ROUND_SLIGHT; + if(0==memcmp(str, "full", 4)) + return ROUND_FULL; + } + + return def; +} + +static EScrollbar toScrollbar(const char *str, EScrollbar def) +{ + if(str) + { + if(0==memcmp(str, "kde", 3)) + return SCROLLBAR_KDE; + if(0==memcmp(str, "windows", 7)) + return SCROLLBAR_WINDOWS; + if(0==memcmp(str, "platinum", 8)) + return SCROLLBAR_PLATINUM; + if(0==memcmp(str, "next", 4)) + return SCROLLBAR_NEXT; + if(0==memcmp(str, "none", 4)) + return SCROLLBAR_NONE; + } + + return def; +} + +static EEffect toEffect(const char *str, EEffect def) +{ + if(str) + { + if(0==memcmp(str, "none", 4)) + return EFFECT_NONE; + if(0==memcmp(str, "shadow", 6)) + return EFFECT_SHADOW; + if(0==memcmp(str, "etch", 4)) + return EFFECT_ETCH; + } + + return def; +} + +static EShading toShading(const char * str, EShading def) +{ + if(str) + { + if(0==memcmp(str, "simple", 6)) + return SHADING_SIMPLE; + if(0==memcmp(str, "hsl", 3)) + return SHADING_HSL; + if(0==memcmp(str, "hsv", 3)) + return SHADING_HSV; + } + + return def; +} + +static EStripe toStripe(const char * str, EStripe def) +{ + if(str) + { + if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4)) + return STRIPE_PLAIN; + if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + return STRIPE_NONE; + if(0==memcmp(str, "diagonal", 8)) + return STRIPE_DIAGONAL; + } + + return def; +} + +static ESliderStyle toSlider(const char * str, ESliderStyle def) +{ + if(str) + { + if(0==memcmp(str, "round", 5)) + return SLIDER_ROUND; + if(0==memcmp(str, "plain", 5)) + return SLIDER_PLAIN; + if(0==memcmp(str, "triangular", 10)) + return SLIDER_TRIANGULAR; + } + + return def; +} + +#endif + +#ifdef CONFIG_WRITE +#include <kstandarddirs.h> +#endif + +static const char * getHome() +{ + static const char *home=NULL; + + if(!home) + { + struct passwd *p=getpwuid(getuid()); + + if(p) + home=p->pw_dir; + else + { + char *env=getenv("HOME"); + + if(env) + home=env; + } + + if(!home) + home="/tmp"; + } + + return home; +} + +static const char *xdgConfigFolder() +{ + static char xdgDir[QTC_MAX_FILENAME_LEN]={'\0'}; + + if(!xdgDir[0]) + { + static const char *home=NULL; + +#if 0 + char *env=getenv("XDG_CONFIG_HOME"); + + /* + Check the setting of XDG_CONFIG_HOME + For some reason, sudo leaves the env vars set to those of the + caller - so XDG_CONFIG_HOME would point to the users setting, and + not roots. + + Therefore, check that home is first part of XDG_CONFIG_HOME + */ + + if(env && 0==getuid()) + { + if(!home) + home=getHome(); + if(home && home!=strstr(env, home)) + env=NULL; + } +#else + /* + Hmm... for 'root' dont bother to check env var, just set to ~/.config + - as problems would arise if "sudo kcmshell style", and then + "sudo su" / "kcmshell style". The 1st would write to ~/.config, but + if root has a XDG_ set then that would be used on the second :-( + */ + char *env=0==getuid() ? NULL : getenv("XDG_CONFIG_HOME"); +#endif + + if(!env) + { + if(!home) + home=getHome(); + + sprintf(xdgDir, "%s/.config", home); + } + else + strcpy(xdgDir, env); + +#if defined CONFIG_WRITE || !defined __cplusplus + { + struct stat info; + + if(0!=lstat(xdgDir, &info)) + { +#ifdef __cplusplus + KStandardDirs::makeDir(xdgDir, 0755); +#else + g_mkdir_with_parents(xdgDir, 0755); +#endif + } + } +#endif + } + + return xdgDir; +} + +#ifdef CONFIG_READ + +#ifdef __cplusplus +#define QTC_IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue()) +#else +#define QTC_IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue) +#endif + +static void checkColor(EShade *s, color *c) +{ + if(SHADE_CUSTOM==*s && QTC_IS_BLACK(*c)) + *s=SHADE_NONE; +} + +#ifdef __cplusplus + +#if QT_VERSION >= 0x040000 +#include <QMap> +#include <QFile> +#include <QTextStream> +#define QTC_LATIN1(A) A.toLatin1() +#else +#define QTC_LATIN1(A) A.latin1() + +#include <qmap.h> +#include <qfile.h> +#include <qtextstream.h> +#endif + +class QtCConfig +{ + public: + + QtCConfig(const QString &filename); + + bool ok() const { return values.count()>0; } + const QString & readEntry(const char *key, const QString &def=QString::null); + + private: + + QMap<QString, QString> values; +}; + +QtCConfig::QtCConfig(const QString &filename) +{ + QFile f(filename); + +#if QT_VERSION >= 0x040000 + if(f.open(QIODevice::ReadOnly)) +#else + if(f.open(IO_ReadOnly)) +#endif + { + QTextStream stream(&f); + QString line; + + while(!stream.atEnd()) + { + line = stream.readLine(); +#if QT_VERSION >= 0x040000 + int pos=line.indexOf('='); +#else + int pos=line.find('='); +#endif + if(-1!=pos) + values[line.left(pos)]=line.mid(pos+1); + } + f.close(); + } +} + +inline const QString & QtCConfig::readEntry(const char *key, const QString &def) +{ + return values.contains(key) ? values[key] : def; +} + +inline QString readStringEntry(QtCConfig &cfg, const char *key) +{ + return cfg.readEntry(key); +} + +static int readNumEntry(QtCConfig &cfg, const char *key, int def) +{ + const QString &val(readStringEntry(cfg, key)); + + return val.isEmpty() ? def : val.toInt(); +} + +static bool readBoolEntry(QtCConfig &cfg, const char *key, bool def) +{ + const QString &val(readStringEntry(cfg, key)); + + return val.isEmpty() ? def : (val=="true" ? true : false); +} + +#if QT_VERSION >= 0x040000 +#define QTC_LATIN1(A) A.toLatin1() +#else +#define QTC_LATIN1(A) A.latin1() +#endif + +#define QTC_CFG_READ_COLOR(ENTRY) \ + { \ + QString sVal(cfg.readEntry(#ENTRY)); \ + if(sVal.isEmpty()) \ + opts->ENTRY=def->ENTRY; \ + else \ + setRgb(&(opts->ENTRY), QTC_LATIN1(sVal)); \ + } + +#else + +static char * lookupCfgHash(GHashTable **cfg, char *key, char *val) +{ + char *rv=NULL; + + if(!*cfg) + *cfg=g_hash_table_new(g_str_hash, g_str_equal); + else + rv=(char *)g_hash_table_lookup(*cfg, key); + + if(!rv && val) + { + g_hash_table_insert(*cfg, g_strdup(key), g_strdup(val)); + rv=(char *)g_hash_table_lookup(*cfg, key); + } + + return rv; +} + +static GHashTable * loadConfig(const char *filename) +{ + FILE *f=fopen(filename, "r"); + GHashTable *cfg=NULL; + + if(f) + { + char line[QTC_MAX_INPUT_LINE_LEN]; + + while(NULL!=fgets(line, QTC_MAX_INPUT_LINE_LEN-1, f)) + { + char *eq=strchr(line, '='); + int pos=eq ? eq-line : -1; + + if(pos>0) + { + char *endl=strchr(line, '\n'); + + if(endl) + *endl='\0'; + + line[pos]='\0'; + + lookupCfgHash(&cfg, line, &line[pos+1]); + } + } + + fclose(f); + } + + return cfg; +} + +static void releaseConfig(GHashTable *cfg) +{ + g_hash_table_destroy(cfg); +} + +static char * readStringEntry(GHashTable *cfg, char *key) +{ + return lookupCfgHash(&cfg, key, NULL); +} + +static int readNumEntry(GHashTable *cfg, char *key, int def) +{ + char *str=readStringEntry(cfg, key); + + return str ? atoi(str) : def; +} + +static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def) +{ + char *str=readStringEntry(cfg, key); + + return str ? (0==memcmp(str, "true", 4) ? true : false) : def; +} + +#define QTC_LATIN1(A) A + +#define QTC_CFG_READ_COLOR(ENTRY) \ + { \ + const char *str=readStringEntry(cfg, #ENTRY); \ + \ + if(str) \ + setRgb(&(opts->ENTRY), str); \ + else \ + opts->ENTRY=def->ENTRY; \ + } +#endif + +#define QTC_CFG_READ_NUM(ENTRY) \ + opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY); + +#define QTC_CFG_READ_BOOL(ENTRY) \ + opts->ENTRY=readBoolEntry(cfg, #ENTRY, def->ENTRY); + +#define QTC_CFG_READ_ROUND(ENTRY) \ + opts->ENTRY=toRound(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_DI(ENTRY) \ + opts->ENTRY=((double)(readNumEntry(cfg, #ENTRY, ((int)(def->ENTRY*100))-100)+100))/100.0; + +#define QTC_CFG_READ_TB_BORDER(ENTRY) \ + opts->ENTRY=toTBarBorder(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_MOUSE_OVER(ENTRY) \ + opts->ENTRY=toMouseOver(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_APPEARANCE(ENTRY, DEF) \ + opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF); + +/* +#define QTC_CFG_READ_APPEARANCE(ENTRY) \ + opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); +*/ + +#define QTC_CFG_READ_STRIPE(ENTRY) \ + opts->ENTRY=toStripe(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_SLIDER(ENTRY) \ + opts->ENTRY=toSlider(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_DEF_BTN(ENTRY) \ + opts->ENTRY=toInd(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_LINE(ENTRY) \ + opts->ENTRY=toLine(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_SHADE(ENTRY, AD) \ + opts->ENTRY=toShade(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY); + +#define QTC_CFG_READ_SCROLLBAR(ENTRY) \ + opts->ENTRY=toScrollbar(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_EFFECT(ENTRY) \ + opts->ENTRY=toEffect(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#ifdef QTC_CONFIG_DIALOG +#define QTC_CFG_READ_SHADING(ENTRY, UNUSED) \ + opts->ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); +#else +#define QTC_CFG_READ_SHADING(ENTRY, DEF) \ + ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF); +#endif + +#ifdef __cplusplus +static bool readConfig(const QString &file, Options *opts, Options *def) +#else +static bool readConfig(const char *file, Options *opts, Options *def) +#endif +{ +#ifdef __cplusplus + if(file.isEmpty()) + { + const char *xdg=xdgConfigFolder(); + + if(xdg) + { + QString filename(xdg); + + filename+="/"QTC_FILE; + return readConfig(filename, opts, def); + } + } +#else + if(!file) + { + const char *xdg=xdgConfigFolder(); + + if(xdg) + { + char filename[QTC_MAX_FILENAME_LEN]; + + sprintf(filename, "%s/"QTC_FILE, xdg); + return readConfig(filename, opts, def); + } + } +#endif + else + { +#ifdef __cplusplus + QtCConfig cfg(file); + + if(cfg.ok()) + { +#else + GHashTable *cfg=loadConfig(file); + + if(cfg) + { +#endif + QTC_CFG_READ_NUM(passwordChar) + QTC_CFG_READ_ROUND(round) + QTC_CFG_READ_DI(highlightFactor) + QTC_CFG_READ_TB_BORDER(toolbarBorders) + QTC_CFG_READ_APPEARANCE(appearance, def->appearance) + QTC_CFG_READ_BOOL(fixParentlessDialogs) + QTC_CFG_READ_STRIPE(stripedProgress) + QTC_CFG_READ_SLIDER(sliderStyle) + QTC_CFG_READ_BOOL(animatedProgress) + QTC_CFG_READ_BOOL(lighterPopupMenuBgnd) + QTC_CFG_READ_BOOL(embolden) + QTC_CFG_READ_DEF_BTN(defBtnIndicator) + QTC_CFG_READ_LINE(sliderThumbs) + QTC_CFG_READ_LINE(handles) + QTC_CFG_READ_BOOL(highlightTab) + QTC_CFG_READ_BOOL(colorSelTab) + QTC_CFG_READ_SHADE(shadeSliders, false) + QTC_CFG_READ_SHADE(shadeMenubars, true) + QTC_CFG_READ_SHADE(shadeCheckRadio, false) + QTC_CFG_READ_APPEARANCE(menubarAppearance, def->menubarAppearance) + QTC_CFG_READ_APPEARANCE(menuitemAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(toolbarAppearance, def->toolbarAppearance) + QTC_CFG_READ_LINE(toolbarSeparators) + QTC_CFG_READ_LINE(splitters) + QTC_CFG_READ_BOOL(customMenuTextColor) + QTC_CFG_READ_MOUSE_OVER(coloredMouseOver) + QTC_CFG_READ_BOOL(menubarMouseOver) + QTC_CFG_READ_BOOL(shadeMenubarOnlyWhenActive) + QTC_CFG_READ_BOOL(thinnerMenuItems) + QTC_CFG_READ_COLOR(customSlidersColor) + QTC_CFG_READ_COLOR(customMenubarsColor) + QTC_CFG_READ_COLOR(customMenuSelTextColor) + QTC_CFG_READ_COLOR(customMenuNormTextColor) + QTC_CFG_READ_COLOR(customCheckRadioColor) + QTC_CFG_READ_SCROLLBAR(scrollbarType) + QTC_CFG_READ_EFFECT(buttonEffect) + QTC_CFG_READ_APPEARANCE(lvAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(tabAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(sliderAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(progressAppearance, opts->appearance) +#ifndef QTC_PLAIN_FOCUS_ONLY + QTC_CFG_READ_BOOL(stdFocus) +#endif + QTC_CFG_READ_BOOL(lvLines) + QTC_CFG_READ_BOOL(drawStatusBarFrames) + QTC_CFG_READ_BOOL(fillSlider) + QTC_CFG_READ_BOOL(roundMbTopOnly) + QTC_CFG_READ_BOOL(borderMenuitems) + QTC_CFG_READ_BOOL(gradientPbGroove) + QTC_CFG_READ_BOOL(darkerBorders) + QTC_CFG_READ_BOOL(vArrows) + QTC_CFG_READ_BOOL(xCheck) + QTC_CFG_READ_BOOL(framelessGroupBoxes) + QTC_CFG_READ_BOOL(inactiveHighlight) + QTC_CFG_READ_BOOL(colorMenubarMouseOver) +#ifdef __cplusplus + QTC_CFG_READ_BOOL(stdSidebarButtons) + QTC_CFG_READ_BOOL(gtkScrollViews) + QTC_CFG_READ_BOOL(gtkComboMenus) +/* +#else + QTC_CFG_READ_BOOL(setDialogButtonOrder) +*/ +#endif +#if !defined __cplusplus || defined QTC_CONFIG_DIALOG + QTC_CFG_READ_BOOL(mapKdeIcons) +#endif +#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus + QTC_CFG_READ_BOOL(gtkButtonOrder) +#endif + QTC_CFG_READ_SHADING(shading, shading); + +#ifndef __cplusplus + releaseConfig(cfg); +#endif + if(SHADE_SELECTED==opts->shadeCheckRadio) + opts->shadeCheckRadio=SHADE_BLEND_SELECTED; + + checkColor(&opts->shadeMenubars, &opts->customMenubarsColor); + checkColor(&opts->shadeSliders, &opts->customSlidersColor); + checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor); + + if(APPEARANCE_BEVELLED==opts->toolbarAppearance) + opts->toolbarAppearance=APPEARANCE_GRADIENT; + else if(APPEARANCE_RAISED==opts->toolbarAppearance) + opts->toolbarAppearance=APPEARANCE_FLAT; + + if(APPEARANCE_BEVELLED==opts->menubarAppearance) + opts->menubarAppearance=APPEARANCE_GRADIENT; + else if(APPEARANCE_RAISED==opts->menubarAppearance) + opts->menubarAppearance=APPEARANCE_FLAT; + + if(APPEARANCE_BEVELLED==opts->sliderAppearance) + opts->sliderAppearance=APPEARANCE_GRADIENT; + + if(APPEARANCE_BEVELLED==opts->tabAppearance) + opts->tabAppearance=APPEARANCE_GRADIENT; + + if(opts->highlightFactor<((100.0+MIN_HIGHLIGHT_FACTOR)/100.0) || + opts->highlightFactor>((100.0+MAX_HIGHLIGHT_FACTOR)/100.0)) + opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR; + + if(opts->animatedProgress && !opts->stripedProgress) + opts->animatedProgress=false; + + if(opts->colorSelTab && APPEARANCE_GRADIENT!=opts->tabAppearance) + opts->colorSelTab=false; + + if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems) + opts->colorMenubarMouseOver=true; + + return true; + } + } + + return false; +} + +static bool fileExists(const char *path) +{ + struct stat info; + + return 0==lstat(path, &info) && (info.st_mode&S_IFMT)==S_IFREG; +} + +static const char * getSystemConfigFile() +{ + static const char * constFiles[]={ "/etc/qt4/"QTC_FILE, "/etc/qt3/"QTC_FILE, "/etc/qt/"QTC_FILE, NULL }; + + int i; + + for(i=0; constFiles[i]; ++i) + if(fileExists(constFiles[i])) + return constFiles[i]; + return NULL; +} + +static void defaultSettings(Options *opts) +{ + /* Set hard-coded defaults... */ + opts->contrast=7; + opts->passwordChar=0x25CF; + opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR; + opts->round=ROUND_FULL; + opts->lighterPopupMenuBgnd=true; + opts->animatedProgress=true; + opts->stripedProgress=STRIPE_DIAGONAL; + opts->sliderStyle=SLIDER_TRIANGULAR; + opts->highlightTab=true; + opts->colorSelTab=false; + opts->embolden=false; + opts->appearance=APPEARANCE_DULL_GLASS; + opts->lvAppearance=APPEARANCE_BEVELLED; + opts->tabAppearance=APPEARANCE_GRADIENT; + opts->sliderAppearance=APPEARANCE_DULL_GLASS; + opts->menubarAppearance=APPEARANCE_GRADIENT; + opts->menuitemAppearance=APPEARANCE_DULL_GLASS; + opts->toolbarAppearance=APPEARANCE_FLAT; + opts->progressAppearance=APPEARANCE_DULL_GLASS; + opts->defBtnIndicator=IND_COLORED; + opts->sliderThumbs=LINE_FLAT; + opts->handles=LINE_SUNKEN; + opts->shadeSliders=SHADE_BLEND_SELECTED; + opts->shadeMenubars=SHADE_NONE; + opts->shadeCheckRadio=SHADE_NONE; + opts->toolbarBorders=TB_NONE; + opts->toolbarSeparators=LINE_NONE; + opts->splitters=LINE_FLAT; + opts->fixParentlessDialogs=false; + opts->customMenuTextColor=false; + opts->coloredMouseOver=MO_PLASTIK; + opts->menubarMouseOver=true; + opts->shadeMenubarOnlyWhenActive=true; + opts->thinnerMenuItems=false; + opts->scrollbarType=SCROLLBAR_KDE; + opts->buttonEffect=EFFECT_NONE; +#ifndef QTC_PLAIN_FOCUS_ONLY + opts->stdFocus=true; +#endif + opts->lvLines=false; + opts->drawStatusBarFrames=false; + opts->fillSlider=true; + opts->roundMbTopOnly=true; + opts->borderMenuitems=true; + opts->gradientPbGroove=true; + opts->darkerBorders=false; + opts->vArrows=false; + opts->xCheck=false; + opts->framelessGroupBoxes=false; + opts->colorMenubarMouseOver=false; + opts->inactiveHighlight=false; +#ifdef QTC_CONFIG_DIALOG + opts->shading=SHADING_HSL; +#endif +#ifdef __cplusplus + opts->stdSidebarButtons=false; + opts->gtkScrollViews=false; + opts->gtkComboMenus=false; + opts->customMenubarsColor.setRgb(0, 0, 0); + opts->customSlidersColor.setRgb(0, 0, 0); + opts->customMenuNormTextColor.setRgb(0, 0, 0); + opts->customMenuSelTextColor.setRgb(0, 0, 0); + opts->customCheckRadioColor.setRgb(0, 0, 0); +#else +/* + opts->setDialogButtonOrder=false; +*/ + opts->customMenubarsColor.red=opts->customMenubarsColor.green=opts->customMenubarsColor.blue=0; + opts->customSlidersColor.red=opts->customSlidersColor.green=opts->customSlidersColor.blue=0; + opts->customMenuNormTextColor.red=opts->customMenuNormTextColor.green=opts->customMenuNormTextColor.blue=0; + opts->customMenuSelTextColor.red=opts->customMenuSelTextColor.green=opts->customMenuSelTextColor.blue=0; + opts->customCheckRadioColor.red=opts->customCheckRadioColor.green=opts->customCheckRadioColor.blue=0; +#endif + +#if !defined __cplusplus || defined QTC_CONFIG_DIALOG + opts->mapKdeIcons=true; +#endif +#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus + opts->gtkButtonOrder=false; +#endif + + /* Read system config file... */ + { + static const char * systemFilename=NULL; + + if(!systemFilename) + systemFilename=getSystemConfigFile(); + + if(systemFilename) + readConfig(systemFilename, opts, opts); + } +} + +#endif + +#ifdef CONFIG_WRITE +static const char *toStr(EDefBtnIndicator ind) +{ + switch(ind) + { + case IND_NONE: + return "none"; + case IND_FONT_COLOR: + return "fontcolor"; + case IND_CORNER: + return "corner"; + default: + return "colored"; + } +} + +static const char *toStr(ELine ind, bool none) +{ + switch(ind) + { + case LINE_DOTS: + return "dots"; + case LINE_DASHES: + return none ? "none" : "dashes"; + case LINE_FLAT: + return "flat"; + default: + return "sunken"; + } +} + +static const char *toStr(ETBarBorder ind) +{ + switch(ind) + { + case TB_DARK: + return "dark"; + case TB_DARK_ALL: + return "dark-all"; + case TB_LIGHT_ALL: + return "light-all"; + case TB_NONE: + return "none"; + default: + return "light"; + } +} + +static const char *toStr(EMouseOver mo) +{ + switch(mo) + { + case MO_COLORED: + return "colored"; + case MO_NONE: + return "none"; + default: + return "plastik"; + } +} + +static const char *toStr(EAppearance exp) +{ + switch(exp) + { + case APPEARANCE_FLAT: + return "flat"; + case APPEARANCE_RAISED: + return "raised"; + case APPEARANCE_GRADIENT: + return "gradient"; + case APPEARANCE_SPLIT_GRADIENT: + return "splitgradient"; + case APPEARANCE_DULL_GLASS: + return "dullglass"; + case APPEARANCE_BEVELLED: + return "bevelled"; + case APPEARANCE_INVERTED: + return "inverted"; + default: + return "shinyglass"; + } +} + +static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel) +{ + switch(exp) + { + default: + case SHADE_NONE: + return "none"; + case SHADE_BLEND_SELECTED: + return dark || !convertBlendSelToSel ? "selected" : "origselected"; + case SHADE_CUSTOM: + return "custom"; + /* case SHADE_SELECTED */ + case SHADE_DARKEN: + return dark ? "darken" : "origselected"; + } +} + +static const char *toStr(ERound exp) +{ + switch(exp) + { + case ROUND_NONE: + return "none"; + case ROUND_SLIGHT: + return "slight"; + default: + case ROUND_FULL: + return "full"; + } +} + +static const char *toStr(EScrollbar sb) +{ + switch(sb) + { + case SCROLLBAR_KDE: + return "kde"; + default: + case SCROLLBAR_WINDOWS: + return "windows"; + case SCROLLBAR_PLATINUM: + return "platinum"; + case SCROLLBAR_NEXT: + return "next"; + case SCROLLBAR_NONE: + return "none"; + } +} + +static const char *toStr(EEffect e) +{ + switch(e) + { + case EFFECT_NONE: + return "none"; + default: + case EFFECT_SHADOW: + return "shadow"; + case EFFECT_ETCH: + return "etch"; + } +} + +inline const char * toStr(bool b) { return b ? "true" : "false"; } + +static QString toStr(const QColor &col) +{ + QString colorStr; + + colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue()); + return colorStr; +} + +static const char *toStr(EShading s) +{ + switch(s) + { + case SHADING_SIMPLE: + return "simple"; + default: + case SHADING_HSL: + return "hsl"; + case SHADING_HSV: + return "hsv"; + } +} + +static const char *toStr(EStripe s) +{ + switch(s) + { + default: + case STRIPE_PLAIN: + return "plain"; + case STRIPE_NONE: + return "none"; + case STRIPE_DIAGONAL: + return "diagonal"; + } +} + +static const char *toStr(ESliderStyle s) +{ + switch(s) + { + case SLIDER_PLAIN: + return "plain"; + case SLIDER_TRIANGULAR: + return "triangular"; + default: + case SLIDER_ROUND: + return "round"; + } +} + +#if QT_VERSION >= 0x040000 +#define CFG config +#else +#define CFG (*cfg) +#endif + +#define CFG_WRITE_ENTRY(ENTRY) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY)); + +#define CFG_WRITE_ENTRY_FORCE(ENTRY) \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY)); + +#define CFG_WRITE_ENTRY_B(ENTRY, B) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, B)); + +#define CFG_WRITE_ENTRY_SHADE(ENTRY, DARK, CONVERT_SHADE) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, DARK, CONVERT_SHADE)); + +#define CFG_WRITE_ENTRY_D(ENTRY) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, ((int)(opts.ENTRY*100))-100); + +#define CFG_WRITE_ENTRY_NUM(ENTRY) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, opts.ENTRY); + +bool static writeConfig(KConfig *cfg, const Options &opts, const Options &def, bool exportingStyle=false) +{ + if(!cfg) + { + const char *xdg=xdgConfigFolder(); + + if(xdg) + { + char filename[QTC_MAX_FILENAME_LEN]; + + sprintf(filename, "%s/"QTC_FILE, xdg); + +#if QT_VERSION >= 0x040000 + KConfig defCfg(filename, KConfig::SimpleConfig); +#else + KConfig defCfg(filename, false, false); +#endif + + return writeConfig(&defCfg, opts, def, exportingStyle); + } + } + else + { +#if QT_VERSION >= 0x040000 + KConfigGroup config(cfg, QTC_GROUP); +#else + cfg->setGroup(QTC_GROUP); +#endif + CFG_WRITE_ENTRY_NUM(passwordChar) + CFG_WRITE_ENTRY(round) + CFG_WRITE_ENTRY_D(highlightFactor) + CFG_WRITE_ENTRY(toolbarBorders) + CFG_WRITE_ENTRY_FORCE(appearance) + CFG_WRITE_ENTRY(fixParentlessDialogs) + CFG_WRITE_ENTRY(stripedProgress) + CFG_WRITE_ENTRY(sliderStyle) + CFG_WRITE_ENTRY(animatedProgress) + CFG_WRITE_ENTRY(lighterPopupMenuBgnd) + CFG_WRITE_ENTRY(embolden) + CFG_WRITE_ENTRY(defBtnIndicator) + CFG_WRITE_ENTRY_B(sliderThumbs, true) + CFG_WRITE_ENTRY_B(handles, false) + CFG_WRITE_ENTRY(highlightTab) + CFG_WRITE_ENTRY(colorSelTab) + CFG_WRITE_ENTRY_SHADE(shadeSliders, false, false) + CFG_WRITE_ENTRY_SHADE(shadeMenubars, true, false) + CFG_WRITE_ENTRY_SHADE(shadeCheckRadio, false, true) + CFG_WRITE_ENTRY_FORCE(menubarAppearance) + CFG_WRITE_ENTRY_FORCE(menuitemAppearance) + CFG_WRITE_ENTRY_FORCE(toolbarAppearance) + CFG_WRITE_ENTRY_B(toolbarSeparators, true) + CFG_WRITE_ENTRY_B(splitters, false) + CFG_WRITE_ENTRY(customMenuTextColor) + CFG_WRITE_ENTRY(coloredMouseOver) + CFG_WRITE_ENTRY(menubarMouseOver) + CFG_WRITE_ENTRY(shadeMenubarOnlyWhenActive) + CFG_WRITE_ENTRY(thinnerMenuItems) + CFG_WRITE_ENTRY(customSlidersColor) + CFG_WRITE_ENTRY(customMenubarsColor) + CFG_WRITE_ENTRY(customMenuSelTextColor) + CFG_WRITE_ENTRY(customMenuNormTextColor) + CFG_WRITE_ENTRY(customCheckRadioColor) + CFG_WRITE_ENTRY(scrollbarType) + CFG_WRITE_ENTRY(buttonEffect) + CFG_WRITE_ENTRY_FORCE(lvAppearance) + CFG_WRITE_ENTRY_FORCE(tabAppearance) + CFG_WRITE_ENTRY_FORCE(sliderAppearance) + CFG_WRITE_ENTRY_FORCE(progressAppearance) +#ifndef QTC_PLAIN_FOCUS_ONLY + CFG_WRITE_ENTRY(stdFocus) +#endif + CFG_WRITE_ENTRY(lvLines) + CFG_WRITE_ENTRY(drawStatusBarFrames) + CFG_WRITE_ENTRY(fillSlider) + CFG_WRITE_ENTRY(roundMbTopOnly) + CFG_WRITE_ENTRY(borderMenuitems) + CFG_WRITE_ENTRY(gradientPbGroove) + CFG_WRITE_ENTRY(darkerBorders) + CFG_WRITE_ENTRY(vArrows) + CFG_WRITE_ENTRY(xCheck) + CFG_WRITE_ENTRY(framelessGroupBoxes) + CFG_WRITE_ENTRY(inactiveHighlight) +#ifdef __cplusplus + CFG_WRITE_ENTRY(stdSidebarButtons) +#endif + + CFG_WRITE_ENTRY(gtkScrollViews) + CFG_WRITE_ENTRY(gtkComboMenus) + CFG_WRITE_ENTRY(gtkButtonOrder) + CFG_WRITE_ENTRY(mapKdeIcons) + CFG_WRITE_ENTRY(shading) + cfg->sync(); + return true; + } + return false; +} +#endif diff --git a/common/config_file.c-orig b/common/config_file.c-orig new file mode 100644 index 0000000..fd51e01 --- /dev/null +++ b/common/config_file.c-orig @@ -0,0 +1,1238 @@ +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include "common.h" +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <pwd.h> +#include <sys/types.h> + +#define QTC_MAX_FILENAME_LEN 1024 +#define QTC_MAX_INPUT_LINE_LEN 256 +#define QTC_FILE "qtcurvestylerc" + +#ifdef CONFIG_READ +static int c2h(char ch) +{ + return (ch>='0' && ch<='9') ? ch-'0' : + (ch>='a' && ch<='f') ? 10+(ch-'a') : + (ch>='A' && ch<='F') ? 10+(ch-'A') : + 0; +} + +#define ATOH(str) ((c2h(*str)<<4)+c2h(*(str+1))) + +static void setRgb(color *col, const char *str) +{ + if(str && strlen(str)>6) + { + int offset='#'==str[0] ? 1 : 0; +#ifdef __cplusplus + col->setRgb(ATOH(&str[offset]), ATOH(&str[offset+2]), ATOH(&str[offset+4])); +#else + col->red=ATOH(&str[offset])<<8; + col->green=ATOH(&str[offset+2])<<8; + col->blue=ATOH(&str[offset+4])<<8; + col->pixel=0; +#endif + } + else +#ifdef __cplusplus + col->setRgb(0, 0, 0); +#else + col->red=col->green=col->blue=col->pixel=0; +#endif +} + +static EDefBtnIndicator toInd(const char *str, EDefBtnIndicator def) +{ + if(str) + { + if(0==memcmp(str, "fontcolor", 9) || 0==memcmp(str, "border", 6)) + return IND_FONT_COLOR; + if(0==memcmp(str, "none", 4)) + return IND_NONE; + if(0==memcmp(str, "corner", 6)) + return IND_CORNER; + if(0==memcmp(str, "colored", 7)) + return IND_COLORED; + } + + return def; +} + +static ELine toLine(const char *str, ELine def) +{ + if(str) + { + if(0==memcmp(str, "dashes", 6)) + return LINE_DASHES; + if(0==memcmp(str, "none", 4)) + return LINE_NONE; + if(0==memcmp(str, "sunken", 6)) + return LINE_SUNKEN; + if(0==memcmp(str, "dots", 4)) + return LINE_DOTS; + if(0==memcmp(str, "flat", 4)) + return LINE_FLAT; + } + return def; +} + +static ETBarBorder toTBarBorder(const char *str, ETBarBorder def) +{ + if(str) + { + if(0==memcmp(str, "dark", 4)) + return 0==memcmp(&str[4], "-all", 4) ? TB_DARK_ALL : TB_DARK; + if(0==memcmp(str, "none", 4)) + return TB_NONE; + if(0==memcmp(str, "light", 5)) + return 0==memcmp(&str[5], "-all", 4) ? TB_LIGHT_ALL : TB_LIGHT; + } + return def; +} + +static EMouseOver toMouseOver(const char *str, EMouseOver def) +{ + if(str) + { + if(0==memcmp(str, "true", 4) || 0==memcmp(str, "colored", 7)) + return MO_COLORED; + if(0==memcmp(str, "plastik", 7)) + return MO_PLASTIK; + if(0==memcmp(str, "false", 4) || 0==memcmp(str, "none", 4)) + return MO_NONE; + } + return def; +} + +static EAppearance toAppearance(const char *str, EAppearance def) +{ + if(str) + { + if(0==memcmp(str, "flat", 4)) + return APPEARANCE_FLAT; + if(0==memcmp(str, "raised", 6)) + return APPEARANCE_RAISED; + if(0==memcmp(str, "gradient", 8) || 0==memcmp(str, "lightgradient", 13)) + return APPEARANCE_GRADIENT; + if(0==memcmp(str, "splitgradient", 13)) + return APPEARANCE_SPLIT_GRADIENT; + if(0==memcmp(str, "glass", 5) || 0==memcmp(str, "shinyglass", 10)) + return APPEARANCE_SHINY_GLASS; + if(0==memcmp(str, "dullglass", 9)) + return APPEARANCE_DULL_GLASS; + if(0==memcmp(str, "inverted", 8)) + return APPEARANCE_INVERTED; + if(0==memcmp(str, "bevelled", 8)) + return APPEARANCE_BEVELLED; + } + return def; +} + +static EShade toShade(const char *str, bool allowDarken, EShade def) +{ + if(str) + { + /* true/false is from 0.25... */ + if(0==memcmp(str, "true", 4) || 0==memcmp(str, "selected", 8)) + return SHADE_BLEND_SELECTED; + if(0==memcmp(str, "origselected", 12)) + return SHADE_SELECTED; + if(allowDarken && 0==memcmp(str, "darken", 6)) + return SHADE_DARKEN; + if(0==memcmp(str, "custom", 6)) + return SHADE_CUSTOM; + if(0==memcmp(str, "none", 4)) + return SHADE_NONE; + } + + return def; +} + +/* Prior to 0.42 round was a bool - so need to read 'false' as 'none' */ +static ERound toRound(const char *str, ERound def) +{ + if(str) + { + if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + return ROUND_NONE; + if(0==memcmp(str, "slight", 6)) + return ROUND_SLIGHT; + if(0==memcmp(str, "full", 4)) + return ROUND_FULL; + } + + return def; +} + +static EScrollbar toScrollbar(const char *str, EScrollbar def) +{ + if(str) + { + if(0==memcmp(str, "kde", 3)) + return SCROLLBAR_KDE; + if(0==memcmp(str, "windows", 7)) + return SCROLLBAR_WINDOWS; + if(0==memcmp(str, "platinum", 8)) + return SCROLLBAR_PLATINUM; + if(0==memcmp(str, "next", 4)) + return SCROLLBAR_NEXT; + if(0==memcmp(str, "none", 4)) + return SCROLLBAR_NONE; + } + + return def; +} + +static EEffect toEffect(const char *str, EEffect def) +{ + if(str) + { + if(0==memcmp(str, "none", 4)) + return EFFECT_NONE; + if(0==memcmp(str, "shadow", 6)) + return EFFECT_SHADOW; + if(0==memcmp(str, "etch", 4)) + return EFFECT_ETCH; + } + + return def; +} + +static EShading toShading(const char * str, EShading def) +{ + if(str) + { + if(0==memcmp(str, "simple", 6)) + return SHADING_SIMPLE; + if(0==memcmp(str, "hsl", 3)) + return SHADING_HSL; + if(0==memcmp(str, "hsv", 3)) + return SHADING_HSV; + } + + return def; +} + +static EStripe toStripe(const char * str, EStripe def) +{ + if(str) + { + if(0==memcmp(str, "plain", 5) || 0==memcmp(str, "true", 4)) + return STRIPE_PLAIN; + if(0==memcmp(str, "none", 4) || 0==memcmp(str, "false", 5)) + return STRIPE_NONE; + if(0==memcmp(str, "diagonal", 8)) + return STRIPE_DIAGONAL; + } + + return def; +} + +static ESliderStyle toSlider(const char * str, ESliderStyle def) +{ + if(str) + { + if(0==memcmp(str, "round", 5)) + return SLIDER_ROUND; + if(0==memcmp(str, "plain", 5)) + return SLIDER_PLAIN; + if(0==memcmp(str, "triangular", 10)) + return SLIDER_TRIANGULAR; + } + + return def; +} + +#endif + +#ifdef CONFIG_WRITE +#include <kstandarddirs.h> +#endif + +static const char * getHome() +{ + static const char *home=NULL; + + if(!home) + { + struct passwd *p=getpwuid(getuid()); + + if(p) + home=p->pw_dir; + else + { + char *env=getenv("HOME"); + + if(env) + home=env; + } + + if(!home) + home="/tmp"; + } + + return home; +} + +static const char *xdgConfigFolder() +{ + static char xdgDir[QTC_MAX_FILENAME_LEN]={'\0'}; + + if(!xdgDir[0]) + { + static const char *home=NULL; + +#if 0 + char *env=getenv("XDG_CONFIG_HOME"); + + /* + Check the setting of XDG_CONFIG_HOME + For some reason, sudo leaves the env vars set to those of the + caller - so XDG_CONFIG_HOME would point to the users setting, and + not roots. + + Therefore, check that home is first part of XDG_CONFIG_HOME + */ + + if(env && 0==getuid()) + { + if(!home) + home=getHome(); + if(home && home!=strstr(env, home)) + env=NULL; + } +#else + /* + Hmm... for 'root' dont bother to check env var, just set to ~/.config + - as problems would arise if "sudo kcmshell style", and then + "sudo su" / "kcmshell style". The 1st would write to ~/.config, but + if root has a XDG_ set then that would be used on the second :-( + */ + char *env=0==getuid() ? NULL : getenv("XDG_CONFIG_HOME"); +#endif + + if(!env) + { + if(!home) + home=getHome(); + + sprintf(xdgDir, "%s/.config", home); + } + else + strcpy(xdgDir, env); + +#if defined CONFIG_WRITE || !defined __cplusplus + { + struct stat info; + + if(0!=lstat(xdgDir, &info)) + { +#ifdef __cplusplus + KStandardDirs::makeDir(xdgDir, 0755); +#else + g_mkdir_with_parents(xdgDir, 0755); +#endif + } + } +#endif + } + + return xdgDir; +} + +#ifdef CONFIG_READ + +#ifdef __cplusplus +#define QTC_IS_BLACK(A) (0==(A).red() && 0==(A).green() && 0==(A).blue()) +#else +#define QTC_IS_BLACK(A) (0==(A).red && 0==(A).green && 0==(A).blue) +#endif + +static void checkColor(EShade *s, color *c) +{ + if(SHADE_CUSTOM==*s && QTC_IS_BLACK(*c)) + *s=SHADE_NONE; +} + +#ifdef __cplusplus + +#if QT_VERSION >= 0x040000 +#include <QMap> +#include <QFile> +#include <QTextStream> +#define QTC_LATIN1(A) A.toLatin1() +#else +#define QTC_LATIN1(A) A.latin1() + +#include <qmap.h> +#include <qfile.h> +#include <qtextstream.h> +#endif + +class QtCConfig +{ + public: + + QtCConfig(const QString &filename); + + bool ok() const { return values.count()>0; } + const QString & readEntry(const char *key, const QString &def=QString::null); + + private: + + QMap<QString, QString> values; +}; + +QtCConfig::QtCConfig(const QString &filename) +{ + QFile f(filename); + +#if QT_VERSION >= 0x040000 + if(f.open(QIODevice::ReadOnly)) +#else + if(f.open(IO_ReadOnly)) +#endif + { + QTextStream stream(&f); + QString line; + + while(!stream.atEnd()) + { + line = stream.readLine(); +#if QT_VERSION >= 0x040000 + int pos=line.indexOf('='); +#else + int pos=line.find('='); +#endif + if(-1!=pos) + values[line.left(pos)]=line.mid(pos+1); + } + f.close(); + } +} + +inline const QString & QtCConfig::readEntry(const char *key, const QString &def) +{ + return values.contains(key) ? values[key] : def; +} + +inline QString readStringEntry(QtCConfig &cfg, const char *key) +{ + return cfg.readEntry(key); +} + +static int readNumEntry(QtCConfig &cfg, const char *key, int def) +{ + const QString &val(readStringEntry(cfg, key)); + + return val.isEmpty() ? def : val.toInt(); +} + +static bool readBoolEntry(QtCConfig &cfg, const char *key, bool def) +{ + const QString &val(readStringEntry(cfg, key)); + + return val.isEmpty() ? def : (val=="true" ? true : false); +} + +#if QT_VERSION >= 0x040000 +#define QTC_LATIN1(A) A.toLatin1() +#else +#define QTC_LATIN1(A) A.latin1() +#endif + +#define QTC_CFG_READ_COLOR(ENTRY) \ + { \ + QString sVal(cfg.readEntry(#ENTRY)); \ + if(sVal.isEmpty()) \ + opts->ENTRY=def->ENTRY; \ + else \ + setRgb(&(opts->ENTRY), QTC_LATIN1(sVal)); \ + } + +#else + +static char * lookupCfgHash(GHashTable **cfg, char *key, char *val) +{ + char *rv=NULL; + + if(!*cfg) + *cfg=g_hash_table_new(g_str_hash, g_str_equal); + else + rv=(char *)g_hash_table_lookup(*cfg, key); + + if(!rv && val) + { + g_hash_table_insert(*cfg, g_strdup(key), g_strdup(val)); + rv=(char *)g_hash_table_lookup(*cfg, key); + } + + return rv; +} + +static GHashTable * loadConfig(const char *filename) +{ + FILE *f=fopen(filename, "r"); + GHashTable *cfg=NULL; + + if(f) + { + char line[QTC_MAX_INPUT_LINE_LEN]; + + while(NULL!=fgets(line, QTC_MAX_INPUT_LINE_LEN-1, f)) + { + char *eq=strchr(line, '='); + int pos=eq ? eq-line : -1; + + if(pos>0) + { + char *endl=strchr(line, '\n'); + + if(endl) + *endl='\0'; + + line[pos]='\0'; + + lookupCfgHash(&cfg, line, &line[pos+1]); + } + } + + fclose(f); + } + + return cfg; +} + +static void releaseConfig(GHashTable *cfg) +{ + g_hash_table_destroy(cfg); +} + +static char * readStringEntry(GHashTable *cfg, char *key) +{ + return lookupCfgHash(&cfg, key, NULL); +} + +static int readNumEntry(GHashTable *cfg, char *key, int def) +{ + char *str=readStringEntry(cfg, key); + + return str ? atoi(str) : def; +} + +static gboolean readBoolEntry(GHashTable *cfg, char *key, gboolean def) +{ + char *str=readStringEntry(cfg, key); + + return str ? (0==memcmp(str, "true", 4) ? true : false) : def; +} + +#define QTC_LATIN1(A) A + +#define QTC_CFG_READ_COLOR(ENTRY) \ + { \ + const char *str=readStringEntry(cfg, #ENTRY); \ + \ + if(str) \ + setRgb(&(opts->ENTRY), str); \ + else \ + opts->ENTRY=def->ENTRY; \ + } +#endif + +#define QTC_CFG_READ_NUM(ENTRY) \ + opts->ENTRY=readNumEntry(cfg, #ENTRY, def->ENTRY); + +#define QTC_CFG_READ_BOOL(ENTRY) \ + opts->ENTRY=readBoolEntry(cfg, #ENTRY, def->ENTRY); + +#define QTC_CFG_READ_ROUND(ENTRY) \ + opts->ENTRY=toRound(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_DI(ENTRY) \ + opts->ENTRY=((double)(readNumEntry(cfg, #ENTRY, ((int)(def->ENTRY*100))-100)+100))/100.0; + +#define QTC_CFG_READ_TB_BORDER(ENTRY) \ + opts->ENTRY=toTBarBorder(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_MOUSE_OVER(ENTRY) \ + opts->ENTRY=toMouseOver(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_APPEARANCE(ENTRY, DEF) \ + opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF); + +/* +#define QTC_CFG_READ_APPEARANCE(ENTRY) \ + opts->ENTRY=toAppearance(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); +*/ + +#define QTC_CFG_READ_STRIPE(ENTRY) \ + opts->ENTRY=toStripe(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_SLIDER(ENTRY) \ + opts->ENTRY=toSlider(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_DEF_BTN(ENTRY) \ + opts->ENTRY=toInd(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_LINE(ENTRY) \ + opts->ENTRY=toLine(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_SHADE(ENTRY, AD) \ + opts->ENTRY=toShade(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), AD, def->ENTRY); + +#define QTC_CFG_READ_SCROLLBAR(ENTRY) \ + opts->ENTRY=toScrollbar(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#define QTC_CFG_READ_EFFECT(ENTRY) \ + opts->ENTRY=toEffect(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); + +#ifdef QTC_CONFIG_DIALOG +#define QTC_CFG_READ_SHADING(ENTRY, UNUSED) \ + opts->ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), def->ENTRY); +#else +#define QTC_CFG_READ_SHADING(ENTRY, DEF) \ + ENTRY=toShading(QTC_LATIN1(readStringEntry(cfg, #ENTRY)), DEF); +#endif + +#ifdef __cplusplus +static bool readConfig(const QString &file, Options *opts, Options *def) +#else +static bool readConfig(const char *file, Options *opts, Options *def) +#endif +{ +#ifdef __cplusplus + if(file.isEmpty()) + { + const char *xdg=xdgConfigFolder(); + + if(xdg) + { + QString filename(xdg); + + filename+="/"QTC_FILE; + return readConfig(filename, opts, def); + } + } +#else + if(!file) + { + const char *xdg=xdgConfigFolder(); + + if(xdg) + { + char filename[QTC_MAX_FILENAME_LEN]; + + sprintf(filename, "%s/"QTC_FILE, xdg); + return readConfig(filename, opts, def); + } + } +#endif + else + { +#ifdef __cplusplus + QtCConfig cfg(file); + + if(cfg.ok()) + { +#else + GHashTable *cfg=loadConfig(file); + + if(cfg) + { +#endif + QTC_CFG_READ_NUM(passwordChar) + QTC_CFG_READ_ROUND(round) + QTC_CFG_READ_DI(highlightFactor) + QTC_CFG_READ_TB_BORDER(toolbarBorders) + QTC_CFG_READ_APPEARANCE(appearance, def->appearance) + QTC_CFG_READ_BOOL(fixParentlessDialogs) + QTC_CFG_READ_STRIPE(stripedProgress) + QTC_CFG_READ_SLIDER(sliderStyle) + QTC_CFG_READ_BOOL(animatedProgress) + QTC_CFG_READ_BOOL(lighterPopupMenuBgnd) + QTC_CFG_READ_BOOL(embolden) + QTC_CFG_READ_DEF_BTN(defBtnIndicator) + QTC_CFG_READ_LINE(sliderThumbs) + QTC_CFG_READ_LINE(handles) + QTC_CFG_READ_BOOL(highlightTab) + QTC_CFG_READ_BOOL(colorSelTab) + QTC_CFG_READ_SHADE(shadeSliders, false) + QTC_CFG_READ_SHADE(shadeMenubars, true) + QTC_CFG_READ_SHADE(shadeCheckRadio, false) + QTC_CFG_READ_APPEARANCE(menubarAppearance, def->menubarAppearance) + QTC_CFG_READ_APPEARANCE(menuitemAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(toolbarAppearance, def->toolbarAppearance) + QTC_CFG_READ_LINE(toolbarSeparators) + QTC_CFG_READ_LINE(splitters) + QTC_CFG_READ_BOOL(customMenuTextColor) + QTC_CFG_READ_MOUSE_OVER(coloredMouseOver) + QTC_CFG_READ_BOOL(menubarMouseOver) + QTC_CFG_READ_BOOL(shadeMenubarOnlyWhenActive) + QTC_CFG_READ_BOOL(thinnerMenuItems) + QTC_CFG_READ_COLOR(customSlidersColor) + QTC_CFG_READ_COLOR(customMenubarsColor) + QTC_CFG_READ_COLOR(customMenuSelTextColor) + QTC_CFG_READ_COLOR(customMenuNormTextColor) + QTC_CFG_READ_COLOR(customCheckRadioColor) + QTC_CFG_READ_SCROLLBAR(scrollbarType) + QTC_CFG_READ_EFFECT(buttonEffect) + QTC_CFG_READ_APPEARANCE(lvAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(tabAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(sliderAppearance, opts->appearance) + QTC_CFG_READ_APPEARANCE(progressAppearance, opts->appearance) +#ifndef QTC_PLAIN_FOCUS_ONLY + QTC_CFG_READ_BOOL(stdFocus) +#endif + QTC_CFG_READ_BOOL(lvLines) + QTC_CFG_READ_BOOL(drawStatusBarFrames) + QTC_CFG_READ_BOOL(fillSlider) + QTC_CFG_READ_BOOL(roundMbTopOnly) + QTC_CFG_READ_BOOL(borderMenuitems) + QTC_CFG_READ_BOOL(gradientPbGroove) + QTC_CFG_READ_BOOL(darkerBorders) + QTC_CFG_READ_BOOL(vArrows) + QTC_CFG_READ_BOOL(xCheck) + QTC_CFG_READ_BOOL(framelessGroupBoxes) + QTC_CFG_READ_BOOL(inactiveHighlight) + QTC_CFG_READ_BOOL(colorMenubarMouseOver) +#ifdef __cplusplus + QTC_CFG_READ_BOOL(stdSidebarButtons) + QTC_CFG_READ_BOOL(gtkScrollViews) + QTC_CFG_READ_BOOL(gtkComboMenus) +/* +#else + QTC_CFG_READ_BOOL(setDialogButtonOrder) +*/ +#endif +#if !defined __cplusplus || defined QTC_CONFIG_DIALOG + QTC_CFG_READ_BOOL(mapKdeIcons) +#endif +#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus + QTC_CFG_READ_BOOL(gtkButtonOrder) +#endif + QTC_CFG_READ_SHADING(shading, shading); + +#ifndef __cplusplus + releaseConfig(cfg); +#endif + if(SHADE_SELECTED==opts->shadeCheckRadio) + opts->shadeCheckRadio=SHADE_BLEND_SELECTED; + + checkColor(&opts->shadeMenubars, &opts->customMenubarsColor); + checkColor(&opts->shadeSliders, &opts->customSlidersColor); + checkColor(&opts->shadeCheckRadio, &opts->customCheckRadioColor); + + if(APPEARANCE_BEVELLED==opts->toolbarAppearance) + opts->toolbarAppearance=APPEARANCE_GRADIENT; + else if(APPEARANCE_RAISED==opts->toolbarAppearance) + opts->toolbarAppearance=APPEARANCE_FLAT; + + if(APPEARANCE_BEVELLED==opts->menubarAppearance) + opts->menubarAppearance=APPEARANCE_GRADIENT; + else if(APPEARANCE_RAISED==opts->menubarAppearance) + opts->menubarAppearance=APPEARANCE_FLAT; + + if(APPEARANCE_BEVELLED==opts->sliderAppearance) + opts->sliderAppearance=APPEARANCE_GRADIENT; + + if(APPEARANCE_BEVELLED==opts->tabAppearance) + opts->tabAppearance=APPEARANCE_GRADIENT; + + if(opts->highlightFactor<((100.0+MIN_HIGHLIGHT_FACTOR)/100.0) || + opts->highlightFactor>((100.0+MAX_HIGHLIGHT_FACTOR)/100.0)) + opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR; + + if(opts->animatedProgress && !opts->stripedProgress) + opts->animatedProgress=false; + + if(opts->colorSelTab && APPEARANCE_GRADIENT!=opts->tabAppearance) + opts->colorSelTab=false; + + if(SHADE_CUSTOM==opts->shadeMenubars || SHADE_BLEND_SELECTED==opts->shadeMenubars || !opts->borderMenuitems) + opts->colorMenubarMouseOver=true; + + return true; + } + } + + return false; +} + +static bool fileExists(const char *path) +{ + struct stat info; + + return 0==lstat(path, &info) && (info.st_mode&S_IFMT)==S_IFREG; +} + +static const char * getSystemConfigFile() +{ + static const char * constFiles[]={ "/etc/qt4/"QTC_FILE, "/etc/qt3/"QTC_FILE, "/etc/qt/"QTC_FILE, NULL }; + + int i; + + for(i=0; constFiles[i]; ++i) + if(fileExists(constFiles[i])) + return constFiles[i]; + return NULL; +} + +static void defaultSettings(Options *opts) +{ + /* Set hard-coded defaults... */ + opts->contrast=7; + opts->passwordChar=0x25CF; + opts->highlightFactor=DEFAULT_HIGHLIGHT_FACTOR; + opts->round=ROUND_FULL; + opts->lighterPopupMenuBgnd=true; + opts->animatedProgress=true; + opts->stripedProgress=STRIPE_DIAGONAL; + opts->sliderStyle=SLIDER_TRIANGULAR; + opts->highlightTab=true; + opts->colorSelTab=false; + opts->embolden=false; + opts->appearance=APPEARANCE_DULL_GLASS; + opts->lvAppearance=APPEARANCE_BEVELLED; + opts->tabAppearance=APPEARANCE_GRADIENT; + opts->sliderAppearance=APPEARANCE_DULL_GLASS; + opts->menubarAppearance=APPEARANCE_GRADIENT; + opts->menuitemAppearance=APPEARANCE_DULL_GLASS; + opts->toolbarAppearance=APPEARANCE_GRADIENT; + opts->progressAppearance=APPEARANCE_DULL_GLASS; + opts->defBtnIndicator=IND_COLORED; + opts->sliderThumbs=LINE_FLAT; + opts->handles=LINE_DOTS; + opts->shadeSliders=SHADE_BLEND_SELECTED; + opts->shadeMenubars=SHADE_DARKEN; + opts->shadeCheckRadio=SHADE_NONE; + opts->toolbarBorders=TB_NONE; + opts->toolbarSeparators=LINE_NONE; + opts->splitters=LINE_FLAT; + opts->fixParentlessDialogs=false; + opts->customMenuTextColor=false; + opts->coloredMouseOver=MO_PLASTIK; + opts->menubarMouseOver=true; + opts->shadeMenubarOnlyWhenActive=true; + opts->thinnerMenuItems=false; + opts->scrollbarType=SCROLLBAR_KDE; + opts->buttonEffect=EFFECT_NONE; +#ifndef QTC_PLAIN_FOCUS_ONLY + opts->stdFocus=true; +#endif + opts->lvLines=false; + opts->drawStatusBarFrames=false; + opts->fillSlider=true; + opts->roundMbTopOnly=true; + opts->borderMenuitems=true; + opts->gradientPbGroove=true; + opts->darkerBorders=false; + opts->vArrows=false; + opts->xCheck=false; + opts->framelessGroupBoxes=false; + opts->colorMenubarMouseOver=false; + opts->inactiveHighlight=false; +#ifdef QTC_CONFIG_DIALOG + opts->shading=SHADING_HSL; +#endif +#ifdef __cplusplus + opts->stdSidebarButtons=false; + opts->gtkScrollViews=false; + opts->gtkComboMenus=false; + opts->customMenubarsColor.setRgb(0, 0, 0); + opts->customSlidersColor.setRgb(0, 0, 0); + opts->customMenuNormTextColor.setRgb(0, 0, 0); + opts->customMenuSelTextColor.setRgb(0, 0, 0); + opts->customCheckRadioColor.setRgb(0, 0, 0); +#else +/* + opts->setDialogButtonOrder=false; +*/ + opts->customMenubarsColor.red=opts->customMenubarsColor.green=opts->customMenubarsColor.blue=0; + opts->customSlidersColor.red=opts->customSlidersColor.green=opts->customSlidersColor.blue=0; + opts->customMenuNormTextColor.red=opts->customMenuNormTextColor.green=opts->customMenuNormTextColor.blue=0; + opts->customMenuSelTextColor.red=opts->customMenuSelTextColor.green=opts->customMenuSelTextColor.blue=0; + opts->customCheckRadioColor.red=opts->customCheckRadioColor.green=opts->customCheckRadioColor.blue=0; +#endif + +#if !defined __cplusplus || defined QTC_CONFIG_DIALOG + opts->mapKdeIcons=true; +#endif +#if defined QTC_CONFIG_DIALOG || (defined QT_VERSION && (QT_VERSION >= 0x040000)) || !defined __cplusplus + opts->gtkButtonOrder=false; +#endif + + /* Read system config file... */ + { + static const char * systemFilename=NULL; + + if(!systemFilename) + systemFilename=getSystemConfigFile(); + + if(systemFilename) + readConfig(systemFilename, opts, opts); + } +} + +#endif + +#ifdef CONFIG_WRITE +static const char *toStr(EDefBtnIndicator ind) +{ + switch(ind) + { + case IND_NONE: + return "none"; + case IND_FONT_COLOR: + return "fontcolor"; + case IND_CORNER: + return "corner"; + default: + return "colored"; + } +} + +static const char *toStr(ELine ind, bool none) +{ + switch(ind) + { + case LINE_DOTS: + return "dots"; + case LINE_DASHES: + return none ? "none" : "dashes"; + case LINE_FLAT: + return "flat"; + default: + return "sunken"; + } +} + +static const char *toStr(ETBarBorder ind) +{ + switch(ind) + { + case TB_DARK: + return "dark"; + case TB_DARK_ALL: + return "dark-all"; + case TB_LIGHT_ALL: + return "light-all"; + case TB_NONE: + return "none"; + default: + return "light"; + } +} + +static const char *toStr(EMouseOver mo) +{ + switch(mo) + { + case MO_COLORED: + return "colored"; + case MO_NONE: + return "none"; + default: + return "plastik"; + } +} + +static const char *toStr(EAppearance exp) +{ + switch(exp) + { + case APPEARANCE_FLAT: + return "flat"; + case APPEARANCE_RAISED: + return "raised"; + case APPEARANCE_GRADIENT: + return "gradient"; + case APPEARANCE_SPLIT_GRADIENT: + return "splitgradient"; + case APPEARANCE_DULL_GLASS: + return "dullglass"; + case APPEARANCE_BEVELLED: + return "bevelled"; + case APPEARANCE_INVERTED: + return "inverted"; + default: + return "shinyglass"; + } +} + +static const char *toStr(EShade exp, bool dark, bool convertBlendSelToSel) +{ + switch(exp) + { + default: + case SHADE_NONE: + return "none"; + case SHADE_BLEND_SELECTED: + return dark || !convertBlendSelToSel ? "selected" : "origselected"; + case SHADE_CUSTOM: + return "custom"; + /* case SHADE_SELECTED */ + case SHADE_DARKEN: + return dark ? "darken" : "origselected"; + } +} + +static const char *toStr(ERound exp) +{ + switch(exp) + { + case ROUND_NONE: + return "none"; + case ROUND_SLIGHT: + return "slight"; + default: + case ROUND_FULL: + return "full"; + } +} + +static const char *toStr(EScrollbar sb) +{ + switch(sb) + { + case SCROLLBAR_KDE: + return "kde"; + default: + case SCROLLBAR_WINDOWS: + return "windows"; + case SCROLLBAR_PLATINUM: + return "platinum"; + case SCROLLBAR_NEXT: + return "next"; + case SCROLLBAR_NONE: + return "none"; + } +} + +static const char *toStr(EEffect e) +{ + switch(e) + { + case EFFECT_NONE: + return "none"; + default: + case EFFECT_SHADOW: + return "shadow"; + case EFFECT_ETCH: + return "etch"; + } +} + +inline const char * toStr(bool b) { return b ? "true" : "false"; } + +static QString toStr(const QColor &col) +{ + QString colorStr; + + colorStr.sprintf("#%02X%02X%02X", col.red(), col.green(), col.blue()); + return colorStr; +} + +static const char *toStr(EShading s) +{ + switch(s) + { + case SHADING_SIMPLE: + return "simple"; + default: + case SHADING_HSL: + return "hsl"; + case SHADING_HSV: + return "hsv"; + } +} + +static const char *toStr(EStripe s) +{ + switch(s) + { + default: + case STRIPE_PLAIN: + return "plain"; + case STRIPE_NONE: + return "none"; + case STRIPE_DIAGONAL: + return "diagonal"; + } +} + +static const char *toStr(ESliderStyle s) +{ + switch(s) + { + case SLIDER_PLAIN: + return "plain"; + case SLIDER_TRIANGULAR: + return "triangular"; + default: + case SLIDER_ROUND: + return "round"; + } +} + +#if QT_VERSION >= 0x040000 +#define CFG config +#else +#define CFG (*cfg) +#endif + +#define CFG_WRITE_ENTRY(ENTRY) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY)); + +#define CFG_WRITE_ENTRY_FORCE(ENTRY) \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY)); + +#define CFG_WRITE_ENTRY_B(ENTRY, B) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, B)); + +#define CFG_WRITE_ENTRY_SHADE(ENTRY, DARK, CONVERT_SHADE) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, toStr(opts.ENTRY, DARK, CONVERT_SHADE)); + +#define CFG_WRITE_ENTRY_D(ENTRY) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, ((int)(opts.ENTRY*100))-100); + +#define CFG_WRITE_ENTRY_NUM(ENTRY) \ + if (!exportingStyle && def.ENTRY==opts.ENTRY) \ + CFG.deleteEntry(#ENTRY); \ + else \ + CFG.writeEntry(#ENTRY, opts.ENTRY); + +bool static writeConfig(KConfig *cfg, const Options &opts, const Options &def, bool exportingStyle=false) +{ + if(!cfg) + { + const char *xdg=xdgConfigFolder(); + + if(xdg) + { + char filename[QTC_MAX_FILENAME_LEN]; + + sprintf(filename, "%s/"QTC_FILE, xdg); + +#if QT_VERSION >= 0x040000 + KConfig defCfg(filename, KConfig::SimpleConfig); +#else + KConfig defCfg(filename, false, false); +#endif + + return writeConfig(&defCfg, opts, def, exportingStyle); + } + } + else + { +#if QT_VERSION >= 0x040000 + KConfigGroup config(cfg, QTC_GROUP); +#else + cfg->setGroup(QTC_GROUP); +#endif + CFG_WRITE_ENTRY_NUM(passwordChar) + CFG_WRITE_ENTRY(round) + CFG_WRITE_ENTRY_D(highlightFactor) + CFG_WRITE_ENTRY(toolbarBorders) + CFG_WRITE_ENTRY_FORCE(appearance) + CFG_WRITE_ENTRY(fixParentlessDialogs) + CFG_WRITE_ENTRY(stripedProgress) + CFG_WRITE_ENTRY(sliderStyle) + CFG_WRITE_ENTRY(animatedProgress) + CFG_WRITE_ENTRY(lighterPopupMenuBgnd) + CFG_WRITE_ENTRY(embolden) + CFG_WRITE_ENTRY(defBtnIndicator) + CFG_WRITE_ENTRY_B(sliderThumbs, true) + CFG_WRITE_ENTRY_B(handles, false) + CFG_WRITE_ENTRY(highlightTab) + CFG_WRITE_ENTRY(colorSelTab) + CFG_WRITE_ENTRY_SHADE(shadeSliders, false, false) + CFG_WRITE_ENTRY_SHADE(shadeMenubars, true, false) + CFG_WRITE_ENTRY_SHADE(shadeCheckRadio, false, true) + CFG_WRITE_ENTRY_FORCE(menubarAppearance) + CFG_WRITE_ENTRY_FORCE(menuitemAppearance) + CFG_WRITE_ENTRY_FORCE(toolbarAppearance) + CFG_WRITE_ENTRY_B(toolbarSeparators, true) + CFG_WRITE_ENTRY_B(splitters, false) + CFG_WRITE_ENTRY(customMenuTextColor) + CFG_WRITE_ENTRY(coloredMouseOver) + CFG_WRITE_ENTRY(menubarMouseOver) + CFG_WRITE_ENTRY(shadeMenubarOnlyWhenActive) + CFG_WRITE_ENTRY(thinnerMenuItems) + CFG_WRITE_ENTRY(customSlidersColor) + CFG_WRITE_ENTRY(customMenubarsColor) + CFG_WRITE_ENTRY(customMenuSelTextColor) + CFG_WRITE_ENTRY(customMenuNormTextColor) + CFG_WRITE_ENTRY(customCheckRadioColor) + CFG_WRITE_ENTRY(scrollbarType) + CFG_WRITE_ENTRY(buttonEffect) + CFG_WRITE_ENTRY_FORCE(lvAppearance) + CFG_WRITE_ENTRY_FORCE(tabAppearance) + CFG_WRITE_ENTRY_FORCE(sliderAppearance) + CFG_WRITE_ENTRY_FORCE(progressAppearance) +#ifndef QTC_PLAIN_FOCUS_ONLY + CFG_WRITE_ENTRY(stdFocus) +#endif + CFG_WRITE_ENTRY(lvLines) + CFG_WRITE_ENTRY(drawStatusBarFrames) + CFG_WRITE_ENTRY(fillSlider) + CFG_WRITE_ENTRY(roundMbTopOnly) + CFG_WRITE_ENTRY(borderMenuitems) + CFG_WRITE_ENTRY(gradientPbGroove) + CFG_WRITE_ENTRY(darkerBorders) + CFG_WRITE_ENTRY(vArrows) + CFG_WRITE_ENTRY(xCheck) + CFG_WRITE_ENTRY(framelessGroupBoxes) + CFG_WRITE_ENTRY(inactiveHighlight) +#ifdef __cplusplus + CFG_WRITE_ENTRY(stdSidebarButtons) +#endif + + CFG_WRITE_ENTRY(gtkScrollViews) + CFG_WRITE_ENTRY(gtkComboMenus) + CFG_WRITE_ENTRY(gtkButtonOrder) + CFG_WRITE_ENTRY(mapKdeIcons) + CFG_WRITE_ENTRY(shading) + cfg->sync(); + return true; + } + return false; +} +#endif diff --git a/common/mkpkg b/common/mkpkg new file mode 100755 index 0000000..41cc3c6 --- /dev/null +++ b/common/mkpkg @@ -0,0 +1,7 @@ +version=`grep "#define VERSION" config.h | awk -F\" '{print $2}'` +packageName=`grep CPACK_PACKAGE_NAME CPackSourceConfig.cmake | grep -v "Package project name" | awk -F\" '{print $2}' | sed y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/` +maintainer=`grep $USER /etc/passwd | awk -F: '{print $5}'` + +checkinstall --nodoc --pkgname="$packageName" --pkgversion="$version" \ + --pkgrelease="0" --exclude="/" --include=install_manifest.txt \ + --pakdir="/tmp/checkinstall-$packageName" sleep 1 diff --git a/common/radio_frame.png b/common/radio_frame.png Binary files differnew file mode 100644 index 0000000..2bf777a --- /dev/null +++ b/common/radio_frame.png diff --git a/common/radio_light.png b/common/radio_light.png Binary files differnew file mode 100644 index 0000000..0c093d4 --- /dev/null +++ b/common/radio_light.png diff --git a/common/radio_on.png b/common/radio_on.png Binary files differnew file mode 100644 index 0000000..7d1557a --- /dev/null +++ b/common/radio_on.png diff --git a/common/slider.png b/common/slider.png Binary files differnew file mode 100644 index 0000000..bdb7e67 --- /dev/null +++ b/common/slider.png diff --git a/common/slider_light.png b/common/slider_light.png Binary files differnew file mode 100644 index 0000000..a36d2ca --- /dev/null +++ b/common/slider_light.png diff --git a/common/slider_light_v.png b/common/slider_light_v.png Binary files differnew file mode 100644 index 0000000..3a9cd92 --- /dev/null +++ b/common/slider_light_v.png diff --git a/common/slider_v.png b/common/slider_v.png Binary files differnew file mode 100644 index 0000000..e2becff --- /dev/null +++ b/common/slider_v.png diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..da83314 --- /dev/null +++ b/config.guess @@ -0,0 +1,1561 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2009-04-27' + +# This file 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner <[email protected]>. +# Please send patches to <[email protected]>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <[email protected]>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# ([email protected] 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # [email protected] (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd | genuineintel) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <features.h> + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <[email protected]> + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <[email protected]>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From [email protected]. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From [email protected]. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From [email protected]. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +and + http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <[email protected]> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..0ecd358 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,7 @@ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#define VERSION "@QTCURVE_VERSION_FULL@" +#define KDE3PREFIX "@KDE3PREFIX@" +#define KDE4PREFIX "@KDE4PREFIX@" +#endif diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..a39437d --- /dev/null +++ b/config.sub @@ -0,0 +1,1686 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +# Free Software Foundation, Inc. + +timestamp='2009-04-17' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to <[email protected]>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <[email protected]>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/CMakeLists.txt b/config/CMakeLists.txt new file mode 100644 index 0000000..b9b391f --- /dev/null +++ b/config/CMakeLists.txt @@ -0,0 +1,7 @@ +set(kstyle_qtcurve_config_PART_SRCS qtcurveconfig.cpp exportthemedialog.cpp) +include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/common ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR}) +kde3_add_ui_files(kstyle_qtcurve_config_PART_SRCS qtcurveconfigbase.ui) +kde3_add_kpart(kstyle_qtcurve_config ${kstyle_qtcurve_config_PART_SRCS}) +kde3_automoc(${kstyle_qtcurve_config_PART_SRCS}) +target_link_libraries(kstyle_qtcurve_config ${KDE3_KDEUI_LIBS} ${KDE3_KIO_LIBS} ${KDE3_KDECORE_LIBS} ${QT_QTGUI_LIBRARY}) +install(TARGETS kstyle_qtcurve_config DESTINATION ${KDE3_LIB_DIR}/kde3) diff --git a/config/exportthemedialog.cpp b/config/exportthemedialog.cpp new file mode 100644 index 0000000..4d1eaf1 --- /dev/null +++ b/config/exportthemedialog.cpp @@ -0,0 +1,94 @@ +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "exportthemedialog.h" +#include <klocale.h> +#include <kurlrequester.h> +#include <klineedit.h> +#include <kmessagebox.h> +#include <kconfig.h> +#include <qdir.h> +#include <qlabel.h> +#include <qlayout.h> +#define CONFIG_WRITE +#include "config_file.c" + +CExportThemeDialog::CExportThemeDialog(QWidget *parent) + : KDialogBase(parent, "ExportDialog", true, i18n("Export Theme"), + Ok|Cancel) +{ + QWidget *page = new QWidget(this); + QGridLayout *layout = new QGridLayout(page, 3, 2, 0, spacingHint()); + + layout->addWidget(new QLabel(i18n("Name:"), page), 0, 0); + layout->addWidget(new QLabel(i18n("Comment:"), page), 1, 0); + layout->addWidget(new QLabel(i18n("Destination folder:"), page), 2, 0); + layout->addWidget(themeName=new QLineEdit(page), 0, 1); + layout->addWidget(themeComment=new QLineEdit(i18n("QtCurve based theme"), page), 1, 1); + layout->addWidget(themeUrl=new KURLRequester(page), 2, 1); + + themeUrl->setMode(KFile::Directory|KFile::ExistingOnly|KFile::LocalOnly); + themeUrl->lineEdit()->setReadOnly(true); + themeUrl->setURL(QDir::homeDirPath()); + setMainWidget(page); +} + +void CExportThemeDialog::run(const Options &o) +{ + opts=o; + exec(); +} + +void CExportThemeDialog::slotOk() +{ + QString name(themeName->text().stripWhiteSpace().lower()); + + if(name.isEmpty()) + KMessageBox::error(this, i18n("Name is empty!")); + else + { + QString fileName(themeUrl->url()+"/"QTC_THEME_PREFIX+name+".themerc"); + + KConfig cfg(fileName, false, false); + bool rv(!cfg.isReadOnly()); + + if(rv) + { + cfg.setGroup("Misc"); + cfg.writeEntry("Name", themeName->text().stripWhiteSpace()); + cfg.writeEntry("Comment", themeComment->text()); + cfg.setGroup("KDE"); + cfg.writeEntry("WidgetStyle", QTC_THEME_PREFIX+name); + + rv=writeConfig(&cfg, opts, opts, true); + } + + if(rv) + { + QDialog::accept(); + KMessageBox::information(this, i18n("Succesfully created:\n%1").arg(fileName)); + } + else + KMessageBox::error(this, i18n("Failed to create file: %1").arg(fileName)); + } +} + +#include "exportthemedialog.moc" + diff --git a/config/exportthemedialog.h b/config/exportthemedialog.h new file mode 100644 index 0000000..0301b9e --- /dev/null +++ b/config/exportthemedialog.h @@ -0,0 +1,53 @@ +#ifndef __EXPORT_THEME_DIALOG_H__ +#define __EXPORT_THEME_DIALOG_H__ + +/* + QtCurve (C) Craig Drummond, 2007 [email protected] + + ---- + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <kdialogbase.h> +#define QTC_CONFIG_DIALOG +#include "common.h" + +class KURLRequester; +class QLineEdit; + +class CExportThemeDialog : public KDialogBase +{ + Q_OBJECT + + public: + + CExportThemeDialog(QWidget *parent); + + void run(const Options &o); + + private slots: + + void slotOk(); + + private: + + QLineEdit *themeName, + *themeComment; + KURLRequester *themeUrl; + Options opts; +}; + +#endif diff --git a/config/qtcurveconfig.cpp b/config/qtcurveconfig.cpp new file mode 100644 index 0000000..b9b36a6 --- /dev/null +++ b/config/qtcurveconfig.cpp @@ -0,0 +1,720 @@ +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "qtcurveconfig.h" +#include "exportthemedialog.h" +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qgroupbox.h> +#include <qradiobutton.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qframe.h> +#include <qtabwidget.h> +#include <qpopupmenu.h> +#include <qfileinfo.h> +#include <klocale.h> +#include <kcolorbutton.h> +#include <kconfig.h> +#include <kfiledialog.h> +#include <kmessagebox.h> +#include <kpushbutton.h> +#include <kcharselect.h> +#include <kdialogbase.h> +#include <knuminput.h> +#include <unistd.h> +#include "config.h" +#define CONFIG_READ +#define CONFIG_WRITE +#include "config_file.c" + +#define QTC_EXTENSION ".qtcurve" + +extern "C" +{ + QWidget * allocate_kstyle_config(QWidget *parent) + { + KGlobal::locale()->insertCatalogue("kstyle_qtcurve_config"); + return new QtCurveConfig(parent); + } +} + +class CharSelectDialog : public KDialogBase +{ + public: + + CharSelectDialog(QWidget *parent, int v) + : KDialogBase(Plain, i18n("Select Password Character"), Ok|Cancel, Cancel, parent) + { + QFrame *page=plainPage(); + + QVBoxLayout *layout=new QVBoxLayout(page, 0, KDialog::spacingHint()); + + itsSelector=new KCharSelect(page, 0L); + itsSelector->setChar(QChar(v)); + layout->addWidget(itsSelector); + } + + int currentChar() const { return itsSelector->chr().unicode(); } + + private: + + KCharSelect *itsSelector; +}; + +static int toInt(const QString &str) +{ + return str.length()>1 ? str[0].unicode() : 0; +} + +static void insertShadeEntries(QComboBox *combo, bool withDarken, bool checkRadio=false) +{ + combo->insertItem(checkRadio ? i18n("Text") + : withDarken ? i18n("Background") + : i18n("Button")); + combo->insertItem(i18n("Custom:")); + + if(checkRadio) // For check/radio, we dont blend, and dont allow darken + combo->insertItem(i18n("Selected background")); + else if(withDarken) + { + // For menubars we dont actually blend... + combo->insertItem(i18n("Selected background")); + combo->insertItem(i18n("Darken")); + } + else + { + combo->insertItem(i18n("Blended selected background")); + combo->insertItem(i18n("Selected background")); + } +} + +static void insertAppearanceEntries(QComboBox *combo, bool all=true) +{ + combo->insertItem(i18n("Flat")); + combo->insertItem(i18n("Raised")); + combo->insertItem(i18n("Dull glass")); + combo->insertItem(i18n("Shiny glass")); + combo->insertItem(i18n("Gradient")); + combo->insertItem(i18n("Inverted gradient")); + if(all) + { + combo->insertItem(i18n("Split gradient")); + combo->insertItem(i18n("Bevelled")); + } +} + +static void insertLineEntries(QComboBox *combo, bool none) +{ + combo->insertItem(i18n("Sunken lines")); + combo->insertItem(i18n("Flat lines")); + combo->insertItem(i18n("Dots")); + combo->insertItem(none ? i18n("None") : i18n("Dashes")); +} + +static void insertDefBtnEntries(QComboBox *combo) +{ + combo->insertItem(i18n("Corner indicator")); + combo->insertItem(i18n("Font color thin border")); + combo->insertItem(i18n("Selected background thick border")); + combo->insertItem(i18n("None")); +} + +static void insertScrollbarEntries(QComboBox *combo) +{ + combo->insertItem(i18n("KDE")); + combo->insertItem(i18n("Windows")); + combo->insertItem(i18n("Platinum")); + combo->insertItem(i18n("Next")); + combo->insertItem(i18n("No buttons")); +} + +static void insertRoundEntries(QComboBox *combo) +{ + combo->insertItem(i18n("Square")); + combo->insertItem(i18n("Slightly rounded")); + combo->insertItem(i18n("Fully rounded")); +} + +static void insertMouseOverEntries(QComboBox *combo) +{ + combo->insertItem(i18n("No coloration")); + combo->insertItem(i18n("Color border")); + combo->insertItem(i18n("Plastik style")); +} + +static void insertToolbarBorderEntries(QComboBox *combo) +{ + combo->insertItem(i18n("None")); + combo->insertItem(i18n("Light")); + combo->insertItem(i18n("Dark")); + combo->insertItem(i18n("Light (all sides)")); + combo->insertItem(i18n("Dark (all sides)")); +} + +static void insertEffectEntries(QComboBox *combo) +{ + combo->insertItem(i18n("Plain")); + combo->insertItem(i18n("Etched")); + combo->insertItem(i18n("Shadowed")); +} + +static void insertShadingEntries(QComboBox *combo) +{ + combo->insertItem(i18n("Simple")); + combo->insertItem(i18n("Use HSL color space")); + combo->insertItem(i18n("Use HSV color space")); +} + +static void insertStripeEntries(QComboBox *combo) +{ + combo->insertItem(i18n("Plain")); + combo->insertItem(i18n("Striped")); + combo->insertItem(i18n("Diagonal stripes")); +} + +static void insertSliderStyleEntries(QComboBox *combo) +{ + combo->insertItem(i18n("Plain")); + combo->insertItem(i18n("Round")); + combo->insertItem(i18n("Triangular")); +} + +QtCurveConfig::QtCurveConfig(QWidget *parent) + : QtCurveConfigBase(parent), + exportDialog(NULL) +{ + titleLabel->setText("QtCurve " VERSION " - (C) Craig Drummond, 2003-2007"); + insertShadeEntries(shadeSliders, false); + insertShadeEntries(shadeMenubars, true); + insertShadeEntries(shadeCheckRadio, false, true); + insertAppearanceEntries(appearance); + insertAppearanceEntries(menubarAppearance); + insertAppearanceEntries(toolbarAppearance); + insertAppearanceEntries(lvAppearance); + insertAppearanceEntries(sliderAppearance); + insertAppearanceEntries(tabAppearance, false); + insertAppearanceEntries(progressAppearance); + insertAppearanceEntries(menuitemAppearance); + insertLineEntries(handles, false); + insertLineEntries(sliderThumbs, true); + insertLineEntries(toolbarSeparators, true); + insertLineEntries(splitters, false); + insertDefBtnEntries(defBtnIndicator); + insertScrollbarEntries(scrollbarType); + insertRoundEntries(round); + insertMouseOverEntries(coloredMouseOver); + insertToolbarBorderEntries(toolbarBorders); + insertEffectEntries(buttonEffect); + insertShadingEntries(shading); + insertStripeEntries(stripedProgress); + insertSliderStyleEntries(sliderStyle); + + highlightFactor->setMinValue(MIN_HIGHLIGHT_FACTOR); + highlightFactor->setMaxValue(MAX_HIGHLIGHT_FACTOR); + highlightFactor->setValue(((int)(DEFAULT_HIGHLIGHT_FACTOR*100))-100); + + connect(lighterPopupMenuBgnd, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(round, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(toolbarBorders, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(sliderThumbs, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(handles, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(appearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(customMenuTextColor, SIGNAL(toggled(bool)), SLOT(customMenuTextColorChanged())); + connect(stripedProgress, SIGNAL(activated(int)), SLOT(stripedProgressChanged())); + connect(animatedProgress, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(embolden, SIGNAL(toggled(bool)), SLOT(emboldenToggled())); + connect(defBtnIndicator, SIGNAL(activated(int)), SLOT(dbiChanged())); + connect(highlightTab, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(menubarAppearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(toolbarAppearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(lvAppearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(sliderAppearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(tabAppearance, SIGNAL(activated(int)), SLOT(tabAppearanceChanged())); + connect(toolbarSeparators, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(splitters, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(fixParentlessDialogs, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(fillSlider, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(sliderStyle, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(roundMbTopOnly, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(gradientPbGroove, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(darkerBorders, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(vArrows, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(xCheck, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(colorSelTab, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(stdSidebarButtons, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(borderMenuitems, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(progressAppearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(menuitemAppearance, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(shadeCheckRadio, SIGNAL(activated(int)), SLOT(shadeCheckRadioChanged())); + connect(customCheckRadioColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged())); + +#ifdef QTC_PLAIN_FOCUS_ONLY + delete stdFocus; +#else + connect(stdFocus, SIGNAL(toggled(bool)), SLOT(updateChanged())); +#endif + connect(lvLines, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(drawStatusBarFrames, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(buttonEffect, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(coloredMouseOver, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(menubarMouseOver, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(shadeMenubarOnlyWhenActive, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(thinnerMenuItems, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(customSlidersColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged())); + connect(customMenubarsColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged())); + connect(customMenuSelTextColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged())); + connect(customMenuNormTextColor, SIGNAL(changed(const QColor &)), SLOT(updateChanged())); + connect(shadeSliders, SIGNAL(activated(int)), SLOT(shadeSlidersChanged())); + connect(shadeMenubars, SIGNAL(activated(int)), SLOT(shadeMenubarsChanged())); + connect(highlightFactor, SIGNAL(valueChanged(int)), SLOT(updateChanged())); + connect(scrollbarType, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(shading, SIGNAL(activated(int)), SLOT(updateChanged())); + connect(gtkScrollViews, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(gtkComboMenus, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(gtkButtonOrder, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(mapKdeIcons, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(passwordChar, SIGNAL(clicked()), SLOT(passwordCharClicked())); + connect(framelessGroupBoxes, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(inactiveHighlight, SIGNAL(toggled(bool)), SLOT(updateChanged())); + + defaultSettings(&defaultStyle); + if(!readConfig(NULL, ¤tStyle, &defaultStyle)) + currentStyle=defaultStyle; + + setWidgetOptions(currentStyle); + + QPopupMenu *menu=new QPopupMenu(this), + *subMenu=new QPopupMenu(this); + + optionBtn->setPopup(menu); + + menu->insertItem(i18n("Predefined Style"), subMenu); + menu->insertSeparator(); + menu->insertItem(i18n("Import..."), this, SLOT(importStyle())); + menu->insertItem(i18n("Export..."), this, SLOT(exportStyle())); + menu->insertSeparator(); + menu->insertItem(i18n("Export Theme..."), this, SLOT(exportTheme())); + + loadStyles(subMenu); +} + +QtCurveConfig::~QtCurveConfig() +{ +} + +void QtCurveConfig::loadStyles(QPopupMenu *menu) +{ + QStringList files(KGlobal::dirs()->findAllResources("data", "QtCurve/*"QTC_EXTENSION, false, true)); + + files.sort(); + + QStringList::Iterator it(files.begin()), + end(files.end()); + Options opts; + + for(; it!=end; ++it) + if(readConfig(*it, &opts, &defaultStyle)) + styles[menu->insertItem(QFileInfo(*it).fileName().remove(QTC_EXTENSION).replace('_', ' '), + this, SLOT(setStyle(int)))]=*it; +} + +void QtCurveConfig::save() +{ + Options opts=currentStyle; + + setOptions(opts); + writeConfig(NULL, opts, defaultStyle); + + KSharedConfig *cfg=KGlobal::sharedConfig(); + QString grp(cfg->group()); + bool useGlobals(cfg->forceGlobal()); + + cfg->setForceGlobal(true); + cfg->setGroup("KDE"); + + if(opts.gtkButtonOrder) + cfg->writeEntry("ButtonLayout", 2); + else + cfg->deleteEntry("ButtonLayout"); + cfg->setGroup(grp); + cfg->sync(); + cfg->setForceGlobal(useGlobals); +} + +void QtCurveConfig::defaults() +{ + setWidgetOptions(defaultStyle); + if (settingsChanged()) + emit changed(true); +} + +void QtCurveConfig::setStyle(int s) +{ + loadStyle(styles[s]); +} + +void QtCurveConfig::emboldenToggled() +{ + if(!embolden->isChecked() && IND_NONE==defBtnIndicator->currentItem()) + defBtnIndicator->setCurrentItem(IND_COLORED); + updateChanged(); +} + +void QtCurveConfig::dbiChanged() +{ + if(IND_NONE==defBtnIndicator->currentItem() && !embolden->isChecked()) + embolden->setChecked(true); + updateChanged(); +} + +void QtCurveConfig::shadeSlidersChanged() +{ + customSlidersColor->setEnabled(SHADE_CUSTOM==shadeSliders->currentItem()); + updateChanged(); +} + +void QtCurveConfig::shadeMenubarsChanged() +{ + customMenubarsColor->setEnabled(SHADE_CUSTOM==shadeMenubars->currentItem()); + updateChanged(); +} + +void QtCurveConfig::shadeCheckRadioChanged() +{ + customCheckRadioColor->setEnabled(SHADE_CUSTOM==shadeCheckRadio->currentItem()); + updateChanged(); +} + +void QtCurveConfig::customMenuTextColorChanged() +{ + customMenuNormTextColor->setEnabled(customMenuTextColor->isChecked()); + customMenuSelTextColor->setEnabled(customMenuTextColor->isChecked()); + updateChanged(); +} + +void QtCurveConfig::stripedProgressChanged() +{ + animatedProgress->setEnabled(STRIPE_NONE!=stripedProgress->currentItem()); + if(animatedProgress->isChecked() && STRIPE_NONE==stripedProgress->currentItem()) + animatedProgress->setChecked(false); + updateChanged(); +} + +void QtCurveConfig::tabAppearanceChanged() +{ + if(colorSelTab->isChecked() && APPEARANCE_GRADIENT!=tabAppearance->currentItem()) + colorSelTab->setChecked(false); + colorSelTab->setEnabled(APPEARANCE_GRADIENT==tabAppearance->currentItem()); + updateChanged(); +} + +void QtCurveConfig::passwordCharClicked() +{ + int cur(toInt(passwordChar->text())); + CharSelectDialog dlg(this, cur); + + if(QDialog::Accepted==dlg.exec() && dlg.currentChar()!=cur) + setPasswordChar(dlg.currentChar()); +} + +void QtCurveConfig::setPasswordChar(int ch) +{ + QString str; + QTextOStream s(&str); + + s.setf(QTextStream::hex); + s << QChar(ch) << " (" << ch << ')'; + passwordChar->setText(str); +} + +void QtCurveConfig::updateChanged() +{ + if (settingsChanged()) + emit changed(true); +} + +void QtCurveConfig::importStyle() +{ + QString file(KFileDialog::getOpenFileName(QString::null, + i18n("*"QTC_EXTENSION"|QtCurve Settings Files\n" + QTC_THEME_PREFIX"*"QTC_THEME_SUFFIX"|QtCurve KDE Theme Files"), + this)); + + if(!file.isEmpty()) + loadStyle(file); +} + +void QtCurveConfig::exportStyle() +{ + QString file(KFileDialog::getSaveFileName(QString::null, i18n("*"QTC_EXTENSION"|QtCurve Settings Files"), this)); + + if(!file.isEmpty()) + { + KConfig cfg(file, false, false); + bool rv(!cfg.isReadOnly()); + + if(rv) + { + Options opts; + + setOptions(opts); + rv=writeConfig(&cfg, opts, defaultStyle, true); + } + + if(!rv) + KMessageBox::error(this, i18n("Could not write to file:\n%1").arg(file)); + } +} + +void QtCurveConfig::exportTheme() +{ + if(!exportDialog) + exportDialog=new CExportThemeDialog(this); + + Options opts; + + setOptions(opts); + exportDialog->run(opts); +} + +void QtCurveConfig::loadStyle(const QString &file) +{ + Options opts; + + if(readConfig(file, &opts, &defaultStyle)) + { + setWidgetOptions(opts); + if (settingsChanged()) + emit changed(true); + } +} + +void QtCurveConfig::setOptions(Options &opts) +{ + opts.round=(ERound)round->currentItem(); + opts.toolbarBorders=(ETBarBorder)toolbarBorders->currentItem(); + opts.appearance=(EAppearance)appearance->currentItem(); +#ifndef QTC_PLAIN_FOCUS_ONLY + opts.stdFocus=stdFocus->isChecked(); +#endif + opts.lvLines=lvLines->isChecked(); + opts.drawStatusBarFrames=drawStatusBarFrames->isChecked(); + opts.buttonEffect=(EEffect)buttonEffect->currentItem(); + opts.coloredMouseOver=(EMouseOver)coloredMouseOver->currentItem(); + opts.menubarMouseOver=menubarMouseOver->isChecked(); + opts.shadeMenubarOnlyWhenActive=shadeMenubarOnlyWhenActive->isChecked(); + opts.thinnerMenuItems=thinnerMenuItems->isChecked(); + opts.fixParentlessDialogs=fixParentlessDialogs->isChecked(); + opts.animatedProgress=animatedProgress->isChecked(); + opts.stripedProgress=(EStripe)stripedProgress->currentItem(); + opts.lighterPopupMenuBgnd=lighterPopupMenuBgnd->isChecked(); + opts.embolden=embolden->isChecked(); + opts.scrollbarType=(EScrollbar)scrollbarType->currentItem(); + opts.defBtnIndicator=(EDefBtnIndicator)defBtnIndicator->currentItem(); + opts.sliderThumbs=(ELine)sliderThumbs->currentItem(); + opts.handles=(ELine)handles->currentItem(); + opts.highlightTab=highlightTab->isChecked(); + opts.shadeSliders=(EShade)shadeSliders->currentItem(); + opts.shadeMenubars=(EShade)shadeMenubars->currentItem(); + opts.menubarAppearance=(EAppearance)menubarAppearance->currentItem(); + opts.toolbarAppearance=(EAppearance)toolbarAppearance->currentItem(); + opts.lvAppearance=(EAppearance)lvAppearance->currentItem(); + opts.sliderAppearance=(EAppearance)sliderAppearance->currentItem(); + opts.tabAppearance=(EAppearance)tabAppearance->currentItem(); + opts.toolbarSeparators=(ELine)toolbarSeparators->currentItem(); + opts.splitters=(ELine)splitters->currentItem(); + opts.customSlidersColor=customSlidersColor->color(); + opts.customMenubarsColor=customMenubarsColor->color(); + opts.highlightFactor=((double)(highlightFactor->value()+100))/100.0; + opts.customMenuNormTextColor=customMenuNormTextColor->color(); + opts.customMenuSelTextColor=customMenuSelTextColor->color(); + opts.customMenuTextColor=customMenuTextColor->isChecked(); + opts.fillSlider=fillSlider->isChecked(); + opts.sliderStyle=(ESliderStyle)sliderStyle->currentItem(); + opts.roundMbTopOnly=roundMbTopOnly->isChecked(); + opts.gradientPbGroove=gradientPbGroove->isChecked(); + opts.darkerBorders=darkerBorders->isChecked(); + opts.vArrows=vArrows->isChecked(); + opts.xCheck=xCheck->isChecked(); + opts.colorSelTab=colorSelTab->isChecked(); + opts.stdSidebarButtons=stdSidebarButtons->isChecked(); + opts.borderMenuitems=borderMenuitems->isChecked(); + opts.progressAppearance=(EAppearance)progressAppearance->currentItem(); + opts.menuitemAppearance=(EAppearance)menuitemAppearance->currentItem(); + opts.shadeCheckRadio=(EShade)shadeCheckRadio->currentItem(); + opts.customCheckRadioColor=customCheckRadioColor->color(); + opts.shading=(EShading)shading->currentItem(); + opts.gtkScrollViews=gtkScrollViews->isChecked(); + opts.gtkComboMenus=gtkComboMenus->isChecked(); + opts.gtkButtonOrder=gtkButtonOrder->isChecked(); + opts.mapKdeIcons=mapKdeIcons->isChecked(); + opts.passwordChar=toInt(passwordChar->text()); + opts.framelessGroupBoxes=framelessGroupBoxes->isChecked(); + opts.inactiveHighlight=inactiveHighlight->isChecked(); +} + +void QtCurveConfig::setWidgetOptions(const Options &opts) +{ + round->setCurrentItem(opts.round); + scrollbarType->setCurrentItem(opts.scrollbarType); + lighterPopupMenuBgnd->setChecked(opts.lighterPopupMenuBgnd); + toolbarBorders->setCurrentItem(opts.toolbarBorders); + sliderThumbs->setCurrentItem(opts.sliderThumbs); + handles->setCurrentItem(opts.handles); + appearance->setCurrentItem(opts.appearance); +#ifndef QTC_PLAIN_FOCUS_ONLY + stdFocus->setChecked(opts.stdFocus); +#endif + lvLines->setChecked(opts.lvLines); + drawStatusBarFrames->setChecked(opts.drawStatusBarFrames); + buttonEffect->setCurrentItem(opts.buttonEffect); + coloredMouseOver->setCurrentItem(opts.coloredMouseOver); + menubarMouseOver->setChecked(opts.menubarMouseOver); + shadeMenubarOnlyWhenActive->setChecked(opts.shadeMenubarOnlyWhenActive); + thinnerMenuItems->setChecked(opts.thinnerMenuItems); + fixParentlessDialogs->setChecked(opts.fixParentlessDialogs); + animatedProgress->setChecked(opts.animatedProgress); + stripedProgress->setCurrentItem(opts.stripedProgress); + embolden->setChecked(opts.embolden); + defBtnIndicator->setCurrentItem(opts.defBtnIndicator); + highlightTab->setChecked(opts.highlightTab); + menubarAppearance->setCurrentItem(opts.menubarAppearance); + toolbarAppearance->setCurrentItem(opts.toolbarAppearance); + lvAppearance->setCurrentItem(opts.lvAppearance); + sliderAppearance->setCurrentItem(opts.sliderAppearance); + tabAppearance->setCurrentItem(opts.tabAppearance); + toolbarSeparators->setCurrentItem(opts.toolbarSeparators); + splitters->setCurrentItem(opts.splitters); + shadeSliders->setCurrentItem(opts.shadeSliders); + shadeMenubars->setCurrentItem(opts.shadeMenubars); + highlightFactor->setValue((int)(opts.highlightFactor*100)-100); + customSlidersColor->setColor(opts.customSlidersColor); + customMenubarsColor->setColor(opts.customMenubarsColor); + customMenuNormTextColor->setColor(opts.customMenuNormTextColor); + customMenuSelTextColor->setColor(opts.customMenuSelTextColor); + customMenuTextColor->setChecked(opts.customMenuTextColor); + + customSlidersColor->setEnabled(SHADE_CUSTOM==opts.shadeSliders); + customMenubarsColor->setEnabled(SHADE_CUSTOM==opts.shadeMenubars); + customMenuNormTextColor->setEnabled(customMenuTextColor->isChecked()); + customMenuSelTextColor->setEnabled(customMenuTextColor->isChecked()); + customCheckRadioColor->setEnabled(SHADE_CUSTOM==opts.shadeCheckRadio); + + animatedProgress->setEnabled(STRIPE_NONE!=stripedProgress->currentItem()); + + fillSlider->setChecked(opts.fillSlider); + sliderStyle->setCurrentItem(opts.sliderStyle); + roundMbTopOnly->setChecked(opts.roundMbTopOnly); + gradientPbGroove->setChecked(opts.gradientPbGroove); + darkerBorders->setChecked(opts.darkerBorders); + vArrows->setChecked(opts.vArrows); + xCheck->setChecked(opts.xCheck); + colorSelTab->setChecked(opts.colorSelTab); + stdSidebarButtons->setChecked(opts.stdSidebarButtons); + borderMenuitems->setChecked(opts.borderMenuitems); + progressAppearance->setCurrentItem(opts.progressAppearance); + menuitemAppearance->setCurrentItem(opts.menuitemAppearance); + shadeCheckRadio->setCurrentItem(opts.shadeCheckRadio); + customCheckRadioColor->setColor(opts.customCheckRadioColor); + + shading->setCurrentItem(opts.shading); + gtkScrollViews->setChecked(opts.gtkScrollViews); + gtkComboMenus->setChecked(opts.gtkComboMenus); + gtkButtonOrder->setChecked(opts.gtkButtonOrder); + mapKdeIcons->setChecked(opts.mapKdeIcons); + setPasswordChar(opts.passwordChar); + framelessGroupBoxes->setChecked(opts.framelessGroupBoxes); + inactiveHighlight->setChecked(opts.inactiveHighlight); +} + +bool QtCurveConfig::settingsChanged() +{ + return round->currentItem()!=currentStyle.round || + toolbarBorders->currentItem()!=currentStyle.toolbarBorders || + appearance->currentItem()!=(int)currentStyle.appearance || +#ifndef QTC_PLAIN_FOCUS_ONLY + stdFocus->isChecked()!=currentStyle.stdFocus || +#endif + lvLines->isChecked()!=currentStyle.lvLines || + drawStatusBarFrames->isChecked()!=currentStyle.drawStatusBarFrames || + buttonEffect->currentItem()!=(int)currentStyle.buttonEffect || + coloredMouseOver->currentItem()!=(int)currentStyle.coloredMouseOver || + menubarMouseOver->isChecked()!=currentStyle.menubarMouseOver || + shadeMenubarOnlyWhenActive->isChecked()!=currentStyle.shadeMenubarOnlyWhenActive || + thinnerMenuItems->isChecked()!=currentStyle.thinnerMenuItems || + fixParentlessDialogs->isChecked()!=currentStyle.fixParentlessDialogs || + animatedProgress->isChecked()!=currentStyle.animatedProgress || + stripedProgress->currentItem()!=currentStyle.stripedProgress || + lighterPopupMenuBgnd->isChecked()!=currentStyle.lighterPopupMenuBgnd || + embolden->isChecked()!=currentStyle.embolden || + fillSlider->isChecked()!=currentStyle.fillSlider || + sliderStyle->currentItem()!=currentStyle.sliderStyle || + roundMbTopOnly->isChecked()!=currentStyle.roundMbTopOnly || + gradientPbGroove->isChecked()!=currentStyle.gradientPbGroove || + darkerBorders->isChecked()!=currentStyle.darkerBorders || + vArrows->isChecked()!=currentStyle.vArrows || + xCheck->isChecked()!=currentStyle.xCheck || + colorSelTab->isChecked()!=currentStyle.colorSelTab || + stdSidebarButtons->isChecked()!=currentStyle.stdSidebarButtons || + borderMenuitems->isChecked()!=currentStyle.borderMenuitems || + defBtnIndicator->currentItem()!=(int)currentStyle.defBtnIndicator || + sliderThumbs->currentItem()!=(int)currentStyle.sliderThumbs || + handles->currentItem()!=(int)currentStyle.handles || + scrollbarType->currentItem()!=(int)currentStyle.scrollbarType || + highlightTab->isChecked()!=currentStyle.highlightTab || + shadeSliders->currentItem()!=(int)currentStyle.shadeSliders || + shadeMenubars->currentItem()!=(int)currentStyle.shadeMenubars || + shadeCheckRadio->currentItem()!=(int)currentStyle.shadeCheckRadio || + menubarAppearance->currentItem()!=currentStyle.menubarAppearance || + toolbarAppearance->currentItem()!=currentStyle.toolbarAppearance || + lvAppearance->currentItem()!=currentStyle.lvAppearance || + sliderAppearance->currentItem()!=currentStyle.sliderAppearance || + tabAppearance->currentItem()!=currentStyle.tabAppearance || + progressAppearance->currentItem()!=currentStyle.progressAppearance || + menuitemAppearance->currentItem()!=currentStyle.menuitemAppearance || + toolbarSeparators->currentItem()!=currentStyle.toolbarSeparators || + splitters->currentItem()!=currentStyle.splitters || + + shading->currentItem()!=(int)currentStyle.shading || + gtkScrollViews->isChecked()!=currentStyle.gtkScrollViews || + gtkComboMenus->isChecked()!=currentStyle.gtkComboMenus || + gtkButtonOrder->isChecked()!=currentStyle.gtkButtonOrder || + mapKdeIcons->isChecked()!=currentStyle.mapKdeIcons || + framelessGroupBoxes->isChecked()!=currentStyle.framelessGroupBoxes || + inactiveHighlight->isChecked()!=currentStyle.inactiveHighlight || + + toInt(passwordChar->text())!=currentStyle.passwordChar || + + (highlightFactor->value()+100)!=(int)(currentStyle.highlightFactor*100) || + customMenuTextColor->isChecked()!=currentStyle.customMenuTextColor || + (SHADE_CUSTOM==currentStyle.shadeSliders && + customSlidersColor->color()!=currentStyle.customSlidersColor) || + (SHADE_CUSTOM==currentStyle.shadeMenubars && + customMenubarsColor->color()!=currentStyle.customMenubarsColor) || + (SHADE_CUSTOM==currentStyle.shadeCheckRadio && + customCheckRadioColor->color()!=currentStyle.customCheckRadioColor) || + (customMenuTextColor->isChecked() && + customMenuNormTextColor->color()!=currentStyle.customMenuNormTextColor) || + (customMenuTextColor->isChecked() && + customMenuSelTextColor->color()!=currentStyle.customMenuSelTextColor); +} + +#include "qtcurveconfig.moc" diff --git a/config/qtcurveconfig.h b/config/qtcurveconfig.h new file mode 100644 index 0000000..8e69510 --- /dev/null +++ b/config/qtcurveconfig.h @@ -0,0 +1,89 @@ +#ifndef __QTCURVECONFIG_H__ +#define __QTCURVECONFIG_H__ + +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#define QTC_COMMON_ONLY_COVERTERS +#define QTC_CONFIG_DIALOG + +#include <qtcurveconfigbase.h> +#include <qmap.h> +#include "common.h" + +class QPopupMenu; +class CExportThemeDialog; + +class QtCurveConfig : public QtCurveConfigBase +{ + Q_OBJECT + + public: + + QtCurveConfig(QWidget *parent); + virtual ~QtCurveConfig(); + + signals: + + void changed(bool); + + private: + + void loadStyles(QPopupMenu *menu); + + public slots: + + void save(); + void defaults(); + + private slots: + + void setStyle(int s); + void updateChanged(); + void importStyle(); + void exportStyle(); + void exportTheme(); + void emboldenToggled(); + void dbiChanged(); + void shadeSlidersChanged(); + void shadeMenubarsChanged(); + void shadeCheckRadioChanged(); + void customMenuTextColorChanged(); + void stripedProgressChanged(); + void tabAppearanceChanged(); + void passwordCharClicked(); + + private: + + void setPasswordChar(int ch); + void loadStyle(const QString &file); + void setOptions(Options &opts); + void setWidgetOptions(const Options &opts); + bool settingsChanged(); + + private: + + Options currentStyle, + defaultStyle; + QMap<int, QString> styles; + CExportThemeDialog *exportDialog; +}; + +#endif diff --git a/config/qtcurveconfigbase.ui b/config/qtcurveconfigbase.ui new file mode 100644 index 0000000..0e535ee --- /dev/null +++ b/config/qtcurveconfigbase.ui @@ -0,0 +1,996 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>QtCurveConfigBase</class> +<widget class="QWidget"> + <property name="name"> + <cstring>QtCurveConfigBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>666</width> + <height>556</height> + </rect> + </property> + <property name="caption"> + <string>Form1</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>titleLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>title</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="QTabWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>optionsTab</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>General</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_6</cstring> + </property> + <property name="text"> + <string>Splitters:</string> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel1_2_3</cstring> + </property> + <property name="text"> + <string>Scrollbars:</string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_2_3_2</cstring> + </property> + <property name="text"> + <string>Sliders:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_7</cstring> + </property> + <property name="text"> + <string>Appearance:</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Progress bars:</string> + </property> + </widget> + <widget class="QLabel" row="7" column="0"> + <property name="name"> + <cstring>textLabel1_8_2</cstring> + </property> + <property name="text"> + <string>Listviews:</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This controls the % that widgets will be highlighted by when the mouse hovers over them</string> + </property> + </widget> + <widget class="QComboBox" row="7" column="1"> + <property name="name"> + <cstring>lvAppearance</cstring> + </property> + </widget> + <widget class="QCheckBox" row="5" column="1"> + <property name="name"> + <cstring>embolden</cstring> + </property> + <property name="text"> + <string>Bold text, and</string> + </property> + </widget> + <widget class="QComboBox" row="8" column="1"> + <property name="name"> + <cstring>tabAppearance</cstring> + </property> + </widget> + <widget class="QComboBox" row="4" column="1"> + <property name="name"> + <cstring>progressAppearance</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>The setting here affects the general appearance - and will be applied to buttons, scrollbars, sliders, combo boxes, and spin buttons.</string> + </property> + </widget> + <widget class="QComboBox" row="3" column="1"> + <property name="name"> + <cstring>scrollbarType</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QComboBox" row="4" column="4"> + <property name="name"> + <cstring>stripedProgress</cstring> + </property> + </widget> + <widget class="QCheckBox" row="4" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>gradientPbGroove</cstring> + </property> + <property name="text"> + <string>Gradient groove</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <property name="name"> + <cstring>sliderAppearance</cstring> + </property> + </widget> + <widget class="QCheckBox" row="4" column="5"> + <property name="name"> + <cstring>animatedProgress</cstring> + </property> + <property name="text"> + <string>Animated</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="2" rowspan="1" colspan="4"> + <property name="name"> + <cstring>lvLines</cstring> + </property> + <property name="text"> + <string>Lines</string> + </property> + </widget> + <widget class="QCheckBox" row="10" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>stdFocus</cstring> + </property> + <property name="text"> + <string>Dotted focus rectangle</string> + </property> + <property name="whatsThis" stdset="0"> + <string>Some applications, such as Qt Designer, and Krita, make use of 'dock windows' These have a handle strip along the top - enabling this option will draw the name of the window in the handle strip.</string> + </property> + </widget> + <widget class="QCheckBox" row="11" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>drawStatusBarFrames</cstring> + </property> + <property name="text"> + <string>Draw statusbar frames</string> + </property> + </widget> + <widget class="QCheckBox" row="12" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>framelessGroupBoxes</cstring> + </property> + <property name="text"> + <string>Frameless groupboxes</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>shadeSliders</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="8" column="0"> + <property name="name"> + <cstring>textLabel1_8_2_2</cstring> + </property> + <property name="text"> + <string>Tabs:</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This controls the % that widgets will be highlighted by when the mouse hovers over them</string> + </property> + </widget> + <widget class="QLabel" row="9" column="0"> + <property name="name"> + <cstring>textLabel1_8_2_2_2</cstring> + </property> + <property name="text"> + <string>Checks/radios:</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This controls the % that widgets will be highlighted by when the mouse hovers over them</string> + </property> + </widget> + <widget class="QComboBox" row="9" column="1"> + <property name="name"> + <cstring>shadeCheckRadio</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KColorButton" row="9" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>customCheckRadioColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="2" column="4"> + <property name="name"> + <cstring>customSlidersColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Default button:</string> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>textLabel1_3_2</cstring> + </property> + <property name="text"> + <string>Mouse-over:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>appearance</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>The setting here affects the general appearance - and will be applied to buttons, scrollbars, sliders, combo boxes, and spin buttons.</string> + </property> + </widget> + <widget class="QCheckBox" row="11" column="2" rowspan="1" colspan="4"> + <property name="name"> + <cstring>stdSidebarButtons</cstring> + </property> + <property name="text"> + <string>Standard buttons for sidebars</string> + </property> + </widget> + <widget class="QComboBox" row="6" column="1"> + <property name="name"> + <cstring>coloredMouseOver</cstring> + </property> + <property name="whatsThis" stdset="0"> + <string>The setting here affects the general appearance - and will be applied to buttons, scrollbars, sliders, combo boxes, and spin buttons.</string> + </property> + </widget> + <widget class="QLabel" row="6" column="2"> + <property name="name"> + <cstring>textLabel1_8</cstring> + </property> + <property name="text"> + <string>Highlight by:</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This controls the % that widgets will be highlighted by when the mouse hovers over them</string> + </property> + </widget> + <widget class="QCheckBox" row="12" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>darkerBorders</cstring> + </property> + <property name="text"> + <string>Darker borders</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>round</cstring> + </property> + </widget> + <widget class="QCheckBox" row="10" column="2" rowspan="1" colspan="4"> + <property name="name"> + <cstring>vArrows</cstring> + </property> + <property name="text"> + <string>'V' style arrows</string> + </property> + </widget> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>splitters</cstring> + </property> + </widget> + <spacer row="13" column="0"> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="9" column="4" rowspan="1" colspan="2"> + <property name="name"> + <cstring>xCheck</cstring> + </property> + <property name="text"> + <string>'X' style checkmarks</string> + </property> + </widget> + <widget class="QCheckBox" row="8" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>highlightTab</cstring> + </property> + <property name="text"> + <string>Highlight selected</string> + </property> + <property name="whatsThis" stdset="0"> + <string>This will cause a coloured stripe to be drawn over the current tab.</string> + </property> + </widget> + <widget class="QCheckBox" row="8" column="4" rowspan="1" colspan="2"> + <property name="name"> + <cstring>colorSelTab</cstring> + </property> + <property name="text"> + <string>Color selected</string> + </property> + </widget> + <widget class="QComboBox" row="3" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>sliderThumbs</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QComboBox" row="5" column="2" rowspan="1" colspan="3"> + <property name="name"> + <cstring>defBtnIndicator</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QCheckBox" row="2" column="6"> + <property name="name"> + <cstring>fillSlider</cstring> + </property> + <property name="text"> + <string>Fill used</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="5"> + <property name="name"> + <cstring>sliderStyle</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="4"> + <property name="name"> + <cstring>buttonEffect</cstring> + </property> + </widget> + <widget class="KIntNumInput" row="6" column="3" rowspan="1" colspan="2"> + <property name="name"> + <cstring>highlightFactor</cstring> + </property> + <property name="suffix"> + <string>%</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Menus && Toolbars</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>Border:</string> + </property> + </widget> + <spacer row="3" column="2"> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>54</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>groupBox2_2</cstring> + </property> + <property name="title"> + <string>Menus</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="8"> + <property name="name"> + <cstring>lighterPopupMenuBgnd</cstring> + </property> + <property name="text"> + <string>Lighter popup-menu background</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="8"> + <property name="name"> + <cstring>menubarMouseOver</cstring> + </property> + <property name="text"> + <string>Enable mouse-over for menubar items</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="8"> + <property name="name"> + <cstring>roundMbTopOnly</cstring> + </property> + <property name="text"> + <string>Round selected menubar items on top only</string> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_4_2_3</cstring> + </property> + <property name="text"> + <string>Coloration:</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_4_2</cstring> + </property> + <property name="text"> + <string>Menubar appearance:</string> + </property> + </widget> + <widget class="QLabel" row="5" column="0"> + <property name="name"> + <cstring>textLabel1_4_2_4</cstring> + </property> + <property name="text"> + <string>Menuitem appearance:</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="0" rowspan="1" colspan="7"> + <property name="name"> + <cstring>thinnerMenuItems</cstring> + </property> + <property name="text"> + <string>Thinner menu items</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="7"> + <property name="name"> + <cstring>shadeMenubarOnlyWhenActive</cstring> + </property> + <property name="text"> + <string>Active window only</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>customMenuTextColor</cstring> + </property> + <property name="text"> + <string>Custom text colors (normal/selected):</string> + </property> + </widget> + <widget class="QComboBox" row="5" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>menuitemAppearance</cstring> + </property> + </widget> + <widget class="QComboBox" row="1" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>shadeMenubars</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QComboBox" row="0" column="1" rowspan="1" colspan="5"> + <property name="name"> + <cstring>menubarAppearance</cstring> + </property> + </widget> + <widget class="KColorButton" row="1" column="6"> + <property name="name"> + <cstring>customMenubarsColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="6"> + <property name="name"> + <cstring>borderMenuitems</cstring> + </property> + <property name="text"> + <string>Border</string> + </property> + </widget> + <widget class="KColorButton" row="2" column="2"> + <property name="name"> + <cstring>customMenuNormTextColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton" row="2" column="4"> + <property name="name"> + <cstring>customMenuSelTextColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Handles:</string> + </property> + </widget> + <spacer row="0" column="4"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>MinimumExpanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="0" column="3"> + <property name="name"> + <cstring>handles</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>toolbarBorders</cstring> + </property> + </widget> + <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>groupBox2</cstring> + </property> + <property name="title"> + <string>Toolbars</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_4_2_2</cstring> + </property> + <property name="text"> + <string>Appearance:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>toolbarAppearance</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>Separators:</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="3"> + <property name="name"> + <cstring>toolbarSeparators</cstring> + </property> + </widget> + <spacer row="0" column="4"> + <property name="name"> + <cstring>spacer4_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>MinimumExpanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Advanced</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>gtkComboMenus</cstring> + </property> + <property name="text"> + <string>Gtk style comboboxes (KDE4 only)</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>gtkScrollViews</cstring> + </property> + <property name="text"> + <string>Gtk style scrollviews (KDE3 and KDE4 only)</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>gtkButtonOrder</cstring> + </property> + <property name="text"> + <string>Gtk button order</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>mapKdeIcons</cstring> + </property> + <property name="text"> + <string>Map KDE icons (Gtk2 only)</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>fixParentlessDialogs</cstring> + </property> + <property name="text"> + <string>'Fix' parentless dialogs</string> + </property> + <property name="whatsThis" stdset="0"> + <string><h2><font color="#ff0000">Warning: Experimental!</font></h1><p><p>Some applications - such as Kate, Kaffeine, and GIMP - produce dialogs that have no 'parent'. This causes the dialog to recieve an entry in the taskbar, and allows the dialog to be minimised independantly of the main application window.</p> + +<p>If you enable this option, QtCurve will try to 'fix' this by assigning the dialogs a parent.</p> + +<p><b>Note:</b> This may brake some applications, as it wiill alter the behaviour of dialogs in a way the application has not intended. Therefore, please use with care.</p></string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>inactiveHighlight</cstring> + </property> + <property name="text"> + <string>Use blended background/highlight colour for highlight of inactive elements</string> + </property> + <property name="whatsThis" stdset="0"> + <string><h2><font color="#ff0000">Warning: Experimental!</font></h1><p><p>Some applications - such as Kate, Kaffeine, and GIMP - produce dialogs that have no 'parent'. This causes the dialog to recieve an entry in the taskbar, and allows the dialog to be minimised independantly of the main application window.</p> + +<p>If you enable this option, QtCurve will try to 'fix' this by assigning the dialogs a parent.</p> + +<p><b>Note:</b> This may brake some applications, as it wiill alter the behaviour of dialogs in a way the application has not intended. Therefore, please use with care.</p></string> + </property> + </widget> + <widget class="QLabel" row="6" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Character to use for password entries:</string> + </property> + </widget> + <widget class="QPushButton" row="6" column="1"> + <property name="name"> + <cstring>passwordChar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer row="6" column="2"> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>133</width> + <height>6</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="7" column="0"> + <property name="name"> + <cstring>textLabel1_5</cstring> + </property> + <property name="text"> + <string>Shading routine:</string> + </property> + </widget> + <widget class="QComboBox" row="7" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>shading</cstring> + </property> + </widget> + <spacer row="8" column="2"> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>203</height> + </size> + </property> + </spacer> + </grid> + </widget> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer6_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>321</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton" row="3" column="1"> + <property name="name"> + <cstring>optionBtn</cstring> + </property> + <property name="text"> + <string>Options</string> + </property> + </widget> + </grid> +</widget> +<tabstops> + <tabstop>optionsTab</tabstop> + <tabstop>appearance</tabstop> + <tabstop>round</tabstop> + <tabstop>buttonEffect</tabstop> + <tabstop>splitters</tabstop> + <tabstop>sliderAppearance</tabstop> + <tabstop>shadeSliders</tabstop> + <tabstop>customSlidersColor</tabstop> + <tabstop>sliderStyle</tabstop> + <tabstop>fillSlider</tabstop> + <tabstop>scrollbarType</tabstop> + <tabstop>sliderThumbs</tabstop> + <tabstop>progressAppearance</tabstop> + <tabstop>gradientPbGroove</tabstop> + <tabstop>stripedProgress</tabstop> + <tabstop>animatedProgress</tabstop> + <tabstop>embolden</tabstop> + <tabstop>defBtnIndicator</tabstop> + <tabstop>coloredMouseOver</tabstop> + <tabstop>highlightFactor</tabstop> + <tabstop>lvAppearance</tabstop> + <tabstop>lvLines</tabstop> + <tabstop>tabAppearance</tabstop> + <tabstop>highlightTab</tabstop> + <tabstop>colorSelTab</tabstop> + <tabstop>shadeCheckRadio</tabstop> + <tabstop>customCheckRadioColor</tabstop> + <tabstop>xCheck</tabstop> + <tabstop>stdFocus</tabstop> + <tabstop>vArrows</tabstop> + <tabstop>drawStatusBarFrames</tabstop> + <tabstop>stdSidebarButtons</tabstop> + <tabstop>framelessGroupBoxes</tabstop> + <tabstop>darkerBorders</tabstop> + <tabstop>toolbarBorders</tabstop> + <tabstop>handles</tabstop> + <tabstop>menubarAppearance</tabstop> + <tabstop>shadeMenubars</tabstop> + <tabstop>customMenubarsColor</tabstop> + <tabstop>shadeMenubarOnlyWhenActive</tabstop> + <tabstop>customMenuTextColor</tabstop> + <tabstop>customMenuNormTextColor</tabstop> + <tabstop>customMenuSelTextColor</tabstop> + <tabstop>menubarMouseOver</tabstop> + <tabstop>roundMbTopOnly</tabstop> + <tabstop>menuitemAppearance</tabstop> + <tabstop>borderMenuitems</tabstop> + <tabstop>lighterPopupMenuBgnd</tabstop> + <tabstop>thinnerMenuItems</tabstop> + <tabstop>toolbarAppearance</tabstop> + <tabstop>toolbarSeparators</tabstop> + <tabstop>gtkComboMenus</tabstop> + <tabstop>gtkScrollViews</tabstop> + <tabstop>gtkButtonOrder</tabstop> + <tabstop>mapKdeIcons</tabstop> + <tabstop>fixParentlessDialogs</tabstop> + <tabstop>inactiveHighlight</tabstop> + <tabstop>passwordChar</tabstop> + <tabstop>shading</tabstop> + <tabstop>optionBtn</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/style/CMakeLists.txt b/style/CMakeLists.txt new file mode 100644 index 0000000..030487b --- /dev/null +++ b/style/CMakeLists.txt @@ -0,0 +1,10 @@ +set(qtcurve_SRCS qtcurve.cpp pixmaps.h) +add_definitions(-DQT_PLUGIN) +include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${KDE3_INCLUDE_DIR} ${QT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/common) +link_directories(${KDE3_LIB_DIR}) +kde3_automoc(${qtcurve_SRCS}) +add_library(qtcurve SHARED ${qtcurve_SRCS}) +set_target_properties(qtcurve PROPERTIES PREFIX "") +target_link_libraries(qtcurve ${QT_QTGUI_LIBRARY} kdefx) +install(TARGETS qtcurve LIBRARY DESTINATION ${KDE3_LIB_DIR}/kde3/plugins/styles) +install(FILES qtcurve.themerc DESTINATION ${KDE3PREFIX}/share/apps/kstyle/themes) diff --git a/style/pixmaps.h b/style/pixmaps.h new file mode 100644 index 0000000..4873fa5 --- /dev/null +++ b/style/pixmaps.h @@ -0,0 +1,247 @@ +#ifndef _QEMBED_1804289383 +#define _QEMBED_1804289383 +static const unsigned int radio_frame_png_len = 419; +static const unsigned char radio_frame_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x08,0x04,0x00,0x00, + 0x00,0xd8,0xe2,0x2c,0xf7,0x00,0x00,0x01,0x6a,0x49,0x44,0x41,0x54,0x18, + 0x19,0x01,0x5f,0x01,0xa0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x00,0x74,0x00,0xd5,0x00,0xff,0x00,0xd5,0x00,0x74,0x00,0x15,0x00, + 0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x5b,0x00,0xdc, + 0x00,0x21,0x00,0x75,0x00,0x33,0x00,0x73,0x00,0x20,0x00,0xdd,0x00,0x5b, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5b,0x00,0xd2,0x00,0x38,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x34,0x00,0xd3,0x00, + 0x5b,0x00,0x00,0x00,0x00,0x15,0x00,0xf0,0x00,0x3a,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x00,0xf0, + 0x00,0x15,0x03,0x00,0x6a,0x00,0xe5,0x00,0x98,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe5,0x00,0x1f,0x00, + 0x1e,0x00,0x00,0xd5,0x00,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4f,0x00,0xd5, + 0x00,0x00,0xff,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x39,0x00,0xff,0x02, + 0x00,0xd6,0x00,0x17,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x00,0xd6,0x03,0x00, + 0x0a,0x00,0x39,0x00,0xb2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x74,0x00,0xbc,0x00,0x00,0x15, + 0x00,0xf3,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x3a,0x00,0xf3,0x00,0x15,0x00,0x00,0x00,0x00, + 0x5b,0x00,0xda,0x00,0x3d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x39,0x00,0xd9,0x00,0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x5b,0x00,0xf4,0x00,0x9f,0x00,0x53,0x00,0x39,0x00,0x4f,0x00,0x9d, + 0x00,0xf5,0x00,0x5b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x15,0x00,0x74,0x00,0xd5,0x00,0xff,0x00,0xd5,0x00,0x74,0x00, + 0x15,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x10,0x26,0x73,0x80,0x50,0xef, + 0x36,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + +/* Generated by qembed */ +static const unsigned int radio_light_png_len = 236; +static const unsigned char radio_light_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x08,0x04,0x00,0x00, + 0x00,0xd8,0xe2,0x2c,0xf7,0x00,0x00,0x00,0x02,0x62,0x4b,0x47,0x44,0x00, + 0xff,0x87,0x8f,0xcc,0xbf,0x00,0x00,0x00,0x09,0x70,0x48,0x59,0x73,0x00, + 0x00,0x0b,0x13,0x00,0x00,0x0b,0x13,0x01,0x00,0x9a,0x9c,0x18,0x00,0x00, + 0x00,0x07,0x74,0x49,0x4d,0x45,0x07,0xd6,0x09,0x13,0x09,0x3a,0x1a,0x90, + 0x15,0xd3,0x1e,0x00,0x00,0x00,0x7d,0x49,0x44,0x41,0x54,0x18,0xd3,0x9d, + 0xcf,0xa1,0x0a,0xc2,0x60,0x18,0x85,0xe1,0xe7,0xdf,0x06,0x83,0xe1,0x2d, + 0x88,0x58,0xd6,0x0d,0x62,0x5d,0xf0,0x02,0xac,0x36,0x2f,0xc5,0xe4,0x35, + 0x79,0x17,0x76,0x41,0xc1,0x22,0x18,0x0c,0x03,0xb3,0xbf,0x61,0xc3,0xe0, + 0xfe,0x15,0xdf,0x78,0x3e,0xde,0xc3,0xf9,0x18,0x25,0x07,0x85,0x99,0x8d, + 0x93,0xbd,0xd2,0x54,0xeb,0xe5,0x4d,0x86,0xc2,0xca,0x55,0xad,0x51,0x3b, + 0xaa,0x2d,0x04,0xa1,0x33,0xe7,0xa2,0xad,0x49,0xdf,0x53,0xf5,0x4d,0x60, + 0xe7,0xf0,0x3d,0xfc,0x10,0xad,0x53,0x71,0x06,0x1e,0x63,0x0b,0x4b,0x4f, + 0x97,0xb4,0x75,0xb6,0x54,0xa5,0xad,0xd6,0xdd,0x6d,0x90,0xc7,0xee,0xe1, + 0x7c,0xa0,0x04,0x7f,0xf2,0x01,0x0c,0x7b,0x12,0xeb,0xfa,0x6c,0x4b,0xe7, + 0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + +static const unsigned int radio_on_png_len = 231; +static const unsigned char radio_on_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0d,0x08,0x06,0x00,0x00, + 0x00,0x72,0xeb,0xe4,0x7c,0x00,0x00,0x00,0x06,0x62,0x4b,0x47,0x44,0x00, + 0xff,0x00,0xff,0x00,0xff,0xa0,0xbd,0xa7,0x93,0x00,0x00,0x00,0x09,0x70, + 0x48,0x59,0x73,0x00,0x00,0x0b,0x13,0x00,0x00,0x0b,0x13,0x01,0x00,0x9a, + 0x9c,0x18,0x00,0x00,0x00,0x07,0x74,0x49,0x4d,0x45,0x07,0xd7,0x05,0x1d, + 0x0b,0x26,0x21,0x2a,0x9e,0xfa,0x9e,0x00,0x00,0x00,0x74,0x49,0x44,0x41, + 0x54,0x28,0xcf,0xd5,0xd0,0x3d,0x0e,0x82,0x50,0x10,0x04,0xe0,0x4f,0xa9, + 0x68,0x39,0x84,0x3d,0xb7,0x80,0x96,0xda,0x23,0xd8,0x51,0xd8,0x7a,0x2f, + 0x2f,0xc0,0x19,0x80,0xd2,0xc6,0xe6,0x9d,0xc1,0xe6,0x91,0xbc,0x6c,0x50, + 0x5b,0x9d,0x64,0xb3,0x7f,0x33,0xd9,0xcc,0xf2,0x77,0xb8,0x60,0xc2,0x9c, + 0x73,0x17,0x09,0xd5,0x8e,0x00,0xee,0x68,0x73,0x3d,0x60,0xc1,0xba,0x91, + 0x8e,0x41,0x74,0xc6,0x13,0x63,0x98,0xdf,0xca,0xe6,0x10,0x96,0x33,0x52, + 0x98,0x35,0x39,0x9f,0xde,0x5d,0x4a,0x05,0xa9,0x14,0xa4,0x4f,0x9e,0x1e, + 0xe8,0x51,0xe7,0xd8,0x70,0x2d,0x3d,0xed,0xa1,0xfb,0xf6,0xbd,0x1f,0xc7, + 0x0b,0x02,0x3c,0x12,0x4f,0x16,0x9a,0x81,0xa2,0x00,0x00,0x00,0x00,0x49, + 0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + +static const unsigned int check_on_png_len = 179; +static const unsigned char check_on_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x09,0x08,0x06,0x00,0x00, + 0x00,0xe0,0x91,0x06,0x10,0x00,0x00,0x00,0x7a,0x49,0x44,0x41,0x54,0x18, + 0x95,0x75,0xce,0x2d,0x0e,0xc2,0x60,0x10,0x84,0xe1,0x87,0x70,0x00,0x0e, + 0x40,0xc2,0x8f,0xe8,0xc1,0xd0,0x08,0xae,0x81,0xc0,0xd5,0x70,0x05,0x2e, + 0xc0,0x39,0xa8,0x03,0x89,0x04,0x51,0x09,0x69,0x41,0x60,0xb6,0xc9,0xa6, + 0xe1,0x1b,0xb5,0x3b,0xfb,0x66,0x76,0x26,0xca,0x5a,0xe1,0x88,0x59,0x09, + 0x58,0xe2,0x8e,0xdb,0x60,0xac,0x51,0x25,0x60,0x8e,0x0b,0xde,0x58,0x0c, + 0xe6,0x13,0x1d,0xf6,0xb1,0xef,0xf0,0x45,0x9d,0xa3,0xb7,0xe8,0xf1,0xc1, + 0x06,0x2d,0x5e,0xff,0x3a,0x1c,0x02,0xea,0x23,0xe5,0x54,0x2a,0xdb,0x04, + 0xd0,0xe5,0x2e,0x63,0x55,0xf1,0xa6,0x19,0x1f,0xa6,0x69,0x6e,0xf1,0xc0, + 0x19,0xd7,0x0c,0xfd,0x00,0x7a,0x3f,0x1a,0x54,0x34,0x8d,0x19,0xdc,0x00, + 0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + +static const unsigned int slider_png_len = 311; +static const unsigned char slider_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x0d,0x08,0x06,0x00,0x00, + 0x00,0x46,0x92,0x25,0x60,0x00,0x00,0x00,0x06,0x62,0x4b,0x47,0x44,0x00, + 0xff,0x00,0xff,0x00,0xff,0xa0,0xbd,0xa7,0x93,0x00,0x00,0x00,0x09,0x70, + 0x48,0x59,0x73,0x00,0x00,0x0b,0x13,0x00,0x00,0x0b,0x13,0x01,0x00,0x9a, + 0x9c,0x18,0x00,0x00,0x00,0x07,0x74,0x49,0x4d,0x45,0x07,0xd7,0x06,0x19, + 0x0b,0x21,0x06,0x08,0x17,0x34,0xb5,0x00,0x00,0x00,0xc4,0x49,0x44,0x41, + 0x54,0x38,0xcb,0xad,0xd3,0x31,0x6a,0x02,0x41,0x18,0x40,0xe1,0xcf,0xc5, + 0x2b,0x4c,0x6c,0xac,0x2c,0xad,0x83,0x44,0x41,0x6c,0x2d,0x24,0xb5,0x90, + 0x3e,0x90,0xde,0x5c,0x25,0x5e,0xc0,0x54,0x29,0x13,0xb0,0xf0,0x16,0x8a, + 0x82,0x42,0xac,0x44,0x52,0x58,0x08,0x39,0x40,0xd2,0xcc,0x86,0x8d,0x8d, + 0xe2,0xce,0x83,0x81,0x29,0x7e,0x1e,0x33,0xf0,0x3f,0xfe,0x13,0x30,0xc2, + 0x12,0x3f,0x17,0x9c,0x65,0x9c,0x0f,0x45,0x49,0xb5,0x70,0x7f,0xc0,0x0b, + 0x26,0x78,0xc6,0x97,0xf3,0xdc,0x60,0x80,0x4f,0x3c,0xe1,0xd5,0x89,0x70, + 0x8e,0x3b,0xd7,0x71,0x8b,0x45,0xf4,0xfc,0x7d,0xf9,0x88,0x8e,0x72,0xb4, + 0xa2,0x27,0x54,0xf0,0x8e,0x5d,0x7c,0x7e,0x59,0xc6,0xa8,0x67,0x68,0x60, + 0x26,0x0d,0x33,0x34,0x32,0x34,0x71,0x48,0x24,0x3d,0xa0,0x99,0x61,0x85, + 0x5a,0x22,0x69,0x0d,0xab,0x0c,0x5b,0xf4,0x13,0x49,0xfb,0xd1,0x27,0xe0, + 0x1b,0xbd,0x92,0xc2,0x4e,0xf4,0x84,0xe2,0x9e,0x6e,0xd0,0xbd,0x52,0xd8, + 0xc6,0x3a,0xdf,0xd3,0xbc,0xa8,0xbc,0x84,0x29,0xde,0xf0,0x81,0xfd,0x85, + 0x45,0xdd,0x63,0x88,0xc7,0xd3,0xa2,0x92,0xb6,0xff,0x0b,0xa5,0xee,0x37, + 0x87,0x80,0xd0,0x1f,0x2b,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae, + 0x42,0x60,0x82 +}; + +static const unsigned int slider_light_png_len = 199; +static const unsigned char slider_light_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x15,0x00,0x00,0x00,0x0d,0x08,0x06,0x00,0x00, + 0x00,0x46,0x92,0x25,0x60,0x00,0x00,0x00,0x8e,0x49,0x44,0x41,0x54,0x38, + 0xcb,0xe5,0xd2,0x31,0x0a,0xc2,0x60,0x0c,0x86,0xe1,0x07,0x5b,0x10,0xa4, + 0x27,0x70,0xeb,0x21,0xc4,0xc5,0xc1,0x41,0xf0,0x0c,0xdd,0xfe,0xd3,0xe8, + 0x31,0xbc,0x8c,0x8b,0x57,0x10,0x1c,0x5c,0x04,0x07,0x07,0x77,0xa1,0x2e, + 0xa9,0x74,0x12,0x2b,0xbf,0x93,0x1f,0x84,0x04,0x42,0xde,0x7c,0x81,0xf0, + 0x63,0x95,0xa8,0x91,0xd0,0x0e,0x88,0x14,0x73,0x65,0x1f,0xd4,0xe5,0x39, + 0xf6,0xd8,0x62,0x89,0xcb,0x07,0x46,0xa6,0x58,0x63,0x87,0x05,0x0e,0x78, + 0x74,0xcd,0x3a,0xb6,0x36,0xa8,0x06,0x5e,0x58,0xc5,0x5c,0x13,0x9c,0x97, + 0x12,0x36,0x5f,0x00,0xdf,0xaa,0xc5,0x2a,0x17,0x6c,0xd4,0xab,0xaf,0xb9, + 0xa0,0x45,0xe4,0x31,0x6e,0x38,0xe5,0x74,0x7a,0xc4,0x0c,0x93,0x9c,0x4e, + 0xef,0xf1,0x42,0xe7,0xdc,0x8f,0x5f,0xf8,0x3b,0x3d,0x01,0x15,0xcd,0x1c, + 0xe6,0xf8,0x5d,0xc5,0xb1,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae, + 0x42,0x60,0x82 +}; + +static const unsigned int slider_v_png_len = 310; +static const unsigned char slider_v_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x15,0x08,0x06,0x00,0x00, + 0x00,0x9d,0x6e,0x64,0x8a,0x00,0x00,0x00,0x06,0x62,0x4b,0x47,0x44,0x00, + 0xff,0x00,0xff,0x00,0xff,0xa0,0xbd,0xa7,0x93,0x00,0x00,0x00,0x09,0x70, + 0x48,0x59,0x73,0x00,0x00,0x0b,0x13,0x00,0x00,0x0b,0x13,0x01,0x00,0x9a, + 0x9c,0x18,0x00,0x00,0x00,0x07,0x74,0x49,0x4d,0x45,0x07,0xd7,0x06,0x19, + 0x0b,0x21,0x3b,0x50,0x7f,0x78,0xa4,0x00,0x00,0x00,0xc3,0x49,0x44,0x41, + 0x54,0x38,0xcb,0xed,0xd4,0x31,0x4e,0x02,0x41,0x14,0x87,0xf1,0x5f,0xa0, + 0xa3,0x5f,0x3a,0xc2,0x1d,0x0c,0x21,0x48,0x24,0xf4,0x36,0x9a,0x58,0xee, + 0x0d,0xa8,0xac,0xe1,0x16,0x36,0x34,0x9e,0x02,0x2e,0xc0,0x19,0x30,0x6e, + 0xa2,0x26,0x54,0x34,0xc6,0x06,0x05,0xeb,0xa5,0x19,0xc8,0x92,0x2c,0x32, + 0xda,0xd8,0xf0,0x35,0x33,0x99,0x79,0x5f,0x5e,0x26,0x79,0xff,0xe1,0x90, + 0x04,0x53,0x3c,0x23,0x0f,0xeb,0x34,0x9c,0xef,0xa9,0x14,0xf6,0x29,0x16, + 0x78,0xc7,0x08,0x5d,0x0c,0xb1,0xc4,0x5b,0xb8,0x3f,0x20,0xc5,0x2b,0xfa, + 0xca,0xe9,0x62,0x5e,0x14,0x13,0x6c,0xd0,0xf3,0x33,0x1d,0x7c,0x22,0xa9, + 0x62,0x80,0x0f,0x3c,0x9c,0x90,0x96,0x68,0xa0,0x29,0x3c,0xf6,0x4e,0x1c, + 0xd7,0xa1,0x5e,0x8e,0xcb,0x48,0xe9,0x02,0x79,0xc5,0x1f,0x38,0x4b,0xff, + 0x22,0x65,0xa8,0x47,0xd6,0xd7,0x91,0x55,0x51,0xc3,0x15,0x26,0x11,0xd2, + 0x3d,0x66,0xbb,0x29,0xff,0x8e,0x18,0xa5,0x16,0xbe,0x8a,0x81,0x4c,0xf1, + 0x12,0x72,0x53,0x46,0x1b,0x4f,0xc7,0x82,0xb8,0xc6,0x23,0x6e,0x43,0xe7, + 0x1b,0x8c,0xb1,0x2a,0x13,0x7e,0xf5,0x47,0x6c,0x01,0x0f,0x64,0x29,0x02, + 0xd4,0x3b,0x9e,0x77,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42, + 0x60,0x82 +}; + +static const unsigned int slider_light_v_png_len = 204; +static const unsigned char slider_light_v_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x15,0x08,0x06,0x00,0x00, + 0x00,0x9d,0x6e,0x64,0x8a,0x00,0x00,0x00,0x93,0x49,0x44,0x41,0x54,0x38, + 0xcb,0xed,0xd3,0xa1,0x0a,0x02,0x51,0x10,0x85,0xe1,0x8f,0x75,0x41,0x10, + 0x9b,0x4d,0x11,0xb1,0x18,0xad,0x46,0x93,0xdd,0x6a,0xf3,0x51,0x4c,0x3e, + 0x97,0x46,0x93,0x6f,0x20,0x88,0x60,0x5f,0x58,0x0c,0x06,0xd7,0x72,0xc3, + 0x65,0x51,0xd9,0x5d,0x30,0x08,0x9e,0x32,0xc3,0x9d,0xf9,0x39,0x77,0x60, + 0x86,0x06,0x6a,0x45,0x79,0x8a,0x11,0x96,0x38,0x62,0x83,0x36,0x86,0xc8, + 0x90,0xe3,0x01,0x49,0x04,0xcc,0x70,0xc2,0x04,0x0b,0x4c,0xb1,0xc3,0x00, + 0x3d,0x14,0x65,0xc7,0x71,0x78,0x5c,0xa1,0x5b,0xaa,0x75,0xde,0x7d,0x73, + 0x8d,0xed,0x0b,0xe0,0xa3,0x0a,0xcc,0xab,0x36,0x27,0x51,0x7e,0x6d,0x02, + 0xf9,0x43,0x3f,0x01,0xf5,0xeb,0x9e,0xc6,0x39,0x6c,0xf9,0x01,0xf7,0xaa, + 0x4e,0xfb,0x10,0xf3,0x3a,0x4e,0x39,0x6e,0xb8,0xd4,0x9d,0x2f,0xf5,0x4d, + 0x3d,0x01,0xf6,0xc8,0x14,0xaa,0x58,0xc9,0x89,0xb4,0x00,0x00,0x00,0x00, + 0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + +static const unsigned int check_x_on_png_len = 181; +static const unsigned char check_x_on_png_data[] = { + 0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48, + 0x44,0x52,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x09,0x08,0x06,0x00,0x00, + 0x00,0xe0,0x91,0x06,0x10,0x00,0x00,0x00,0x09,0x70,0x48,0x59,0x73,0x00, + 0x00,0x0b,0x13,0x00,0x00,0x0b,0x13,0x01,0x00,0x9a,0x9c,0x18,0x00,0x00, + 0x00,0x1d,0x74,0x45,0x58,0x74,0x43,0x6f,0x6d,0x6d,0x65,0x6e,0x74,0x00, + 0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x54, + 0x68,0x65,0x20,0x47,0x49,0x4d,0x50,0xef,0x64,0x25,0x6e,0x00,0x00,0x00, + 0x3e,0x49,0x44,0x41,0x54,0x18,0x95,0x95,0x8f,0x4b,0x0a,0x00,0x20,0x08, + 0x05,0x07,0xba,0xb6,0x97,0xab,0x7b,0x45,0xee,0xea,0x91,0x86,0x24,0xb8, + 0x70,0x18,0x7f,0x0d,0x30,0xa0,0x03,0x13,0x18,0x9c,0x50,0xce,0x92,0x34, + 0x11,0x94,0x07,0x90,0xd5,0x69,0x67,0x10,0x5e,0x62,0x29,0x94,0xab,0xd2, + 0x89,0x5f,0xdf,0xdd,0x37,0x6c,0xee,0x67,0xfc,0x35,0xc3,0xb2,0x07,0xf6, + 0x7b,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82 +}; + +#include <qcstring.h> +#include <qdict.h> +static struct Embed { + unsigned int size; + const unsigned char *data; + const char *name; +} embed_vec[] = { + { 419, radio_frame_png_data, "radio_frame.png" }, + { 236, radio_light_png_data, "radio_light.png" }, + { 231, radio_on_png_data, "radio_on.png" }, + { 179, check_on_png_data, "check_on.png" }, + { 311, slider_png_data, "slider.png" }, + { 199, slider_light_png_data, "slider_light.png" }, + { 310, slider_v_png_data, "slider_v.png" }, + { 204, slider_light_v_png_data, "slider_light_v.png" }, + { 181, check_x_on_png_data, "check_x_on.png" }, + { 0, 0, 0 } +}; + +static const QByteArray& qembed_findData( const char* name ) +{ + static QDict<QByteArray> dict; + QByteArray* ba = dict.find( name ); + if ( !ba ) { + for ( int i = 0; embed_vec[i].data; i++ ) { + if ( strcmp(embed_vec[i].name, name) == 0 ) { + ba = new QByteArray; + ba->setRawData( (char*)embed_vec[i].data, + embed_vec[i].size ); + dict.insert( name, ba ); + break; + } + } + if ( !ba ) { + static QByteArray dummy; + return dummy; + } + } + return *ba; +} + +#endif diff --git a/style/qtcurve.cpp b/style/qtcurve.cpp new file mode 100644 index 0000000..de2cc1f --- /dev/null +++ b/style/qtcurve.cpp @@ -0,0 +1,6394 @@ +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + Based upon B???Curve style (Copyright (c) 2002 R?d H?t, Inc) + Bernhard Rosenkrazer <bero@r?dh?t.com> + Preston Brown <pbrown@r?dh?t.com> + Than Ngo <than@r?dh?t.com> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + ---- + + B???Curve is based on the KDE Light style, 2nd revision: + Copyright(c)2000-2001 Trolltech AS ([email protected]). The light style + license is as follows: + + 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. +*/ + +/* +KHTML +----- +Srollbars: + +For some reason Scrollbars in KHTML seem to lose the bottom/left pixels. As if KHTML expects +the scrollbar to be 1 pixel smaller/thinner than it actually is. To 'fix' this, the pixelMetric +function will return 1 scrollbar with 1 greater than standard for form widgets, or where widget==NULL + +In the CC_ScrollBar draw code, the rects used for each component are shrunk by 1, in the appropriate +dimension, so as to draw the scrollbar at the correct size. +*/ + +#include <kdeversion.h> +#include <qsettings.h> +#include <qmenubar.h> +#include <qapplication.h> +#include <qpainter.h> +#include <qpalette.h> +#include <qframe.h> +#include <qpushbutton.h> +#include <qdrawutil.h> +#include <qscrollbar.h> +#include <qtabbar.h> +#include <qtabwidget.h> +#include <qlineedit.h> +#include <qlistview.h> +#include <qtable.h> +#include <qimage.h> +#include <qcombobox.h> +#include <qslider.h> +#include <qcleanuphandler.h> +#include <qcheckbox.h> +#include <qradiobutton.h> +#include <qtoolbutton.h> +#include <qtoolbar.h> +#include <qprogressbar.h> +#include <qheader.h> +#include <qwidgetstack.h> +#include <qsplitter.h> +#include <qtextedit.h> +#include <qlabel.h> +#include <qlistbox.h> +#include <qhbox.h> +#include <qvbox.h> +#include <qtimer.h> +#include <qdatetimeedit.h> +#include <qobjectlist.h> +#include <math.h> +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#define QTC_COMMON_FUNCTIONS +#include "qtcurve.h" +#define CONFIG_READ +#include "config_file.c" +#include "pixmaps.h" +#include <qdialog.h> +#include <qprogressdialog.h> +#include <qstyleplugin.h> +#include <qgroupbox.h> +#include <qdir.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#include <fixx11h.h> + +static QString readEnvPath(const char *env) +{ + QCString path=getenv(env); + + return path.isEmpty() ? QString::null : QFile::decodeName(path); +} + +static QString kdeHome() +{ + QString env(readEnvPath(getuid() ? "KDEHOME" : "KDEROOTHOME")); + + return env.isEmpty() + ? QDir::homeDirPath()+"/.kde" + : env; +} + +static void getStyles(const QString &dir, QStringList &styles) +{ + QDir d(dir+QTC_THEME_DIR); + + d.setNameFilter(QTC_THEME_PREFIX"*"QTC_THEME_SUFFIX); + + QStringList entries(d.entryList()); + QStringList::ConstIterator it(entries.begin()), + end(entries.end()); + + for(; it!=end; ++it) + { + QString style((*it).left((*it).findRev(QTC_THEME_SUFFIX))); + + if(!styles.contains(style)) + styles.append(style); + } +} + +static QString themeFile(const QString &dir, const QString &n) +{ + QString name(dir+QTC_THEME_DIR+n+QTC_THEME_SUFFIX); + + return QFile(name).exists() ? name : QString(); +} + +class QtCurveStylePlugin : public QStylePlugin +{ + public: + + QtCurveStylePlugin() : QStylePlugin() { } + + QStringList keys() const + { + QStringList list; + list << "QtCurve"; + + getStyles(kdeHome(), list); + getStyles(KDE_PREFIX(3), list); + getStyles(KDE_PREFIX(4), list); + + return list; + } + + QStyle * create(const QString &s) + { + return "qtcurve"==s.lower() + ? new QtCurveStyle + : 0==s.find(QTC_THEME_PREFIX) + ? new QtCurveStyle(s) + : 0; + } +}; + +Q_EXPORT_PLUGIN(QtCurveStylePlugin) + +#define QTC_SKIP_TASKBAR (APP_SKIP_TASKBAR==itsThemedApp || APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp) + +#if KDE_VERSION >= 0x30200 +#include <qfile.h> +#endif + +#define QTC_NO_SECT -1 + +#define QTC_VERTICAL_TB_BUTTON 0x01000000 +#define QTC_CHECK_BUTTON 0x02000000 +#define QTC_STD_TOOLBUTTON 0x04000000 +#define QTC_TOGGLE_BUTTON 0x08000000 +#define QTC_NO_ETCH_BUTTON 0x10000000 +#define QTC_LISTVIEW_ITEM 0x20000000 +#define QTC_MENU_ITEM 0x40000000 + +#if KDE_VERSION >= 0x30200 +// Try to read $KDEHOME/share/config/kickerrc to find out if kicker is transparent... + +static bool kickerIsTrans() +{ + QString cfgFileName(kdeHome()+"/share/config/kickerrc"); + bool trans(false); + QFile cfgFile(cfgFileName); + + if (cfgFile.open(IO_ReadOnly)) + { + QTextStream stream(&cfgFile); + QString line; + bool stop(false), + inGen(false); + + while (!stream.atEnd() && !stop) + { + line=stream.readLine(); + + if(inGen) + { + if(0==line.find("Transparent=")) // Found it! + { + if(-1!=line.find("true")) + trans=true; + stop=true; + } + else if(line[0]==QChar('[')) // Then wasn't in General section... + stop=true; + } + else if(0==line.find("[General]")) + inGen=true; + } + cfgFile.close(); + } + + return trans; +} +#endif + +inline QColor midColor(const QColor &a, const QColor &b, double factor=1.0) +{ + return QColor((a.red()+limit(b.red()*factor))>>1, + (a.green()+limit(b.green()*factor))>>1, + (a.blue()+limit(b.blue()*factor))>>1); +} + +static bool isKhtmlWidget(const QWidget *w, int level=1) +{ + return w && ((w->name() && 0==strcmp(w->name(), "__khtml")) || + (level && isKhtmlWidget(w->parentWidget(), --level))); +} + +static bool isKhtmlFormWidget(const QWidget *widget) +{ + if(isKhtmlWidget(widget)) + return true; + + // Copied from Keramik... + + //Form widgets are in the KHTMLView, but that has 2 further inner levels + //of widgets - QClipperWidget, and outside of that, QViewportWidget + QWidget *potentialClipPort(widget ? widget->parentWidget() : NULL); + + if (!potentialClipPort || potentialClipPort->isTopLevel()) + return false; + + QWidget *potentialViewPort(potentialClipPort->parentWidget()); + + if (!potentialViewPort || potentialViewPort->isTopLevel() || + qstrcmp(potentialViewPort->name(), "qt_viewport")) + return false; + + QWidget *potentialKHTML(potentialViewPort->parentWidget()); + + if (!potentialKHTML || potentialKHTML->isTopLevel() || + qstrcmp(potentialKHTML->className(), "KHTMLView")) + return false; + + return true; +} + +QColor shade(const QColor &a, float k) +{ + QColor mod; + + shade(a, &mod, k); + return mod; +} + +static void drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int offset, + const QColor *cols, int startOffset, int dark, int etchedDisp=1, + bool light=true) +{ + int space((nLines*2)+(etchedDisp || !light ? (nLines-1) : 0)), + step(etchedDisp || !light ? 3 : 2), + x(horiz ? r.x(): r.x()+((r.width()-space)>>1)), + y(horiz ? r.y()+((r.height()-space)>>1): r.y()), + x2(r.x()+r.width()-1), + y2(r.y()+r.height()-1), + i; + + if(horiz) + { + if(startOffset && y+startOffset>0) + y+=startOffset; + + p->setPen(cols[dark]); + for(i=0; i<space; i+=step) + p->drawLine(x+offset, y+i, x2-(offset+etchedDisp), y+i); + + if(light) + { + p->setPen(cols[0]); + for(i=1; i<space; i+=step) + p->drawLine(x+offset+etchedDisp, y+i, x2-offset, y+i); + } + } + else + { + if(startOffset && x+startOffset>0) + x+=startOffset; + + p->setPen(cols[dark]); + for(i=0; i<space; i+=step) + p->drawLine(x+i, y+offset, x+i, y2-(offset+etchedDisp)); + + if(light) + { + p->setPen(cols[0]); + for(i=1; i<space; i+=step) + p->drawLine(x+i, y+offset+etchedDisp, x+i, y2-offset); + } + } +} + +static void drawDots(QPainter *p, const QRect &r, bool horiz, int nLines, int offset, + const QColor *cols, int startOffset, int dark) +{ + int space((nLines*2)+(nLines-1)), + x(horiz ? r.x() : r.x()+((r.width()-space)>>1)), + y(horiz ? r.y()+((r.height()-space)>>1) : r.y()), + i, j, + numDots((horiz ? (r.width()-(2*offset))/3 : (r.height()-(2*offset))/3)+1); + + if(horiz) + { + if(startOffset && y+startOffset>0) + y+=startOffset; + + p->setPen(cols[dark]); + for(i=0; i<space; i+=3) + for(j=0; j<numDots; j++) + p->drawPoint(x+offset+(3*j), y+i); + + p->setPen(cols[0]); + for(i=1; i<space; i+=3) + for(j=0; j<numDots; j++) + p->drawPoint(x+offset+1+(3*j), y+i); + } + else + { + if(startOffset && x+startOffset>0) + x+=startOffset; + + p->setPen(cols[dark]); + for(i=0; i<space; i+=3) + for(j=0; j<numDots; j++) + p->drawPoint(x+i, y+offset+(3*j)); + + p->setPen(cols[0]); + for(i=1; i<space; i+=3) + for(j=0; j<numDots; j++) + p->drawPoint(x+i, y+offset+1+(3*j)); + } +} + +static bool onToolBar(QWidget *widget, int l=0) +{ + return l<3 && widget && widget->parentWidget() + ? widget->parentWidget()->inherits("QToolBar") || + onToolBar(widget->parentWidget(), ++l) + : false; +} + +enum ECacheAppearance +{ + CACHE_APPEARANCE_SELECTED=APPEARANCE_BEVELLED+1 +}; + +inline int app2App(EAppearance app, bool sel) +{ + return sel ? (int)CACHE_APPEARANCE_SELECTED : (int)app; +} + +#define QTC_PIXMAP_DIMENSION 10 + +static int double2int(double d) { return (int)(d*100); } +static QString createKey(int size, QRgb color, bool horiz, bool increase=false, int app=0, + EWidget w=WIDGET_OTHER, double shadeTop=0.0, double shadeBot=0.0) +{ + QString key; + + if(WIDGET_DEF_BUTTON==w && !IS_GLASS(app)) // Glass uses different shading for def button... + w=WIDGET_STD_BUTTON; + + QTextOStream(&key) << size << color << horiz << increase << app << (int)w + << ' ' << double2int(shadeTop) << ' ' << double2int(shadeBot); + + return key; +} + +static QString createKey(QRgb color) +{ + QString key; + + QTextOStream(&key) << 'p' << color; + + return key; +} + +static QString createKey(QRgb color, EPixmap p) +{ + QString key; + + QTextOStream(&key) << 'P' << color << p; + + return key; +} + +static void readPal(QString &line, QPalette::ColorGroup grp, QPalette &pal) +{ + QStringList cols(QStringList::split(", ", line.mid(line.find("=#")+1))); + + if(17==cols.count()) + { + QStringList::ConstIterator it(cols.begin()), + end(cols.end()); + QColorGroup group; + + for(int i=0; it!=end, i<16; ++it, ++i) + { + QColor col; + + setRgb(&col, (*it).latin1()); + group.setColor((QColorGroup::ColorRole)i, col); + } + + switch(grp) + { + case QPalette::Active: + pal.setActive(group); + break; + case QPalette::Disabled: + pal.setDisabled(group); + break; + case QPalette::Inactive: + pal.setInactive(group); + default: + break; + } + } +} + +static bool readQt4(QFile &f, QPalette &pal, QFont &font) +{ + bool inSect(false), + gotPal(false), + gotFont(false); + + if(f.open(IO_ReadOnly)) + { + QTextStream in(&f); + + while (!in.atEnd()) + { + QString line(in.readLine()); + + if(inSect) + { + gotPal=true; + if(0==line.find("Palette\\active=#")) + { + readPal(line, QPalette::Active, pal); + gotPal=true; + } + else if(0==line.find("Palette\\disabled=#")) + { + readPal(line, QPalette::Disabled, pal); + gotPal=true; + } + else if(0==line.find("Palette\\inactive=#")) + { + readPal(line, QPalette::Inactive, pal); + gotPal=true; + } + else if(0==line.find("font=\"")) + gotFont=font.fromString(line.mid(6, line.findRev('\"')-6)); + else if (0==line.find('[')) + break; + } + else if(0==line.find("[Qt]")) + inSect=true; + } + f.close(); + } + + return gotPal && gotFont; +} + +static bool useQt4Settings() +{ + static const char *vers=getenv("KDE_SESSION_VERSION"); + + return vers && atoi(vers)>=4; +} + +static bool readQt4(QPalette &pal, QFont &font) +{ + if(useQt4Settings()) + { + QFile file(xdgConfigFolder()+QString("Trolltech.conf")); + + if(file.exists()) + return readQt4(file, pal, font); + } + return false; +} + +static bool isCheckBoxOfGroupBox(const QObject *w) +{ + return w && w->parent() && + ::qt_cast<QCheckBox *>(w) && ::qt_cast<QGroupBox *>(w->parent()) && + !qstrcmp(w->name(), "qt_groupbox_checkbox"); +} + +// +// OO.o 2.x checks to see whether the used theme "inherits" from HighContrastStyle, +// if so it uses the highlightedText color to draw highlighted menubar and popup menu +// items. Otherwise it uses the standard color. So faking this inheritance, solves this +// problem. +HighContrastStyle::HighContrastStyle() + : KStyle(AllowMenuTransparency, WindowsStyleScrollBar) +{ +} + +QtCurveStyle::QtCurveStyle(const QString &name) + : itsSliderCols(NULL), + itsDefBtnCols(NULL), + itsMouseOverCols(NULL), + itsSidebarButtonsCols(NULL), + itsThemedApp(APP_OTHER), + itsPixmapCache(150000, 499), +#if KDE_VERSION >= 0x30200 + itsIsTransKicker(false), +#endif + itsHover(HOVER_NONE), + itsOldPos(-1, -1), + itsFormMode(false), + itsHoverWidget(NULL), + itsHoverSect(QTC_NO_SECT), + itsHoverTab(NULL), + itsMactorPal(NULL), + itsActive(true), + itsIsSpecialHover(false) +{ + QString rcFile; + + defaultSettings(&opts); + if(!name.isEmpty()) + { + rcFile=themeFile(kdeHome(), name); + + if(rcFile.isEmpty()) + { + rcFile=themeFile(KDE_PREFIX(useQt4Settings() ? 4 : 3), name); + if(rcFile.isEmpty()) + rcFile=themeFile(KDE_PREFIX(useQt4Settings() ? 3 : 4), name); + } + } + + readConfig(rcFile, &opts, &opts); + opts.contrast=QSettings().readNumEntry("/Qt/KDE/contrast", 7); + if(opts.contrast<0 || opts.contrast>10) + opts.contrast=7; + itsPixmapCache.setAutoDelete(true); + + if ((SHADE_CUSTOM==opts.shadeMenubars || SHADE_BLEND_SELECTED==opts.shadeMenubars) && + "soffice.bin"==QString(qApp->argv()[0]) && TOO_DARK(SHADE_CUSTOM==opts.shadeMenubars + ? opts.customMenubarsColor + : itsMenuitemCols[ORIGINAL_SHADE])) + opts.shadeMenubars=SHADE_DARKEN; + + shadeColors(QApplication::palette().active().highlight(), itsMenuitemCols); + shadeColors(QApplication::palette().active().background(), itsBackgroundCols); + shadeColors(QApplication::palette().active().button(), itsButtonCols); + if(SHADE_SELECTED==opts.shadeSliders) + itsSliderCols=itsMenuitemCols; + else if(SHADE_NONE!=opts.shadeSliders) + { + itsSliderCols=new QColor [TOTAL_SHADES+1]; + shadeColors(SHADE_BLEND_SELECTED==opts.shadeSliders + ? midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]) + : opts.customSlidersColor, + itsSliderCols); + } + + if(IND_COLORED==opts.defBtnIndicator) + if(SHADE_BLEND_SELECTED==opts.shadeSliders) + itsDefBtnCols=itsSliderCols; + else + { + itsDefBtnCols=new QColor [TOTAL_SHADES+1]; + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols); + } + + if(opts.coloredMouseOver) + if(itsDefBtnCols) + itsMouseOverCols=itsDefBtnCols; + else + { + itsMouseOverCols=new QColor [TOTAL_SHADES+1]; + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]), itsMouseOverCols); + } + + setMenuColors(QApplication::palette().active()); + + if(opts.lighterPopupMenuBgnd) + itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE], + POPUPMENU_LIGHT_FACTOR); + + switch(opts.shadeCheckRadio) + { + default: + itsCheckRadioCol=QApplication::palette().active().text(); + break; + case SHADE_BLEND_SELECTED: + case SHADE_SELECTED: + itsCheckRadioCol=QApplication::palette().active().highlight(); + break; + case SHADE_CUSTOM: + itsCheckRadioCol=opts.customCheckRadioColor; + } + + if (opts.animatedProgress) + { + itsAnimationTimer = new QTimer(this); + connect(itsAnimationTimer, SIGNAL(timeout()), this, SLOT(updateProgressPos())); + } + + setSbType(); +} + +QtCurveStyle::~QtCurveStyle() +{ + if(itsSidebarButtonsCols!=itsSliderCols && + itsSidebarButtonsCols!=itsDefBtnCols) + delete [] itsSidebarButtonsCols; + if(itsMouseOverCols && itsMouseOverCols!=itsDefBtnCols && + itsMouseOverCols!=itsSliderCols) + delete [] itsMouseOverCols; + if(itsDefBtnCols && itsDefBtnCols!=itsSliderCols) + delete [] itsDefBtnCols; + if(itsSliderCols && itsSliderCols!=itsMenuitemCols) + delete [] itsSliderCols; + delete itsMactorPal; +} + +static QString getFile(const QString &f) +{ + QString d(f); + + int slashPos(d.findRev('/')); + + if(slashPos!=-1) + d.remove(0, slashPos+1); + + return d; +} + +void QtCurveStyle::polish(QApplication *app) +{ + QString appName(getFile(app->argv()[0])); + + if ("kicker"==appName || "appletproxy"==appName) + { + itsThemedApp=APP_KICKER; +#if KDE_VERSION >= 0x30200 + itsIsTransKicker=kickerIsTrans(); +#endif + } + else if ("kontact"==appName) + itsThemedApp=APP_KONTACT; + else if ("konqueror"==appName) + itsThemedApp=APP_KONQUEROR; + else if ("kpresenter"==appName) + itsThemedApp=APP_KPRESENTER; + else if ("soffice.bin"==appName) + { + itsThemedApp=APP_OPENOFFICE; + opts.framelessGroupBoxes=false; + } + else if ("kdefilepicker"==appName) + itsThemedApp=APP_SKIP_TASKBAR; + else if ("kprinter"==appName) + itsThemedApp=APP_KPRINTER; + else if ("kdialog"==appName) + itsThemedApp=APP_KDIALOG; + else if ("kdialogd"==appName) + itsThemedApp=APP_KDIALOGD; + else if ("tora"==appName) + itsThemedApp=APP_TORA; + else if ("opera"==appName) + itsThemedApp=APP_OPERA; + else if ("korn"==appName) + { + itsThemedApp=APP_KORN; +#if KDE_VERSION >= 0x30200 + itsIsTransKicker=kickerIsTrans(); +#endif + } + else if ("mactor"==appName) + { + if(!itsMactorPal) + itsMactorPal=new QPalette(QApplication::palette()); + itsThemedApp=APP_MACTOR; + } + else + itsThemedApp=APP_OTHER; + + if(APP_OPENOFFICE==itsThemedApp) + { + if(opts.scrollbarType==SCROLLBAR_NEXT) + opts.scrollbarType=SCROLLBAR_KDE; + else if(opts.scrollbarType==SCROLLBAR_NONE) + opts.scrollbarType=SCROLLBAR_WINDOWS; + setSbType(); + } +} + +void QtCurveStyle::polish(QPalette &pal) +{ + if(APP_MACTOR==itsThemedApp && itsMactorPal && + pal.active().background()!=itsMactorPal->active().background()) + return; + + QPalette pal4; + QFont font; + QSettings settings; + + if(readQt4(pal4, font)) + { + pal=pal4; + QApplication::setFont(font); + } + else if(!opts.inactiveHighlight)// Read in Qt3 palette... Required for the inactive settings... + { + QStringList active(settings.readListEntry("/Qt/Palette/active")), + inactive(settings.readListEntry("/Qt/Palette/inactive")); + + // Only set if: the active highlight is the same, and the inactive highlight is different. + // If the user has no ~/.qt/qtrc, then QSettings will return a default palette. However, the palette + // passed in to this ::polish function will be the KDE one - which maybe different. Hence, we need to + // check that Qt active == KDE active, before reading inactive... + if (QColorGroup::NColorRoles==active.count() && + QColorGroup::NColorRoles==inactive.count() && + QColor(active[QColorGroup::Highlight])==pal.color(QPalette::Active, QColorGroup::Highlight) && + QColor(active[QColorGroup::HighlightedText])==pal.color(QPalette::Active, QColorGroup::HighlightedText)) + { + QColor h(inactive[QColorGroup::Highlight]), + t(inactive[QColorGroup::HighlightedText]); + + if(h!=pal.color(QPalette::Inactive, QColorGroup::Highlight) || t!=QPalette::Inactive, QColorGroup::HighlightedText) + { + pal.setColor(QPalette::Inactive, QColorGroup::Highlight, h); + pal.setColor(QPalette::Inactive, QColorGroup::HighlightedText, t); + } + } + } + + if(opts.inactiveHighlight) + { + pal.setColor(QPalette::Inactive, QColorGroup::Highlight, + midColor(pal.color(QPalette::Active, QColorGroup::Background), + pal.color(QPalette::Active, QColorGroup::Highlight), INACTIVE_HIGHLIGHT_FACTOR)); + pal.setColor(QPalette::Inactive, QColorGroup::HighlightedText, pal.color(QPalette::Active, QColorGroup::Foreground)); + } + + int c(settings.readNumEntry("/Qt/KDE/contrast", 7)); + bool newContrast(false); + + if(c<0 || c>10) + c=7; + + if(c!=opts.contrast) + { + opts.contrast=c; + newContrast=true; + } + + bool newMenu(newContrast || + itsMenuitemCols[ORIGINAL_SHADE]!=QApplication::palette().active().highlight()), + newGray(newContrast || + itsBackgroundCols[ORIGINAL_SHADE]!=QApplication::palette().active().background()), + newButton(newContrast || + itsButtonCols[ORIGINAL_SHADE]!=QApplication::palette().active().button()), + newSlider(itsSliderCols && SHADE_BLEND_SELECTED==opts.shadeSliders && + (newContrast || newButton || newMenu)), + newDefBtn(itsDefBtnCols && IND_COLORED==opts.defBtnIndicator && + SHADE_BLEND_SELECTED!=opts.shadeSliders && + (newContrast || newButton || newMenu)), + newMouseOver(itsMouseOverCols && itsMouseOverCols!=itsDefBtnCols && + itsMouseOverCols!=itsSliderCols && + (newContrast || newButton || newMenu)); + + if(newGray) + shadeColors(QApplication::palette().active().background(), itsBackgroundCols); + + if(newButton) + shadeColors(QApplication::palette().active().button(), itsButtonCols); + + if(newMenu) + shadeColors(QApplication::palette().active().highlight(), itsMenuitemCols); + + setMenuColors(QApplication::palette().active()); + + if(newSlider) + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]), itsSliderCols); + + if(newDefBtn) + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]), itsDefBtnCols); + + if(newMouseOver) + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]), itsMouseOverCols); + + if(itsSidebarButtonsCols && SHADE_BLEND_SELECTED!=opts.shadeSliders && + IND_COLORED!=opts.defBtnIndicator) + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], + itsButtonCols[ORIGINAL_SHADE]), itsSidebarButtonsCols); + + if(opts.lighterPopupMenuBgnd && newGray) + itsLighterPopupMenuBgndCol=shade(itsBackgroundCols[ORIGINAL_SHADE], + POPUPMENU_LIGHT_FACTOR); + + const QColorGroup &actGroup(pal.active()), + &inactGroup(pal.inactive()), + &disGroup(pal.disabled()); + const QColor *use(backgroundColors(actGroup)); + QColorGroup newAct(actGroup.foreground(), actGroup.button(), use[0], use[QT_STD_BORDER], + actGroup.mid(), actGroup.text(), actGroup.brightText(), + actGroup.base(), actGroup.background()); + QColorGroup::ColorRole roles[]={QColorGroup::Midlight, QColorGroup::ButtonText, + QColorGroup::Shadow, QColorGroup::Highlight, + QColorGroup::HighlightedText, + QColorGroup::NColorRoles }; + int r(0); + + for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r) + newAct.setColor(roles[r], actGroup.color(roles[r])); + pal.setActive(newAct); + + use=backgroundColors(inactGroup); + + QColorGroup newInact(inactGroup.foreground(), inactGroup.button(), use[0], use[QT_STD_BORDER], + inactGroup.mid(), inactGroup.text(), inactGroup.brightText(), + inactGroup.base(), inactGroup.background()); + + for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r) + newInact.setColor(roles[r], inactGroup.color(roles[r])); + pal.setInactive(newInact); + + use=backgroundColors(disGroup); + + QColorGroup newDis(disGroup.foreground(), disGroup.button(), use[0], use[QT_STD_BORDER], + disGroup.mid(), disGroup.text(), disGroup.brightText(), + disGroup.base(), disGroup.background()); + + for(r=0; roles[r]!=QColorGroup::NColorRoles; ++r) + newDis.setColor(roles[r], disGroup.color(roles[r])); + pal.setDisabled(newDis); + + switch(opts.shadeCheckRadio) + { + default: + itsCheckRadioCol=QApplication::palette().active().text(); + break; + case SHADE_SELECTED: + case SHADE_BLEND_SELECTED: + itsCheckRadioCol=QApplication::palette().active().highlight(); + break; + case SHADE_CUSTOM: + itsCheckRadioCol=opts.customCheckRadioColor; + } + + if(itsMactorPal) + *itsMactorPal=pal; +} + +static const char * kdeToolbarWidget="kde toolbar widget"; + +void QtCurveStyle::polish(QWidget *widget) +{ + bool enableFilter(!equal(opts.highlightFactor, 1.0) || opts.coloredMouseOver); + + if(::isKhtmlFormWidget(widget)) + { + itsKhtmlWidgets[widget]=true; + connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(khtmlWidgetDestroyed(QObject *))); + } + + if(widget->parentWidget() && ::qt_cast<QScrollView *>(widget) && ::qt_cast<QComboBox *>(widget->parentWidget())) + { + QPalette pal(widget->palette()); +#if 0 + QPalette orig(pal); +#endif + QColorGroup act(pal.active()); + +#if 0 + if(opts.gtkComboMenus) + act.setColor(QColorGroup::Base, opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE]); + act.setColor(QColorGroup::Background, opts.gtkComboMenus + ? opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol : itsBackgroundCols[ORIGINAL_SHADE] + : QApplication::palette().active().base()); +#endif + act.setColor(QColorGroup::Foreground, itsBackgroundCols[QT_STD_BORDER]); + + pal.setActive(act); + widget->setPalette(pal); +#if 0 + //((QScrollView *)widget)->setMargin(1); + + const QObjectList *children(widget->children()); + + if(children) + { + QObjectList::Iterator it(children->begin()), + end(children->end()); + + for(; it!=end; ++it) + if(::qt_cast<QWidget *>(*it)) + ((QWidget *)(*it))->setPalette(orig); + } +#endif + } + + if (APP_MACTOR==itsThemedApp && itsMactorPal && !widget->inherits("QTipLabel")) + widget->setPalette(*itsMactorPal); + + // Get rid of Kontact's frame... + if(APP_KONTACT==itsThemedApp && ::qt_cast<QHBox *>(widget) && widget->parentWidget() && + 0==qstrcmp(widget->parentWidget()->className(), "Kontact::MainWindow")) + ((QHBox *)widget)->setLineWidth(0); + + if (::qt_cast<QRadioButton *>(widget) || ::qt_cast<QCheckBox *>(widget)) + { + bool framelessGroupBoxCheckBox=(opts.framelessGroupBoxes && isCheckBoxOfGroupBox(widget)); + + if(framelessGroupBoxCheckBox || enableFilter) + { +#if QT_VERSION >= 0x030200 + if(!isFormWidget(widget)) + widget->setMouseTracking(true); +#endif + if(framelessGroupBoxCheckBox) + { + QFont fnt(widget->font()); + + fnt.setBold(true); + widget->setFont(fnt); + } + widget->installEventFilter(this); + } + } + else if (::qt_cast<QHeader *>(widget) || ::qt_cast<QTabBar *>(widget) || ::qt_cast<QSpinWidget *>(widget)/* || + ::qt_cast<QDateTimeEditBase*>(widget)*/) + { + if(enableFilter) + { + widget->setMouseTracking(true); + widget->installEventFilter(this); + } + } + else if (::qt_cast<QToolButton *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) + widget->setBackgroundMode(PaletteBackground); + if(enableFilter) + { + widget->installEventFilter(this); +#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500 + widget->setMouseTracking(true); +#endif + } + } + else if (::qt_cast<QButton *>(widget) || widget->inherits("QToolBarExtensionWidget")) + { + /*if(onToolBar(widget)) + widget->setBackgroundMode(NoBackground); + else*/ if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) + widget->setBackgroundMode(PaletteBackground); + if(enableFilter) + widget->installEventFilter(this); + } + else if (::qt_cast<QComboBox *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) + widget->setBackgroundMode(PaletteBackground); + widget->installEventFilter(this); + + if(QTC_DO_EFFECT && onToolBar(widget)) + widget->setName(kdeToolbarWidget); + + if(enableFilter) + widget->setMouseTracking(true); + + if(((QComboBox *)widget)->listBox()) + ((QComboBox *)widget)->listBox()->installEventFilter(this); + } + else if(::qt_cast<QMenuBar *>(widget) || ::qt_cast<QToolBar *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) + widget->setBackgroundMode(PaletteBackground); + if(SHADE_NONE!=opts.shadeMenubars) + widget->installEventFilter(this); + } + else if(::qt_cast<QPopupMenu *>(widget)) + widget->setBackgroundMode(NoBackground); // PaletteBackground); + else if (widget->inherits("KToolBarSeparator") || + (widget->inherits("KListViewSearchLineWidget") && + widget->parent() && ::qt_cast<QToolBar *>(widget->parent()))) + { + widget->setName(kdeToolbarWidget); + widget->setBackgroundMode(NoBackground); + widget->installEventFilter(this); + } + else if (::qt_cast<QScrollBar *>(widget)) + { + if(enableFilter) + { + widget->setMouseTracking(true); + widget->installEventFilter(this); + } + //widget->setBackgroundMode(NoBackground); + } + else if (::qt_cast<QSlider *>(widget)) + { + if(enableFilter) + widget->installEventFilter(this); + if(widget->parent() && ::qt_cast<QToolBar *>(widget->parent())) + { + widget->setName(kdeToolbarWidget); + widget->setBackgroundMode(NoBackground); // We paint whole background. + } + + // This bit stolen form polyester... + connect(widget, SIGNAL(sliderMoved(int)), this, SLOT(sliderThumbMoved(int))); + connect(widget, SIGNAL(valueChanged(int)), this, SLOT(sliderThumbMoved(int))); + } + else if (::qt_cast<QLineEdit*>(widget) || ::qt_cast<QTextEdit*>(widget)) + { + widget->installEventFilter(this); + if(onToolBar(widget)) + widget->setName(kdeToolbarWidget); + if(widget && widget->parentWidget() && + widget->inherits("KLineEdit") && widget->parentWidget()->inherits("KIO::DefaultProgress") && + ::qt_cast<QFrame *>(widget)) + ((QFrame *)widget)->setLineWidth(0); + } + else if (widget->inherits("QSplitterHandle") || widget->inherits("QDockWindowHandle")) + { + if(enableFilter) + widget->installEventFilter(this); + } + else if (0==qstrcmp(widget->name(), kdeToolbarWidget)) + { + if(!widget->parent() || + 0!=qstrcmp(static_cast<QWidget *>(widget->parent())->className(), + "KListViewSearchLineWidget") || + onToolBar(widget)) + { + widget->installEventFilter(this); + widget->setBackgroundMode(NoBackground); // We paint whole background. + } + } + + if (widget->parentWidget() && ::qt_cast<QMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), "QFrame")) + { + widget->installEventFilter(this); + widget->setBackgroundMode(NoBackground); // We paint whole background. + } + else if (Qt::X11ParentRelative!=widget->backgroundMode() && + (::qt_cast<QLabel *>(widget) || ::qt_cast<QHBox *>(widget) || + ::qt_cast<QVBox *>(widget)) && + widget->parent() && + ( 0==qstrcmp(static_cast<QWidget *>(widget->parent())->className(), + "MainWindow") || onToolBar(widget))) + { + widget->setName(kdeToolbarWidget); + widget->installEventFilter(this); + widget->setBackgroundMode(NoBackground); // We paint the whole background. + } + else if(::qt_cast<QProgressBar *>(widget)) + { + if(widget->palette().inactive().highlightedText()!=widget->palette().active().highlightedText()) + { + QPalette pal(widget->palette()); + pal.setInactive(widget->palette().active()); + widget->setPalette(pal); + } + + if(opts.animatedProgress) + { + widget->installEventFilter(this); + itsProgAnimWidgets[widget] = 0; + connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(progressBarDestroyed(QObject *))); + if (!itsAnimationTimer->isActive()) + itsAnimationTimer->start(PROGRESS_ANIMATION, false); + } + } +#ifdef QTC_HIGHLIGHT_SCROLVIEWS + else if(::qt_cast<QScrollView*>(widget)) + widget->installEventFilter(this); +#endif + else if(!qstrcmp(widget->className(), "KonqFrameStatusBar")) + { + // This disables the white background of the KonquerorFrameStatusBar. + // When the green led is shown the background is set to + // applications cg.midlight() so we override it to standard background. + // Thanks Comix! (because this was ugly from day one!) + // NOTE: Check if we can set it earlier (before painting), cause + // on slow machines we can see the repainting of the bar (from white to background...) + QPalette pal(QApplication::palette()); + + pal.setColor(QColorGroup::Midlight, pal.active().background()); + QApplication::setPalette(pal); + } + else if(widget->inherits("KTabCtl") || (opts.framelessGroupBoxes && ::qt_cast<QGroupBox *>(widget))) + widget->installEventFilter(this); + else if(opts.fixParentlessDialogs && ::qt_cast<QDialog *>(widget)) + { + QDialog *dlg=(QDialog *)widget; + + // The parent->isShown is needed for KWord. It's insert picure file dialog is a child of + // the insert picture dialog - but the file dialog is shown *before* the picture dialog! + if( (QTC_SKIP_TASKBAR && !dlg->parentWidget()) || + ( (!dlg->parentWidget() || !dlg->parentWidget()->isShown())// && + /*(dlg->isModal() || ::qt_cast<QProgressDialog *>(widget))*/) ) + widget->installEventFilter(this); + } + + if(opts.fixParentlessDialogs && (APP_KPRINTER==itsThemedApp || APP_KDIALOG==itsThemedApp || + APP_KDIALOGD==itsThemedApp)) + { + QString cap(widget->caption()); + int index=-1; + + // Remove horrible "Open - KDialog" titles... + if( cap.length() && + ( (APP_KPRINTER==itsThemedApp && (-1!=(index=cap.find(" - KPrinter"))) && + (index+11)==(int)cap.length()) || + (APP_KDIALOG==itsThemedApp && (-1!=(index=cap.find(" - KDialog"))) && + (index+10)==(int)cap.length()) || + (APP_KDIALOGD==itsThemedApp && (-1!=(index=cap.find(" - KDialog Daemon"))) && + (index+17)==(int)cap.length())) ) + widget->QWidget::setCaption(cap.left(index)); + } + + KStyle::polish(widget); +} + +void QtCurveStyle::unPolish(QWidget *widget) +{ + if(isFormWidget(widget)) + itsKhtmlWidgets.remove(widget); + + if (::qt_cast<QRadioButton *>(widget) || ::qt_cast<QCheckBox *>(widget)) + { +#if QT_VERSION >= 0x030200 + widget->setMouseTracking(false); +#endif + widget->removeEventFilter(this); + } + else if (::qt_cast<QHeader *>(widget) || ::qt_cast<QTabBar *>(widget) || ::qt_cast<QSpinWidget *>(widget) /*|| + ::qt_cast<QDateTimeEditBase*>(widget)*/) + { + widget->setMouseTracking(false); + widget->removeEventFilter(this); + } + else if (::qt_cast<QButton *>(widget) || widget->inherits("QToolBarExtensionWidget")) + { + if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) + widget->setBackgroundMode(PaletteButton); + widget->removeEventFilter(this); + } + else if (::qt_cast<QToolButton *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) + widget->setBackgroundMode(PaletteButton); + widget->removeEventFilter(this); +#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500 + widget->setMouseTracking(false); +#endif + } + else if (::qt_cast<QComboBox *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) // && onToolBar(widget)) + widget->setBackgroundMode(PaletteButton); + widget->removeEventFilter(this); + widget->setMouseTracking(false); + if(((QComboBox *)widget)->listBox()) + ((QComboBox *)widget)->listBox()->removeEventFilter(this); + } + else if (::qt_cast<QToolBar *>(widget) || ::qt_cast<QPopupMenu *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) + widget->setBackgroundMode(PaletteBackground); + } + else if (::qt_cast<QMenuBar *>(widget)) + { + if(NoBackground!=widget->backgroundMode()) + widget->setBackgroundMode(PaletteBackground); + if(SHADE_NONE!=opts.shadeMenubars) + widget->removeEventFilter(this); + } + else if (widget->inherits("KToolBarSeparator")) + { + widget->setBackgroundMode(PaletteBackground); + widget->removeEventFilter(this); + } + else if (::qt_cast<QScrollBar *>(widget)) + { + widget->setMouseTracking(false); + widget->removeEventFilter(this); + widget->setBackgroundMode(PaletteButton); + } + else if (::qt_cast<QSlider *>(widget)) + { + widget->removeEventFilter(this); + if(widget->parent() && ::qt_cast<QToolBar *>(widget->parent())) + widget->setBackgroundMode(PaletteBackground); + } + else if (::qt_cast<QLineEdit*>(widget) || ::qt_cast<QTextEdit*>(widget)) + widget->removeEventFilter(this); + else if (widget->inherits("QSplitterHandle") || widget->inherits("QDockWindowHandle")) + widget->removeEventFilter(this); + else if (::qt_cast<QProgressBar*>(widget)) + { + itsProgAnimWidgets.remove(widget); + widget->removeEventFilter(this); + } +#ifdef QTC_HIGHLIGHT_SCROLVIEWS + else if(::qt_cast<QScrollView*>(widget)) + widget->removeEventFilter(this); +#endif + else if(0==qstrcmp(widget->name(), kdeToolbarWidget)) + { + widget->removeEventFilter(this); + widget->setBackgroundMode(PaletteBackground); + } + if (widget->parentWidget() && ::qt_cast<QMenuBar *>(widget->parentWidget()) && !qstrcmp(widget->className(), "QFrame")) + { + widget->removeEventFilter(this); + widget->setBackgroundMode(PaletteBackground); // We paint whole background. + } + else if(widget->inherits("KTabCtl") || (opts.framelessGroupBoxes && ::qt_cast<QGroupBox *>(widget))) + widget->removeEventFilter(this); + else if(opts.fixParentlessDialogs && ::qt_cast<QDialog *>(widget)) + widget->removeEventFilter(this); + + KStyle::unPolish(widget); +} + +static void sendXEvent(QDialog *dlg, const char *msg) +{ + static Atom msgTypeAtom = XInternAtom(qt_xdisplay(), "_NET_WM_STATE", False); + + XEvent xev; + Atom atom=XInternAtom(qt_xdisplay(), msg, False); + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.window = dlg->winId(); + xev.xclient.message_type = msgTypeAtom; + xev.xclient.format = 32; + xev.xclient.data.l[0] = 1; + xev.xclient.data.l[1] = atom; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(qt_xdisplay(), qt_xrootwin(), False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev); +} + +bool QtCurveStyle::appIsNotEmbedded(QDialog *dlg) +{ + Window win; + + if(!XGetTransientForHint(qt_xdisplay(), dlg->winId(), &win) || (int)win < 1000) + return true; + + // OK, dialog has been set transient, so there is no need for this event filter anymore :-) + dlg->removeEventFilter(this); + return false; +} + +bool QtCurveStyle::eventFilter(QObject *object, QEvent *event) +{ + if(itsHoverWidget && object==itsHoverWidget && (QEvent::Destroy==event->type() || QEvent::Hide==event->type())) + { + itsOldPos.setX(-1); + itsOldPos.setY(-1); + itsHoverWidget=NULL; + itsIsSpecialHover=false; + itsHoverSect=QTC_NO_SECT; + itsHover=HOVER_NONE; + } + + if(object->parent() && 0==qstrcmp(object->name(), kdeToolbarWidget)) + { + // Draw background for custom widgets in the toolbar that have specified a + // "kde toolbar widget" name. + if(QEvent::Paint==event->type()) + { + QWidget *widget(static_cast<QWidget*>(object)), + *parent(static_cast<QWidget*>(object->parent())); + + if(IS_FLAT(opts.toolbarAppearance)) + QPainter(widget).fillRect(widget->rect(), parent->colorGroup().background()); + else + { + int y_offset(widget->y()); + + while(parent && parent->parent() && 0==qstrcmp(parent->name(), kdeToolbarWidget)) + { + y_offset += parent->y(); + parent = static_cast<QWidget*>(parent->parent()); + } + + QRect r(widget->rect()), + pr(parent->rect()); + bool horiz=pr.width() > pr.height(); + QPainter p(widget); + QToolBar *tb(::qt_cast<QToolBar*>(parent)); + + // If parent is a QToolbar use its orientation, else just base on width>height. + if (tb) + horiz = Qt::Horizontal==tb->orientation(); + + QRect bgndRect(r.x(), r.y()-y_offset, r.width(), pr.height()); + + if(!IS_FLAT(opts.toolbarAppearance)) + if(horiz) + bgndRect.addCoords(0, -1, 0, 1); + else + bgndRect.addCoords(-1, 0, 1, 0); + + drawMenuOrToolBarBackground(&p, bgndRect, parent->colorGroup(), false, horiz); + } + + if(!::qt_cast<QLineEdit*>(object) && !::qt_cast<QTextEdit*>(object) && + !(QTC_DO_EFFECT && ::qt_cast<QComboBox*>(object))) + return false; // Now draw the contents + } + } + else if (opts.framelessGroupBoxes && QEvent::Move==event->type() && isCheckBoxOfGroupBox(object)) + { + QCheckBox *cb=static_cast<QCheckBox *>(object); + QRect r(cb->geometry()); + + cb->removeEventFilter(this); + if(QApplication::reverseLayout()) + r.setWidth(r.width()+8); + else + r.setX(0); + cb->setGeometry(r); + cb->installEventFilter(this); + return false; + } + else if (QEvent::Paint==event->type()) + { + if (opts.framelessGroupBoxes && ::qt_cast<QGroupBox *>(object)) + { + QGroupBox *box=static_cast<QGroupBox*>(object); + + if (!box->isCheckable()) + { + QString title(box->title()); + + if(title.length()) + { + int left, + right, + top, + bottom, + width, + height; + QPainter p(box); + QFontMetrics fm(p.fontMetrics()); + QRect r(box->rect()); + int th(fm.height()+2); + QFont f(p.font()); + + r.rect(&left, &top, &width, &height); + r.coords(&left, &top, &right, &bottom); + f.setBold(true); + p.setPen(box->colorGroup().foreground()); + p.setFont(f); + p.drawText(QRect(left, top, width, th), + (QApplication::reverseLayout() ? AlignRight : AlignLeft)|AlignVCenter|ShowPrefix|SingleLine, title); + return true; + } + } + } + else if (object->inherits("KToolBarSeparator")) + { + QFrame *frame(::qt_cast<QFrame *>(object)); + + if(frame && QFrame::NoFrame!=frame->frameShape()) + { + QPainter painter(frame); + if (QFrame::VLine==frame->frameShape()) + drawPrimitive(PE_DockWindowSeparator, &painter, frame->rect(), + frame->colorGroup(), Style_Horizontal); + else if (QFrame::HLine==frame->frameShape()) + drawPrimitive(PE_DockWindowSeparator, &painter, frame->rect(), + frame->colorGroup()); + else + return false; + return true; // been drawn! + } + } + else if(object->inherits("KTabCtl") && ::qt_cast<QWidget*>(object)) + { + QWidget *widget((QWidget*)object); + QObject *child(object->child("_tabbar")); + QTabBar *tb(child ? ::qt_cast<QTabBar *>(child) : NULL); + QPainter painter(widget); + QRect r(widget->rect()); + int tbHeight(tb ? tb->height()-1 : 28); + + if(tb && (QTabBar::RoundedBelow == tb->shape() || + QTabBar::TriangularBelow == tb->shape())) + r.addCoords(0, 0, 0, -tbHeight); + else + r.addCoords(0, tbHeight, 0, 0); + drawPrimitive(PE_PanelTabWidget, &painter, r, widget->colorGroup(), + Style_Horizontal|Style_Enabled); + return true; + } + } + + // Fix mdi buttons in menubars... + if(::qt_cast<QWidget*>(object) && ((QWidget *)object)->parentWidget() && + ::qt_cast<QMenuBar*>(((QWidget *)object)->parentWidget())) + { + bool drawMenubar=false; + + switch(event->type()) + { + case QEvent::Paint: + drawMenubar=true; + break; + case QEvent::WindowActivate: + itsActive=true; + drawMenubar=opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars; + break; + case QEvent::WindowDeactivate: + itsActive=false; + drawMenubar=opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars; + default: + break; + } + + if(drawMenubar) + { + + QWidget *widget(static_cast<QWidget*>(object)), + *parent(static_cast<QWidget*>(object->parent())); + QRect r(widget->rect()); + QPainter p(widget); + int y_offset(widget->y()+parent->y()); + + r.setY(r.y()-y_offset); + r.setHeight(parent->rect().height()); + + drawMenuOrToolBarBackground(&p, r, parent->colorGroup(), true, true); + return true; + } + } + + // Taken from plastik... + // focus highlight + if (::qt_cast<QLineEdit*>(object) || ::qt_cast<QTextEdit*>(object)/* || ::qt_cast<QDateTimeEditBase*>(object)*/) + { + if((QEvent::FocusIn==event->type() || QEvent::FocusOut==event->type())) + { + QWidget *widget(static_cast<QWidget*>(object)); + + if (::qt_cast<QSpinWidget*>(widget->parentWidget())) + { + widget->parentWidget()->repaint(false); + return false; + } + + widget->repaint(false); + } + return false; + } + + if(opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars && + ::qt_cast<QMenuBar *>(object)) + switch(event->type()) + { + case QEvent::WindowActivate: + itsActive=true; + ((QWidget *)object)->repaint(false); + return false; + case QEvent::WindowDeactivate: + itsActive=false; + ((QWidget *)object)->repaint(false); + return false; + default: + break; + } + + if(opts.fixParentlessDialogs && ::qt_cast<QDialog *>(object)) + { + QDialog *dlg=(QDialog *)object; + + switch(event->type()) + { + case QEvent::ShowMinimized: + if(QTC_SKIP_TASKBAR && appIsNotEmbedded(dlg)) + { + // Ugly hack :-( Cant seem to get KWin to remove the minimize button. So when + // the dialog gets minimized, restore. + dlg->setWindowState(dlg->windowState() & ~WindowMinimized | WindowActive); + return true; + } + break; + case QEvent::WindowActivate: + if(QTC_SKIP_TASKBAR && appIsNotEmbedded(dlg)) + { + // OO.o's filepicker is a spawned process - but is not set transient :-( + // --plus no reliable way of finding which widget to make it transient for... + sendXEvent(dlg, "_NET_WM_STATE_SKIP_PAGER"); + sendXEvent(dlg, "_NET_WM_STATE_SKIP_TASKBAR"); + sendXEvent(dlg, "_NET_WM_STATE_ABOVE"); + sendXEvent(dlg, "_NET_WM_STATE_STAYS_ON_TOP"); + //setActions(dlg); + } + break; + case QEvent::Show: + // The parent->isShown is needed for KWord. It's insert picure file dialog is a + // child of the insert picture dialog - but the file dialog is shown *before* the + // picture dialog! + if((!dlg->parentWidget() || !dlg->parentWidget()->isShown())) // && + //(dlg->isModal() || ::qt_cast<QProgressDialog *>(object))) + { + QWidget *activeWindow=qApp->activeWindow(); + + if(activeWindow) + { + XWindowAttributes attr; + int rx, ry; + Window win; + + if(!XGetTransientForHint(qt_xdisplay(), dlg->winId(), &win) || + win!=activeWindow->winId()) + { + XSetTransientForHint(qt_xdisplay(), dlg->winId(), + activeWindow->winId()); + + if(XGetWindowAttributes(qt_xdisplay(), activeWindow->winId(), &attr)) + { + XTranslateCoordinates(qt_xdisplay(), activeWindow->winId(), + attr.root, -attr.border_width, -16, + &rx, &ry, &win); + + rx=(rx+(attr.width/2))-(dlg->width()/2); + if(rx<0) + rx=0; + ry=(ry+(attr.height/2))-(dlg->height()/2); + if(ry<0) + ry=0; + dlg->move(rx, ry); + if(!dlg->isModal()) + dlg->setModal(true); + } + } + } + } + default: + break; + } + return false; + } + + // Track show events for progress bars + if (opts.animatedProgress && ::qt_cast<QProgressBar*>(object)) + { + if(QEvent::Show==event->type() && !itsAnimationTimer->isActive()) + itsAnimationTimer->start(PROGRESS_ANIMATION, false); + return false; + } + + switch(event->type()) + { +#ifdef QTC_HIGHLIGHT_SCROLVIEWS + case QEvent::FocusIn: + case QEvent::FocusOut: + if(object->isWidgetType() && ::qt_cast<QScrollView*>(object)) + ((QWidget *)object)->repaint(false); + break; +#endif + case QEvent::Hide: + case QEvent::Show: + if(::qt_cast<QListBox *>(object) && + (((QListBox *)object)->parentWidget() && + ::qt_cast<QComboBox *>(((QListBox *)object)->parentWidget()))) + ((QComboBox *)(((QListBox *)object)->parentWidget()))->repaint(false); +// else if(::qt_cast<QFrame *>(object) && +// (QFrame::Box==((QFrame *)object)->frameShape() || QFrame::Panel==((QFrame *)object)->frameShape() || +// QFrame::WinPanel==((QFrame *)object)->frameShape())) +// ((QFrame *)object)->setFrameShape(QFrame::StyledPanel); + break; + case QEvent::Enter: + if(object->isWidgetType()) + { + itsHoverWidget=(QWidget *)object; + + if(itsHoverWidget && itsHoverWidget->isEnabled()) + { + if(::qt_cast<QTabBar*>(object) && static_cast<QWidget*>(object)->isEnabled()) + { + itsHoverTab=NULL; + itsHoverWidget->repaint(false); + } + else if(!itsHoverWidget->hasMouseTracking() || + (itsFormMode=isFormWidget(itsHoverWidget))) + { + itsHoverWidget->repaint(false); + itsFormMode=false; + } + } + else + itsHoverWidget=NULL; + + if(itsHoverWidget && !itsIsSpecialHover && + ( +#if QT_VERSION >= 0x030200 + ::qt_cast<QRadioButton *>(itsHoverWidget) || + ::qt_cast<QCheckBox *>(itsHoverWidget) || +#endif + ::qt_cast<QScrollBar *>(itsHoverWidget) || +#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500 + ::qt_cast<QToolButton *>(itsHoverWidget) || + +#endif + ::qt_cast<QHeader *>(itsHoverWidget) || + ::qt_cast<QSpinWidget *>(itsHoverWidget) || + ::qt_cast<QComboBox *>(itsHoverWidget) || + ::qt_cast<QTabBar *>(itsHoverWidget))) + + itsIsSpecialHover=true; + } + break; + case QEvent::Leave: + if(itsHoverWidget && object==itsHoverWidget) + { + itsOldPos.setX(-1); + itsOldPos.setY(-1); + itsHoverWidget=NULL; + itsHoverSect=QTC_NO_SECT; + itsHover=HOVER_NONE; + itsHoverTab=NULL; + ((QWidget *)object)->repaint(false); + } + break; + case QEvent::MouseMove: // Only occurs for widgets with mouse tracking enabled + { + QMouseEvent *me = static_cast<QMouseEvent*>(event); + + if(me && itsHoverWidget && object->isWidgetType()) + { + if(!me->pos().isNull() && itsIsSpecialHover && redrawHoverWidget(me->pos())) + itsHoverWidget->repaint(false); + itsOldPos=me->pos(); + } + break; + } + default: + break; + } + + return KStyle::eventFilter(object, event); +} + +void QtCurveStyle::drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &rOrig, + const QColorGroup &cg, SFlags flags, + int round, const QColor &fill, const QColor *custom, + bool doBorder, bool doCorners, EWidget w) const +{ + EAppearance app(widgetApp(w, &opts)); + QRect r(rOrig), + br(r); + bool bevelledButton(WIDGET_BUTTON(w) && APPEARANCE_BEVELLED==app), + sunken(flags &(Style_Down|Style_On|Style_Sunken)), + lightBorder(QTC_DRAW_LIGHT_BORDER(sunken , w, app)), + doColouredMouseOver(doBorder && + opts.coloredMouseOver && flags&Style_MouseOver && + (!IS_SLIDER(w) || (WIDGET_SB_SLIDER==w && MO_PLASTIK==opts.coloredMouseOver)) && + (flags&QTC_CHECK_BUTTON || flags&QTC_TOGGLE_BUTTON || !sunken)), + plastikMouseOver(doColouredMouseOver && MO_PLASTIK==opts.coloredMouseOver), + colouredMouseOver(doColouredMouseOver && MO_COLORED==opts.coloredMouseOver), + doEtch(!itsFormMode && doBorder && ETCH_WIDGET(w) && !(flags&QTC_CHECK_BUTTON) && + QTC_DO_EFFECT), + horiz(flags&Style_Horizontal); + int dark(bevelledButton ? 2 : 4), + c1(sunken ? dark : 0); + const QColor *cols(custom ? custom : itsBackgroundCols), + *border(colouredMouseOver ? borderColors(flags, cols) : cols); + + p->save(); + + if(doEtch) + { + r.addCoords(0, 1, 0, -1); + br=r; + } + + if(!colouredMouseOver && lightBorder) + br.addCoords(1, 1,-1,-1); + else if(colouredMouseOver || (!IS_GLASS(app) && !sunken && flags&Style_Raised)) + { + if(colouredMouseOver) + p->setPen(border[QTC_MO_STD_LIGHT(w, sunken)]); + else + p->setPen(border[c1]); + if(colouredMouseOver || bevelledButton || APPEARANCE_RAISED==app) + { + //Left & top + p->drawLine(br.x()+1, br.y()+2, br.x()+1, br.y()+br.height()-3); + p->drawLine(br.x()+1, br.y()+1, br.x()+br.width()-2, br.y()+1); + + if(colouredMouseOver) + p->setPen(border[QTC_MO_STD_DARK(w)]); + else + p->setPen(border[sunken ? 0 : dark]); + //Right & bottom + p->drawLine(br.x()+br.width()-2, br.y()+1, br.x()+br.width()-2, br.y()+br.height()-3); + p->drawLine(br.x()+1, br.y()+br.height()-2, br.x()+br.width()-2, br.y()+br.height()-2); + br.addCoords(2, 2,-2,-2); + } + else + { + //Left & top + p->drawLine(br.x()+1, br.y()+2, br.x()+1, br.y()+br.height()-2); + p->drawLine(br.x()+1, br.y()+1, br.x()+br.width()-2, br.y()+1); + br.addCoords(2, 2,-1,-1); + } + } + else + br.addCoords(1, 1,-1,-1); + + if(!colouredMouseOver && lightBorder && br.width()>0 && br.height()>0) + { + QColor col(cols[APPEARANCE_DULL_GLASS==app ? 1 : 0]); + + p->setPen(col); + br=r; + br.addCoords(1,1,-1,-1); + p->drawRect(br); + + if(WIDGET_PROGRESSBAR==w && !IS_GLASS(app)) + br.addCoords(1,1,-1,-1); + else if(horiz) + br.addCoords(1,0,-1,-1); + else + br.addCoords(0,1,-1,-1); + } + + // fill + if(br.width()>0 && br.height()>0) + { + drawBevelGradient(fill, !sunken, p, br, horiz, getWidgetShade(w, true, sunken, app), + getWidgetShade(w, false, sunken, app), sunken, app, w); + + if(plastikMouseOver) + { + if(WIDGET_SB_SLIDER==w) + { + int len(QTC_SB_SLIDER_MO_LEN(horiz ? r.width() : r.height())), + so(lightBorder ? QTC_SLIDER_MO_BORDER : 1), + eo(len+so), + col(QTC_SLIDER_MO_SHADE); + + if(horiz) + { + drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x()+so, r.y(), len, r.height()), + horiz, getWidgetShade(w, true, sunken, app), + getWidgetShade(w, false, sunken, app), sunken, app, w); + drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x()+r.width()-eo, r.y(), len, r.height()), + horiz, getWidgetShade(w, true, sunken, app), + getWidgetShade(w, false, sunken, app), sunken, app, w); + } + else + { + drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x(), r.y()+so, r.width(), len), + horiz, getWidgetShade(w, true, sunken, app), + getWidgetShade(w, false, sunken, app), sunken, app, w); + drawBevelGradient(itsMouseOverCols[col], !sunken, p, QRect(r.x(), r.y()+r.height()-eo, r.width(), len), + horiz, getWidgetShade(w, true, sunken, app), + getWidgetShade(w, false, sunken, app), sunken, app, w); + } + } + else + { + bool horizontal((horiz && WIDGET_SB_BUTTON!=w)|| (!horiz && WIDGET_SB_BUTTON==w)), + thin(WIDGET_SB_BUTTON==w || WIDGET_SPIN==w || ((horiz ? r.height() : r.width())<16)); + + p->setPen(itsMouseOverCols[QTC_MO_PLASTIK_DARK(w)]); + if(horizontal) + { + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); + p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); + } + else + { + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); + } + if(!thin) + { + p->setPen(itsMouseOverCols[QTC_MO_PLASTIK_LIGHT(w)]); + if(horizontal) + { + p->drawLine(r.x()+1, r.y()+2, r.x()+r.width()-2, r.y()+2); + p->drawLine(r.x()+1, r.y()+r.height()-3, r.x()+r.width()-2, r.y()+r.height()-3); + } + else + { + p->drawLine(r.x()+2, r.y()+1, r.x()+2, r.y()+r.height()-2); + p->drawLine(r.x()+r.width()-3, r.y()+1, r.x()+r.width()-3, r.y()+r.height()-2); + } + } + } + } + } + + if(doBorder) + drawBorder(bgnd, p, r, cg, flags, round, cols, w, doCorners); + + if(doEtch) + drawEtch(p, rOrig, cg, true, true, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && !sunken); + + p->restore(); +} + +void QtCurveStyle::drawEtch(QPainter *p, const QRect &r, const QColorGroup &cg, bool top, bool bot, bool raised) const +{ + if(top && !raised) + { + QColor darkCol(shade(cg.background(), QTC_ETCHED_DARK)); + + p->setPen(darkCol); + p->drawLine(r.x()+2, r.y(), r.x()+r.width()-3, r.y()); + p->setPen(midColor(darkCol, cg.background())); + p->drawPoint(r.x()+1, r.y()); + p->drawPoint(r.x()+r.width()-2, r.y()); + p->drawPoint(r.x(), r.y()+1); + p->drawPoint(r.x()+r.width()-1, r.y()+1); + } + if(bot) + { + QColor col(raised ? shade(cg.background(), QTC_ETCHED_DARK) : itsBackgroundCols[1]); + + p->setPen(col); + p->drawLine(r.x()+2, r.y()+r.height()-1, r.x()+r.width()-3, r.y()+r.height()-1); + p->setPen(midColor(raised ? col : itsBackgroundCols[0], cg.background())); + p->drawPoint(r.x()+1, r.y()+r.height()-1); + p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1); + p->drawPoint(r.x(), r.y()+r.height()-2); + p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-2); + } +} + +void QtCurveStyle::drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, const QColorGroup &cg, + SFlags flags, int round, const QColor *custom, EWidget w, bool doCorners, + EBorder borderProfile, bool blendBorderColors, int borderVal) const +{ + EAppearance app(widgetApp(w, &opts)); + const QColor *cols(custom ? custom : itsBackgroundCols); + QColor border(flags&Style_ButtonDefault && IND_FONT_COLOR==opts.defBtnIndicator && + flags&Style_Enabled + ? cg.buttonText() + : cols[!(flags&Style_Enabled) && (WIDGET_BUTTON(w) || WIDGET_SLIDER_TROUGH==w || flags&QTC_CHECK_BUTTON) + ? QT_DISABLED_BORDER : borderVal]); + + switch(borderProfile) + { + case BORDER_FLAT: + break; + case BORDER_RAISED: + case BORDER_SUNKEN: + p->setPen(flags&Style_Enabled && (BORDER_RAISED==borderProfile || APPEARANCE_FLAT!=app) + ? blendBorderColors + ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile + ? 0 : QT_FRAME_DARK_SHADOW]) // Was base??? + : cols[BORDER_RAISED==borderProfile ? 0 : QT_FRAME_DARK_SHADOW] + : cg.background()); + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); + p->setPen(flags&Style_Enabled && (BORDER_SUNKEN==borderProfile || APPEARANCE_FLAT!=app) + ? blendBorderColors + ? midColor(cg.background(), cols[BORDER_RAISED==borderProfile + ? QT_FRAME_DARK_SHADOW : 0]) // Was base??? + : cols[BORDER_RAISED==borderProfile ? QT_FRAME_DARK_SHADOW : 0] + : cg.background()); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); + } + + if(QTC_ROUNDED && ROUNDED_NONE!=round) + { + bool largeArc(ROUND_FULL==opts.round && !(flags&QTC_CHECK_BUTTON) && + r.width()>=QTC_MIN_BTN_SIZE && r.height()>=QTC_MIN_BTN_SIZE); + + p->setPen(border); + if(itsFormMode) + { + // If we're itsFormMode (KHTML) then we need to draw the aa borders using pixmaps + // - so we need to draw 2 pixels away from each corner (so that the alpha + // blend lets through the background color... + p->drawLine(r.x()+2, r.y(), r.x()+r.width()-3, r.y()); + p->drawLine(r.x()+2, r.y()+r.height()-1, r.x()+r.width()-3, r.y()+r.height()-1); + p->drawLine(r.x(), r.y()+2, r.x(), r.y()+r.height()-3); + p->drawLine(r.x()+r.width()-1, r.y()+2, r.x()+r.width()-1, r.y()+r.height()-3); + + // If not rounding a corner need to draw the missing pixels! + if(!(round&CORNER_TL) || !largeArc) + { + p->drawPoint(r.x()+1, r.y()); + p->drawPoint(r.x(), r.y()+1); + } + if(!(round&CORNER_TR) || !largeArc) + { + p->drawPoint(r.x()+r.width()-2, r.y()); + p->drawPoint(r.x()+r.width()-1, r.y()+1); + } + if(!(round&CORNER_BR) || !largeArc) + { + p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1); + p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-2); + } + if(!(round&CORNER_BL) || !largeArc) + { + p->drawPoint(r.x()+1, r.y()+r.height()-1); + p->drawPoint(r.x(), r.y()+r.height()-2); + } + } + else + { + // If we're not itsFormMode (ie. not KHTML) then we can just draw 1 pixel in - as + // we can overwrite with the alpha colour. + p->drawLine(r.x()+1, r.y(), r.x()+r.width()-2, r.y()); + p->drawLine(r.x()+1, r.y()+r.height()-1, r.x()+r.width()-2, r.y()+r.height()-1); + p->drawLine(r.x(), r.y()+1, r.x(), r.y()+r.height()-2); + p->drawLine(r.x()+r.width()-1, r.y()+1, r.x()+r.width()-1, r.y()+r.height()-2); + } + + QColor largeArcMid(midColor(border, bgnd)), + aaColor(midColor(custom ? custom[3] : itsBackgroundCols[3], bgnd)); + QPixmap *pix=itsFormMode ? getPixelPixmap(border) : NULL; + + if(round&CORNER_TL) + { + if(largeArc) + { + p->drawPoint(r.x()+1, r.y()+1); + if(itsFormMode) + { + p->drawPixmap(r.x(), r.y()+1, *pix); + p->drawPixmap(r.x()+1, r.y(), *pix); + } + else + { + p->setPen(largeArcMid); + p->drawLine(r.x(), r.y()+1, r.x()+1, r.y()); + } + } + if(doCorners) + if(itsFormMode) + { + if(!largeArc) + p->drawPixmap(r.x(), r.y(), *pix); + } + else + { + p->setPen(largeArc ? bgnd : aaColor); + p->drawPoint(r.x(), r.y()); + } + } + else + p->drawPoint(r.x(), r.y()); + + p->setPen(border); + if(round&CORNER_TR) + { + if(largeArc) + { + p->drawPoint(r.x()+r.width()-2, r.y()+1); + if(itsFormMode) + { + p->drawPixmap(r.x()+r.width()-2, r.y(), *pix); + p->drawPixmap(r.x()+r.width()-1, r.y()+1, *pix); + } + else + { + p->setPen(largeArcMid); + p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-1, r.y()+1); + } + } + if(doCorners) + if(itsFormMode) + { + if(!largeArc) + p->drawPixmap(r.x()+r.width()-1, r.y(), *pix); + } + else + { + p->setPen(largeArc ? bgnd : aaColor); + p->drawPoint(r.x()+r.width()-1, r.y()); + } + } + else + p->drawPoint(r.x()+r.width()-1, r.y()); + + p->setPen(border); + if(round&CORNER_BR) + { + if(largeArc) + { + p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2); + if(itsFormMode) + { + p->drawPixmap(r.x()+r.width()-2, r.y()+r.height()-1, *pix); + p->drawPixmap(r.x()+r.width()-1, r.y()+r.height()-2, *pix); + } + else + { + p->setPen(largeArcMid); + p->drawLine(r.x()+r.width()-2, r.y()+r.height()-1, r.x()+r.width()-1, + r.y()+r.height()-2); + } + } + if(doCorners) + if(itsFormMode) + { + if(!largeArc) + p->drawPixmap(r.x()+r.width()-1, r.y()+r.height()-1, *pix); + } + else + { + p->setPen(largeArc ? bgnd : aaColor); + p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1); + } + } + else + p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1); + + p->setPen(border); + if(round&CORNER_BL) + { + if(largeArc) + { + p->drawPoint(r.x()+1, r.y()+r.height()-2); + if(itsFormMode) + { + p->drawPixmap(r.x(), r.y()+r.height()-2, *pix); + p->drawPixmap(r.x()+1, r.y()+r.height()-1, *pix); + } + else + { + p->setPen(largeArcMid); + p->drawLine(r.x(), r.y()+r.height()-2, r.x()+1, r.y()+r.height()-1); + } + } + if(doCorners) + if(itsFormMode) + { + if(!largeArc) + p->drawPixmap(r.x(), r.y()+r.height()-1, *pix); + } + else + { + p->setPen(largeArc ? bgnd : aaColor); + p->drawPoint(r.x(), r.y()+r.height()-1); + } + } + else + p->drawPoint(r.x(), r.y()+r.height()-1); + } + else + { + p->setPen(border); + p->setBrush(NoBrush); + p->drawRect(r); + } +} + +void QtCurveStyle::drawEntryField(QPainter *p, const QRect &rx, const QColorGroup &cg, + SFlags flags, bool highlight, int round, EWidget w) const +{ + const QColor *use(highlight ? itsMenuitemCols : buttonColors(cg)); + bool isSpin(WIDGET_SPIN==w), + doEtch(!itsFormMode && QTC_DO_EFFECT); + + QRect r(rx); + + if(doEtch) + r.addCoords(0, 1, 0, -1); + + if(isSpin) + { + if(QApplication::reverseLayout()) + r.addCoords(-1, 0, 0, 0); + + p->setPen(flags&Style_Enabled ? cg.base() : cg.background()); + p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1); + p->drawLine(r.x()+r.width()-3, r.y(), r.x()+r.width()-3, r.y()+r.height()-1); + } + + if(!itsFormMode) + p->fillRect(rx, cg.background()); + p->fillRect(QRect(rx.x()+2, rx.y()+2, rx.x()+rx.width()-3, rx.y()+rx.height()-3), + flags&Style_Enabled ? cg.base() : cg.background()); + + p->setPen(APPEARANCE_FLAT!=opts.appearance || highlight + ? midColor(flags&Style_Enabled ? cg.base() : cg.background(), use[3]) + : cg.base()); + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-(isSpin ? 0 : 2), r.y()+1); + + p->setPen(flags&Style_Enabled ? midColor(cg.base(), use[0]) : cg.background()); + p->drawLine(r.x()+r.width()-(isSpin && highlight ? 3 : 2), r.y()+1, + r.x()+r.width()-(isSpin && highlight ? 3 : 2), r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-(isSpin ? 0 : 2), r.y()+r.height()-2); + + if(highlight && isSpin) + { + p->setPen(use[QT_STD_BORDER]); + p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1); + } + + drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), round, use); + if(doEtch) + { + r=rx; + p->setClipRegion(r); + + if(!(round&CORNER_TR) && !(round&CORNER_BR)) + r.addCoords(0, 0, 2, 0); + if(!(round&CORNER_TL) && !(round&CORNER_BL)) + r.addCoords(-2, 0, 0, 0); + drawEtch(p, r, cg, true, true, EFFECT_SHADOW==opts.buttonEffect && WIDGET_BUTTON(w) && + !(flags &(Style_Down | Style_On | Style_Sunken))); + p->setClipping(false); + } +} + +static void drawArrow(QPainter *p, const QRect &r, const QColor &col, QStyle::PrimitiveElement pe, const Options &opts, bool small=false) +{ + QPointArray a; + + if(small) + switch(pe) + { + case QStyle::PE_ArrowUp: + a.setPoints(opts.vArrows ? 7 : 3, 2,0, 0,-2, -2,0, -2,1, -1,0, 1,0, 2,1); + break; + case QStyle::PE_ArrowDown: + a.setPoints(opts.vArrows ? 7 : 3, 2,0, 0,2, -2,0, -2,-1, -1,0, 1,0, 2,-1); + break; + case QStyle::PE_ArrowRight: + a.setPoints(opts.vArrows ? 7 : 3, 0,-2, 2,0, 0,2, -1,2, 0,1, 0,-1, -1,-2); + break; + case QStyle::PE_ArrowLeft: + a.setPoints(opts.vArrows ? 7 : 3, 0,-2, -2,0, 0,2, 1,2, 0,1, 0,-1, 1,-2); + break; + default: + return; + } + else // Large arrows... + switch(pe) + { + case QStyle::PE_ArrowUp: + a.setPoints(opts.vArrows ? 6 : 3, 3,1, 0,-2, -3,1, -2, 2, 0,0, 2,2); + break; + case QStyle::PE_ArrowDown: + a.setPoints(opts.vArrows ? 6 : 3, 3,-1, 0,2, -3,-1, -2,-2, 0,0, 2,-2); + break; + case QStyle::PE_ArrowRight: + a.setPoints(opts.vArrows ? 6 : 3, -1,-3, 2,0, -1,3, -2,2, 0,0, -2,-2); + break; + case QStyle::PE_ArrowLeft: + a.setPoints(opts.vArrows ? 6 : 3, 1,-3, -2,0, 1,3, 2,2, 0,0, 2,-2); + break; + default: + return; + } + + if(a.isNull()) + return; + + p->save(); + a.translate((r.x()+(r.width()>>1)),(r.y()+(r.height()>>1))); + p->setBrush(col); + p->setPen(col); + p->drawPolygon(a); + p->restore(); +} + +void QtCurveStyle::drawArrow(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, + PrimitiveElement pe, bool small, bool checkActive) const +{ + const QColor &col(flags&Style_Enabled + ? checkActive && flags&Style_Active + ? cg.highlightedText() + : cg.text() + : cg.mid()); + + ::drawArrow(p, r, col, pe, opts, small); +} + +void QtCurveStyle::drawPrimitive(PrimitiveElement pe, QPainter *p, const QRect &r, + const QColorGroup &cg, SFlags flags, const QStyleOption &data) const +{ + switch(pe) + { + case PE_HeaderSection: + { + // Is it a taskbar button? Kicker uses PE_HeaderSection for these! :-( + // If the painter device is a QWidger, assume its not a taskbar button... + if(APP_KICKER==itsThemedApp && (!p->device() || !dynamic_cast<QWidget *>(p->device()))) + { + const QColor *use(buttonColors(cg)); + + if(flags&Style_Down) + flags=((flags|Style_Down)^Style_Down)| Style_Sunken; + flags|=Style_Enabled; +#if KDE_VERSION >= 0x30200 +#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500 + if(HOVER_KICKER==itsHover && itsHoverWidget) // && itsHoverWidget==p->device()) + flags|=Style_MouseOver; +#endif + itsFormMode=itsIsTransKicker; +#endif + drawLightBevel(p, r, cg, flags|Style_Horizontal, ROUNDED_ALL, + getFill(flags, use), use, true, false); +#if KDE_VERSION >= 0x30200 + itsFormMode=false; +#endif + } + else + { + bool isFirst(false), isLast(false), isTable(false); + QHeader *header(p && p->device() ? dynamic_cast<QHeader*>(p->device()) + : NULL); + + if (header) + { + if(header->parent() && ::qt_cast<const QTable *>(header->parent())) + { + QTable *tbl((QTable *)(header->parent())); + + isTable=true; + if(flags&Style_Horizontal) + isFirst=tbl->columnAt(r.x()+header->offset())==0; + else + isLast=tbl->rowAt(r.y()+header->offset())==(tbl->numRows()-1); + } + else + isFirst = header->mapToIndex(header->sectionAt(r.x()+header->offset())) == 0; + } + else if(0==flags) // Header on popup menu? + { + const QColor *use(buttonColors(cg)); + + drawLightBevel(p, r, cg, flags|Style_Horizontal, ROUNDED_ALL, + getFill(flags, use), use); + break; + } + + flags=((flags|Style_Sunken)^Style_Sunken)| Style_Raised; + + if(QTC_NO_SECT!=itsHoverSect && HOVER_HEADER==itsHover && itsHoverWidget) + { + QHeader *hd(::qt_cast<QHeader *>(itsHoverWidget)); + + if(hd && hd->isClickEnabled(itsHoverSect) && r==hd->sectionRect(itsHoverSect)) + flags|=Style_MouseOver; + } + + bool sunken(flags &(Style_Down | Style_On | Style_Sunken)); + + drawBevelGradient(getFill(flags, itsBackgroundCols), !sunken, p, r, flags&Style_Horizontal, + sunken ? SHADE_BEVEL_GRAD_SEL_LIGHT : SHADE_BEVEL_GRAD_LIGHT, + sunken ? SHADE_BEVEL_GRAD_SEL_DARK : SHADE_BEVEL_GRAD_DARK, + sunken, opts.lvAppearance, WIDGET_LISTVIEW_HEADER); + + if(APPEARANCE_RAISED==opts.lvAppearance) + { + p->setPen(itsBackgroundCols[4]); + if(flags&Style_Horizontal) + p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1, r.y()+r.height()-2); + else + p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1); + } + + const QColor *border(borderColors(flags, NULL)); + + if(flags&Style_Horizontal) + { + if(border) + { + p->setPen(border[ORIGINAL_SHADE]); + p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1, + r.y()+r.height()-2); + p->setPen(border[QT_STD_BORDER]); + } + else + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + + if(!isFirst) + { + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x(), r.y()+5, r.x(), r.y()+r.height()-6); + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+1, r.y()+5, r.x()+1, r.y()+r.height()-6); + } + } + else + { + if(border) + { + p->setPen(border[ORIGINAL_SHADE]); + p->drawLine(r.x()+r.width()-2, r.y(), r.x()+r.width()-2, r.y()+r.height()-1); + p->setPen(border[QT_STD_BORDER]); + } + else + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x()+r.width()-1, r.y(), r.x()+r.width()-1, r.y()+r.height()-1); + + if(!isLast) + { + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x()+5, r.y()+r.height()-2, r.x()+r.width()-6, + r.y()+r.height()-2); + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+5, r.y()+r.height()-1, r.x()+r.width()-6, + r.y()+r.height()-1); + } + } + } + break; + } + case PE_HeaderArrow: + drawArrow(p, r, cg, flags, flags&Style_Up ? PE_ArrowUp : PE_ArrowDown); + break; + case PE_ButtonBevel: + flags|=Style_Enabled; + case PE_ButtonCommand: + case PE_ButtonTool: + case PE_ButtonDropDown: + { + const QColor *use(buttonColors(cg)); + bool glassMod(PE_ButtonTool==pe && IS_GLASS(opts.appearance) && + IS_GLASS(opts.toolbarAppearance)), + mdi(!(flags&QTC_CHECK_BUTTON) && (!(flags&QTC_STD_TOOLBUTTON)||flags&QTC_NO_ETCH_BUTTON) && + PE_ButtonTool==pe && r.width()<=16 && r.height()<=16), + operaMdi(PE_ButtonTool==pe && APP_OPERA==itsThemedApp && r.width()==16 && r.height()==16); + + // If its not sunken, its raised-don't want flat buttons. + if(!(flags&Style_Sunken)) + flags|=Style_Raised; + + if(PE_ButtonTool==pe && flags&QTC_VERTICAL_TB_BUTTON) + { + flags-=QTC_VERTICAL_TB_BUTTON; + if(flags&Style_Horizontal) + flags-=Style_Horizontal; + } + + // Dont AA' MDI windows' control buttons... + itsFormMode=itsFormMode || mdi || operaMdi; + + if(mdi || operaMdi) + flags|=Style_Horizontal; + + drawLightBevel(p, r, cg, glassMod ? flags : flags|Style_Horizontal, +#if KDE_VERSION >= 0x30200 + (APP_KORN==itsThemedApp && itsIsTransKicker && PE_ButtonTool==pe) || +#endif + operaMdi || mdi + ? ROUNDED_NONE + : ROUNDED_ALL, + getFill(flags, use), use, true, true, + flags&QTC_NO_ETCH_BUTTON ? WIDGET_NO_ETCH_BTN : WIDGET_STD_BUTTON); + + if(IND_COLORED==opts.defBtnIndicator && (flags&Style_ButtonDefault)) + { + const QColor *cols=itsMouseOverCols && flags&Style_MouseOver ? itsMouseOverCols : itsDefBtnCols; + QRegion outer(r); + QRect r2(r); + + if(!itsFormMode && QTC_DO_EFFECT) + r2.addCoords(0, 1, 0, -1); + + r2.addCoords(COLORED_BORDER_SIZE, COLORED_BORDER_SIZE, -COLORED_BORDER_SIZE, + -COLORED_BORDER_SIZE); + + QRegion inner(r2); + + p->setClipRegion(outer.eor(inner)); + + drawLightBevel(p, r, cg, glassMod ? flags : flags|Style_Horizontal, + flags&QTC_CHECK_BUTTON +#if KDE_VERSION >= 0x30200 + || (APP_KORN==itsThemedApp && itsIsTransKicker && PE_ButtonTool==pe) +#endif + ? ROUNDED_NONE : ROUNDED_ALL, + cols[QTC_MO_DEF_BTN], cols, true, true, + WIDGET_DEF_BUTTON); + p->setClipping(false); + } + itsFormMode=false; + break; + } + + case PE_ButtonDefault: + switch(opts.defBtnIndicator) + { + case IND_CORNER: + { + const QColor *use(buttonColors(cg)); + QPointArray points; + bool sunken(flags&Style_Down || flags&Style_Sunken); + int offset(sunken ? 4 : 3); + + points.setPoints(3, r.x()+offset, r.y()+offset+1, r.x()+offset+6, r.y()+offset+1, + r.x()+offset, r.y()+offset+7); + + p->setBrush(use[sunken ? 0 : 4]); + p->setPen(use[sunken ? 0 : 4]); + p->drawPolygon(points); + break; + } + default: + break; + } + break; + case PE_CheckMark: + if(flags&Style_On) + { + QPixmap *pix(getPixmap(flags&Style_Enabled + ? (flags&Style_Selected && !(flags&QTC_LISTVIEW_ITEM)) || + (flags&Style_Active && flags&QTC_MENU_ITEM) + ? cg.highlightedText() + : itsCheckRadioCol + : cg.mid(), + PIX_CHECK, 1.0)); + + p->drawPixmap(r.center().x()-(pix->width()/2), r.center().y()-(pix->height()/2), + *pix); + } + else if (!(flags&Style_Off)) // tri-state + { + int x(r.center().x()), y(r.center().y()); + + p->setPen(flags&Style_Enabled + ? flags&Style_Selected && !(flags&QTC_LISTVIEW_ITEM) + ? cg.highlightedText() + : itsCheckRadioCol + : cg.mid()); + p->drawLine(x-3, y, x+3, y); + p->drawLine(x-3, y+1, x+3, y+1); + } + break; + case PE_CheckListController: + { + QCheckListItem *item(data.checkListItem()); + + if(item) + { + const QColor *bc(borderColors(flags, NULL)), + *btn(buttonColors(cg)), + *use(bc ? bc : btn); + int x(r.x()+1), y(r.y()+2); + + p->drawPixmap(x, y, *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver + ? 4 : QT_BORDER(flags&Style_Enabled)], + PIX_RADIO_BORDER, 0.8)); + ::drawArrow(p, QRect(r.x()-1, r.y()-1, r.width(), r.height()), + use[opts.coloredMouseOver && flags&Style_MouseOver ? 4:5], PE_ArrowDown, opts); + } + break; + } + case PE_CheckListIndicator: + { + QCheckListItem *item(data.checkListItem()); + + if(item) + { + QListView *lv(item->listView()); + + p->setPen(QPen(flags&Style_Enabled ? cg.text() + : lv->palette().color(QPalette::Disabled, + QColorGroup::Text))); + if (flags&Style_Selected) + { + flags-=Style_Selected; + if(!lv->rootIsDecorated() && !((item->parent() && 1==item->parent()->rtti() && + QCheckListItem::Controller==((QCheckListItem*)item->parent())->type()))) + { + p->fillRect(0, 0, r.x()+lv->itemMargin()+r.width()+4, item->height(), + cg.brush(QColorGroup::Highlight)); + if(item->isEnabled()) + { + p->setPen(QPen(cg.highlightedText())); + flags+=Style_Selected; + } + } + } + + QRect checkRect(r.x()+1, r.y()+1, QTC_CHECK_SIZE, QTC_CHECK_SIZE); + drawPrimitive(PE_Indicator, p, checkRect, cg, flags|QTC_LISTVIEW_ITEM); + } + break; + } + case PE_IndicatorMask: + if(QTC_ROUNDED) + { + p->fillRect(r, color0); + p->fillRect(r.x()+1, r.y(), r.width()-2, r.height(), color1); + p->setPen(color1); + p->drawLine(r.x(), r.y()+1, r.x(), r.y()+r.height()-2); + p->drawLine(r.x()+r.width()-1, r.y()+1, r.x()+r.width()-1, r.y()+r.height()-2); + } + else + p->fillRect(r, color1); + break; + case PE_Indicator: + { + bool on(flags&Style_On || !(flags&Style_Off)); + SFlags sflags(!(flags&Style_Off) ? flags|Style_On : flags); + + if(!itsFormMode && sflags&Style_MouseOver && HOVER_NONE==itsHover) + sflags-=Style_MouseOver; + + const QColor *bc(borderColors(sflags, NULL)), + *btn(buttonColors(cg)), + *use(bc ? bc : btn), + &bgnd(sflags&Style_Enabled + ? sflags&Style_MouseOver + ? use[QTC_CR_MO_FILL] + : cg.base() + : cg.background()); + + if(IS_FLAT(opts.appearance)) + p->fillRect(QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), bgnd); + else + drawBevelGradient(bgnd, false, p, QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2), true, + getWidgetShade(WIDGET_TROUGH, true, false, APPEARANCE_GRADIENT), + getWidgetShade(WIDGET_TROUGH, false, false, APPEARANCE_GRADIENT), + false, APPEARANCE_GRADIENT, WIDGET_TROUGH); + + p->setPen(midColor(sflags&Style_Enabled ? cg.base() : cg.background(), use[3])); + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); + + drawBorder(cg.background(), p, r, cg, (SFlags)(sflags|Style_Horizontal|QTC_CHECK_BUTTON), + ROUNDED_ALL, use, WIDGET_OTHER, !(flags&QTC_LISTVIEW_ITEM)); + + if(on) + drawPrimitive(PE_CheckMark, p, r, cg, flags); + break; + } + case PE_CheckListExclusiveIndicator: + { + QCheckListItem *item(data.checkListItem()); + + if(item) + { + const QColor *bc(borderColors(flags, NULL)), + *btn(buttonColors(cg)), + *use(bc ? bc : btn), + &on(flags&Style_Enabled + ? itsCheckRadioCol + : cg.mid()); + + int x(r.x()), y(r.y()+2); + + p->drawPixmap(x, y, *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)], + PIX_RADIO_BORDER, 0.8)); + + if(flags&Style_On) + p->drawPixmap(x, y, *getPixmap(on, PIX_RADIO_ON, 1.0)); + } + break; + } + case PE_ExclusiveIndicator: + case PE_ExclusiveIndicatorMask: + { + int x(r.x()), y(r.y()); + + if(PE_ExclusiveIndicatorMask==pe) + { + p->fillRect(r, color0); + p->setPen(Qt::color1); + p->setBrush(Qt::color1); + p->drawPie(r, 0, 5760); + } + else + { + QPointArray clipRegion; + + clipRegion.setPoints(8, x, y+8, x, y+4, x+4, y, x+8, y, + x+12, y+4, x+12, y+8, x+8, y+12, x+4, y+12); + + SFlags sflags(flags); + + if(!itsFormMode && sflags&Style_MouseOver && HOVER_NONE==itsHover) + sflags-=Style_MouseOver; + + const QColor *bc(borderColors(sflags, NULL)), + *btn(buttonColors(cg)), + *use(bc ? bc : btn); + const QColor &on(sflags&Style_Enabled + ? sflags&Style_Selected && !(flags&QTC_LISTVIEW_ITEM) + ? cg.highlightedText() + : itsCheckRadioCol + : cg.mid()), + &bgnd(sflags&Style_Enabled + ? sflags&Style_MouseOver + ? use[QTC_CR_MO_FILL] + : cg.base() + : cg.background()); + bool set(sflags&Style_On); + + p->save(); + p->fillRect(r, cg.background()); + + p->setClipRegion(QRegion(clipRegion)); + if(IS_FLAT(opts.appearance)) + p->fillRect(QRect(x+1, y+1, r.width()-2, r.height()-2), bgnd); + else + drawBevelGradient(bgnd, false, p, QRect(x+1, y+1, r.width()-2, r.height()-2), true, + getWidgetShade(WIDGET_TROUGH, true, false, APPEARANCE_GRADIENT), + getWidgetShade(WIDGET_TROUGH, false, false, APPEARANCE_GRADIENT), + false, APPEARANCE_GRADIENT, WIDGET_TROUGH); + + p->setClipping(false); + + p->drawPixmap(r.x(), r.y(), + *getPixmap(use[opts.coloredMouseOver && sflags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)], + PIX_RADIO_BORDER, 0.8)); + + if(QApplication::NormalColor!=QApplication::colorSpec() || itsFormMode) + { + p->setPen(QPen(use[opts.coloredMouseOver && sflags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)], 1)); + p->drawArc(r, 0, 5760); + } + + if(set) + p->drawPixmap(r.x(), r.y(), *getPixmap(on, PIX_RADIO_ON, 1.0)); + if(QApplication::NormalColor==QApplication::colorSpec() || itsFormMode) + p->drawPixmap(r.x(), r.y(), *getPixmap(btn[sflags&Style_MouseOver ? 3 : 4], PIX_RADIO_LIGHT)); + p->restore(); + } + break; + } + case PE_DockWindowSeparator: + { + QRect r2(r); + + r2.addCoords(-1, -1, 2, 2); + drawMenuOrToolBarBackground(p, r2, cg, false, flags&Style_Horizontal); + + switch(opts.toolbarSeparators) + { + case LINE_NONE: + break; + case LINE_FLAT: + case LINE_SUNKEN: + if(r.width()<r.height()) + { + int x(r.x()+((r.width()-2) / 2)); + + p->setPen(itsBackgroundCols[LINE_SUNKEN==opts.toolbarSeparators ? 3 : 4]); + p->drawLine(x, r.y()+6, x, r.y()+r.height()-7); + if(LINE_SUNKEN==opts.toolbarSeparators) + { + p->setPen(itsBackgroundCols[0]); + p->drawLine(x+1, r.y()+6, x+1, r.y()+r.height()-7); + } + } + else + { + int y(r.y()+((r.height()-2) / 2)); + + p->setPen(itsBackgroundCols[LINE_SUNKEN==opts.toolbarSeparators ? 3 : 4]); + p->drawLine(r.x()+6, y, r.x()+r.width()-7, y); + if(LINE_SUNKEN==opts.toolbarSeparators) + { + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+6, y+1, r.x()+r.width()-7, y+1); + } + } + break; + default: + case LINE_DOTS: + drawDots(p, r, !(flags & Style_Horizontal), 1, 5, itsBackgroundCols, 0, 5); + } + break; + } + case PE_Splitter: + { + if(itsHoverWidget && itsHoverWidget == p->device()) + flags|=Style_MouseOver; + + const QColor *use(buttonColors(cg)); + const QColor *border(borderColors(flags, use)); + + p->fillRect(r, QColor(flags&Style_MouseOver + ? shade(cg.background(), opts.highlightFactor) + : cg.background())); + switch(opts.splitters) + { + default: + case LINE_DOTS: + drawDots(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 1, border, 0, 5); + break; + case LINE_SUNKEN: + drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 1, border, 0, 3); + break; + case LINE_FLAT: + drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 3, border, 0, 3, 0, false); + break; + case LINE_DASHES: + drawLines(p, r, flags&Style_Horizontal, NUM_SPLITTER_DASHES, 1, border, 0, 3, 0); + } + break; + } + case PE_DockWindowResizeHandle: + { + const QColor *use(backgroundColors(cg)); + + drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), + ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_RAISED, false); + break; + } + case PE_GroupBoxFrame: + case PE_PanelGroupBox: + if (!opts.framelessGroupBoxes) + if(APP_OPENOFFICE==itsThemedApp || data.lineWidth()>0 || data.isDefault()) + { + const QColor *use(backgroundColors(cg)); + + drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), + ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_FLAT); + } + else + QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data); + break; + case PE_Panel: + case PE_WindowFrame: + if(APP_OPENOFFICE==itsThemedApp || data.lineWidth()>0 || data.isDefault()) + { + const QColor *use( +#ifdef QTC_HIGHLIGHT_SCROLVIEWS + flags&Style_HasFocus ? itsMenuitemCols : +#endif + backgroundColors(cg)); + + itsFormMode=itsIsTransKicker; + drawBorder(cg.background(), p, r, cg, + (SFlags)(flags|Style_Horizontal|Style_Enabled), + ROUNDED_ALL, use, WIDGET_OTHER, APP_KICKER!=itsThemedApp, itsIsTransKicker + ? BORDER_FLAT + : flags&Style_Sunken + ? BORDER_SUNKEN + : BORDER_RAISED); + itsFormMode=false; + } + else + QCommonStyle::drawPrimitive(pe, p, r, cg, flags, data); + break; + case PE_PanelTabWidget: + { + const QColor *use(backgroundColors(cg)); + + drawBorder(cg.background(), p, r, cg, + (SFlags)(flags|Style_Horizontal|Style_Enabled), + ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_RAISED, false); + break; + } + case PE_PanelPopup: + { + const QColor *use(backgroundColors(cg)); + + p->setPen(use[QT_STD_BORDER]); + p->setBrush(NoBrush); + p->drawRect(r); + if(opts.lighterPopupMenuBgnd) + { + p->setPen(/*opts.lighterPopupMenuBgnd ? */itsLighterPopupMenuBgndCol/* : cg.background()*/); + p->drawRect(QRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2)); + } + else + { + p->setPen(use[0]); + p->drawLine(r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); + p->drawLine(r.x()+1, r.y()+1, r.x()+1, r.y()+r.height()-2); + p->setPen(use[QT_FRAME_DARK_SHADOW]); + p->drawLine(r.x()+1, r.y()+r.height()-2, r.x()+r.width()-2, r.y()+r.height()-2); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()+r.height()-2); + } + break; + } + case PE_TabBarBase: + { + const QColor *use(backgroundColors(cg)); + bool flat(APPEARANCE_FLAT==opts.appearance); + + if(data.isDefault() || data.lineWidth()>1) + { + p->setPen(use[QT_STD_BORDER]); + p->setBrush(NoBrush); + p->drawRect(r); + qDrawShadePanel(p, r.x()+1, r.y()+1, r.width()-2, r.height()-2, + QColorGroup(use[flat ? ORIGINAL_SHADE : 4], use[ORIGINAL_SHADE], + use[0], use[flat ? ORIGINAL_SHADE : 4], use[2], + cg.text(), use[ORIGINAL_SHADE]), flags & Style_Sunken, + data.isDefault() ? 1 : data.lineWidth()-1); + } + else + qDrawShadePanel(p, r, QColorGroup(use[flat ? ORIGINAL_SHADE : 5], + use[ORIGINAL_SHADE], use[0], use[flat ? ORIGINAL_SHADE : 5], use[2], + cg.text(), use[ORIGINAL_SHADE]), flags & Style_Sunken, + data.isDefault() ? 2 : data.lineWidth()); + break; + } + case PE_PanelDockWindow: + case PE_PanelMenuBar: + { + // fix for toolbar lag (from Mosfet Liquid) + QWidget *w = dynamic_cast<QWidget *>(p->device()); + + if(w) + { + if(PaletteButton==w->backgroundMode()) + w->setBackgroundMode(PaletteBackground); + + if(itsActive && opts.shadeMenubarOnlyWhenActive && SHADE_NONE!=opts.shadeMenubars) + { + QWidget *top=w->topLevelWidget(); + + if(top && !top->isActiveWindow()) + itsActive=false; + } + } + + drawMenuOrToolBarBackground(p, r, cg, PE_PanelMenuBar==pe, + PE_PanelMenuBar==pe || r.width()>r.height()); + + if(TB_NONE!=opts.toolbarBorders) + { + const QColor *use=PE_PanelMenuBar==pe && itsActive + ? itsMenubarCols + : backgroundColors(cg.background()); + bool dark(TB_DARK==opts.toolbarBorders || TB_DARK_ALL==opts.toolbarBorders); + + if(TB_DARK_ALL==opts.toolbarBorders || TB_LIGHT_ALL==opts.toolbarBorders) + { + p->setPen(use[0]); + p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + p->drawLine(r.x(), r.y(), r.x(), r.y()+r.width()-1); + p->setPen(use[dark ? 3 : 4]); + p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + p->drawLine(r.x()+r.width()-1, r.y(), r.x()+r.width()-1, r.y()+r.height()-1); + } + else if(PE_PanelMenuBar==pe || r.width()>r.height()) + { + if(PE_PanelMenuBar!=pe) + { + p->setPen(use[0]); + p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + } + p->setPen(use[dark ? 3 : 4]); + p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + } + else + { + p->setPen(use[0]); + p->drawLine(r.x(), r.y(), r.x(), r.y()+r.height()-1); + p->setPen(use[dark ? 3 : 4]); + p->drawLine(r.x()+r.width()-1, r.y(), r.x()+r.width()-1, r.y()+r.height()-1); + } + } + break; + } + case PE_ScrollBarAddLine: + case PE_ScrollBarSubLine: + { + QRect br(r), + ar(r); + const QColor *use(itsButtonCols); // buttonColors(cg)); + + pe=flags&Style_Horizontal + ? PE_ScrollBarAddLine==pe ? PE_ArrowRight : PE_ArrowLeft + : PE_ScrollBarAddLine==pe ? PE_ArrowDown : PE_ArrowUp; + + int round=PE_ArrowRight==pe ? ROUNDED_RIGHT : + PE_ArrowLeft==pe ? ROUNDED_LEFT : + PE_ArrowDown==pe ? ROUNDED_BOTTOM : + PE_ArrowUp==pe ? ROUNDED_TOP : ROUNDED_NONE; + + if(flags&Style_Down) + ar.addCoords(1, 1, 1, 1); + + switch(opts.scrollbarType) + { + default: + case SCROLLBAR_WINDOWS: + break; + case SCROLLBAR_KDE: + case SCROLLBAR_PLATINUM: + if(PE_ArrowLeft==pe && r.x()>3) + { + round=ROUNDED_NONE; + br.addCoords(0, 0, 1, 0); + ar.addCoords(1, 0, 1, 0); + } + else if(PE_ArrowUp==pe && r.y()>3) + { + round=ROUNDED_NONE; + br.addCoords(0, 0, 0, 1); + ar.addCoords(0, 1, 0, 1); + } + break; + case SCROLLBAR_NEXT: + if(PE_ArrowRight==pe) + { + round=ROUNDED_NONE; + br.addCoords(-1, 0, 0, 0); + ar.addCoords(-1, 0, 0, -1); + } + else if(PE_ArrowDown==pe) + { + round=ROUNDED_NONE; + br.addCoords(0, -1, 0, 0); + ar.addCoords(0, -1, 0, -1); + } + break; + } + drawLightBevel(p, br, cg, flags|Style_Raised, + round, getFill(flags, use), use, true, true, WIDGET_SB_BUTTON); + + drawPrimitive(pe, p, ar, cg, flags); + break; + } + case PE_ScrollBarSlider: + drawSbSliderHandle(p, r, cg, flags); + break; + case PE_FocusRect: +#if 0 + // Menu item style selection... + if(opts.gtkComboMenus) + { + QWidget *widget(dynamic_cast<QWidget*>(p->device())); + + if(widget && 0==qstrcmp(widget->className(), "QViewportWidget") && + widget->parentWidget() && ::qt_cast<QListBox *>(widget->parentWidget()) && + widget->parentWidget()->parentWidget() && ::qt_cast<QComboBox *>(widget->parentWidget()->parentWidget())) + { + struct QtCurveListBoxItem : public QListBoxItem + { + void paintContents(QPainter *p) + { + paint(p); + } + }; + + QListBox *box=(QListBox *)widget->parentWidget(); + QtCurveListBoxItem *item=(QtCurveListBoxItem *)(box->item(box->currentItem())); + + if(item) + { + //p->fillRect(r, Qt::black); + drawMenuItem(p, r, cg, false, ROUNDED_ALL, + opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol + : itsBackgroundCols[ORIGINAL_SHADE], itsMenuitemCols); + item->paintContents(p); + break; + } + } + } +#endif +#ifndef QTC_PLAIN_FOCUS_ONLY + if(opts.stdFocus) + { +#endif + p->setPen(Qt::black); + p->drawWinFocusRect(r); +#ifndef QTC_PLAIN_FOCUS_ONLY + } + else + { + //Figuring out in what beast we are painting... + const QColor *use(backgroundColors(cg)); + QWidget *widget(dynamic_cast<QWidget*>(p->device())); + + if(r.width()<4 || r.height()<4 || + (widget && (dynamic_cast<QScrollView*>(widget->parent()) || + dynamic_cast<QListBox*>(widget->parent())))) + { + p->setPen(use[QT_FOCUS]); + p->drawRect(r); + } + else + drawBorder(cg.background(), p, r, cg, Style_Horizontal, + ROUNDED_ALL, use, WIDGET_OTHER, false, BORDER_FLAT, true, QT_FOCUS); + } +#endif + break; + case PE_ArrowUp: + case PE_ArrowDown: + case PE_ArrowRight: + case PE_ArrowLeft: + drawArrow(p, r, cg, flags, pe); + break; + case PE_SpinWidgetUp: + case PE_SpinWidgetDown: + case PE_SpinWidgetPlus: + case PE_SpinWidgetMinus: + { + QRect sr(r); + const QColor *use(buttonColors(cg)); + bool reverse(QApplication::reverseLayout()), + doEtch(!itsFormMode && QTC_DO_EFFECT); + + if(doEtch) + if(PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe) + sr.addCoords(0, 0, 0, -1); + else + sr.addCoords(0, 1, 0, 0); + + drawLightBevel(p, sr, cg, flags|Style_Horizontal, PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe + ? reverse + ? ROUNDED_BOTTOMLEFT + : ROUNDED_BOTTOMRIGHT + : reverse + ? ROUNDED_TOPLEFT + : ROUNDED_TOPRIGHT, + getFill(flags, use), use, true, true, WIDGET_SPIN); + + if(doEtch) + { + QRect er(r); + p->setClipRegion(er); + if(reverse) + er.addCoords(0, 0, 2, 0); + else + er.addCoords(-2, 0, 0, 0); + drawEtch(p, er, cg, PE_SpinWidgetUp==pe || PE_SpinWidgetPlus==pe, + PE_SpinWidgetDown==pe || PE_SpinWidgetMinus==pe); + p->setClipping(false); + } + + if(PE_SpinWidgetUp==pe || PE_SpinWidgetDown==pe) + { + sr.setY(sr.y()+(PE_SpinWidgetDown==pe ? -2 : 1)); + + if(flags&Style_Sunken) + sr.addCoords(1, 1, 1, 1); + + drawArrow(p, sr, cg, flags, PE_SpinWidgetUp==pe ? PE_ArrowUp : PE_ArrowDown, true); + } + else + { + int l(QMIN(r.width()-6, r.height()-6)); + QPoint c(r.x()+(r.width()/2), r.y()+(r.height()/2)); + + l/=2; + if(l%2 != 0) + --l; + + if(flags&Style_Sunken) + c+=QPoint(1, 1); + + p->setPen(cg.buttonText()); + p->drawLine(c.x()-l, c.y(), c.x()+l, c.y()); + if(PE_SpinWidgetPlus==pe) + p->drawLine(c.x(), c.y()-l, c.x(), c.y()+l); + } + break; + } + case PE_PanelLineEdit: + { + bool isReadOnly(false), + isEnabled(true); + // panel is highlighted by default if it has focus, but if we have access to the + // widget itself we can try to avoid highlighting in case it's readOnly or disabled. + if (p->device() && dynamic_cast<QLineEdit*>(p->device())) + { + QLineEdit *lineEdit(dynamic_cast<QLineEdit*>(p->device())); + isReadOnly = lineEdit->isReadOnly(); + isEnabled = lineEdit->isEnabled(); + + if(flags&Style_Enabled && isReadOnly) + flags-=Style_Enabled; + } + + // HACK!! (From Plastik) + // + // In this place there is no reliable way to detect if we are in khtml; the + // only thing we know is that khtml buffers its widgets into a pixmap. So + // when the paint device is a QPixmap, chances are high that we are in khtml. + // It's possible that this breaks other things, so let's see how it works... + if (p->device() && dynamic_cast<QPixmap*>(p->device())) + itsFormMode=true; + + drawEntryField(p, r, cg, flags, !isReadOnly && isEnabled && (flags&Style_HasFocus), + ROUNDED_ALL); + itsFormMode=false; + break; + } + case PE_StatusBarSection: + if(opts.drawStatusBarFrames) + KStyle::drawPrimitive(pe, p, r, cg, flags, data); + break; + default: + KStyle::drawPrimitive(pe, p, r, cg, flags, data); + } +} + +static QString elliditide(const QString &text, const QFontMetrics &fontMetrics, int space) +{ + // Chop and insert ellide into title if text is too wide + QString title(text); + + if (fontMetrics.width(text) > space) + { + QString ellipsis("..."); + + while (fontMetrics.width(title+ellipsis)>space && !title.isEmpty()) + title=title.left(title.length()-1); + return title+ellipsis; + } + + return title; +} + +void QtCurveStyle::drawKStylePrimitive(KStylePrimitive kpe, QPainter *p, const QWidget *widget, + const QRect &r, const QColorGroup &cg, SFlags flags, + const QStyleOption &opt) const +{ + ELine handles(kpe!=KPE_ToolBarHandle && LINE_DASHES==opts.handles ? LINE_SUNKEN + : opts.handles); + + switch(kpe) + { + case KPE_ToolBarHandle: + { + QRect r2(r); + r2.addCoords(-1, -1, 2, 2); + drawMenuOrToolBarBackground(p, r2, cg, false, flags&Style_Horizontal); + drawHandleMarkers(p, r, flags, true, handles); + break; + } + case KPE_DockWindowHandle: + { + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + if ((w <= 2) || (h <= 2)) + p->fillRect(r, cg.background().dark(105)); + else + { + QWidget *wid(const_cast<QWidget*>(widget)); + bool horizontal(flags & Style_Horizontal); + QFont fnt(QApplication::font(wid)); + QPixmap pix; + QString title(wid->parentWidget()->caption()); + QPainter p2; + + fnt.setPointSize(fnt.pointSize()-2); + + // Draw the item on an off-screen pixmap to preserve Xft antialiasing for + // vertically oriented handles. + if (horizontal) + pix.resize(h-2, w-2); + else + pix.resize(w-2, h-2); + + p2.begin(&pix); + p2.fillRect(pix.rect(), cg.background().dark(105)); + p2.setPen(cg.text()); + p2.setFont(fnt); + p2.drawText(pix.rect(), AlignCenter, + elliditide(title, QFontMetrics(fnt), pix.width())); + p2.end(); + + if (horizontal) + { + QWMatrix m; + + m.rotate(-90.0); + QPixmap vpix(pix.xForm(m)); + bitBlt(wid, r.x()+1, r.y()+1, &vpix); + } + else + bitBlt(wid, r.x()+1, r.y()+1, &pix); + } + break; + } + case KPE_GeneralHandle: + drawHandleMarkers(p, r, flags, false, handles); + break; + case KPE_SliderGroove: + drawSliderGroove(p, r, cg, flags, widget); + break; + case KPE_SliderHandle: + drawSliderHandle(p, r, cg, flags, widget ? ::qt_cast<QSlider *>(widget) : NULL); + break; + case KPE_ListViewExpander: + { + QRect ar(r.x()+((r.width()-(QTC_LV_SIZE+4))>>1), r.y()+((r.height()-(QTC_LV_SIZE+4))>>1), QTC_LV_SIZE+4, + QTC_LV_SIZE+4); + + if(opts.lvLines) + { + int lo(QTC_ROUNDED ? 2 : 0); + + p->setPen(cg.mid()); + p->drawLine(ar.x()+lo, ar.y(), (ar.x()+ar.width()-1)-lo, ar.y()); + p->drawLine(ar.x()+lo, ar.y()+ar.height()-1, (ar.x()+ar.width()-1)-lo, + ar.y()+ar.height()-1); + p->drawLine(ar.x(), ar.y()+lo, ar.x(), (ar.y()+ar.height()-1)-lo); + p->drawLine(ar.x()+ar.width()-1, ar.y()+lo, ar.x()+ar.width()-1, + (ar.y()+ar.height()-1)-lo); + + if(QTC_ROUNDED) + { + p->drawPoint(ar.x()+1, ar.y()+1); + p->drawPoint(ar.x()+1, ar.y()+ar.height()-2); + p->drawPoint(ar.x()+ar.width()-2, ar.y()+1); + p->drawPoint(ar.x()+ar.width()-2, ar.y()+ar.height()-2); + p->setPen(midColor(cg.mid(), cg.background())); + p->drawLine(ar.x(), ar.y()+1, ar.x()+1, ar.y()); + p->drawLine(ar.x()+ar.width()-2, ar.y(), ar.x()+ar.width()-1, ar.y()+1); + p->drawLine(ar.x(), ar.y()+ar.height()-2, ar.x()+1, ar.y()+ar.height()-1); + p->drawLine(ar.x()+ar.width()-2, ar.y()+ar.height()-1, ar.x()+ar.width()-1, + ar.y()+ar.height()-2); + } + } + + drawArrow(p, ar, cg, flags|Style_Enabled, flags&Style_On // Collapsed = On + ? QApplication::reverseLayout() + ? PE_ArrowLeft + : PE_ArrowRight + : PE_ArrowDown); + break; + } + case KPE_ListViewBranch: + if(opts.lvLines) + { + p->setPen(cg.mid()); + if (flags&Style_Horizontal) + { + if(r.width()>0) + p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + } + else + if(r.height()>0) + p->drawLine(r.x(), r.y(), r.x(), r.y()+r.height()-1); + } + break; + default: + KStyle::drawKStylePrimitive(kpe, p, widget, r, cg, flags, opt); + } +} + +void QtCurveStyle::drawControl(ControlElement control, QPainter *p, const QWidget *widget, + const QRect &r, const QColorGroup &cg, SFlags flags, + const QStyleOption &data) const +{ + if(widget==itsHoverWidget) + flags|=Style_MouseOver; + + switch(control) + { + case CE_TabBarTab: + { + const QTabBar *tb((const QTabBar *)widget); + int tabIndex(tb->indexOf(data.tab()->identifier())), + dark(APPEARANCE_FLAT==opts.appearance ? ORIGINAL_SHADE : QT_FRAME_DARK_SHADOW); + bool cornerWidget(false), + bottomCornerWidget(false), + reverse(QApplication::reverseLayout()), + firstTab(0==tabIndex), + lastTab((tb->count()-1)==tabIndex), +// isFirstKTabCtlTab(firstTab && widget->parent() +// ? 0==qstrcmp("KTabCtl", widget->parent()->className()) +// : false), + active(flags & Style_Selected), + itsHover(itsHoverTab && itsHoverTab->isEnabled() && data.tab()==itsHoverTab && + !(flags&Style_Selected) && + tb->currentTab()!=tabIndex); + const QColor &fill(getTabFill(flags&Style_Selected, itsHover, itsBackgroundCols)); + + if(reverse) + { + bool oldLast=lastTab; + + lastTab=firstTab; + firstTab=oldLast; + } + + if(::qt_cast<const QTabWidget *>(tb->parent())) + { + const QTabWidget *tw((const QTabWidget*)tb->parent()); + + // is there a corner widget in the (top) left edge? + if(tw->cornerWidget(Qt::TopLeft)) + cornerWidget=true; + if(tw->cornerWidget(Qt::BottomLeft)) + bottomCornerWidget=true; + } + + QRect tr(r); + bool top(QTabBar::TriangularAbove==tb->shape() || QTabBar::RoundedAbove==tb->shape()); + + if(!active) + if(top) + tr.addCoords(0, 2, 0, 0); + else + tr.addCoords(0, 0, 0, -2); + + if(!firstTab && top && (APP_TORA==itsThemedApp || (APP_OPENOFFICE==itsThemedApp && !active))) + tr.addCoords(-1, 0, 0, 0); + + p->setClipRect(QRect(tr.x(), top ? tr.y() : tr.y()+2, tr.width(), top ? tr.height()-2 : tr.height()), + QPainter::CoordPainter); + + if(APPEARANCE_INVERTED==opts.appearance && active) + p->fillRect(tr, cg.background()); + else + drawBevelGradient(fill, top, p, tr, true, + top || (active && opts.colorSelTab) ? SHADE_TAB_SEL_LIGHT + : SHADE_BOTTOM_TAB_SEL_DARK, + top || (active && opts.colorSelTab) ? SHADE_TAB_SEL_DARK + : SHADE_BOTTOM_TAB_SEL_LIGHT, + active, active ? QTC_SEL_TAB_APP : QTC_NORM_TAB_APP, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT); + + drawBorder(cg.background(), p, tr, cg, flags|Style_Horizontal|Style_Enabled, + active + ? (top ? ROUNDED_TOP : ROUNDED_BOTTOM) + : firstTab + ? (top ? ROUNDED_TOPLEFT : ROUNDED_BOTTOMLEFT) + : lastTab + ? (top ? ROUNDED_TOPRIGHT : ROUNDED_BOTTOMRIGHT) + : ROUNDED_NONE, NULL, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT, true, + active && !opts.colorSelTab ? BORDER_RAISED : BORDER_FLAT, false); + p->setClipping(false); + + if(top) + { + if(active) + { + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawPoint(r.x(), r.y()+r.height()-2); + p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-2); + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+1, r.y()+r.height()-3, r.x()+1, r.y()+r.height()-1); + //p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-1); + p->setPen(itsBackgroundCols[QT_FRAME_DARK_SHADOW]); + p->drawPoint(r.x()+r.width()-2, r.y()+r.height()-2); + } + else + { + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x(), r.y()+r.height()-2, r.x()+r.width()-1, r.y()+r.height()-2); + + if(opts.coloredMouseOver && itsHover) + { + p->setPen(itsMouseOverCols[ORIGINAL_SHADE]); + p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y()+1, + tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()+1); + + p->setPen(itsMouseOverCols[QT_STD_BORDER]); + p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y(), + tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()); + } + } + + if(((!reverse && firstTab) || (lastTab && reverse)) && !cornerWidget) + { + int x(reverse ? r.x()+r.width()-1 : r.x()), + x2(reverse ? x-1 : x+1); + + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(x, r.y()+r.height()-1, x, r.height()-2); + if(active) + { + p->setPen(itsBackgroundCols[reverse ? dark : 0]); + p->drawLine(x2, r.y()+r.height()-1, x2, r.height()-2); + } + } + + if(active && opts.highlightTab) + { + p->setPen(itsMenuitemCols[0]); + p->drawLine(tr.left(), tr.top()+1, tr.right(), tr.top()+1); + p->setPen(midColor(fill, itsMenuitemCols[0], IS_FLAT(opts.tabAppearance) ? 1.0 : 1.2)); + p->drawLine(tr.left(), tr.top()+2, tr.right(), tr.top()+2); + + p->setClipRect(QRect(tr.x(), tr.y(), tr.width(), 3), QPainter::CoordPainter); + drawBorder(cg.background(), p, tr, cg, flags|Style_Horizontal|Style_Enabled, + ROUNDED_ALL, itsMenuitemCols, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT, + true, BORDER_FLAT, false, 3); + p->setClipping(false); + } + + // Round top-left corner... + if(ROUND_FULL==opts.round && APP_TORA!=itsThemedApp && firstTab && !active && !cornerWidget && !reverse) // && !isFirstKTabCtlTab) + { + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawPoint(r.x()+1, r.y()+r.height()-1); + p->setPen(midColor(itsBackgroundCols[QT_STD_BORDER], cg.background())); + p->drawPoint(r.x()+1, r.y()+r.height()-2); + } + } + else + { + if(active) + { + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawPoint(r.x(), r.y()+1); + p->drawPoint(r.x()+r.width()-1, r.y()+1); + p->setPen(itsBackgroundCols[0]); + p->drawLine(r.x()+1, r.y()+2, r.x()+1, r.y()); + p->setPen(itsBackgroundCols[QT_FRAME_DARK_SHADOW]); + p->drawLine(r.x()+r.width()-2, r.y()+1, r.x()+r.width()-2, r.y()); + p->drawPoint(r.x()+r.width()-1, r.y()); + } + else + { + p->setPen(itsBackgroundCols[dark]); + p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x(), r.y()+1, r.x()+r.width()-1, r.y()+1); + + if(opts.coloredMouseOver && itsHover) + { + p->setPen(itsMouseOverCols[ORIGINAL_SHADE]); + p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y()+tr.height()-2, + tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()+tr.height()-2); + + p->setPen(itsMouseOverCols[3]); + p->drawLine(tr.x()+(firstTab ? opts.round : 1), tr.y()+tr.height()-1, + tr.x()+tr.width()-((lastTab ? opts.round : 0)+1), tr.y()+tr.height()-1); + } + } + + if(active && opts.highlightTab) + { + p->setPen(itsMenuitemCols[0]); + p->drawLine(tr.left(), tr.bottom()-1, tr.right(), tr.bottom()-1); + p->setPen(midColor(fill, itsMenuitemCols[0])); + p->drawLine(tr.left(), tr.bottom()-2, tr.right(), tr.bottom()-2); + p->setClipRect(QRect(tr.x(), tr.y()+r.height()-3, tr.width(), 3), QPainter::CoordPainter); + drawBorder(cg.background(), p, tr, cg, flags|Style_Horizontal|Style_Enabled, + ROUNDED_ALL, itsMenuitemCols, top ? WIDGET_TAB_TOP : WIDGET_TAB_BOT, + true, BORDER_FLAT, false, 3); + p->setClipping(false); + } + + if(ROUND_FULL==opts.round && APP_TORA!=itsThemedApp && firstTab && !bottomCornerWidget)// && !isFirstKTabCtlTab) + { + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawPoint(r.x(), reverse ? r.y()+r.width()-1 : r.y()); + // Round bottom-left corner... + if(!active&& !reverse) + { + p->drawPoint(r.x()+1, r.y()-1); + p->setPen(midColor(itsBackgroundCols[QT_STD_BORDER], cg.background())); + p->drawPoint(r.x()+1, r.y()); + } + } + } + break; + } +#if QT_VERSION >= 0x030200 + case CE_TabBarLabel: + { + if (data.isDefault()) + break; + + const QTabBar *tb((const QTabBar *) widget); + QTab *t(data.tab()); + QRect tr(r); + int shift(pixelMetric(PM_TabBarTabShiftVertical, tb)); + + if (t->identifier() == tb->currentTab()) + { + if(QTabBar::RoundedAbove==tb->shape() || QTabBar::TriangularAbove==tb->shape()) + tr.addCoords(0, -shift, 0, -shift); + } + else + if(QTabBar::RoundedBelow==tb->shape() || QTabBar::TriangularBelow==tb->shape()) + tr.addCoords(0, shift, 0, shift); + + if(APP_MACTOR==itsThemedApp) + { + drawControl(CE_TabBarTab, p, widget, t->rect(), cg, flags, data); + + if(t->iconSet()) + { + QIconSet::Mode mode((t->isEnabled() && tb->isEnabled()) + ? QIconSet::Normal : QIconSet::Disabled); + + if (mode == QIconSet::Normal && (flags&Style_HasFocus)) + mode = QIconSet::Active; + + QPixmap pixmap(t->iconSet()->pixmap(QIconSet::Small, mode)); + int pixh(pixmap.height()), + xoff(0), + yoff(0); + + if(!(flags&Style_Selected)) + { + xoff = pixelMetric(PM_TabBarTabShiftHorizontal, widget); + yoff = pixelMetric(PM_TabBarTabShiftVertical, widget); + } + p->drawPixmap(t->rect().left()+8+xoff, t->rect().center().y()-pixh/2 + yoff, + pixmap); + } + } + + drawItem(p, tr, AlignCenter | ShowPrefix, cg, flags & Style_Enabled, 0, t->text()); + + if ((flags & Style_HasFocus) && !t->text().isEmpty()) + { + QRect fr(r); + + if(QTabBar::RoundedAbove==tb->shape() || QTabBar::TriangularAbove==tb->shape()) + fr.addCoords(0, 1, 0, -1); + else + fr.addCoords(0, 0, 0, -1); + + drawPrimitive(PE_FocusRect, p, fr, cg); + } + break; + } +#endif + case CE_PushButtonLabel: // Taken from Highcolor and Plastik... + { + int x, y, w, h; + + r.rect(&x, &y, &w, &h); + + const QPushButton *button(static_cast<const QPushButton *>(widget)); + bool active(button->isOn() || button->isDown()), + cornArrow(false); + + // Shift button contents if pushed. + if (active) + { + x += pixelMetric(PM_ButtonShiftHorizontal, widget); + y += pixelMetric(PM_ButtonShiftVertical, widget); + flags |= Style_Sunken; + } + + // Does the button have a popup menu? + if (button->isMenuButton()) + { + int dx(pixelMetric(PM_MenuButtonIndicator, widget)), + margin(pixelMetric(PM_ButtonMargin, widget)); + + if(button->iconSet() && !button->iconSet()->isNull() && + (dx+button->iconSet()->pixmap(QIconSet::Small, QIconSet::Normal, QIconSet::Off + ).width()) >= w ) + cornArrow = true; //To little room. Draw the arrow in the corner, don't adjust + //the widget + else + { + drawPrimitive(PE_ArrowDown, p, + visualRect(QRect((x + w) - (dx + margin), y, dx, h), r), cg, + flags, data); + w-=dx; + } + } + + // Draw the icon if there is one + if (button->iconSet() && !button->iconSet()->isNull()) + { + QIconSet::Mode mode(QIconSet::Disabled); + QIconSet::State state(QIconSet::Off); + + if (button->isEnabled()) + mode = button->hasFocus() ? QIconSet::Active : QIconSet::Normal; + if (button->isToggleButton() && button->isOn()) + state = QIconSet::On; + + QPixmap pixmap = button->iconSet()->pixmap(QIconSet::Small, mode, state); + + static const int constSpace(2); + + int xo(0), + pw(pixmap.width()), + iw(0); + + if (button->text().isEmpty() && !button->pixmap()) + p->drawPixmap(x + (w>>1) - (pixmap.width()>>1), + y + (h>>1) - (pixmap.height()>>1), + pixmap); + else + { + iw=button->pixmap() ? button->pixmap()->width() + : widget->fontMetrics().size(Qt::ShowPrefix, + button->text()).width(); + + int cw(iw+pw+constSpace); + + xo=cw<w ? (w-cw)>>1 : constSpace; + p->drawPixmap(x+xo, y + (h>>1) - (pixmap.height()>>1), pixmap); + xo+=pw; + } + + if (cornArrow) //Draw over the icon + drawPrimitive(PE_ArrowDown, p, visualRect(QRect(x + w - 6, x + h - 6, 7, 7), r), + cg, flags, data); + + if(xo && iw) + { + x+= xo+constSpace; + w=iw; + } + else + { + x+= pw+constSpace; + w-= pw+constSpace; + } + } + + // Make the label indicate if the button is a default button or not + int i, + j(opts.embolden && button->isDefault() ? 2 : 1); + const QColor &textCol(!opts.stdSidebarButtons && button->isFlat() && + button->inherits("KMultiTabBarTab") && + (button->isOn() || flags&Style_On) + ? QApplication::palette().active().highlightedText() + : button->colorGroup().buttonText()); + + for(i=0; i<j; i++) + drawItem(p, QRect(x+i, y, w, h), AlignCenter|ShowPrefix, button->colorGroup(), + button->isEnabled(), + button->pixmap(), button->text(), -1, &textCol); + + // Draw a focus rect if the button has focus + if (flags & Style_HasFocus) + drawPrimitive(PE_FocusRect, p, visualRect(subRect(SR_PushButtonFocusRect, + widget), widget), cg, flags); + break; + } + case CE_PopupMenuItem: + { + if(!widget || data.isDefault()) + break; + + const QPopupMenu *popupmenu((const QPopupMenu *)widget); + QMenuItem *mi(data.menuItem()); + int tab(data.tabWidth()), + maxpmw(data.maxIconWidth()), + x, y, w, h; + + r.rect(&x, &y, &w, &h); + + if((flags & Style_Active)&&(flags & Style_Enabled)) + drawMenuItem(p, r, cg, false, ROUNDED_ALL, + opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol + : itsBackgroundCols[ORIGINAL_SHADE], itsMenuitemCols); + else if(widget->erasePixmap() && !widget->erasePixmap()->isNull()) + p->drawPixmap(x, y, *widget->erasePixmap(), x, y, w, h); + else + p->fillRect(r, opts.lighterPopupMenuBgnd ? itsLighterPopupMenuBgndCol + : itsBackgroundCols[ORIGINAL_SHADE]); + + if(!mi) + break; + + if(mi->isSeparator()) + { + y=r.y()+((r.height()/2)-1); + p->setPen(itsBackgroundCols[QT_STD_BORDER]); + p->drawLine(r.x()+4, y, r.x()+r.width()-5, y); +// p->setPen(itsBackgroundCols[0]); +// p->drawLine(r.x()+4, y+1, r.x()+r.width()-5, y+1); + break; + } + + maxpmw=QMAX(maxpmw, 16); + + QRect cr, ir, tr, sr; + // check column + cr.setRect(r.left(), r.top(), maxpmw, r.height()); + // submenu indicator column + sr.setCoords(r.right()-maxpmw, r.top(), r.right(), r.bottom()); + // tab/accelerator column + tr.setCoords(sr.left()-tab-4, r.top(), sr.left(), r.bottom()); + // item column + ir.setCoords(cr.right()+4, r.top(), tr.right()-4, r.bottom()); + + bool reverse(QApplication::reverseLayout()); + + if(reverse) + { + cr=visualRect(cr, r); + sr=visualRect(sr, r); + tr=visualRect(tr, r); + ir=visualRect(ir, r); + } + + if(mi->iconSet()) + { + // Select the correct icon from the iconset + QIconSet::Mode mode=flags & Style_Active + ? (mi->isEnabled() ? QIconSet::Active : QIconSet::Disabled) + : (mi->isEnabled() ? QIconSet::Normal : QIconSet::Disabled); + cr=visualRect(QRect(x, y, maxpmw, h), r); + + // Do we have an icon and are checked at the same time? + // Then draw a "pressed" background behind the icon + if(popupmenu->isCheckable() && mi->isChecked()) + drawLightBevel((flags & Style_Active)&&(flags & Style_Enabled) + ? itsMenuitemCols[ORIGINAL_SHADE] + : cg.background(), p, QRect(cr.x()+1, cr.y()+2, cr.width()-2, cr.height()-4), + cg, flags|Style_Sunken|Style_Horizontal, ROUNDED_ALL, + getFill(flags|Style_Sunken|Style_Enabled, itsBackgroundCols), + itsBackgroundCols, true, false, WIDGET_NO_ETCH_BTN); + + // Draw the icon + QPixmap pixmap(mi->iconSet()->pixmap(QIconSet::Small, mode)); + QRect pmr(0, 0, pixmap.width(), pixmap.height()); + + pmr.moveCenter(cr.center()); + p->drawPixmap(pmr.topLeft(), pixmap); + } + else if(popupmenu->isCheckable() && mi->isChecked()) + drawPrimitive(PE_CheckMark, p, cr, cg, + (flags &(Style_Enabled|Style_Active))| Style_On|QTC_MENU_ITEM); + + QColor textcolor, + embosscolor; + + if(flags&Style_Active) + { + if(!(flags & Style_Enabled)) + { + textcolor=cg.text(); + embosscolor=cg.light(); + } + else + { + textcolor=cg.highlightedText(); + embosscolor=cg.midlight().light(); + } + } + else if(!(flags & Style_Enabled)) + { + textcolor=cg.text(); + embosscolor=cg.light(); + } + else + { + textcolor=cg.foreground(); + embosscolor=cg.light(); + } + p->setPen(textcolor); + + if(mi->custom()) + { + p->save(); + if(!(flags & Style_Enabled)) + { + p->setPen(cg.light()); + mi->custom()->paint(p, cg,(flags & Style_Enabled)?(flags & Style_Active): 0, + flags & Style_Enabled, ir.x()+1, ir.y()+1, ir.width()-1, + ir.height()-1); + p->setPen(textcolor); + } + mi->custom()->paint(p, cg,(flags & Style_Enabled)?(flags & Style_Active): 0, + flags & Style_Enabled, ir.x(), ir.y(), ir.width(), ir.height()); + p->restore(); + } + + QString text=mi->text(); + + if(!text.isNull()) + { + int t(text.find('\t')); + + // draw accelerator/tab-text + if(t>=0) + { + int alignFlag(AlignVCenter | ShowPrefix | DontClip | SingleLine); + + alignFlag |=(reverse ? AlignLeft : AlignRight); + + if(!(flags & Style_Enabled)) + { + p->setPen(embosscolor); + tr.moveBy(1, 1); + p->drawText(tr, alignFlag, text.mid(t +1)); + tr.moveBy(-1,-1); + p->setPen(textcolor); + } + + p->drawText(tr, alignFlag, text.mid(t +1)); + } + + int alignFlag(AlignVCenter | ShowPrefix | DontClip | SingleLine); + + alignFlag |=(reverse ? AlignRight : AlignLeft); + + if(!(flags & Style_Enabled)) + { + p->setPen(embosscolor); + ir.moveBy(1, 1); + p->drawText(ir, alignFlag, text, t); + ir.moveBy(-1,-1); + p->setPen(textcolor); + } + + p->drawText(ir, alignFlag, text, t); + } + else if(mi->pixmap()) + { + QPixmap *pixmap(mi->pixmap()); + + if(1==pixmap->depth()) + p->setBackgroundMode(OpaqueMode); + int diffw(((r.width() - pixmap->width())/2) + + ((r.width() - pixmap->width())%2)); + p->drawPixmap(r.x()+diffw, r.y()+1, *pixmap ); + if(1==pixmap->depth()) + p->setBackgroundMode(TransparentMode); + } + + if(mi->popup()) + drawArrow(p, sr, cg, flags, reverse ? PE_ArrowLeft : PE_ArrowRight, false, true); + break; + } + case CE_MenuBarItem: + { + bool down( (flags&Style_Enabled) && (flags&Style_Active) && (flags&Style_Down) ), + active( (flags&Style_Enabled) && (flags&Style_Active) && + ( (flags&Style_Down) || opts.menubarMouseOver ) ); + + if(!active || IS_GLASS(opts.menubarAppearance) || SHADE_NONE!=opts.shadeMenubars) + { + QMenuBar *mb((QMenuBar*)widget); + QRect r2(r); + + r2.setY(mb->rect().y()+1); + r2.setHeight(mb->rect().height()-2); + + drawMenuOrToolBarBackground(p, r2, cg); + } + + if(active) + drawMenuItem(p, r, cg, true, down && opts.roundMbTopOnly ? ROUNDED_TOP : ROUNDED_ALL, + itsMenubarCols[ORIGINAL_SHADE], + opts.colorMenubarMouseOver || down ? itsMenuitemCols : itsBackgroundCols); + + if(data.isDefault()) + break; + + QMenuItem *mi(data.menuItem()); + + if(mi->text().isEmpty()) // Draw pixmap... + drawItem(p, r, AlignCenter|ShowPrefix|DontClip|SingleLine, cg, flags&Style_Enabled, + mi->pixmap(), QString::null); + else + { + const QColor *col=(opts.colorMenubarMouseOver && active) || (!opts.colorMenubarMouseOver && down) + ? opts.customMenuTextColor + ? &opts.customMenuSelTextColor + : &cg.highlightedText() + : itsActive + ? opts.customMenuTextColor + ? &opts.customMenuNormTextColor + : SHADE_BLEND_SELECTED==opts.shadeMenubars || + (SHADE_CUSTOM==opts.shadeMenubars && + TOO_DARK(itsMenubarCols[ORIGINAL_SHADE])) + ? &cg.highlightedText() + : &cg.foreground() + : &cg.foreground(); + + p->setPen(*col); + p->drawText(r, AlignCenter|ShowPrefix|DontClip|SingleLine, mi->text()); + } + + break; + } + case CE_MenuBarEmptyArea: + drawMenuOrToolBarBackground(p, r, cg); + break; + case CE_DockWindowEmptyArea: + if(widget && widget->inherits("QToolBar")) + { + QDockWindow *wind((QDockWindow*)widget); + + drawMenuOrToolBarBackground(p, r, cg, false, Qt::Horizontal==wind->orientation()); + } + else + KStyle::drawControl(control, p, widget, r, cg, flags, data); + break; + case CE_ProgressBarGroove: + { + if(opts.gradientPbGroove) + drawBevelGradient(flags & Style_Enabled ? cg.base() : cg.background(), false, p, r, true, + getWidgetShade(WIDGET_TROUGH, true, false, opts.progressAppearance), + getWidgetShade(WIDGET_TROUGH, false, false, opts.progressAppearance), + false, APPEARANCE_GRADIENT, WIDGET_TROUGH); + else + { + p->setBrush(flags & Style_Enabled ? cg.base() : cg.background()); + p->drawRect(r); + } + + const QColor *use(backgroundColors(cg)); + + drawBorder(cg.background(), p, r, cg, (SFlags)(flags|Style_Horizontal), + ROUNDED_ALL, use, WIDGET_OTHER, true, BORDER_SUNKEN); + break; + } + case CE_ProgressBarContents: + { + const QProgressBar *pb((const QProgressBar*)widget); + int steps(pb->totalSteps()); + + if(0==steps)//Busy indicator + { + static const int barWidth(10); + + int progress(pb->progress() % (2*(r.width()-barWidth))); + + if(progress < 0) + progress = 0; + else if(progress > r.width()-barWidth) + progress = (r.width()-barWidth)-(progress-(r.width()-barWidth)); + + p->fillRect(r, flags & Style_Enabled ? cg.base() : cg.background()); + drawLightBevel(cg.background(), p, QRect(r.x()+progress, r.y(), barWidth, + r.height()), cg, flags, ROUNDED_ALL, itsMenuitemCols[ORIGINAL_SHADE], + itsMenuitemCols, true, true, WIDGET_PROGRESSBAR); + } + else + { + QRect cr(subRect(SR_ProgressBarContents, widget)); + + if(cr.isValid() && pb->progress()>0) + { + double pg(((double)pb->progress()) / steps); + int width(QMIN(cr.width(), (int)(pg * cr.width()))); + + if(QApplication::reverseLayout()) + drawProgress(p, QRect(cr.x()+(cr.width()-width), cr.y(), width, + cr.height()), cg, flags, + width==cr.width() ? ROUNDED_NONE : ROUNDED_LEFT, widget); + else + drawProgress(p, QRect(cr.x(), cr.y(), width, cr.height()), cg, flags, + width==cr.width() ? ROUNDED_NONE : ROUNDED_RIGHT, widget); + } + } + break; + } + case CE_PushButton: + { + const QPushButton *button(static_cast<const QPushButton *>(widget)); + bool sidebar(button->isFlat() && button->inherits("KMultiTabBarTab")); + + if(!opts.stdSidebarButtons && sidebar) + { + QRect r2(r); + + flags|=QTC_TOGGLE_BUTTON; + if(button->isOn()) + flags|=Style_On; + + const QColor *use(flags&Style_On ? getSidebarButtons() : buttonColors(cg)); + + if((flags&Style_On ) || flags&Style_MouseOver) + { + r2.addCoords(-1, -1, 1, 1); + drawLightBevel(p, r2, cg, flags|Style_Horizontal, ROUNDED_NONE, + getFill(flags, use), use, false, false, WIDGET_MENU_ITEM); + } + else + p->fillRect(r2, cg.background()); + + if(flags&Style_MouseOver && opts.coloredMouseOver) + { + r2=r; + if(MO_PLASTIK==opts.coloredMouseOver) + r2.addCoords(0, 1, 0, -1); + else + r2.addCoords(1, 1, -1, -1); + p->setPen(itsMouseOverCols[flags&Style_On ? 0 : 1]); + p->drawLine(r.x(), r.y(), r.x()+r.width()-1, r.y()); + p->drawLine(r2.x(), r2.y(), r2.x()+r2.width()-1, r2.y()); + + if(MO_PLASTIK!=opts.coloredMouseOver) + { + p->drawLine(r.x(), r.y(), r.x(), r.y()+r.height()-1); + p->drawLine(r2.x(), r2.y(), r2.x(), r2.y()+r2.height()-1); + p->setPen(itsMouseOverCols[flags&Style_On ? 1 : 2]); + } + + p->drawLine(r.x(), r.y()+r.height()-1, r.x()+r.width()-1, r.y()+r.height()-1); + p->drawLine(r2.x(), r2.y()+r2.height()-1, r2.x()+r2.width()-1, + r2.y()+r2.height()-1); + + if(MO_PLASTIK!=opts.coloredMouseOver) + { + p->drawLine(r.x()+r.width()-1, r.y(), r.x()+r.width()-1, r.y()+r.height()-1); + p->drawLine(r2.x()+r2.width()-1, r2.y(), r2.x()+r2.width()-1, + r2.y()+r2.height()-1); + } + } + } + else + { + itsFormMode = isFormWidget(widget); + + if(IND_FONT_COLOR==opts.defBtnIndicator && button->isDefault()) + flags|=Style_ButtonDefault; + + if(button->isToggleButton()) + flags|=QTC_TOGGLE_BUTTON; + + if(sidebar) + flags|=QTC_NO_ETCH_BUTTON; + + drawPrimitive(PE_ButtonCommand, p, r, cg, flags); + if (button->isDefault() && IND_CORNER==opts.defBtnIndicator) + drawPrimitive(PE_ButtonDefault, p, r, cg, flags); + itsFormMode = false; + } + break; + } + case CE_CheckBox: + itsFormMode = isFormWidget(widget); + drawPrimitive(PE_Indicator, p, r, cg, flags, data); + itsFormMode = false; + break; + case CE_RadioButton: + itsFormMode=isFormWidget(widget); + drawPrimitive(PE_ExclusiveIndicator, p, r, cg, flags, data); + itsFormMode=false; + break; + default: + KStyle::drawControl(control, p, widget, r, cg, flags, data); + } +} + +void QtCurveStyle::drawControlMask(ControlElement control, QPainter *p, const QWidget *widget, + const QRect &r, const QStyleOption &data) const +{ + switch(control) + { + case CE_PushButton: + case CE_MenuBarItem: + { + int offset(r.width()<QTC_MIN_BTN_SIZE || r.height()<QTC_MIN_BTN_SIZE ? 1 : 2); + + p->fillRect(r, color0); + p->fillRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2, color1); + p->setPen(color1); + p->drawLine(r.x()+offset, r.y(), r.x()+r.width()-(offset+1), r.y()); + p->drawLine(r.x()+offset, r.y()+r.height()-1, r.x()+r.width()-(offset+1), + r.y()+r.height()-1); + p->drawLine(r.x(), r.y()+offset, r.x(), r.y()+r.height()-(offset+1)); + p->drawLine(r.x()+r.width()-1, r.y()+offset, r.x()+r.width()-1, + r.y()+r.height()-(offset+1)); + break; + } + default: + KStyle::drawControlMask(control, p, widget, r, data); + } +} + +void QtCurveStyle::drawComplexControlMask(ComplexControl control, QPainter *p, const QWidget *widget, + const QRect &r, const QStyleOption &data) const +{ + switch (control) + { + case CC_SpinWidget: + case CC_ComboBox: + case CC_ToolButton: + drawControlMask(CE_PushButton, p, widget, r, data); + break; + default: + KStyle::drawComplexControlMask(control, p, widget, r, data); + } +} + +QRect QtCurveStyle::subRect(SubRect subrect, const QWidget *widget)const +{ + QRect rect, + wrect(widget->rect()); + + switch(subrect) + { + case SR_PushButtonFocusRect: + { + int dbw1(pixelMetric(PM_ButtonDefaultIndicator, widget)), + dbw2(dbw1*2), + border(3), + border2=(border*2); + + rect.setRect(wrect.x()+border +dbw1, wrect.y()+border +dbw1, + wrect.width()-border2-dbw2, + wrect.height()-border2-dbw2); + + + if(!isFormWidget(widget) && QTC_DO_EFFECT) + rect.addCoords(0, 1, 0, -1); + + break; + } + case SR_ProgressBarGroove: + rect=QRect(widget->rect()); + break; + case SR_ProgressBarContents: + case SR_ProgressBarLabel: + rect=QRect(wrect.left()+2, wrect.top()+2, wrect.width()-4, wrect.height()-4); + break; + default: + rect=KStyle::subRect(subrect, widget); + } + + return rect; +} + +void QtCurveStyle::drawComplexControl(ComplexControl control, QPainter *p, const QWidget *widget, + const QRect &r, const QColorGroup &cg, SFlags flags, + SCFlags controls, SCFlags active, + const QStyleOption &data) const +{ + if(widget==itsHoverWidget) + flags |=Style_MouseOver; + + switch(control) + { + case CC_ToolButton: + { + const QToolButton *toolbutton((const QToolButton *)widget); + QRect button(querySubControlMetrics(control, widget, SC_ToolButton, data)), + menuarea(querySubControlMetrics(control, widget, SC_ToolButtonMenu, + data)); + SFlags bflags(flags|QTC_STD_TOOLBUTTON), + mflags(flags); + + if (APP_KORN==itsThemedApp) + { + drawPrimitive(PE_ButtonTool, p, button, cg, bflags, data); + break; + } + + const QToolBar *tb(widget->parentWidget() + ? ::qt_cast<const QToolBar *>(widget->parentWidget()) : NULL); + bool onControlButtons(false), + onExtender(!tb && + widget->parentWidget() && + widget->parentWidget()->inherits( "QToolBarExtensionWidget") && + ::qt_cast<QToolBar *>(widget->parentWidget()->parentWidget())); + + if (!tb && !onExtender && widget->parentWidget() && + !qstrcmp(widget->parentWidget()->name(), "qt_maxcontrols")) + onControlButtons = true; + + if(active & SC_ToolButton) + bflags |=Style_Down; + if(active & SC_ToolButtonMenu) + mflags |=Style_Down; + + itsFormMode = isFormWidget(widget); + + if(controls&SC_ToolButton) + { + if(onControlButtons || + (toolbutton->parentWidget() && toolbutton->parentWidget()->parentWidget() && + ::qt_cast<const QMenuBar *>(toolbutton->parentWidget()->parentWidget()))) + bflags|=QTC_NO_ETCH_BUTTON; + + // If we're pressed, on, or raised... +#if KDE_VERSION >= 0x30200 + if(bflags &(Style_Down | Style_On | Style_Raised) || onControlButtons) +#else + if(bflags &(Style_Down | Style_On | Style_Raised | Style_MouseOver) || + onControlButtons) +#endif + { + //Make sure the standalone toolbuttons have a gradient in the right direction + if (!tb && !onControlButtons) + bflags |= Style_Horizontal; + + if(tb) + if(Qt::Vertical==tb->orientation()) + bflags|=QTC_VERTICAL_TB_BUTTON; + else + bflags|=Style_Horizontal; + + if(toolbutton->isToggleButton()) + bflags|=QTC_TOGGLE_BUTTON; + + drawPrimitive(PE_ButtonTool, p, button, cg, bflags, data); + } + + // Check whether to draw a background pixmap + else if(APP_MACTOR!=itsThemedApp && toolbutton->parentWidget() && + toolbutton->parentWidget()->backgroundPixmap() && + !toolbutton->parentWidget()->backgroundPixmap()->isNull()) + p->drawTiledPixmap(r, *(toolbutton->parentWidget()->backgroundPixmap()), + toolbutton->pos()); + else if(widget->parent()) + { + QToolBar *tb(NULL); + + if(::qt_cast<const QToolBar *>(widget->parent())) + tb=(QToolBar*)widget->parent(); + else if(widget->parent()->inherits("QToolBarExtensionWidget")) + { + QWidget *parent=(QWidget*)widget->parent(); + + tb=(QToolBar*)parent->parent(); + } + + if(tb) + { + QRect tbr(tb->rect()); + bool horiz(Qt::Horizontal==tb->orientation()); + + if(!IS_FLAT(opts.toolbarAppearance)) + if(horiz) + tbr.addCoords(0, -1, 0, 0); + else + tbr.addCoords(-1, 0, 0, 0); + + drawMenuOrToolBarBackground(p, tbr, cg, false, horiz); + } + } + } + + if(controls&SC_ToolButtonMenu) + { + if(mflags &(Style_Down | Style_On | Style_Raised)) + drawPrimitive(PE_ButtonDropDown, p, menuarea, cg, mflags, data); + drawPrimitive(PE_ArrowDown, p, menuarea, cg, mflags, data); + } + + if(toolbutton->hasFocus() && !toolbutton->focusProxy()) + { + QRect fr(toolbutton->rect()); + fr.addCoords(3, 3,-3,-3); + drawPrimitive(PE_FocusRect, p, fr, cg); + } + + itsFormMode=false; + break; + } + case CC_ComboBox: + { + const QComboBox *combobox((const QComboBox *)widget); + QRect frame(QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, + SC_ComboBoxFrame, + data), widget)), + arrow(QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, + SC_ComboBoxArrow, + data), widget)), + field(QStyle::visualRect(querySubControlMetrics(CC_ComboBox, widget, + SC_ComboBoxEditField, + data), widget)); + const QColor *use(buttonColors(cg)); + bool editable(combobox->editable()), + sunken(combobox->listBox() ? combobox->listBox()->isShown() : false), + reverse(QApplication::reverseLayout()); + SFlags fillFlags(flags); + + itsFormMode = isFormWidget(widget); + + if(sunken) + { + fillFlags|=Style_Sunken; + if(fillFlags&Style_MouseOver) + fillFlags-=Style_MouseOver; + } + + if(editable ||(!itsFormMode && QTC_DO_EFFECT && qstrcmp(widget->name(), kdeToolbarWidget))) + { + p->setPen(cg.background()); + p->drawRect(r); + } + + if(controls&SC_ComboBoxFrame && frame.isValid()) + { + if(editable && HOVER_CB_ARROW!=itsHover && fillFlags&Style_MouseOver) + fillFlags-=Style_MouseOver; + + if(opts.coloredMouseOver && fillFlags&Style_MouseOver && editable && !sunken) + frame.addCoords(reverse ? 0 : 1, 0, reverse ? 1 : 0, 0); + + drawLightBevel(p, frame, cg, fillFlags|Style_Raised|Style_Horizontal, + controls&SC_ComboBoxEditField && field.isValid() && editable + ? (reverse ? ROUNDED_LEFT : ROUNDED_RIGHT) : ROUNDED_ALL, + getFill(fillFlags, use), use, true, true, WIDGET_STD_BUTTON); + } + + if(controls&SC_ComboBoxArrow && arrow.isValid()) + { + if(sunken) + arrow.addCoords(1, 1, 1, 1); + drawPrimitive(PE_ArrowDown, p, arrow, cg, flags & ~Style_MouseOver); + } + + if(controls&SC_ComboBoxEditField && field.isValid()) + { + if(editable) + { + field.addCoords(-1,-1, 0, 1); + p->setPen(flags&Style_Enabled ? cg.base() : cg.background()); + p->drawRect(field); + field.addCoords(-2,-2, 2, 2); + drawEntryField(p, field, cg, fillFlags, flags&Style_Enabled && + (flags&Style_HasFocus), reverse ? ROUNDED_RIGHT : ROUNDED_LEFT, + WIDGET_STD_BUTTON); + } + else + { + field.addCoords(1, sunken ? 2 : 1, sunken ? 2 : 1, -1); + p->setPen(use[QT_BORDER(flags&Style_Enabled)]); + p->drawLine(reverse ? field.left()-3 : field.right(), field.top(), + reverse ? field.left()-3 : field.right(), field.bottom()); + if(!sunken) + { + p->setPen(use[0]); + p->drawLine(reverse ? field.left()-2 : field.right()+1, field.top(), + reverse ? field.left()-2 : field.right()+1, field.bottom()); + } + } + + if((flags & Style_HasFocus) && !editable) + { + QRect fr(QStyle::visualRect(subRect(SR_ComboBoxFocusRect, widget), widget)); + + if(reverse) + fr.addCoords(3, 0, 0, 0); + else + fr.addCoords(0, 0, -2, 0); + + if(!itsFormMode && QTC_DO_EFFECT) + fr.addCoords(0, 1, 0, -1); + drawPrimitive(PE_FocusRect, p, fr, cg, flags | Style_FocusAtBorder, + QStyleOption(cg.highlight())); + } + } + + p->setPen(flags & Style_Enabled ? cg.buttonText() : cg.mid()); + itsFormMode = false; + break; + } + case CC_SpinWidget: + { + const QSpinWidget *spinwidget((const QSpinWidget *)widget); + QRect frame(querySubControlMetrics(CC_SpinWidget, widget, SC_SpinWidgetFrame, + data)), + up(spinwidget->upRect()), + down(spinwidget->downRect()); + bool hw(itsHoverWidget && itsHoverWidget==spinwidget), + reverse(QApplication::reverseLayout()), + doFrame((controls&SC_SpinWidgetFrame) && frame.isValid()); + + if(flags&Style_MouseOver) + flags-=Style_MouseOver; + + if(!reverse && doFrame) + { + itsFormMode = isFormWidget(widget); + frame.setWidth(frame.width()+1); + + drawEntryField(p, frame, cg, flags, + spinwidget ? spinwidget->hasFocus() && (flags&Style_Enabled) : false, + ROUNDED_LEFT, WIDGET_SPIN); + itsFormMode=false; + } + + if((controls&SC_SpinWidgetUp) && up.isValid()) + { + PrimitiveElement pe(PE_SpinWidgetUp); + SFlags upflags(flags); + + if(hw && HOVER_SW_UP==itsHover) + upflags|=Style_MouseOver; + up.setHeight(up.height()+1); + if(spinwidget->buttonSymbols()==QSpinWidget::PlusMinus) + pe=PE_SpinWidgetPlus; + if(!spinwidget->isUpEnabled()) + upflags^=Style_Enabled; + drawPrimitive(pe, p, up, cg, + upflags |((active==SC_SpinWidgetUp) + ? Style_On | Style_Sunken : Style_Raised)); + } + + if((controls&SC_SpinWidgetDown) && down.isValid()) + { + PrimitiveElement pe(PE_SpinWidgetDown); + SFlags downflags(flags); + + if(hw && HOVER_SW_DOWN==itsHover) + downflags|=Style_MouseOver; + if(spinwidget->buttonSymbols()==QSpinWidget::PlusMinus) + pe=PE_SpinWidgetMinus; + if(!spinwidget->isDownEnabled()) + downflags^=Style_Enabled; + drawPrimitive(pe, p, down, cg, + downflags |((active==SC_SpinWidgetDown) + ? Style_On | Style_Sunken : Style_Raised)); + } + + if(reverse && doFrame) + { + itsFormMode = isFormWidget(widget); + frame.setWidth(frame.width()+1); + drawEntryField(p, frame, cg, flags, + spinwidget ? spinwidget->hasFocus() && (flags&Style_Enabled) : false, + ROUNDED_RIGHT, WIDGET_SPIN); + itsFormMode=false; + } + break; + } + case CC_ScrollBar: + { + const QScrollBar *sb((const QScrollBar *)widget); + bool hw(itsHoverWidget && itsHoverWidget==sb), + useThreeButtonScrollBar(SCROLLBAR_KDE==opts.scrollbarType), + horiz(Qt::Horizontal==sb->orientation()), + maxed(sb->minValue() == sb->maxValue()), + atMin(maxed || sb->value()==sb->minValue()), + atMax(maxed || sb->value()==sb->maxValue()); + SFlags sflags((horiz ? Style_Horizontal : Style_Default) | + (maxed ? Style_Default : Style_Enabled)); + QRect subline(querySubControlMetrics(control, widget, SC_ScrollBarSubLine, + data)), + addline(querySubControlMetrics(control, widget, SC_ScrollBarAddLine, + data)), + subpage(querySubControlMetrics(control, widget, SC_ScrollBarSubPage, + data)), + addpage(querySubControlMetrics(control, widget, SC_ScrollBarAddPage, + data)), + slider(querySubControlMetrics(control, widget, SC_ScrollBarSlider, + data)), + first(querySubControlMetrics(control, widget, SC_ScrollBarFirst, + data)), + last(querySubControlMetrics(control, widget, SC_ScrollBarLast, + data)), + subline2(addline), + sbRect(sb->rect()); + + itsFormMode=isFormWidget(widget); + + if(itsFormMode) + { + // See KHTML note at top of file + if(horiz) + { + subline.addCoords(0, 0, 0, -1); + addline.addCoords(0, 0, 0, -1); + subpage.addCoords(0, 0, 0, -1); + addpage.addCoords(0, 0, 0, -1); + slider.addCoords(0, 0, 0, -1); + first.addCoords(0, 0, 0, -1); + last.addCoords(0, 0, 0, -1); + subline2.addCoords(0, 0, 0, -1); + sbRect.addCoords(0, 0, 0, -1); + } + else + { + subline.addCoords(0, 0, -1, 0); + addline.addCoords(0, 0, -1, 0); + subpage.addCoords(0, 0, -1, 0); + addpage.addCoords(0, 0, -1, 0); + slider.addCoords(0, 0, -1, 0); + first.addCoords(0, 0, -1, 0); + last.addCoords(0, 0, -1, 0); + subline2.addCoords(0, 0, -1, 0); + sbRect.addCoords(0, 0, -1, 0); + } + +#ifndef QTC_SIMPLE_SCROLLBARS + if(sbRect.isValid() && SCROLLBAR_NONE==opts.scrollbarType) + if(horiz) + sbRect.addCoords(0, 0, -1, 0); + else + sbRect.addCoords(0, 0, 0, -1); +#endif + } + + if (useThreeButtonScrollBar) + if (horiz) + subline2.moveBy(-addline.width(), 0); + else + subline2.moveBy(0, -addline.height()); + + // Draw trough... + const QColor *trough(itsBackgroundCols); // backgroundColors(cg)); + bool noButtons(SCROLLBAR_NONE==opts.scrollbarType); + QRect s2(subpage), a2(addpage); + +#ifndef QTC_SIMPLE_SCROLLBARS + if(noButtons) + { + // Increase clipping to allow trough to "bleed" into slider corners... + a2.addCoords(-3, -3, 3, 3); + s2.addCoords(-3, -3, 3, 3); + } +#endif + + p->setClipRegion(QRegion(s2)+QRegion(addpage)); + drawLightBevel(p, sbRect, cg, sflags|Style_Down, +#ifndef QTC_SIMPLE_SCROLLBARS + SCROLLBAR_NONE==opts.scrollbarType ? ROUNDED_ALL : +#endif + ROUNDED_NONE, + trough[2], trough, true, true, WIDGET_TROUGH); + p->setClipping(false); + + if(/*(controls&SC_ScrollBarSubLine) && */subline.isValid()) + { + bool enable=(!maxed && sb->value()!=sb->minValue()); + + drawPrimitive(PE_ScrollBarSubLine, p, subline, cg, sflags | + //(enable ? Style_Enabled : Style_Default) | + (enable && hw && HOVER_SB_SUB==itsHover + ? Style_MouseOver : Style_Default) | + (enable && (!hw || HOVER_SB_SUB==itsHover || HOVER_NONE==itsHover) + && SC_ScrollBarSubLine==active ? Style_Down : Style_Default)); + + if (useThreeButtonScrollBar && subline2.isValid()) + drawPrimitive(PE_ScrollBarSubLine, p, subline2, cg, sflags | + //(enable ? Style_Enabled : Style_Default) | + (enable && hw && HOVER_SB_SUB2==itsHover + ? Style_MouseOver : Style_Default) | + (enable && (!hw || HOVER_SB_SUB2==itsHover || HOVER_NONE==itsHover) + && SC_ScrollBarSubLine==active ? Style_Down : Style_Default)); + } + if(/*(controls&SC_ScrollBarAddLine) && */addline.isValid()) + { + bool enable=(!maxed && sb->value()!=sb->maxValue()); + + // See KHTML note at top of file + if(itsFormMode && SCROLLBAR_NEXT!=opts.scrollbarType) + if(horiz) + addline.addCoords(0, 0, -1, 0); + else + addline.addCoords(0, 0, 0, -1); + + drawPrimitive(PE_ScrollBarAddLine, p, addline, cg, sflags | + //(enable ? Style_Enabled : Style_Default) | + (enable && hw && HOVER_SB_ADD==itsHover + ? Style_MouseOver : Style_Default) | + (enable && SC_ScrollBarAddLine==active + ? Style_Down : Style_Default)); + } + + if((controls&SC_ScrollBarFirst) && first.isValid()) + drawPrimitive(PE_ScrollBarFirst, p, first, cg, sflags | + //(maxed ? Style_Default : Style_Enabled) | + (!maxed && SC_ScrollBarFirst==active ? Style_Down : Style_Default)); + + if((controls&SC_ScrollBarLast) && last.isValid()) + drawPrimitive(PE_ScrollBarLast, p, last, cg, sflags | + //(maxed ? Style_Default : Style_Enabled) | + (!maxed && SC_ScrollBarLast==active ? Style_Down : Style_Default)); + + if(((controls&SC_ScrollBarSlider) || noButtons) && slider.isValid()) + { + // If "SC_ScrollBarSlider" wasn't pecified, then we only want to draw the portion + // of the slider that overlaps with the tough. So, once again set the clipping + // region... + if(!(controls&SC_ScrollBarSlider)) + p->setClipRegion(QRegion(s2)+QRegion(addpage)); +#ifdef QTC_INCREASE_SB_SLIDER + else + { + if(atMax) + switch(opts.scrollbarType) + { + case SCROLLBAR_KDE: + case SCROLLBAR_WINDOWS: + case SCROLLBAR_PLATINUM: + if(horiz) + slider.addCoords(0, 0, 1, 0); + else + slider.addCoords(0, 0, 0, 1); + default: + break; + } + if(atMin) + switch(opts.scrollbarType) + { + case SCROLLBAR_KDE: + case SCROLLBAR_WINDOWS: + case SCROLLBAR_NEXT: + if(horiz) + slider.addCoords(-1, 0, 0, 0); + else + slider.addCoords(0, -1, 0, 0); + default: + break; + } + } +#endif + + drawPrimitive(PE_ScrollBarSlider, p, slider, cg, sflags | + //(maxed ? Style_Default : Style_Enabled) | + (!maxed && hw && HOVER_SB_SLIDER==itsHover + ? Style_MouseOver : Style_Default) | + (!maxed && SC_ScrollBarSlider==active + ? Style_Down : Style_Default)); + + // ### perhaps this should not be able to accept focus if maxedOut? + if(sb->hasFocus()) + drawPrimitive(PE_FocusRect, p, QRect(slider.x()+2, slider.y()+2, + slider.width()-5, slider.height()-5), cg, Style_Default); + +#ifndef QTC_SIMPLE_SCROLLBARS + if(noButtons && (!atMin || !atMax)) + { + p->setPen(backgroundColors(cg)[QT_STD_BORDER]); + + if(horiz) + { + if(!atMin) + { + p->drawLine(slider.x(), slider.y(), + slider.x()+1, slider.y()); + p->drawLine(slider.x(), slider.y()+slider.height()-1, + slider.x()+1, slider.y()+slider.height()-1); + } + if(!atMax) + { + p->drawLine(slider.x()+slider.width()-1, slider.y(), + slider.x()+slider.width()-2, slider.y()); + p->drawLine(slider.x()+slider.width()-1, + slider.y()+slider.height()-1, + slider.x()+slider.width()-2, + slider.y()+slider.height()-1); + } + } + else + { + if(!atMin) + { + p->drawLine(slider.x(), slider.y(), + slider.x(), slider.y()+1); + p->drawLine(slider.x()+slider.width()-1, slider.y(), + slider.x()+slider.width()-1, slider.y()+1); + } + if(!atMax) + { + p->drawLine(slider.x(), slider.y()+slider.height()-1, + slider.x(), slider.y()+slider.height()-2); + p->drawLine(slider.x()+slider.width()-1, + slider.y()+slider.height()-1, + slider.x()+slider.width()-1, + slider.y()+slider.height()-2); + } + } + } +#endif + if(!(controls&SC_ScrollBarSlider)) + p->setClipping(false); + } + break; + } + case CC_Slider: + // + // Note: Can't use KStyle's drawing routine, as this doesnt work for sliders on gradient + // toolbars. It also draws groove, focus, slider - wherease QtCurve needs groove, + // slider, focus. We also ony double-buffer if not on a toolbar, as we dont know + // the background, etc, if on a toolbar - and that is handled in eventFilter + { + bool tb(!IS_FLAT(opts.toolbarAppearance) && widget && + 0==qstrcmp(widget->name(), kdeToolbarWidget)); + QRect groove=querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, data), + handle=querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, data); + QPixmap pix(widget->size()); + QPainter p2, + *paint(tb ? p : &p2); + + if(!tb) + { + paint->begin(&pix); + if (widget->parentWidget() && widget->parentWidget()->backgroundPixmap() && + !widget->parentWidget()->backgroundPixmap()->isNull()) + paint->drawTiledPixmap(r, *(widget->parentWidget()->backgroundPixmap()), widget->pos()); + else + pix.fill(cg.background()); + } + + if((controls & SC_SliderGroove)&& groove.isValid()) + drawSliderGroove(paint, groove, cg, flags, widget); + if((controls & SC_SliderHandle)&& handle.isValid()) + drawSliderHandle(paint, handle, cg, flags, widget ? ::qt_cast<QSlider *>(widget) : NULL, tb); + if(controls & SC_SliderTickmarks) + QCommonStyle::drawComplexControl(control, paint, widget, r, cg, flags, SC_SliderTickmarks, + active, data); + + if(flags & Style_HasFocus) + drawPrimitive(PE_FocusRect, paint, groove, cg); + + if(!tb) + { + paint->end(); + bitBlt((QWidget*)widget, r.x(), r.y(), &pix); + } + break; + } + default: + KStyle::drawComplexControl(control, p, widget, r, cg, flags, controls, active, data); + } +} + +QRect QtCurveStyle::querySubControlMetrics(ComplexControl control, const QWidget *widget, + SubControl sc, const QStyleOption &data) const +{ + bool reverse(QApplication::reverseLayout()); + + switch(control) + { + case CC_SpinWidget: + { + if(!widget) + return QRect(); + + int fw(pixelMetric(PM_SpinBoxFrameWidth, 0)); + QSize bs; + + bs.setHeight(widget->height()>>1); + if(bs.height()< 8) + bs.setHeight(8); + bs.setWidth(15); + bs=bs.expandedTo(QApplication::globalStrut()); + + int extra(bs.height()*2==widget->height()? 0 : 1), + y(0), x(widget->width()-bs.width()), + rx(x-fw*2); + + switch(sc) + { + case SC_SpinWidgetUp: + return QRect(x, y, bs.width(), bs.height()); + case SC_SpinWidgetDown: + return QRect(x, y+bs.height(), bs.width(), bs.height()+extra); + case SC_SpinWidgetButtonField: + return QRect(x, y, bs.width(), widget->height()-2*fw); + case SC_SpinWidgetEditField: + return QRect(fw, fw, rx, widget->height()-2*fw); + case SC_SpinWidgetFrame: + return reverse + ? QRect(widget->x()+bs.width(), widget->y(), + widget->width()-bs.width()-1, widget->height()) + : QRect(widget->x(), widget->y(), + widget->width()-bs.width(),widget->height()); + default: + break; // Remove compiler warnings... + } + } + case CC_ComboBox: + { + QRect r(KStyle::querySubControlMetrics(control, widget, sc, data)); + + if(SC_ComboBoxFrame==sc) + { + const QComboBox *cb(::qt_cast<const QComboBox *>(widget)); + + if(cb && cb->editable()) + r=QRect((r.x()+r.width()-1)-18, r.y(), 19, r.height()); + } + else if (reverse && SC_ComboBoxEditField==sc) + r.addCoords(-1, 0, -2, 0); + return r; + } + case CC_ScrollBar: + { + // Taken from kstyle.cpp, and modified so as to allow for no scrollbar butttons... + bool threeButtonScrollBar(SCROLLBAR_KDE==opts.scrollbarType), + platinumScrollBar(SCROLLBAR_PLATINUM==opts.scrollbarType), + nextScrollBar(SCROLLBAR_NEXT==opts.scrollbarType), + noButtons(SCROLLBAR_NONE==opts.scrollbarType); + QRect ret; + const QScrollBar *sb((const QScrollBar*)widget); + bool horizontal(sb->orientation() == Qt::Horizontal); + int sliderstart(sb->sliderStart()), + sbextent(pixelMetric(PM_ScrollBarExtent, widget)), + maxlen((horizontal ? sb->width() : sb->height()) + - (noButtons ? 0 : (sbextent * (threeButtonScrollBar ? 3 : 2)))), + sliderlen; + + // calculate slider length + if (sb->maxValue() != sb->minValue()) + { + uint range = sb->maxValue() - sb->minValue(); + sliderlen = (sb->pageStep() * maxlen) / (range + sb->pageStep()); + + int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget ); + if ( sliderlen < slidermin || range > INT_MAX / 2 ) + sliderlen = slidermin; + if ( sliderlen > maxlen ) + sliderlen = maxlen; + } + else + sliderlen = maxlen; + + // Subcontrols + switch(sc) + { + case SC_ScrollBarSubLine: + if(noButtons) + return QRect(); + + // top/left button + if (platinumScrollBar) + if (horizontal) + ret.setRect(sb->width() - 2 * sbextent, 0, sbextent, sbextent); + else + ret.setRect(0, sb->height() - 2 * sbextent, sbextent, sbextent); + else + ret.setRect(0, 0, sbextent, sbextent); + break; + case SC_ScrollBarAddLine: + if(noButtons) + return QRect(); + + // bottom/right button + if (nextScrollBar) + if (horizontal) + ret.setRect(sbextent, 0, sbextent, sbextent); + else + ret.setRect(0, sbextent, sbextent, sbextent); + else + if (horizontal) + ret.setRect(sb->width() - sbextent, 0, sbextent, sbextent); + else + ret.setRect(0, sb->height() - sbextent, sbextent, sbextent); + break; + case SC_ScrollBarSubPage: + // between top/left button and slider + if (platinumScrollBar) + if (horizontal) + ret.setRect(0, 0, sliderstart, sbextent); + else + ret.setRect(0, 0, sbextent, sliderstart); + else if (nextScrollBar) + if (horizontal) + ret.setRect(sbextent*2, 0, sliderstart-2*sbextent, sbextent); + else + ret.setRect(0, sbextent*2, sbextent, sliderstart-2*sbextent); + else + if (horizontal) + ret.setRect(noButtons ? 0 : sbextent, 0, + noButtons ? sliderstart + : (sliderstart - sbextent), sbextent); + else + ret.setRect(0, noButtons ? 0 : sbextent, sbextent, + noButtons ? sliderstart : (sliderstart - sbextent)); + break; + case SC_ScrollBarAddPage: + { + // between bottom/right button and slider + int fudge; + + if (platinumScrollBar) + fudge = 0; + else if (nextScrollBar) + fudge = 2*sbextent; + else if(noButtons) + fudge = 0; + else + fudge = sbextent; + + if (horizontal) + ret.setRect(sliderstart + sliderlen, 0, + maxlen - sliderstart - sliderlen + fudge, sbextent); + else + ret.setRect(0, sliderstart + sliderlen, sbextent, + maxlen - sliderstart - sliderlen + fudge); + break; + } + case SC_ScrollBarGroove: + if(noButtons) + { + if (horizontal) + ret.setRect(0, 0, sb->width(), sb->height()); + else + ret.setRect(0, 0, sb->width(), sb->height()); + } + else + { + int multi = threeButtonScrollBar ? 3 : 2, + fudge; + + if (platinumScrollBar) + fudge = 0; + else if (nextScrollBar) + fudge = 2*sbextent; + else + fudge = sbextent; + + if (horizontal) + ret.setRect(fudge, 0, sb->width() - sbextent * multi, sb->height()); + else + ret.setRect(0, fudge, sb->width(), sb->height() - sbextent * multi); + } + break; + case SC_ScrollBarSlider: + if (horizontal) + ret.setRect(sliderstart, 0, sliderlen, sbextent); + else + ret.setRect(0, sliderstart, sbextent, sliderlen); + break; + default: + ret = QCommonStyle::querySubControlMetrics(control, widget, sc, data); + break; + } + return ret; + } + default: + break; // Remove compiler warnings... + } + + return KStyle::querySubControlMetrics(control, widget, sc, data); +} + +int QtCurveStyle::pixelMetric(PixelMetric metric, const QWidget *widget) const +{ + switch(metric) + { + case PM_MenuButtonIndicator: + return 7; + case PM_ButtonMargin: + return 3; +#if QT_VERSION >= 0x030200 + case PM_TabBarTabShiftVertical: + { + const QTabBar *tb=widget ? ::qt_cast<const QTabBar *>(widget) : 0; + + return tb + ? QTabBar::RoundedAbove==tb->shape() || QTabBar::TriangularAbove==tb->shape() + ? 1 + : -1 + : KStyle::pixelMetric(metric, widget); + } + case PM_TabBarTabShiftHorizontal: + return 0; +#endif + case PM_ButtonShiftHorizontal: + case PM_ButtonShiftVertical: + return 1; + case PM_ButtonDefaultIndicator: + return 0; + case PM_DefaultFrameWidth: + if(QTC_DO_EFFECT && widget && !isFormWidget(widget) && + (::qt_cast<const QLineEdit *>(widget) || ::qt_cast<QDateTimeEditBase*>(widget) || + ::qt_cast<QTextEdit*>(widget))) + return 3; + else + return 2; + case PM_SpinBoxFrameWidth: + return QTC_DO_EFFECT && !isFormWidget(widget) ? 3 : 2; + case PM_IndicatorWidth: + case PM_IndicatorHeight: + return QTC_CHECK_SIZE; + case PM_ExclusiveIndicatorWidth: + case PM_ExclusiveIndicatorHeight: + return QTC_RADIO_SIZE; + case PM_TabBarTabOverlap: + return 1; + case PM_ProgressBarChunkWidth: + return 4; + case PM_DockWindowSeparatorExtent: + return 4; + case PM_DockWindowHandleExtent: + return 10; + case PM_SplitterWidth: + return 6; + case PM_ScrollBarSliderMin: + return 16; + case PM_SliderThickness: + return SLIDER_TRIANGULAR==opts.sliderStyle ? 22 : 18; + case PM_SliderControlThickness: + return SLIDER_TRIANGULAR==opts.sliderStyle ? 19 : 15; // This equates to 13, as we draw the handle 2 pix smaller for focus rect... + case PM_SliderLength: + return SLIDER_TRIANGULAR==opts.sliderStyle ? 11 : 21; + case PM_ScrollBarExtent: + // See KHTML note at top of file + return APP_KPRESENTER==itsThemedApp || + ((APP_KONQUEROR==itsThemedApp || APP_KONTACT==itsThemedApp) && (!widget || isFormWidget(widget))) + ? 16 : 15; + case PM_MaximumDragDistance: + return -1; + case PM_TabBarTabVSpace: + return opts.highlightTab ? 11 : 9; + default: + return KStyle::pixelMetric(metric, widget); + } +} + +int QtCurveStyle::kPixelMetric(KStylePixelMetric kpm, const QWidget *widget) const +{ + switch(kpm) + { + case KPM_MenuItemSeparatorHeight: + return 2; + default: + return KStyle::kPixelMetric(kpm, widget); + } +} + +QSize QtCurveStyle::sizeFromContents(ContentsType contents, const QWidget *widget, + const QSize &contentsSize, const QStyleOption &data) const +{ + switch(contents) + { + case CT_PushButton: + { + const QPushButton *button(static_cast<const QPushButton *>(widget)); + + if (button && !button->text().isEmpty()) + { + bool allowEtch(QTC_DO_EFFECT && !isFormWidget(widget)); + + const int constMinH(allowEtch ? 29 : 27); + + int margin(2*pixelMetric(PM_ButtonMargin, widget)), + mbi(button->isMenuButton() ? pixelMetric(PM_MenuButtonIndicator, widget) : 0), + w(contentsSize.width() + margin + mbi + 16), + h(contentsSize.height() + margin); + +// if(button->text()=="...") +// w+=24; +// else + if("..."!=button->text()) + { + const int constMinW(84); + + if(opts.embolden) + w+=6; // add room for bold font - Assume all buttons can be default! + if(w<constMinW) + w=constMinW; + } + + if(allowEtch) + h+=2; + + return QSize(w, h < constMinH ? constMinH : h); + } + break; + } + case CT_ComboBox: + { + bool allowEtch(QTC_DO_EFFECT && !isFormWidget(widget)); + + const int constMinH(allowEtch ? 26 : 24); + + QSize sz(KStyle::sizeFromContents(contents, widget, contentsSize, data)); + int h(sz.height()); + + if(allowEtch) + h+=2; + + return QSize(sz.width(), h<constMinH ? constMinH : h); + } + case CT_PopupMenuItem: + { + if (!widget || data.isDefault()) + break; + + const int constMinH(opts.thinnerMenuItems ? 25 : 27); + + QMenuItem *mi(data.menuItem()); + const QPopupMenu *popupmenu(static_cast<const QPopupMenu *>(widget)); + int maxpmw(data.maxIconWidth()), + w(contentsSize.width()), h(contentsSize.height()); + + if (mi->custom()) + { + w = mi->custom()->sizeHint().width(); + h = mi->custom()->sizeHint().height(); + + if (!mi->custom()->fullSpan() && h < constMinH) + h = constMinH; + } + else if(mi->widget()) + ; + else if (mi->isSeparator()) + { + w = 10; + h = opts.thinnerMenuItems ? 6 : 8; + } + else + { + // check is at least 16x16 + if (h < 16) + h = 16; + if (mi->pixmap()) + h = QMAX(h, mi->pixmap()->height()); + else if (!mi->text().isNull()) + h = QMAX(h, popupmenu->fontMetrics().height() + 2); + if (mi->iconSet()!= 0) + h = QMAX(h, mi->iconSet()->pixmap(QIconSet::Small, QIconSet::Normal).height()); + h+=(opts.thinnerMenuItems ? 2 : 4); + } + + // check | 4 pixels | item | 8 pixels | accel | 4 pixels | check + + // check is at least 16x16 + maxpmw=QMAX(maxpmw, 16); + w += (maxpmw * 2) + 8; + + if (! mi->text().isNull() && mi->text().find('\t') >= 0) + w += 8; + + return QSize(w, h); + } + case CT_SpinBox: + { + QSize size(KStyle::sizeFromContents(contents, widget, contentsSize, data)); + + if(!(size.height()%2)) + size.setHeight(size.height()+1); + +// if(!isFormWidget(widget)) +// size.setHeight(size.height()+2); + + return size; + } + case CT_ToolButton: + if(widget->parent() && ::qt_cast<QToolBar *>(widget->parent())) + return QSize(contentsSize.width()+8, contentsSize.height()+8); + default: + break; // Remove compiler warnings... + } + + return KStyle::sizeFromContents(contents, widget, contentsSize, data); +} + +int QtCurveStyle::styleHint(StyleHint stylehint, const QWidget *widget, const QStyleOption &option, + QStyleHintReturn *returnData) const +{ + switch(stylehint) + { + case SH_ScrollView_FrameOnlyAroundContents: + return opts.gtkScrollViews; + case SH_EtchDisabledText: + case SH_Slider_SnapToValue: + case SH_PrintDialog_RightAlignButtons: + case SH_FontDialog_SelectAssociatedText: + case SH_MenuBar_AltKeyNavigation: + case SH_PopupMenu_MouseTracking: + case SH_PopupMenu_SpaceActivatesItem: + case SH_ComboBox_ListMouseTracking: + case SH_ScrollBar_MiddleClickAbsolutePosition: + return 1; + case SH_LineEdit_PasswordCharacter: + if(opts.passwordChar) + { + int chars[4]={opts.passwordChar, 0x25CF, 0x2022, 0}; + const QFontMetrics &fm(widget ? widget->fontMetrics() : QFontMetrics(QFont())); + + for(int i=0; chars[i]; ++i) + if (fm.inFont(QChar(chars[i]))) + return chars[i]; + return '*'; + } + else + return '\0'; + case SH_MainWindow_SpaceBelowMenuBar: + return 0; + case SH_PopupMenu_AllowActiveAndDisabled: + return 0; + case SH_MenuBar_MouseTracking: + return opts.menubarMouseOver ? 1 : 0; + default: + return KStyle::styleHint(stylehint, widget, option, returnData); + } +} + +void QtCurveStyle::drawMenuItem(QPainter *p, const QRect &r, const QColorGroup &cg, + bool mbi, int round, const QColor &bgnd, const QColor *cols) const +{ + if(opts.borderMenuitems) + { + int flags(Style_Raised); + bool stdColor(!mbi || SHADE_BLEND_SELECTED!=opts.shadeMenubars); + + flags|=Style_Horizontal; + + if(stdColor) + drawLightBevel(bgnd, p, r, cg, flags, round, cols[ORIGINAL_SHADE], + cols, stdColor, !(mbi && IS_GLASS(opts.menubarAppearance)), WIDGET_MENU_ITEM); + else + { + QRect fr(r); + + fr.addCoords(1, 1, -1, -1); + + if(fr.width()>0 && fr.height()>0) + drawBevelGradient(cols[ORIGINAL_SHADE], true, p, fr, true, + getWidgetShade(WIDGET_MENU_ITEM, true, false, opts.menuitemAppearance), + getWidgetShade(WIDGET_MENU_ITEM, false, false, opts.menuitemAppearance), + false, opts.menuitemAppearance, WIDGET_MENU_ITEM); + drawBorder(bgnd, p, r, cg, flags, round, cols, WIDGET_OTHER, false, BORDER_FLAT, false, 0); + } + } + else + drawBevelGradient(cols[ORIGINAL_SHADE], true, p, r, true, + getWidgetShade(WIDGET_MENU_ITEM, true, false, opts.menuitemAppearance), + getWidgetShade(WIDGET_MENU_ITEM, false, false, opts.menuitemAppearance), + false, opts.menuitemAppearance, WIDGET_MENU_ITEM); +} + +void QtCurveStyle::drawProgress(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, + int round, const QWidget *widget) const +{ + if(r.width()<1) + return; + + int minWidth(3); + bool drawFull(r.width()>minWidth), + drawStripe(r.width()>(minWidth*1.5)); + QRegion outer(r); + + if(drawStripe) + { + int animShift=-PROGRESS_CHUNK_WIDTH; + + if (opts.animatedProgress) + { + // find the animation Offset for the current Widget + QWidget *nonConstWidget(const_cast<QWidget*>(widget)); + QMapConstIterator<QWidget*, int> it(itsProgAnimWidgets.find(nonConstWidget)); + + if (it!=itsProgAnimWidgets.end()) + animShift += it.data(); + } + + switch(opts.stripedProgress) + { + default: + case STRIPE_NONE: + break; + case STRIPE_PLAIN: + for(int offset=0; offset<(r.width()+PROGRESS_CHUNK_WIDTH); offset+=(PROGRESS_CHUNK_WIDTH*2)) + { + QRect r2(r.x()+offset+animShift, r.y(), PROGRESS_CHUNK_WIDTH, r.height()); + QRegion inner(r2); + + outer=outer.eor(inner); + } + break; + case STRIPE_DIAGONAL: + { + QPointArray a; + int shift(r.height()); + + for(int offset=0; offset<(r.width()+shift+2); offset+=(PROGRESS_CHUNK_WIDTH*2)) + { + a.setPoints(4, r.x()+offset+animShift, r.y(), + r.x()+offset+animShift+PROGRESS_CHUNK_WIDTH, r.y(), + (r.x()+offset+animShift+PROGRESS_CHUNK_WIDTH)-shift, r.y()+r.height()-1, + (r.x()+offset+animShift)-shift, r.y()+r.height()-1); + + outer=outer.eor(QRegion(a)); + } + } + } + } + + if(drawFull) + { + flags|=Style_Raised|Style_Horizontal; + + drawLightBevel(cg.background(), p, r, cg, flags, round, itsMenuitemCols[ORIGINAL_SHADE], + itsMenuitemCols, true, true, WIDGET_PROGRESSBAR); + + if(drawStripe && opts.stripedProgress) + { + p->setClipRegion(outer); + drawLightBevel(cg.background(), p, r, cg, flags, round, itsMenuitemCols[1], + itsMenuitemCols, true, true, WIDGET_PROGRESSBAR); + p->setClipping(false); + } + } + else + { + p->setPen(itsMenuitemCols[QT_STD_BORDER]); + p->setBrush(itsMenuitemCols[ORIGINAL_SHADE]); + p->drawRect(r); + } + if(QTC_ROUNDED && r.width()>2 && ROUNDED_ALL!=round) + { + p->setPen(midColor(cg.background(), itsMenuitemCols[QT_STD_BORDER])); + if(!(round&CORNER_TL) || !drawFull) + p->drawPoint(r.x(), r.y()); + if(!(round&CORNER_BL) || !drawFull) + p->drawPoint(r.x(), r.y()+r.height()-1); + if(!(round&CORNER_TR) || !drawFull) + p->drawPoint(r.x()+r.width()-1, r.y()); + if(!(round&CORNER_BR) || !drawFull) + p->drawPoint(r.x()+r.width()-1, r.y()+r.height()-1); + } +} + +void QtCurveStyle::drawBevelGradient(const QColor &base, bool increase, QPainter *p, + const QRect &origRect, bool horiz, double shadeTop, + double shadeBot, bool sel, EAppearance bevApp, EWidget w) const +{ + if(IS_FLAT(bevApp)) + p->fillRect(origRect, base); + else + { + EAppearance app(APPEARANCE_BEVELLED!=bevApp || WIDGET_BUTTON(w) || WIDGET_LISTVIEW_HEADER==w + ? bevApp + : APPEARANCE_GRADIENT); + + bool selected(opts.colorSelTab && (WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w) ? false : sel); + QRect r(0, 0, horiz ? QTC_PIXMAP_DIMENSION : origRect.width(), + horiz ? origRect.height() : QTC_PIXMAP_DIMENSION); + QString key(createKey(horiz ? r.height() : r.width(), base.rgb(), horiz, increase, + app2App(app, sel), w, shadeTop, shadeBot)); + QPixmap *pix(itsPixmapCache.find(key)); + + if(!pix) + { + pix=new QPixmap(r.width(), r.height()); + + QPainter pixPainter(pix); + + if(!selected && (IS_GLASS(app) || APPEARANCE_SPLIT_GRADIENT==app)) + { + if(WIDGET_TAB_BOT==w) + { + double t(shadeTop); + shadeTop=shadeBot; + shadeBot=t; + } + + double shadeTopA(WIDGET_TAB_BOT==w + ? 1.0 + : APPEARANCE_SPLIT_GRADIENT==app + ? shadeTop + : shadeTop*SHADE_GLASS_TOP_A(app, w)), + shadeTopB(WIDGET_TAB_BOT==w + ? 1.0 + : APPEARANCE_SPLIT_GRADIENT==app + ? shadeTop-((shadeTop-shadeBot)*SPLIT_GRADIENT_FACTOR) + : shadeTop*SHADE_GLASS_TOP_B(app, w)), + shadeBotA(WIDGET_TAB_TOP==w + ? 1.0 + : APPEARANCE_SPLIT_GRADIENT==app + ? shadeBot+((shadeTop-shadeBot)*SPLIT_GRADIENT_FACTOR) + : shadeBot*SHADE_GLASS_BOT_A(app)), + shadeBotB(WIDGET_TAB_TOP==w + ? 1.0 + : APPEARANCE_SPLIT_GRADIENT==app + ? shadeBot + : shadeBot*SHADE_GLASS_BOT_B(app)); + + QColor topA, topB, botA, botB; + QRect r1(r), r2(r), r3(r); + + shade(base, &topA, shadeTopA); + shade(base, &topB, shadeTopB); + shade(base, &botA, shadeBotA); + shade(base, &botB, shadeBotB); + + if(horiz) + { + r1.setHeight(r1.height()/2); + r2.setY(r2.y()+r1.height()); + } + else + { + r1.setWidth(r1.width()/2); + r2.setX(r2.x()+r1.width()); + } + drawGradient(topA, topB, increase, &pixPainter, r1, horiz); + drawGradient(botA, botB, increase, &pixPainter, r2, horiz); + } + else if(!selected && APPEARANCE_BEVELLED==app && + ((horiz ? r.height() + : r.width()) > (((WIDGET_BUTTON(w) ? 2 : 1)*BEVEL_BORDER(w))+4))) + { + if(WIDGET_LISTVIEW_HEADER==w) + { + QColor bot; + QRect r1(r), r2(r); + + if(horiz) + { + r2.setHeight(BEVEL_BORDER(w)); + r1.setHeight(r.height()-r2.height()); + r2.moveTop(r.y()+r1.height()); + } + else + { + r2.setWidth(BEVEL_BORDER(w)); + r1.setWidth(r.width()-r2.width()); + r2.moveLeft(r.x()+r1.width()); + } + shade(base, &bot, SHADE_BEVEL_BOT(w)); + pixPainter.fillRect(r1, base); + drawGradient(base, bot, true, &pixPainter, r2, horiz); + } + else + { + QColor bot, midTop, midBot, top; + QRect r1(r), r2(r), r3(r); + + if(horiz) + { + r1.setHeight(BEVEL_BORDER(w)); + r3.setHeight(BEVEL_BORDER(w)); + r2.setHeight(r.height()-(r1.height()+r3.height())); + r2.moveTop(r.y()+r1.height()); + r3.moveTop(r.y()+r1.height()+r2.height()); + } + else + { + r1.setWidth(BEVEL_BORDER(w)); + r3.setWidth(BEVEL_BORDER(w)); + r2.setWidth(r.width()-(r1.width()+r3.width())); + r2.moveLeft(r.x()+r1.width()); + r3.moveLeft(r.x()+r1.width()+r2.width()); + } + + shade(base, &top, SHADE_BEVEL_TOP); + shade(base, &midTop, SHADE_BEVEL_MID_TOP); + shade(base, &midBot, SHADE_BEVEL_MID_BOT); + shade(base, &bot, SHADE_BEVEL_BOT(w)); + drawGradient(top, midTop, true, &pixPainter, r1, horiz); + drawGradient(midTop, midBot, true, &pixPainter, r2, horiz); + drawGradient(midBot, bot, true, &pixPainter, r3, horiz); + } + } + else + { + QColor top, + bot, + baseTopCol(opts.colorSelTab && sel && (WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w) + ? midColor(base, itsMenuitemCols[0], QTC_COLOR_SEL_TAB_FACTOR) : base); + + if(equal(1.0, shadeTop)) + top=baseTopCol; + else + shade(baseTopCol, &top, shadeTop); + if(equal(1.0, shadeBot)) + bot=base; + else + shade(base, &bot, shadeBot); + + drawGradient(top, bot, sel || APPEARANCE_INVERTED!=app ? increase : !increase, + &pixPainter, r, horiz); + } + pixPainter.end(); + itsPixmapCache.insert(key, pix, pix->width()*pix->height()*(pix->depth()/8)); + } + p->drawTiledPixmap(origRect, *pix); + } +} + +void QtCurveStyle::drawGradient(const QColor &top, const QColor &bot, bool increase, + QPainter *p, QRect const &r, bool horiz) const +{ + if(r.width()>0 && r.height()>0) + { + if(top==bot) + p->fillRect(r, top); + else + { + int rh(r.height()), rw(r.width()), + rTop(top.red()), gTop(top.green()), bTop(top.blue()), + rx, ry, rx2, ry2, + size(horiz ? rh : rw); + + r.coords(&rx, &ry, &rx2, &ry2); + + register int rl(rTop << 16); + register int gl(gTop << 16); + register int bl(bTop << 16); + register int i; + + int dr(((1<<16) * (bot.red() - rTop)) / size), + dg(((1<<16) * (bot.green() - gTop)) / size), + db(((1<<16) * (bot.blue() - bTop)) / size); + + if(increase) + if(horiz) + { + for (i=0; i < size; i++) + { + p->setPen(QColor(rl>>16, gl>>16, bl>>16)); + p->drawLine(rx, ry+i, rx2, ry+i); + rl += dr; + gl += dg; + bl += db; + } + } + else + for(i=0; i < size; i++) + { + p->setPen(QColor(rl>>16, gl>>16, bl>>16)); + p->drawLine(rx+i, ry, rx+i, ry2); + rl += dr; + gl += dg; + bl += db; + } + else + if(horiz) + { + for(i=size-1; i>=0; i--) + { + p->setPen(QColor(rl>>16, gl>>16, bl>>16)); + p->drawLine(rx, ry+i, rx2, ry+i); + rl += dr; + gl += dg; + bl += db; + } + } + else + for(i=size-1; i>=0; i--) + { + p->setPen(QColor(rl>>16, gl>>16, bl>>16)); + p->drawLine(rx+i, ry, rx+i, ry2); + rl += dr; + gl += dg; + bl += db; + } + } + } +} + +void QtCurveStyle::drawSbSliderHandle(QPainter *p, const QRect &orig, const QColorGroup &cg, + SFlags flags, bool slider) const +{ + int min(MIN_SLIDER_SIZE(opts.sliderThumbs)); + const QColor *use(sliderColors(/*cg, */flags)); + QRect r(orig); +// EShade shade(opts.shadeSliders); + + if(flags&(Style_Sunken|Style_Down)) + flags|=Style_MouseOver; + flags&=~Style_Down; + if(r.width()>r.height()) + flags|=Style_Horizontal; + flags|=Style_Raised; + + drawLightBevel(p, r, cg, flags, slider +#ifndef QTC_SIMPLE_SCROLLBARS + || SCROLLBAR_NONE==opts.scrollbarType +#endif + ? ROUNDED_ALL : ROUNDED_NONE, + getFill(flags, use), use, true, false, WIDGET_SB_SLIDER); + + const QColor *markers(/*opts.coloredMouseOver && flags&Style_MouseOver + ? SHADE_NONE==shade ? itsMouseOverCols : itsBackgroundCols + : */use); + if(flags & Style_Horizontal) + r.setX(r.x()+1); + else + r.setY(r.y()+1); + + if(LINE_NONE!=opts.sliderThumbs && (slider || ((flags & Style_Horizontal && r.width()>=min)|| r.height()>=min))) + switch(opts.sliderThumbs) + { + case LINE_FLAT: + drawLines(p, r, !(flags & Style_Horizontal), 3, 5, markers, 0, 5, 0, false); + break; + case LINE_SUNKEN: + drawLines(p, r, !(flags & Style_Horizontal), 4, 3, markers, 0, 3); + break; + case LINE_DOTS: + default: + drawDots(p, r, !(flags & Style_Horizontal), slider ? 3 : 5, slider ? 5 : 2, markers, 0, 5); + } +} + +void QtCurveStyle::drawSliderHandle(QPainter *p, const QRect &r, const QColorGroup &cg, + SFlags flags, QSlider *slider, bool tb) const +{ + bool horiz(SLIDER_TRIANGULAR==opts.sliderStyle ? r.height()>r.width() : r.width()>r.height()); + + if(SLIDER_TRIANGULAR==opts.sliderStyle || (SLIDER_ROUND==opts.sliderStyle && ROUND_FULL==opts.round)) + { + const QColor *use(sliderColors(/*cg, */flags)); + const QColor &fill(getFill(flags, use)); + int x(r.x()), + y(r.y()), + xo(horiz ? 8 : 0), + yo(horiz ? 0 : 8); + PrimitiveElement direction(horiz ? PE_ArrowDown : PE_ArrowRight); + bool drawLight(MO_PLASTIK!=opts.coloredMouseOver || !(flags&Style_MouseOver) || + (SLIDER_ROUND==opts.sliderStyle && + (SHADE_BLEND_SELECTED==opts.shadeSliders || SHADE_SELECTED==opts.shadeSliders))); + int size(SLIDER_TRIANGULAR==opts.sliderStyle ? 15 : 13); + + if(horiz) + y++; + else + x++; + + QPointArray clipRegion; + + p->save(); + if(SLIDER_TRIANGULAR==opts.sliderStyle) + { + if(slider) + switch(slider->tickmarks()) + { + case QSlider::Both: + case QSlider::NoMarks: + case QSlider::Below: + direction=horiz ? PE_ArrowDown : PE_ArrowRight; + break; + case QSlider::Above: + direction=horiz ? PE_ArrowUp : PE_ArrowLeft; + } + + switch(direction) + { + default: + case PE_ArrowDown: + y+=2; + clipRegion.setPoints(7, x, y+2, x+2, y, x+8, y, x+10, y+2, x+10, y+9, x+5, y+14, x, y+9); + break; + case PE_ArrowUp: + y-=2; + clipRegion.setPoints(7, x, y+12, x+2, y+14, x+8, y+14, x+10, y+12, x+10, y+5, x+5, y, x, y+5); + break; + case PE_ArrowLeft: + x-=2; + clipRegion.setPoints(7, x+12, y, x+14, y+2, x+14, y+8, x+12, y+10, x+5, y+10, x, y+5, x+5, y ); + break; + case PE_ArrowRight: + x+=2; + clipRegion.setPoints(7, x+2, y, x, y+2, x, y+8, x+2, y+10, x+9, y+10, x+14, y+5, x+9, y); + } + } + else + clipRegion.setPoints(8, x, y+8+yo, x, y+4, x+4, y, x+8+xo, y, + x+12+xo, y+4, x+12+xo, y+8+yo, x+8+xo, y+12+yo, x+4, y+12+yo); + + if(!tb) + p->fillRect(QRect(x, y, r.width()-(horiz ? 0 : 2), r.height()-(horiz ? 2 : 0)), cg.background()); + p->setClipRegion(QRegion(clipRegion)); // , QPainter::CoordPainter); + if(IS_FLAT(opts.appearance)) + { + p->fillRect(r, fill); + if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver) + { + int col(QTC_SLIDER_MO_SHADE), + len(QTC_SLIDER_MO_LEN); + + if(horiz) + { + p->fillRect(QRect(x+1, y+1, len, size-2), itsMouseOverCols[col]); + p->fillRect(QRect(x+r.width()-(1+len), y+1, len, r.height()-2), itsMouseOverCols[col]); + } + else + { + p->fillRect(QRect(x+1, y+1, size-2, len), itsMouseOverCols[col]); + p->fillRect(QRect(x+1, y+r.height()-(1+len), r.width()-2, len), itsMouseOverCols[col]); + } + } + } + else + { + drawBevelGradient(fill, true, p, QRect(x, y, horiz ? r.width()-1 : size, horiz ? size : r.height()-1), + horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, + false, opts.sliderAppearance); + + if(MO_PLASTIK==opts.coloredMouseOver && flags&Style_MouseOver) + { + int col(QTC_SLIDER_MO_SHADE), + len(QTC_SLIDER_MO_LEN); + + if(horiz) + { + drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+1, y+1, len, size-2), + horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance); + drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+r.width()-(1+len), y+1, len, size-2), + horiz,SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance); + } + else + { + drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+1, y+1, size-2, len), + horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance); + drawBevelGradient(itsMouseOverCols[col], true, p, QRect(x+1, y+r.height()-(1+len), size-2, len), + horiz, SHADE_BEVEL_GRAD_LIGHT, SHADE_BEVEL_GRAD_DARK, false, opts.sliderAppearance); + } + } + } + + p->setClipping(false); + + if(SLIDER_TRIANGULAR==opts.sliderStyle) + { + QPointArray aa, + light; + + switch(direction) + { + default: + case PE_ArrowDown: + aa.setPoints(8, x, y+1, x+1, y, x+9, y, x+10, y+1, x+10, y+10, x+6, y+14, x+4, y+14, x, y+10); + light.setPoints(3, x+1, y+9, x+1, y+1, x+8, y+1); + break; + case PE_ArrowUp: + aa.setPoints(8, x, y+13, x+1, y+14, x+9, y+14, x+10, y+13, x+10, y+4, x+6, y, x+4, y, x, y+4); + light.setPoints(3, x+1, y+13, x+1, y+5, x+5, y+1); + break; + case PE_ArrowLeft: + aa.setPoints(8, x+13, y, x+14, y+1, x+14, y+9, x+13, y+10, x+4, y+10, x, y+6, x, y+4, x+4, y); + light.setPoints(3, x+1, y+5, x+5, y+1, x+13, y+1); + break; + case PE_ArrowRight: + aa.setPoints(8, x+1, y, x, y+1, x, y+9, x+1, y+10, x+10, y+10, x+14, y+6, x+14, y+4, x+10, y); + light.setPoints(3, x+1, y+8, x+1, y+1, x+9, y+1); + } + + p->setPen(midColor(use[QT_STD_BORDER], cg.background())); + p->drawPolygon(aa); + if(drawLight) + { + p->setPen(use[APPEARANCE_DULL_GLASS==opts.sliderAppearance ? 1 : 0]); + p->drawPolyline(light); + } + p->setPen(use[QT_STD_BORDER]); + p->drawPolygon(clipRegion); + } + else + { + p->drawPixmap(x, y, + *getPixmap(use[opts.coloredMouseOver && flags&Style_MouseOver ? 4 : QT_BORDER(flags&Style_Enabled)], + horiz ? PIX_SLIDER : PIX_SLIDER_V, 0.8)); + if(drawLight) + p->drawPixmap(x, y, *getPixmap(use[0], horiz ? PIX_SLIDER_LIGHT : PIX_SLIDER_LIGHT_V)); + } + p->restore(); + } + else + { + QRect sr(r); + + if(horiz) + sr.addCoords(0, 1, 0, 0); + else + sr.addCoords(1, 0, 0, 0); + + drawSbSliderHandle(p, sr, cg, flags|(horiz ? Style_Horizontal : 0), true); + } +} + +void QtCurveStyle::drawSliderGroove(QPainter *p, const QRect &r, const QColorGroup &cg, + SFlags flags, const QWidget *widget) const +{ + const QSlider *sliderWidget((const QSlider *)widget); + QRect groove(r); + bool horiz(Qt::Horizontal==sliderWidget->orientation()), + reverse(QApplication::reverseLayout()); + const QColor &usedCol=itsSliderCols + ? itsSliderCols[ORIGINAL_SHADE] + : itsMouseOverCols + ? itsMouseOverCols[ORIGINAL_SHADE] + : itsMenuitemCols[1]; + + if(horiz) + { + int dh=(groove.height()-5)>>1; + groove.addCoords(0, dh, 0, -dh); + flags|=Style_Horizontal; + } + else + { + int dw=(groove.width()-5)>>1; + groove.addCoords(dw, 0, -dw, 0); + } + + drawLightBevel(p, groove, cg, flags|Style_Down, ROUNDED_ALL, itsBackgroundCols[flags&Style_Enabled ? 2 : ORIGINAL_SHADE], + itsBackgroundCols, true, true, WIDGET_SLIDER_TROUGH); + + if(opts.fillSlider && sliderWidget->maxValue()!=sliderWidget->minValue() && flags&Style_Enabled) + { + QRect used(groove); + int pos((int)(((double)(horiz ? groove.width() : groove.height()) / + (sliderWidget->maxValue()-sliderWidget->minValue())) * + (sliderWidget->value() - sliderWidget->minValue()))); + + if(horiz) + { + pos+=(groove.width()>10 && pos<(groove.width()/2)) ? 3 : 0; + if(reverse) + used.addCoords(groove.width()-pos, 0, 0, 0); + else + used.addCoords(0, 0, -(groove.width()-pos), 0); + } + else + { + pos+=(groove.height()>10 && pos<(groove.height()/2)) ? 3 : 0; + used.addCoords(0, pos, 0, 0); + } + if(used.height()>0 && used.width()>0) + drawLightBevel(p, used, cg, flags|Style_Down, ROUNDED_ALL, usedCol, NULL, + true, true, WIDGET_SLIDER_TROUGH); + } +} + +void QtCurveStyle::drawMenuOrToolBarBackground(QPainter *p, const QRect &r, const QColorGroup &cg, + bool menu, bool horiz) const +{ + EAppearance app(menu ? opts.menubarAppearance : opts.toolbarAppearance); + QColor color(menu && itsActive ? itsMenubarCols[ORIGINAL_SHADE] : cg.background()); + double from(0.0), to(0.0); + + switch(app) + { + default: + case APPEARANCE_GRADIENT: + from=SHADE_MENU_LIGHT; + to=SHADE_MENU_DARK; + break; + case APPEARANCE_FLAT: + case APPEARANCE_RAISED: + break; + case APPEARANCE_SHINY_GLASS: + case APPEARANCE_DULL_GLASS: + from=SHADE_BEVEL_GRAD_LIGHT; + to=SHADE_BEVEL_GRAD_DARK; + } + + drawBevelGradient(color, true, p, r, horiz, from, to, false, app); +} + +void QtCurveStyle::drawHandleMarkers(QPainter *p, const QRect &r, SFlags flags, bool tb, + ELine handles) const +{ + if(r.width()<2 || r.height()<2) + return; + +// if(!(flags&Style_MouseOver) && p->device()==itsHoverWidget) +// flags|=Style_MouseOver; + flags&=~Style_MouseOver; // Dont mouse-over handles - we dont do this for KDE4... + + const QColor *border(borderColors(flags, itsBackgroundCols)); + + switch(handles) + { + case LINE_DOTS: + drawDots(p, r, !(flags & Style_Horizontal), 2, + APP_KICKER==itsThemedApp ? 1 : tb ? 5 : 3, border, + APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 5); + break; + case LINE_DASHES: + if(flags&Style_Horizontal) + { + QRect r1(r.x()+(tb ? 2 : (r.width()-6)/2), r.y(), 3, r.height()); + + drawLines(p, r1, true, (r.height()-8)/2, + tb ? 0 : (r.width()-5)/2, border, 0, 5, 0); + } + else + { + QRect r1(r.x(), r.y()+(tb ? 2 : (r.height()-6)/2), r.width(), 3); + + drawLines(p, r1, false, (r.width()-8)/2, + tb ? 0 : (r.height()-5)/2, border, 0, 5, 0); + } + break; + case LINE_FLAT: + drawLines(p, r, !(flags & Style_Horizontal), 2, + APP_KICKER==itsThemedApp ? 1 : tb ? 4 : 2, border, + APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 4, 0, false); + break; + default: + drawLines(p, r, !(flags & Style_Horizontal), 2, + APP_KICKER==itsThemedApp ? 1 : tb ? 4 : 2, border, + APP_KICKER==itsThemedApp ? 1 : tb ? -2 : 0, 3); + } +} + +void QtCurveStyle::shadeColors(const QColor &base, QColor *vals) const +{ + QTC_SHADES + + for(int i=0; i<NUM_STD_SHADES; ++i) + shade(base, &vals[i], QTC_SHADE(opts.contrast, i)); + shade(base, &vals[SHADE_ORIG_HIGHLIGHT], opts.highlightFactor); + shade(vals[4], &vals[SHADE_4_HIGHLIGHT], opts.highlightFactor); + shade(vals[2], &vals[SHADE_2_HIGHLIGHT], opts.highlightFactor); + vals[ORIGINAL_SHADE]=base; +} + +const QColor * QtCurveStyle::buttonColors(const QColorGroup &cg) const +{ + if(cg.button()!=itsButtonCols[ORIGINAL_SHADE]) + { + shadeColors(cg.button(), itsColoredButtonCols); + return itsColoredButtonCols; + } + + return itsButtonCols; +} + +const QColor * QtCurveStyle::sliderColors(/*const QColorGroup &cg, */ SFlags flags) const +{ + return (flags&Style_Enabled) + ? SHADE_NONE!=opts.shadeSliders //&& cg.button()==itsButtonCols[ORIGINAL_SHADE] + ? itsSliderCols + : itsButtonCols // buttonColors(cg) + : itsBackgroundCols; +} + +const QColor * QtCurveStyle::backgroundColors(const QColor &c) const +{ + if(c!=itsBackgroundCols[ORIGINAL_SHADE]) + { + shadeColors(c, itsColoredBackgroundCols); + return itsColoredBackgroundCols; + } + + return itsBackgroundCols; +} + +const QColor * QtCurveStyle::borderColors(SFlags flags, const QColor *use) const +{ + return itsMouseOverCols && opts.coloredMouseOver && flags&Style_MouseOver + ? itsMouseOverCols : use; +} + +const QColor * QtCurveStyle::getSidebarButtons() const +{ + if(!itsSidebarButtonsCols) + { + if(SHADE_BLEND_SELECTED==opts.shadeSliders) + itsSidebarButtonsCols=itsSliderCols; + else if(IND_COLORED==opts.defBtnIndicator) + itsSidebarButtonsCols=itsDefBtnCols; + else + { + itsSidebarButtonsCols=new QColor [TOTAL_SHADES+1]; + shadeColors(midColor(itsMenuitemCols[ORIGINAL_SHADE], itsButtonCols[ORIGINAL_SHADE]), + itsSidebarButtonsCols); + } + } + + return itsSidebarButtonsCols; +} + +void QtCurveStyle::setMenuColors(const QColorGroup &cg) +{ + switch(opts.shadeMenubars) + { + case SHADE_NONE: + memcpy(itsMenubarCols, itsBackgroundCols, sizeof(QColor)*(TOTAL_SHADES+1)); + break; + case SHADE_BLEND_SELECTED: // For menubars we dont actually blend... + shadeColors(IS_GLASS(opts.appearance) + ? shade(itsMenuitemCols[ORIGINAL_SHADE], MENUBAR_GLASS_SELECTED_DARK_FACTOR) + : itsMenuitemCols[ORIGINAL_SHADE], + itsMenubarCols); + break; + case SHADE_CUSTOM: + shadeColors(opts.customMenubarsColor, itsMenubarCols); + break; + case SHADE_DARKEN: + shadeColors(shade(cg.background(), MENUBAR_DARK_FACTOR), itsMenubarCols); + } +} + +bool QtCurveStyle::redrawHoverWidget(const QPoint &pos) +{ + if(!itsHoverWidget || !itsHoverWidget->isShown() || !itsHoverWidget->isVisible()) + return false; + +#if QT_VERSION >= 0x030200 + // + // Qt>=3.2 sets the sensitive part of a check/radio to the image + label -> anything else + // is not sensitive. But, the widget can ocupy a larger area - and this whole area will + // react to mouse over. This needs to be counteracted so that it looks as if only the + // sensitive area mouse-overs... + QRadioButton *rb(::qt_cast<QRadioButton *>(itsHoverWidget)); + + if(rb) + { + QRect rect(0, 0, + visualRect(subRect(SR_RadioButtonFocusRect, rb), rb).width()+ + pixelMetric(PM_ExclusiveIndicatorWidth)+4, itsHoverWidget->height()); + + itsHover=rect.contains(pos) ? HOVER_RADIO : HOVER_NONE; + return (HOVER_NONE!=itsHover && !rect.contains(itsOldPos)) || + (HOVER_NONE==itsHover && rect.contains(itsOldPos)); + } + else + { + QCheckBox *cb(::qt_cast<QCheckBox *>(itsHoverWidget)); + + if(cb) + { + QRect rect(0, 0, + visualRect(subRect(SR_CheckBoxFocusRect, cb), cb).width()+ + pixelMetric(PM_IndicatorWidth)+4, itsHoverWidget->height()); + + itsHover=rect.contains(pos) ? HOVER_CHECK : HOVER_NONE; + return (HOVER_NONE!=itsHover && !rect.contains(itsOldPos)) || (HOVER_NONE==itsHover && rect.contains(itsOldPos)); + } + else + { +#endif + QScrollBar *sb(::qt_cast<QScrollBar *>(itsHoverWidget)); + + if(sb) // So, are we over add button, sub button, slider, or none? + { + bool useThreeButtonScrollBar(SCROLLBAR_KDE==opts.scrollbarType); + QRect subline(querySubControlMetrics(CC_ScrollBar, itsHoverWidget, + SC_ScrollBarSubLine)), + addline(querySubControlMetrics(CC_ScrollBar, itsHoverWidget, + SC_ScrollBarAddLine)), + slider(querySubControlMetrics(CC_ScrollBar, itsHoverWidget, + SC_ScrollBarSlider)), + subline2(addline); + + if (useThreeButtonScrollBar) + if (Qt::Horizontal==sb->orientation()) + subline2.moveBy(-addline.width(), 0); + else + subline2.moveBy(0, -addline.height()); + + if(slider.contains(pos)) + itsHover=HOVER_SB_SLIDER; + else if(subline.contains(pos)) + itsHover=HOVER_SB_SUB; + else if(addline.contains(pos)) + itsHover=HOVER_SB_ADD; + else if(subline2.contains(pos)) + itsHover=HOVER_SB_SUB2; + else + itsHover=HOVER_NONE; + + return (HOVER_SB_SLIDER==itsHover && !slider.contains(itsOldPos)) || + (HOVER_SB_SLIDER!=itsHover && slider.contains(itsOldPos)) || + (HOVER_SB_SUB==itsHover && !subline.contains(itsOldPos)) || + (HOVER_SB_SUB!=itsHover && subline.contains(itsOldPos)) || + + (useThreeButtonScrollBar && + (HOVER_SB_SUB2==itsHover && !subline2.contains(itsOldPos)) || + (HOVER_SB_SUB2!=itsHover && subline2.contains(itsOldPos))) || + + (HOVER_SB_ADD==itsHover && !addline.contains(itsOldPos)) || + (HOVER_SB_ADD!=itsHover && addline.contains(itsOldPos)); + } + else + { +#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500 + QToolButton *tb(::qt_cast<QToolButton *>(itsHoverWidget)); + + if(tb) + { + itsHover=APP_KICKER==itsThemedApp ? HOVER_KICKER : HOVER_NONE; + return HOVER_KICKER==itsHover; + } + else + { +#endif + QHeader *hd(::qt_cast<QHeader *>(itsHoverWidget)); + + if(hd) + { + // Hmm... this ones tricky, as there's only 1 widget - but it has different + // sections... + // and the ones that aren't clickable should not highlight on mouse over! + + QRect rect(0, 0, itsHoverWidget->width(), itsHoverWidget->height()); + int s(0); + bool redraw(false); + + itsHover=rect.contains(pos) ? HOVER_HEADER : HOVER_NONE; + itsHoverSect=QTC_NO_SECT; + + for(s=0; s<hd->count() && (QTC_NO_SECT==itsHoverSect || !redraw); ++s) + { + QRect r(hd->sectionRect(s)); + bool hasNew(r.contains(pos)); + + if(hasNew) + itsHoverSect=s; + + if(!redraw) + { + bool hasOld(r.contains(itsOldPos)); + + if((hasNew && !hasOld) || (!hasNew && hasOld)) + redraw=true; + } + } + return redraw; + } + else + { + QSpinWidget *sw(::qt_cast<QSpinWidget *>(itsHoverWidget)); + + if(sw) // So, are we over up or down? + { + QRect up(querySubControlMetrics(CC_SpinWidget, itsHoverWidget, + SC_SpinWidgetUp)), + down(querySubControlMetrics(CC_SpinWidget, itsHoverWidget, + SC_SpinWidgetDown)); + + if(up.contains(pos)) + itsHover=HOVER_SW_UP; + else if(down.contains(pos)) + itsHover=HOVER_SW_DOWN; + else + itsHover=HOVER_NONE; + + return (HOVER_SW_UP==itsHover && !up.contains(itsOldPos)) || + (HOVER_SW_UP!=itsHover && up.contains(itsOldPos)) || + (HOVER_SW_DOWN==itsHover && !down.contains(itsOldPos)) || + (HOVER_SW_DOWN!=itsHover && down.contains(itsOldPos)); + } + else + { + QTabBar *tabbar(::qt_cast<QTabBar *>(itsHoverWidget)); + + if(tabbar) + { + bool redraw(false); + QTab *tab(tabbar->selectTab(pos)); + int tabIndex(tab ? tabbar->indexOf(tab->identifier()) : -1), + selectedTab(tabbar->currentTab()); + + redraw=tab!=itsHoverTab && tabIndex!=selectedTab; + itsHoverTab=tab; + + return redraw; + } + else + { + QComboBox *cb(::qt_cast<QComboBox *>(itsHoverWidget)); + + if(cb) + { + QRect arrow(cb->rect()); + + if(!cb->editable()) + itsHover=HOVER_CB_ARROW; + else + { + arrow=(querySubControlMetrics(CC_ComboBox, itsHoverWidget, + SC_ComboBoxArrow)); + + if(arrow.contains(pos)) + itsHover=HOVER_CB_ARROW; + else + itsHover=HOVER_NONE; + } + + return (HOVER_CB_ARROW==itsHover && !arrow.contains(itsOldPos)) || + (HOVER_CB_ARROW!=itsHover && arrow.contains(itsOldPos)); + } + else + return itsOldPos==QPoint(-1, -1); + + } + } +#if KDE_VERSION >= 0x30400 && KDE_VERSION < 0x30500 + } +#endif +#if KDE_VERSION >= 0x30400 + } +#endif + } +#if QT_VERSION >= 0x030200 + } + } +#endif + + return false; +} + +const QColor & QtCurveStyle::getFill(SFlags flags, const QColor *use) const +{ + return !(flags&Style_Enabled) + ? use[ORIGINAL_SHADE] + : flags&Style_Down + ? use[4] + : flags&Style_MouseOver + ? flags&(Style_On | Style_Sunken) + ? use[SHADE_4_HIGHLIGHT] + : use[SHADE_ORIG_HIGHLIGHT] + : flags&(Style_On | Style_Sunken) + ? use[4] + : use[ORIGINAL_SHADE]; +} + +const QColor & QtCurveStyle::getTabFill(bool current, bool highlight, const QColor *use) const +{ + return current + ? use[ORIGINAL_SHADE] + : highlight + ? use[SHADE_2_HIGHLIGHT] + : use[2]; +} + +QPixmap * QtCurveStyle::getPixelPixmap(const QColor col) const +{ + QRgb rgb(col.rgb()); + QString key(createKey(rgb)); + + QPixmap *pix=itsPixmapCache.find(key); + + if(!pix) + { + static const int constAlpha=110; + + QImage img(1, 1, 32); + + img.setAlphaBuffer(true); + img.setPixel(0, 0, qRgba(qRed(rgb), qGreen(rgb), qBlue(rgb), constAlpha)); + pix=new QPixmap(img); + itsPixmapCache.insert(key, pix, pix->depth()/8); + } + + return pix; +} + +QPixmap * QtCurveStyle::getPixmap(const QColor col, EPixmap p, double shade) const +{ + QRgb rgb(col.rgb()); + QString key(createKey(rgb, p)); + QPixmap *pix=itsPixmapCache.find(key); + + if(!pix) + { + pix=new QPixmap(); + + QImage img; + + switch(p) + { + case PIX_RADIO_BORDER: + img.loadFromData(qembed_findData("radio_frame.png")); + break; + case PIX_RADIO_LIGHT: + img.loadFromData(qembed_findData("radio_light.png")); + break; + case PIX_RADIO_ON: + img.loadFromData(qembed_findData("radio_on.png")); + break; + case PIX_CHECK: + img.loadFromData(qembed_findData(opts.xCheck ? "check_x_on.png" : "check_on.png")); + break; + case PIX_SLIDER: + img.loadFromData(qembed_findData("slider.png")); + break; + case PIX_SLIDER_LIGHT: + img.loadFromData(qembed_findData("slider_light.png")); + break; + case PIX_SLIDER_V: + img.loadFromData(qembed_findData("slider_v.png")); + break; + case PIX_SLIDER_LIGHT_V: + img.loadFromData(qembed_findData("slider_light_v.png")); + break; + } + + if (img.depth()<32) + img=img.convertDepth(32); + + adjustPix(img.bits(), 4, img.width(), img.height(), img.bytesPerLine(), col.red(), + col.green(), col.blue(), shade); + pix->convertFromImage(img); + itsPixmapCache.insert(key, pix, pix->depth()/8); + } + + return pix; +} + +void QtCurveStyle::setSbType() +{ + switch(opts.scrollbarType) + { + case SCROLLBAR_KDE: + this->setScrollBarType(KStyle::ThreeButtonScrollBar); + break; + default: + case SCROLLBAR_WINDOWS: + this->setScrollBarType(KStyle::WindowsStyleScrollBar); + break; + case SCROLLBAR_PLATINUM: + this->setScrollBarType(KStyle::PlatinumStyleScrollBar); + break; + case SCROLLBAR_NEXT: + this->setScrollBarType(KStyle::NextStyleScrollBar); + break; + } +} + +void QtCurveStyle::updateProgressPos() +{ + // Taken from lipstik! + QMap<QWidget*, int>::iterator it(itsProgAnimWidgets.begin()), + end(itsProgAnimWidgets.end()); + bool visible(false); + for (; it!=end; ++it) + { + if (!::qt_cast<QProgressBar*>(it.key())) + continue; + + QProgressBar *pb(::qt_cast<QProgressBar*>(it.key())); + + if (it.key() -> isEnabled() && pb -> progress()!=pb->totalSteps()) + { + // update animation Offset of the current Widget + it.data() = (it.data() + (QApplication::reverseLayout() ? -1 : 1)) + % (PROGRESS_CHUNK_WIDTH*2); + it.key()->update(); + } + if (it.key()->isVisible()) + visible = true; + } + if (!visible) + itsAnimationTimer->stop(); +} + +void QtCurveStyle::progressBarDestroyed(QObject *bar) +{ + itsProgAnimWidgets.remove(static_cast<QWidget*>(bar)); +} + +void QtCurveStyle::sliderThumbMoved(int) +{ + QSlider *slider(::qt_cast<QSlider*>(sender())); + + if(slider) + slider->update(); +} + +void QtCurveStyle::khtmlWidgetDestroyed(QObject *o) +{ + itsKhtmlWidgets.remove(static_cast<const QWidget *>(o)); +} + +#include "qtcurve.moc" diff --git a/style/qtcurve.h b/style/qtcurve.h new file mode 100644 index 0000000..f021dd3 --- /dev/null +++ b/style/qtcurve.h @@ -0,0 +1,246 @@ +#ifndef __QTCURVE_H__ +#define __QTCURVE_H__ + +/* + QtCurve (C) Craig Drummond, 2003 - 2007 [email protected] + + ---- + + Based upon B???Curve style (Copyright (c) 2002 R?d H?t, Inc) + Bernhard Rosenkrazer <bero@r?dh?t.com> + Preston Brown <pbrown@r?dh?t.com> + Than Ngo <than@r?dh?t.com> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + ---- + + B???Curve is based on the KDE Light style, 2nd revision: + Copyright (c) 2000-2001 Trolltech AS ([email protected]). The light style + license is as follows: + + 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 "config.h" +#include <kdeversion.h> +#include <kstyle.h> +#include <qcolor.h> +#include <qpoint.h> +#include <qpalette.h> +#include <qpixmap.h> +#include <qcache.h> +#include "common.h" + +class QTimer; +class QSlider; + +class HighContrastStyle : public KStyle +{ + Q_OBJECT + + public: + + HighContrastStyle(); + virtual ~HighContrastStyle() { } + + const char * className(); +}; + +class QtCurveStyle : public HighContrastStyle +{ + Q_OBJECT + + public: + + enum EApp + { + APP_KICKER, + APP_KORN, + APP_OPENOFFICE, + APP_MACTOR, + APP_KPRESENTER, + APP_KONQUEROR, + APP_SKIP_TASKBAR, + APP_KPRINTER, + APP_KDIALOG, + APP_KDIALOGD, + APP_TORA, + APP_KONTACT, + APP_OPERA, + APP_OTHER + }; + + enum EHover + { + HOVER_NONE, + HOVER_CHECK, + HOVER_RADIO, + HOVER_SB_ADD, + HOVER_SB_SUB, + HOVER_SB_SUB2, + HOVER_SB_SLIDER, + HOVER_HEADER, + HOVER_KICKER, + HOVER_SW_UP, + HOVER_SW_DOWN, + HOVER_CB_ARROW + }; + + QtCurveStyle(const QString &name=QString()); + virtual ~QtCurveStyle(); + + void polish(QApplication *app); + void polish(QPalette &pal); + void polish(QWidget *widget); + void unPolish(QWidget *widget); + void drawLightBevel(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, + int round, const QColor &fill, const QColor *custom=NULL, + bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const + { drawLightBevel(cg.background(), p, r, cg, flags, round, fill, custom, doBorder, doCorners, w); } + void drawLightBevel(const QColor &bgnd, QPainter *p, const QRect &r, const QColorGroup &cg, + SFlags flags, int round, const QColor &fill, const QColor *custom=NULL, + bool doBorder=true, bool doCorners=true, EWidget w=WIDGET_OTHER) const; + void drawEtch(QPainter *p, const QRect &r, const QColorGroup &cg, bool top, bool bot, bool raised=false) const; + void drawBorder(const QColor &bgnd, QPainter *p, const QRect &r, const QColorGroup &cg, + SFlags flags, int round, const QColor *custom=NULL, EWidget w=WIDGET_OTHER, + bool doCorners=true, EBorder borderProfile=BORDER_FLAT, bool blendBorderColors=true, int borderVal=QT_STD_BORDER) const; + void drawEntryField(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, + bool highlight, int round, EWidget=WIDGET_OTHER) const; + void drawArrow(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, + QStyle::PrimitiveElement pe, bool small=false, bool checkActive=false) const; + void drawPrimitive(PrimitiveElement, QPainter *, const QRect &, const QColorGroup &, + SFlags = Style_Default, const QStyleOption & = QStyleOption::Default) const; + void drawKStylePrimitive(KStylePrimitive kpe, QPainter* p, const QWidget* widget, const QRect &r, + const QColorGroup &cg, SFlags flags, const QStyleOption &opt ) const; + void drawControl(ControlElement, QPainter *, const QWidget *, const QRect &, const QColorGroup &, + SFlags = Style_Default, const QStyleOption & = QStyleOption::Default) const; + void drawControlMask(ControlElement, QPainter *, const QWidget *, const QRect &, + const QStyleOption & = QStyleOption::Default) const; + void drawComplexControlMask(ComplexControl control, QPainter *p, const QWidget *widget, + const QRect &r, const QStyleOption &data) const; + QRect subRect(SubRect, const QWidget *) const; + void drawComplexControl(ComplexControl, QPainter *, const QWidget *, const QRect &, + const QColorGroup &, SFlags = Style_Default, SCFlags = SC_All, + SCFlags = SC_None, const QStyleOption & = QStyleOption::Default) const; + QRect querySubControlMetrics(ComplexControl, const QWidget *, SubControl, + const QStyleOption & = QStyleOption::Default) const; + int pixelMetric(PixelMetric, const QWidget *widget= 0) const; + int kPixelMetric(KStylePixelMetric kpm, const QWidget *widget) const; + QSize sizeFromContents(ContentsType, const QWidget *, const QSize &, + const QStyleOption & = QStyleOption::Default) const; + int styleHint(StyleHint, const QWidget *widget= 0, const QStyleOption & = QStyleOption::Default, + QStyleHintReturn *returnData= 0) const; + + protected: + + bool appIsNotEmbedded(QDialog *dlg); + bool eventFilter(QObject *object, QEvent *event); + void drawMenuItem(QPainter *p, const QRect &r, const QColorGroup &cg, + bool mbi, int round, const QColor &bgnd, const QColor *cols) const; + void drawProgress(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, int round, + const QWidget *widget) const; + void drawBevelGradient(const QColor &base, bool increase, QPainter *p, QRect const &r, + bool horiz, double shadeTop, double shadeBot, bool sel, EAppearance bevApp, + EWidget w=WIDGET_OTHER) const; + void drawGradient(const QColor &top, const QColor &bot, bool increase, QPainter *p, + const QRect &r, bool horiz=true) const; + void drawSbSliderHandle(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, bool slider=false) const; + void drawSliderHandle(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, QSlider *slider, bool tb=false) const; + void drawSliderGroove(QPainter *p, const QRect &r, const QColorGroup &cg, SFlags flags, + const QWidget *widget) const; + void drawMenuOrToolBarBackground(QPainter *p, const QRect &r, const QColorGroup &cg, bool menu=true, + bool horiz=true) const; + void drawHandleMarkers(QPainter *p, const QRect &r, SFlags flags, bool tb, ELine handles) const; + + private: + + void shadeColors(const QColor &base, QColor *vals) const; + const QColor * buttonColors(const QColorGroup &cg) const; + const QColor * sliderColors(/*const QColorGroup &cg, */SFlags flags) const; + const QColor * backgroundColors(const QColor &c) const; + const QColor * backgroundColors(const QColorGroup &cg) const + { return backgroundColors(cg.background()); } + const QColor * borderColors(SFlags flags, const QColor *use) const; + const QColor * getSidebarButtons() const; + void setMenuColors(const QColorGroup &cg); + bool redrawHoverWidget(const QPoint &pos); + const QColor & getFill(SFlags flags, const QColor *use) const; + const QColor & getListViewFill(SFlags flags, const QColor *use) const; + const QColor & getTabFill(bool current, bool highlight, const QColor *use) const; + + QPixmap * getPixelPixmap(const QColor col) const; + QPixmap * getPixmap(const QColor col, EPixmap pix, double shade=1.0) const; + void setSbType(); + bool isFormWidget(const QWidget *w) const { return itsKhtmlWidgets.contains(w); } + + private slots: + + void updateProgressPos(); + void progressBarDestroyed(QObject *bar); + void sliderThumbMoved(int val); + void khtmlWidgetDestroyed(QObject *o); + + private: + + Options opts; + QColor itsMenuitemCols[TOTAL_SHADES+1], + itsBackgroundCols[TOTAL_SHADES+1], + itsMenubarCols[TOTAL_SHADES+1], + *itsSliderCols, + *itsDefBtnCols, + *itsMouseOverCols, + itsButtonCols[TOTAL_SHADES+1], + itsLighterPopupMenuBgndCol, + itsCheckRadioCol; + mutable QColor *itsSidebarButtonsCols; + mutable QColor itsColoredButtonCols[TOTAL_SHADES+1]; + mutable QColor itsColoredBackgroundCols[TOTAL_SHADES+1]; + EApp itsThemedApp; + mutable QCache<QPixmap> itsPixmapCache; +#if KDE_VERSION >= 0x30200 + bool itsIsTransKicker; +#endif + EHover itsHover; + QPoint itsOldPos; + mutable bool itsFormMode; + QWidget *itsHoverWidget; + int itsHoverSect; + QTab *itsHoverTab; + QPalette *itsMactorPal; + QMap<QWidget*, int> itsProgAnimWidgets; + QMap<const QWidget*, bool> itsKhtmlWidgets; + QTimer *itsAnimationTimer; + mutable bool itsActive, + itsIsSpecialHover; +}; + +#endif diff --git a/style/qtcurve.themerc b/style/qtcurve.themerc new file mode 100644 index 0000000..3473ed0 --- /dev/null +++ b/style/qtcurve.themerc @@ -0,0 +1,6 @@ +[Misc] +Name=QtCurve +Comment=Clean and elegant style +ConfigPage=kstyle_qtcurve_config +[KDE] +WidgetStyle=QtCurve diff --git a/themes/CMakeLists.txt b/themes/CMakeLists.txt new file mode 100644 index 0000000..ec017d4 --- /dev/null +++ b/themes/CMakeLists.txt @@ -0,0 +1,4 @@ +install(FILES Clear.qtcurve Dull_Glass.qtcurve Shiny_Glass.qtcurve Inverted.qtcurve Plain.qtcurve Glass.qtcurve + Human.qtcurve Plastic.qtcurve Murrine.qtcurve Curve.qtcurve Clean.qtcurve DESTINATION ${DATA_INSTALL_DIR}/QtCurve) + +install(FILES qtc_klearlooks.themerc DESTINATION ${DATA_INSTALL_DIR}/kstyle/themes) diff --git a/themes/Clean.qtcurve b/themes/Clean.qtcurve new file mode 100644 index 0000000..91c1b20 --- /dev/null +++ b/themes/Clean.qtcurve @@ -0,0 +1,53 @@ +[Settings] +animatedProgress=true +appearance=bevelled +borderMenuitems=true +buttonEffect=etch +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=false +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=bevelled +lvLines=false +mapKdeIcons=true +menubarAppearance=gradient +menubarMouseOver=true +menuitemAppearance=bevelled +progressAppearance=bevelled +round=full +roundMbTopOnly=true +scrollbarType=kde +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=true +shadeMenubars=darken +shadeSliders=selected +sliderAppearance=gradient +sliderStyle=round +sliderThumbs=dots +splitters=dots +stdFocus=true +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=gradient +toolbarBorders=none +toolbarSeparators=dots +vArrows=false diff --git a/themes/Clear.qtcurve b/themes/Clear.qtcurve new file mode 100644 index 0000000..8219a1b --- /dev/null +++ b/themes/Clear.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=false +appearance=bevelled +borderMenuitems=true +buttonEffect=etch +coloredMouseOver=none +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=fontcolor +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=false +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dashes +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=bevelled +lvLines=false +mapKdeIcons=true +menubarAppearance=gradient +menubarMouseOver=true +menuitemAppearance=bevelled +progressAppearance=bevelled +round=full +roundMbTopOnly=true +scrollbarType=windows +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=true +shadeMenubars=darken +shadeSliders=none +sliderAppearance=gradient +sliderStyle=round +sliderThumbs=sunken +splitters=dashes +stdFocus=true +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=light +toolbarSeparators=sunken +vArrows=false + diff --git a/themes/Curve.qtcurve b/themes/Curve.qtcurve new file mode 100644 index 0000000..d46ee06 --- /dev/null +++ b/themes/Curve.qtcurve @@ -0,0 +1,53 @@ +[Settings] +animatedProgress=false +appearance=raised +borderMenuitems=true +buttonEffect=none +coloredMouseOver=none +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=true +defBtnIndicator=fontcolor +drawStatusBarFrames=false +embolden=false +fillSlider=false +framelessGroupBoxes=true +gradientPbGroove=false +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=sunken +highlightFactor=8 +highlightTab=false +lighterPopupMenuBgnd=false +lvAppearance=raised +lvLines=false +mapKdeIcons=true +menubarAppearance=flat +menubarMouseOver=false +menuitemAppearance=inverted +progressAppearance=inverted +round=none +roundMbTopOnly=true +scrollbarType=windows +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=false +shadeMenubars=none +shadeSliders=none +sliderAppearance=raised +sliderStyle=plain +sliderThumbs=sunken +splitters=sunken +stdFocus=true +stdSidebarButtons=false +stripedProgress=false +tabAppearance=raised +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=dark-all +toolbarSeparators=sunken +vArrows=true diff --git a/themes/Dull_Glass.qtcurve b/themes/Dull_Glass.qtcurve new file mode 100644 index 0000000..d093d87 --- /dev/null +++ b/themes/Dull_Glass.qtcurve @@ -0,0 +1,53 @@ +[Settings] +animatedProgress=true +appearance=dullglass +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=dullglass +lvLines=false +mapKdeIcons=true +menubarAppearance=dullglass +menubarMouseOver=true +menuitemAppearance=dullglass +progressAppearance=dullglass +round=full +roundMbTopOnly=true +scrollbarType=kde +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=true +shadeMenubars=darken +shadeSliders=selected +sliderAppearance=dullglass +sliderStyle=round +sliderThumbs=dots +splitters=dots +stdFocus=false +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=none +toolbarSeparators=dots +vArrows=false diff --git a/themes/Glass.qtcurve b/themes/Glass.qtcurve new file mode 100644 index 0000000..4a5ec69 --- /dev/null +++ b/themes/Glass.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=true +appearance=dullglass +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=bevelled +lvLines=false +mapKdeIcons=true +menubarAppearance=gradient +menubarMouseOver=true +menuitemAppearance=dullglass +progressAppearance=dullglass +round=full +roundMbTopOnly=true +scrollbarType=kde +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=true +shadeMenubars=darken +shadeSliders=selected +sliderAppearance=dullglass +sliderStyle=round +sliderThumbs=dots +splitters=dots +stdFocus=true +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=gradient +toolbarBorders=none +toolbarSeparators=dots +vArrows=false + diff --git a/themes/Human.qtcurve b/themes/Human.qtcurve new file mode 100644 index 0000000..ff01374 --- /dev/null +++ b/themes/Human.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=true +appearance=dullglass +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=true +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=7 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=bevelled +lvLines=false +mapKdeIcons=true +menubarAppearance=gradient +menubarMouseOver=true +menuitemAppearance=gradient +progressAppearance=shinyglass +round=full +roundMbTopOnly=true +scrollbarType=windows +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=false +shadeMenubars=darken +shadeSliders=none +sliderAppearance=gradient +sliderStyle=round +sliderThumbs=dots +splitters=dots +stdFocus=true +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=light +toolbarSeparators=sunken +vArrows=false + diff --git a/themes/Inverted.qtcurve b/themes/Inverted.qtcurve new file mode 100644 index 0000000..3d0a25c --- /dev/null +++ b/themes/Inverted.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=true +appearance=inverted +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=inverted +lvLines=false +mapKdeIcons=true +menubarAppearance=inverted +menubarMouseOver=true +menuitemAppearance=inverted +progressAppearance=inverted +round=full +roundMbTopOnly=true +scrollbarType=kde +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=true +shadeMenubars=darken +shadeSliders=selected +sliderAppearance=inverted +sliderStyle=round +sliderThumbs=dots +splitters=dots +stdFocus=false +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=inverted +toolbarBorders=none +toolbarSeparators=dots +vArrows=false + diff --git a/themes/Murrine.qtcurve b/themes/Murrine.qtcurve new file mode 100644 index 0000000..ede8110 --- /dev/null +++ b/themes/Murrine.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=true +appearance=dullglass +borderMenuitems=true +buttonEffect=etch +coloredMouseOver=colored +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=fontcolor +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=false +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=sunken +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=dullglass +lvLines=false +mapKdeIcons=true +menubarAppearance=dullglass +menubarMouseOver=true +menuitemAppearance=dullglass +progressAppearance=dullglass +round=slight +roundMbTopOnly=false +scrollbarType=windows +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=false +shadeMenubars=selected +shadeSliders=origselected +sliderAppearance=dullglass +sliderStyle=plain +sliderThumbs=sunken +splitters=dashes +stdFocus=true +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=light +toolbarSeparators=sunken +vArrows=false + diff --git a/themes/Plain.qtcurve b/themes/Plain.qtcurve new file mode 100644 index 0000000..aec522c --- /dev/null +++ b/themes/Plain.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=false +appearance=flat +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=none +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=fontcolor +drawStatusBarFrames=false +embolden=true +fillSlider=true +framelessGroupBoxes=false +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=sunken +highlightFactor=5 +highlightTab=false +lighterPopupMenuBgnd=false +lvAppearance=flat +lvLines=false +mapKdeIcons=true +menubarAppearance=flat +menubarMouseOver=true +menuitemAppearance=flat +progressAppearance=flat +round=full +roundMbTopOnly=true +scrollbarType=kde +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=false +shadeMenubars=darken +shadeSliders=none +sliderAppearance=flat +sliderStyle=plain +sliderThumbs=sunken +splitters=dashes +stdFocus=true +stdSidebarButtons=false +stripedProgress=false +tabAppearance=flat +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=light +toolbarSeparators=sunken +vArrows=false + diff --git a/themes/Plastic.qtcurve b/themes/Plastic.qtcurve new file mode 100644 index 0000000..b65be20 --- /dev/null +++ b/themes/Plastic.qtcurve @@ -0,0 +1,54 @@ +[Settings] +animatedProgress=true +appearance=gradient +borderMenuitems=true +buttonEffect=none +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=false +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=-2 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=gradient +lvLines=false +mapKdeIcons=true +menubarAppearance=flat +menubarMouseOver=true +menuitemAppearance=gradient +progressAppearance=flat +round=full +roundMbTopOnly=false +scrollbarType=windows +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=false +shadeMenubars=none +shadeSliders=none +sliderAppearance=gradient +sliderStyle=triangular +sliderThumbs=dots +splitters=dots +stdFocus=true +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=flat +toolbarBorders=light-all +toolbarSeparators=sunken +vArrows=false +xCheck=true diff --git a/themes/Shiny_Glass.qtcurve b/themes/Shiny_Glass.qtcurve new file mode 100644 index 0000000..2e2dfcf --- /dev/null +++ b/themes/Shiny_Glass.qtcurve @@ -0,0 +1,53 @@ +[Settings] +animatedProgress=true +appearance=shinyglass +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=plastik +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=colored +drawStatusBarFrames=false +embolden=false +fillSlider=true +framelessGroupBoxes=true +gradientPbGroove=true +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=5 +highlightTab=true +lighterPopupMenuBgnd=true +lvAppearance=shinyglass +lvLines=false +mapKdeIcons=true +menubarAppearance=shinyglass +menubarMouseOver=true +menuitemAppearance=shinyglass +progressAppearance=shinyglass +round=full +roundMbTopOnly=true +scrollbarType=kde +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=true +shadeMenubars=darken +shadeSliders=selected +sliderAppearance=shinyglass +sliderStyle=round +sliderThumbs=dots +splitters=dots +stdFocus=false +stdSidebarButtons=false +stripedProgress=true +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=shinyglass +toolbarBorders=none +toolbarSeparators=dots +vArrows=false diff --git a/themes/qtc_klearlooks.themerc b/themes/qtc_klearlooks.themerc new file mode 100644 index 0000000..ccfca9d --- /dev/null +++ b/themes/qtc_klearlooks.themerc @@ -0,0 +1,60 @@ +[Misc] +Name=Klearlooks +Comment=Clearlooks inspired style +[KDE] +WidgetStyle=qtc_klearlooks +[Settings] +animatedProgress=false +appearance=splitgradient +borderMenuitems=true +buttonEffect=shadow +coloredMouseOver=none +colorSelTab=true +customCheckRadioColor=#000000 +customMenuNormTextColor=#000000 +customMenuSelTextColor=#000000 +customMenuTextColor=false +customMenubarsColor=#000000 +customSlidersColor=#000000 +darkerBorders=false +defBtnIndicator=fontcolor +drawStatusBarFrames=false +embolden=false +fillSlider=true +fixParentlessDialogs=true +framelessGroupBoxes=true +gradientPbGroove=false +gtkScrollViews=false +gtkComboMenus=false +gtkButtonOrder=false +handles=dots +highlightFactor=7 +highlightTab=false +lighterPopupMenuBgnd=true +lvAppearance=splitgradient +lvLines=false +mapKdeIcons=true +menubarAppearance=gradient +menubarMouseOver=true +menuitemAppearance=splitgradient +progressAppearance=splitgradient +round=full +roundMbTopOnly=true +scrollbarType=windows +shadeCheckRadio=none +shadeMenubarOnlyWhenActive=false +shadeMenubars=darken +shadeSliders=selected +sliderStyle=plain +sliderAppearance=splitgradient +sliderThumbs=flat +splitters=dashes +stdFocus=true +stdSidebarButtons=false +stripedProgress=diagonal +tabAppearance=gradient +thinnerMenuItems=false +toolbarAppearance=splitgradient +toolbarBorders=light +toolbarSeparators=sunken +vArrows=true |