diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-03-21 20:35:05 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-03-21 20:35:05 +0100 |
commit | 066aaaeb73a8bb908b1c0d8c45f110b2f799f7ce (patch) | |
tree | 4cb26eb8ace976f7d0c8607dc2d3de2b5107670c | |
download | tde-style-baghira-066aaaeb73a8bb908b1c0d8c45f110b2f799f7ce.tar.gz tde-style-baghira-066aaaeb73a8bb908b1c0d8c45f110b2f799f7ce.zip |
Initial import of baghira 0.8
247 files changed, 35937 insertions, 0 deletions
@@ -0,0 +1 @@ +Thomas Lübking <thomas.luebking@web.de> @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..df70813 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +see readme
\ No newline at end of file @@ -0,0 +1,167 @@ +Basic Installation +================== + + These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' if you want to change +it or regenerate `configure' using a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes a while. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Type `make install' to install the programs and any data files and + documentation. + + 4. You can remove the program binaries and object files from the + source code directory by typing `make clean'. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +Compiling For Multiple Architectures +==================================== + + You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not supports the `VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use `make distclean' before reconfiguring for another +architecture. + +Installation Names +================== + + By default, `make install' will install the package's files in +`/usr/local/bin', `/usr/local/man', etc. You can specify an +installation prefix other than `/usr/local' by giving `configure' the +option `--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give `configure' the option `--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + + Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + + There may be some features `configure' can not figure out +automatically, but needs to determine by the type of host the package +will run on. Usually `configure' can figure that out, but if it prints +a message saying it can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are building compiler tools for cross-compiling, you can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +Sharing Defaults +================ + + If you want to set default values for `configure' scripts to share, +you can create a site shell script called `config.site' that gives +default values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..3569e38 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,31 @@ + +if HAVE_3_4 +KICKERMENUDIR=kickermenu +SIDEBARDIR=sidebar +else +KICKERMENUDIR=kickermenu-3.3 +SIDEBARDIR= +endif + +SUBDIRS = bab colorscheme config deco icons sessionapplet starter style $(KICKERMENUDIR) $(SIDEBARDIR) + +$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ; + +$(top_srcdir)/subdirs: + cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs + +$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in + @cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4 + +MAINTAINERCLEANFILES = configure.in acinclude.m4 configure.files + +package-messages: + $(MAKE) -f admin/Makefile.common package-messages + $(MAKE) -C po merge + +EXTRA_DIST = admin COPYING configure.in.in + +dist-hook: + cd $(top_distdir) && perl admin/am_edit -padmin + cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs @@ -0,0 +1 @@ +see README @@ -0,0 +1,707 @@ +Baghira +======= +For all you Apple Junkies out there... (like me) ;-) +Bases upon mosfet-liquid0.9.6pre4... the last heir of mosfet. +Suggestions welcomed. + +Installation +----------------- +tar -xjf baghira.tar.bz2 +cd baghira/baghira +either try ./install.sh or +./configure --prefix=`kde-config --prefix` --disable-debug [--enable-final] +(!!!BEGINNERS: the direction of the accents is _important_ (top-left to bottom-right), the rectangular brackets mean "this is optional" - don't type them!!!) +make +and finally as root: +make install + +Changelog +---------------- +*** IF YOU HAVE A 64 BIT MACHINE, UPDATE TO QT 3.3.3 *** +will fix the horizontal slider problem, rotating pixmaps in general + +0.8 +---- +after a long time, this is a snapshot of the current cvs version and probably the last baghira for Qt3 ever. +there won't be Baghira for Qt4, don't ask. +- several bugfixes, minor changes, whatever. + +0.7a +---- +- [style] Reincluded workaround for kpdf < 3.4.3 +- [style] added Milk style +- [style] some code enhancements/cleanups +- [bab] removed "start QString name int deco" dcop interface (useless anyway) +- [bab] added "start QString name QString settings" dcop interface to allow starting a program with the rules set for another one (or a general rule like "Milk" ;) +- [menubar applet] size fix (using an own settings value ;) + +0.7 +---- +Many? - see cvs log... +- New Konqueror Sidebar (Hardware access + Drag 'n Drop link list) +- New search oriented Application Launcher +- More speed and less bugs in the style and the deco +- New look on the brushed metal design +- New Tiger design +- New management to the menubar applet (in matters of size) +.... and much more i forgot over the time ;) + +0.6e +---- +Maintainance release (mainly) +- Fixed compile error on kde3.3 +- Made resize grip optionally (off by default, disable if you get querky problems with the deco) +- starter applet will auto correct size +- added new widget color "Smoke" by Anton + +0.6d +---- +========================== +BECAUSE OF COLOR PREFIXES: +If you think you've got an interesting colorset, that should be part of further releases, please drop me a mail. +----- +widget colors must include: +- a name ("my colorset") +- {R,G,B}, where R,G,B must be [0-255],[0-255],[0-255] +----- +deco colors must include: +- a name ("my colorset") +- {{R,G,B},{R,G,B},{R,G,B},{R,G,B},{R,G,B},{R,G,B},{R,G,B},{R,G,B},{R,G,B},{R,G,B}} in order: +inactiveColor, closeColor, minColor, maxColor, menuColor, helpColor, stickyColor, aboveColor, behindColor, shadeColor +(10 values) +----- +inclusion depends on my arbitrariness ;) +============================== +* (style) update: slightly changed the appereance of the scrollbar sliders (on DementedPixel note) +* (style) update: appereance of groupboxes w/o title (improved the code resulting in more speed as well) +* (config) feature: added color presets for the widget colors +* (config) update: reorganized appereance a bit - NO changes on the config protocol though +* (deco) feature: added a resize handle drag - this will probaby be optional on future releases, but currently im interested in FEEDBACK +* (deco) update: corrected the button spacing (on DementedPixel note) +* (deco) feature: added color presets for the buttons +* (deco) feature: added option to remove captions as i saw some ppl interested on this. +however in general i do not suggest this, as apps often use the title to indicate states (like e.g. unsaved) +* (bab) bugfix: misbehaviour on dcop bab default start <appname> x command (start <app> x y was ok) +* (starter) bugfix: compile error on non final compilations +* (menuapplet) bugfix: compile error because of gcc/kde_export misbehaviour (3.3 problem?) + baghira will compile a 3.3 or 3.4 version depending on the current running system + (binary packagers should note this) +* (menuapplet) update: improved Indicator title calculation +* (menuapplet) update: ported modal window handling (0.6b) to 3.4 version +* (icons) update: dfsw compliant license + +0.6c +---- +* (overall) feature: if you compile yourself, you may try the ./install.sh script, being a GUI wizzard leading you through the installation (especially if you're unexperienced - everyone else: this was just for some lazy hour and playing around with kdialog, i'd personally never click through dialogs instead of ./configure; make; make install ;) +* (overall) bugfix: included 0.6b fixes +* (style) feature: because i was in some kind of nostalgic mood, i added jaguar (liquidlike) buttons. also as jaguar used darker stipples if and only if you use the bab dcop starter or predefinitions, using jaguar will lead to darker stipples (+4 to your default) +* (style) note: this leads to new (consistent) settings: "0" is jaguar in style and deco, so calling +dcop bab default start kcalc 0 0 +will bring you a jaguar kcalc +dcop bab default start kcalc 1 2 +will instead bring you panther kcakc with a b/m deco +THIS HAS ALSO IMPACT ON THE PREDEFINITIONS! +You can either update them by hand or ONCE(!) call ./updatePredefs from the baghira topsrc dir +* (style) update: better handling for icons on buttons +* (style) update: improved editlines (thanks to Gav Wood for suggestion) +* (config) bugfix: writing valid value for visible toolbuttons +* (config) update: added option to replace kickers menu applet +* (deco) update: removed left/right side lines if not using comicframe (looked as if the deco was smaller than the window) +* (deco) update: corrected appereance of the left/right b/m resize handles +* (kickermenu) bugfix: kde3.4 support - i don't know if it will still work correctly with kde3.3 +* (starter) new: i was sucked by kickers startbutton displaying the tooltip on hover, so i wrote a kickerapplet as startmenubutton replacement. you can use any png as button. +name them bStarter.png, bStarter_hover.png, bStarter_down.png, and settle them in 22x22/action - defaults are included +as i don't have such nice access on the startmenu as the button has, its not possible to close the menu by clicking again _AFFTER_ you left the button once, also the default KDE binding to the startmenu (alt+f1, windows key) will display the menu in the screen center instead below the (nonexistent) button + +0.6b +---- +* (style) feature: animated pushbuttons +* (style) bugfix: konqueror crashes on repolishes +* (style) update: improved the look of (colored) iTunes (rectangular) buttons +* (configuration) feature: look predefinition for each application (deco needs kde 3.4b1 and up to work) +* (configuration) bugfix: skipped various unnecessary repolishes +* (bab) update: rewrote the way design switching stuff according to kde 3.4, removed all imperfect workaround stuff -> works much better, but needs kde 3.4 to work properly +* (kickermenu) update: using XClassHint to display the appname (better than relying on the netwm info) +* (kickermenu) update: using app menu instead of desktop menu for modal dialogs +* (kickermenu) note: kicker from kde 3.4 has a special menupanel that autoloads the kicker menuapplet to display the menu. you can remove this menu and readd the baghiramenu, but you'll have to do that after every kde start. -> open [kdeprefix - e.g. usr]/share/apps/kicker/applets/menuapplet.desktop, change "X-KDE-Library=menu_panelapplet" to "X-KDE-Library=b_menu_panelapplet" or (as root) run the following script (simply using sed to update the file): +--------------------start--------------- +#!/bin/sh +sed s/"X-KDE-Library=menu_panelapplet"/"X-KDE-Library=b_menu_panelapplet"/g $(kde-config --prefix)/share/apps/kicker/applets/menuapplet.desktop > _baghirabuffer_ +rm -f $(kde-config --prefix)/share/apps/kicker/applets/menuapplet.desktop +mv _baghirabuffer_ $(kde-config --prefix)/share/apps/kicker/applets/menuapplet.desktop +---------------------end---------------- + +0.6a +---- +* (style) serious bugfix: drawing groupbox frames on non groupboxes +* (style) bugfix: popup menu painting +* (style) bugfix: handles ksplash and kontact splash problem +* (configuration) bugfix: resetting settings +* (configuration) feature: save/restore settings to/from file +* (icons) update: copyright notice +* (general) bugfix: big endian (ppc/sparc) architecture support +* (general) bugfix: openBSD support (thanks to Damir Naden) + + +0.6 +--- +* stripped all fake translucency/shadows code, honoring the fact x.org 6.8 now supports true alpha handling +* fixed OOo error (stupid one, btw. - only had to see it :) +* tricked OOo to get background colored menubar/menus and keep nice button colors +* better support for OOo scrollbars (allways displayd as active, as OOo does not support the MousOver effect) +* better animation code - cpu hunger of some apps should be gone +* completely new settings handling to avoid conflicts of concurring file accesses - unfortunately you'll have to recreate all your settings :( + + +0.5f +---- +bugfix release only +bab started apps shouldn't hang +konqueror shouldn't crash, NOTICE: +the error occured, when updating the palette (applying a new background) to the toolbuttons (seems to be some very specific ones), +please don't ask me why this worked before - i don't know (but i think it's related to the redesign of the eventhandler which now responds much faster) +so the only solution i found was to disable the palette update for the toolbuttons, therefore you should display the inactive toolbuttons for b/m (e.g. by applying "brushed metal" or "both" in the last bab setting) + +0.5e +---- +style: +- fixed the "kde toolbar widget" thing (location bar/juk slider etc.) +- worked around brushed metal kicker translucency support +- changed the appereance of the kicker executor (like konqueror combobox) +- worked around konqueror statusbar offset +- flattened statusbars in genereal +bab: +- most important change: + bab supports a new dcop command to start applications with individual style settings, so + dcop bab babInterface start konqueror 1 2 + will open konqueror b/m + the first argument is the command you want to execute. + if you want to use switches, use "" to combine them, i.e. + dcop bab babInterface start "konqueror --profile webbrowsing --caption Safari" 1 2 + will start konqueror, b/m mode, show the about screen and renames the title to "Safari" + unfortunately the command may not contain a '"' or blanks, so if your app is named "kde application" you will not be able to pass it to bab, maybe i'll implement support for escape chars (\) if there's demand in the future. + the first digit addresses the style (so '0' means aqua, '1' means b/m) the second one the deco (predefined deco 0/1/2) + in addition there's a second command + dcop bab babInterface start xterm 0 + only differing by the fact it only changes the deco design. + USE THIS ONE FOR NONE KDE APPS (i.e. everything that doesn't get styled by baghira) as the other function won't be able to reset the settings for style and deco. + The good thing about this: + 1. You don't have to run complex scripts (maybe just check if dcop is running), bab does all for you + 2. bab does not reset the settings until the app read them - so you will get style and deco you wanted + The "bad" thing: + Though much better than the solution before, this is not process relative, i.e.: + - start an app with long startup time (e.g. juk) + - start another app with short startup time directly after starting juk + the startups will interfere (i.e. the fast app will change the settings and the slow app will get uncertain settings) +- just for cute... bab now "shapes" the upper corners of your screen (so any kickerbar there will be rounded as well:), but don't ask me about the perverse way i found to do so... ;) + +0.5d +---- +- completely remodeled the eventfilter -> faster! (reload the library) +- added some colored throbbers and an xcf so you can create your own colors +- sorting headers appear colored +- put the menuapplet into its own library, so it won't conflict with the kde one and is installed by default +- corrected kwin (stippled) frame to align the style +- corercted brushed toolbars (disalignment) + +0.5c +---- +Added a patched version of the kicker menu applet, main difference: +shows current window name left of the menu (you can also click this indicator to get a windowlist, as the menu takes space that's usually used for the taskbar) +*** THIS MENU APPLET WOULD REPLACE THE ORIGINAL ONE, THEREFORE IT'S NOT AUTOINSTALLED *** +to install it with baghira, edit the "subdirs" file and remove the "#" in front of "kickermenu" _before_ (!!!) ./configure + +*** KAnimWidget (Throbbers) now usefully support translucent pixmaps, so the throbber is now translucent (and i removed the ugly frame :) *** +anyway, i don't know since which version this holds, therefore maybe you want to keep the old throbber to prevent uncleaned repaints +(if someone wants to create the nice iTunes throbber - hey thanks, i don't have iTunes) + +Mainly kde3.3 alignments +- fixed juk toolbar stuff (and any other) +- fixed new kwin buttons +- toplevelmenubars are not set to stipples anymore, honoring the fact, that the kicker menuapplet recolors them itself to kicker background +- arrows will are dark grey rather than black - makes them appear more smooth + +- remodelled the include structure +- fixed repolishment errors +- fixed taskbar +- deco can be set to have a frame in maximized mode as well +- toolbuttons are not connected, if inactive toolbuttons are not shown + +0.5b +---- +Style: +- code improvements: should give some overall speed, closed a slight memory leak (lists of pointers in b/m mode) +- rewrote the groupbox code -> 1. faster, 2. aligned stipples +- combos on toolbars (konqueror :) look like the safari combo +- changed the appereance of inactive sliders (no bubbles) +- did anyone notice, i changed the stiopples again (figured out that apple uses bright-mid-dark-mid, while mosfet's stipple were dark-dark-bright-bright) + imho this leads to better readable text +- corrected alignment of left side tile in b/m mode +- handled amaroK in b/m mode + +Deco: +- added option to auto add spycing between buttons (making use of the kde spacing leads to unhappy effects, i the window misses a button (e.g. minimize in baghira help)) +- corrected alignment of left side tile in b/m mode + +Bab: +- fixed some saving issues + +Goodies: +The stuff in this folder is not autoinstalled. +Look into it and use whatever you want, however you want (except claiming cr and suing me for nonliterally copying ;) +- added new stuff: bootsplash, konqui tile, kdm picture, lilo-bootscreen +*** read the readme! *** + +0.5a +---- +- BUGFIX (style): konqueror address label +- BUGFIX (style): tab hovering for b/m +- WORKAROUND (style) kiconedit crashes on startup (notice that this error lies in kiconedit and the workaround will be removed as soon as kiconedit is fixed) +- (style) corrected size of the add/remove tab buttons (prevetning from overlaying the tabs) +- (deco): slightly modified coloring function (light dots on button top) + + +0.5 +--- +STYLE +===== +- well, light gradient, right ;) +- highlight color appears as gradient +- TOPLEVEL (mac like) MENUABRS (read this): + The light gradient causes (of course) some trouble on the top level menubars, as the gradient is arranged to the corresponding application window - not to kicker. + As there was interference with the stipples, when using e.g. toplevel brushed metal menus embedded into aqua style kicker, i decided to force toplevel menubars appearing in aqua mode (stippled) assuming you're using an aqua like kicker. this will cause problems if you're using b/m kicker. in this case, i suggest to avoid toplevel menus to get a consistent look (while using auqa mode kicker is preferred) + +DECO +==== +- new brushed style/removed flat brushed +- BUGFIX: bottombar draws void +- some graphical adjustments, corresponding to the brushed metal stuff +- buttons masked on brushed metal design + +ICONS +===== +- new license, read "readme.copyright" + + +0.4d +---- +- several bugfixes, notable: + 1. kicker children appear brushed metaled (if wished), thanks to A. Quincey + 2. that bookmark button thing... + please notice, that this could not really be fixed (the kbookmarkbar somehow accesses the toolbar iterator while i'm using it to check the toolbar layout - what confuses both of us) but i excluded the bookmarkbar by it's name (that could easily differ in other kde versions) and assume it's structure (bunch of combined buttons - no breaks / spacers) + 3. Corrected listviewheader hovering behaviour (wasn't that hard, after all...) +- highlights of this version (gee... what a shameless self promotion :) + 1. configurable deco button colors (added support for kde 3.3 buttons, well - hopefully, as i couldn't test yet) + 2. tabs hover on mouseover + 3. (round) iTunes like rectangular buttons + +0.4c +---- +- (hopefully) fixed compiler stuff - code cleanup: later +- redesigned the dialogs for the windeco 1024x768 compatible now (allmost 800x600 :) +- fixed the toolbutton stuff +- removed any listviewheader correction as this caused more problems that it could ever solve (if you worry about listviews, having too short headers and therefore paint void areas - complain to the appropriate author) + +0.4b +----- +code should be more iso-cpp compatible (especially the preprocessor stuff (#include/#define)) +it compiles nice on gcc-3.4.1, i have no idea about gcc-3.4.0 + +STYLE +===== +- (initial support) of conjuncted toolbuttons (use smooth tool for best effect) + restrictions: + o only works with kde toolbars (not on toolbars in plain qt applications, e.g. qt-designer) + o only works when the kde toolbar uses kde toolbarbuttons (rather than qt toolbuttons) - most kde applications do, well - some do not (you'll see) + +DECO +==== +- includes version that was meant for 0.4a (see changelog for this version) +- addidionally you can choose individual decos (_not_ buttons) for active and inactive windows + + +0.4a +----- +fixed the and cleant up the makefiles - maybe you've got some useless stuff (menuentries, icons) in your system due to old releases +call ./cleanMySystem /<prefix> from the baghira topdir if you wish to delete them (if you're paraniod, you can use this script as help for deleting them by hand as well) +where <prefix> is the prefix you gave when configuring baghira + +STYLE +===== +- fixed some graphical errors (toolbar stuff etc) +- it's now possible to tint the brushed metal style (autoapplied to the the deco as well) +- tricked back the konqueror statusbar (gee.., we don't like to be recolored, right?) +- found a (hopefully) better solution for the listviewheaders (setting only too small ones to be expanded) + +DECO +==== +- fixed (and improved :) frame painting +- new deco "glossy" using the aquarius coloring function + +CONFIG +====== +- added color picker for the aquarius function + *notice* this is only a _color picker_ + to not mess up with your color scheme arrangement, it will not touch the current color settings + +0.4 (finally :) +---------------- +YOU WILL NEED KDE 3.2 TO SUCCESSFULLY COMPILE THIS PACKAGE ! +Though i applied all kindly provided gcc-3.4 patches, i yet did not install this compiler, so i don't guarantee it will work, patched versions of gcc-3.3 (gcc-3.3-x) may also fail + +STYLE +===== +- new coloring function "Aquarius" - replacing the "icy" style. + as the two functions are incompatible on pixmap layer, there's no way back - sorry +- ended the stipple experiment +- fixed some stuff (missing pixel on tabs, tabclosebutton position, ... whatever (more stuff i forgot - test if your main issue is fixed and complain if not :P )) +- improved scrollbar animation code, fixed the juk problem as side effect. the deactivation is yet not functional (forgot to implement) expect for 0.4a +- improved the popuptranslucency for menubars - as a sideefeect, the dynamic offscreen buffer (to prevent artefacts) now works on toplevel menus (macstyle menus) + +DECO +==== +- now shipped with package :P +- better 3D effect for the title (dark/bright offset like Apple does, to provide distinction from any background) +- comic frame in titleblend color (right, resp. bottom color) +- complete change of big bottom bar - change to 6px thick bar to only provide shaped framing +- fixed several issues with the frame size (eg. width on maximized windows) + +BAB +=== +- bab now also provides dcop acces to the windeco style + +CONFIG DIALOG +============= +- completely new, though tested, some settings could have unexpected results (i couldn't really test everything), please notice if you find something (besides deactivation of scrollbar animation - see above) +- attaches to the style dialog +- the old dialog remains in system unless you remove it by hand (look for "kcm_kcmbaghira.la", "kcm_kcmbaghira.so" in $(PREFIX)/lib/kde3/ and "kcmbaghira.desktop" in $(PREFIX)/share/applnk/Settings/LookNFeel) +- test the about dialog =) +- click help +- more intuitive interface with a later release (setting dependend deactivation of widgets, etc.) + +COLORSCHEMES +============ +Christian Lehmann provided two new Colorschemes for the new function, AquaBlue and AquaGraphite - they're auto installed +as starting point, you could try rgb = 84,140,242 for the button - avoid very low or very high saturated color (result is uncolored/flat colored) + +ICONS +===== +Due to massive request (protest?) the icons for bab and the black and blue paw are installed to your system... NO COMPLAINTS ABOUT THAT, PLEASE... +The throbber is _not_ installed (sorry, but this would be much too invasive) - if you want it, copy it by hand + +SCRIPTS +======= +- added a script terminal to roughly show bab/dcop/windeco functionality (the script uses sleep - if it does not work on your system, use kstart similar to the other sripts and remove the sleep call) +- scripts are not installed, as they're just examples + +FINAL WORDS +=========== +haha...! i even had some letters left ;) + +----------------------------------------------------------------------------------- +=================================================================================== +----------------------------------------------------------------------------------- + +0.3s +- tweaked several graphics + o i was annoyed by the raised panels in knetscan, so i forced panels to appear sunken, similar to the editframes + o changed appereance of the toolbarhandlers (the old where too loud) + o fixed bug on splitters (well, somehow - obviously noone cares about the direction flag) + o fixed "bug" that lead to black frames under combos in some apps (e.g. amaroK) +- bugfixed the setting stuff (misdisplayd groupboxes, ability to unset shadows under popups...) +- Tab vs. Chooser is now optional + o the default setting is somewhat clever, i.e. if the toplevel widget is a dialog, tabs appear as choosers, as oldstyle tabs elsewise + -> result: apps like konqueror, kdevelop, quanta, konsole... will show tabs, dialogs will show choosers + o you can define the tab behaviour for aqua and brushed metal individually in the bab menu +- fixed menu animation stuff +- fixed bookmark menu behaviour (so could have told me...) +- fixed toolbutton repolishment +- "--enable-final" should work again +- bab: + o added a dropdownmenu (rightclick), currently mainly to allow you to set a default style (so you don't have to care about the setting when shutting down kde) +- lightweightened the stipples (more aqua like) and improved alignment (!you do not need to set the align stipples checkbox - it's useless!) +- new icons, created by timur ((c) 2004 TKdesign-studio.com. All rights reserved.) + +- ppc users: i added an endian definition to baghira.h - try to set it to big endian (but i don't know if it'll help) + +0.3r +- scrollbars: + o no useless sliders are drawn + o code should be faster now +- changed the tabbars to look like apples chooser widgets (button tabs) + this is a bit hackish, as qt doesn't know choosers + i don't knwow if i can easily make this optional, so i'll probably rely on reactions... +- went through the polishment code, uhmmm... that was really necessary +- option to brush me... + +0.3q +- new arrows on scrollbars + combos (thanks to Narcis Tesa for providing the pix) +- added option to fade in popup menus (works with translucency) +- Tabbar Bases will follow tabs colors :) + +0.3p +- redesigned groupboxes (twice as fast :) +- corrected wrongly shadowed widgets (flat groupboxes) +- redesigned scrollbars + +0.3o +- IMPROVED MEMORY MANAGEMENT - menus won't eat your memory anymore +- fixed bugs that may have caused crashes on some systems +- thanks to "mbllos" for some code optimization and a bugfix in the button coloring function +- slight changes to the toolbuttons (especially the round version) +- pressed sliders aren't animated, better slider hover behaviour at all, "hand" cursor on sliders +- included throbber for konqueror - copy to your icon folder (global is $KDEPREFIX/share/icons/default.kde) +- fixed nasty bug when trying to remove nonexistent popupmenushadows (crashed tear off menus) + + +0.3n +- fixed error that lead korganizer to crash (well, it's rather a workaround - as the KOAgenda class doesn't like foreign eventhandlers, i removed my - on cost of slider behaviour) +- fixed graphical error on some scrollbars +- fixed qtoolbutton error (some non stippled and miscolored buttonbackgrounds in toolbars) +- fixed error on some scrollviews (that didn't highlight the scrollers) +- fixed graphical problem with stipple unalignment on toolbars +- better support for toolbuttons besides toolbars (e.g. k3b) +- some further (minor) graphical improvements +- better menu-indicator/shadow related behaviour... yes, i said this wouldn't be possible, but it annoyed me too much, so i did it. (anyone here may thank RenderMan for this, he asked and this followed me so i really had to fix this :) + +0.3m +- speedUps, speedUps anywhere... ;-) + 1. by avoiding permanent repaint (update) of animated widgets (scrollers/progressbar)) - nice sideeffect: scrollers are back on wished behaviour again ;-) + 2. by avoiding useless searching the dictionaries (restructured popup code - allmost feared it'd never compile anymore...) and some calculations ;-) +- especially for jos added a new option for even smoother taskbar butoons ;-) +- fixed miinor error in kcmbaghira (you couldn't set opacity in gradient mode / stuck to custom opacity) +- removed annoying progress percent display + +0.3l +- modified dropshadow behaviour (menus < shadowoffset won't draw any shadow at the too small side) +- slightly changed sublying pixmap for scrollbar sliders +- new progressbar for "apple" style +- new progressbar behaviour ;-) (try apple or liquid - i'm sorry i denied this was possible... i'm just a little fool):\ +- also new Scrollbar bahaviour (side effect: if there are more scrollable areas in an app, all scrollers will be paint active if you enter one. +- slightly rounded the rect toolbuttons +- more apple like shadows - i hope to soon provide fast blurring AND I DO NOT LIKE THE MS STYLE!!! (yes, this means you, RenderMan! ;-) + (notice that 1. the current implementation is subefficient - i'll enhace that for next release; 2. this totally messed up my translucency code - so if you notice any artefacts, fractions or shifts: please drop me a mail ;-) +0.3k (serious bugfix release, recommanded over 0.3j) +- better support for groupboxes of kicker apps (e.g. button background) +- fixed error on small popupmenus (thanks to RenderMan for the hint!) +- (rough) support for bottom Tabs (cause konsole will use them in 3.2) +- included math.h - i still do not understand, why some compilers (gcc versions!!!) do not suppport exp and pow internal? %) +0.3j +- corrected slider geometrics (won't slide out of sliderarea, you can grip the whole slider) +- corrected highlighted menutext color when using custom menu colors +- set the very small pushbuttons to new gradient style +- set minimum tab height to 27 pixels (regarding to tabs on apples homepage) +- reordered dropshadow calling process +- changed behaviour of kicker headers (task buttons - to say it the ms way...:) - highlightning/coloring assumes them to be NOT button colored (rather background) +- corrected slider color on groupboxes also for my friends, who don't like stipples... ignoramuses ;-) +- added gradient translucency (but please don't expect this to be a speed wonder - the gradient has to be rendered for every menu (as they can be of different width) and then blended to the background completely (different from common translucency, where i can often take parts out of the buffer) +However: it's at least ghost free and not rendered twice - if you close and then reopen a submenu (e.g. from a menubar) +- added buffer to provide ghost free shadows (this leads to double buffering for translucency, well - gradients are and keep doublebuffered anyway) +- added free sizable menu drop shadows (w/o kde bug on shadows that run out of screen) / the shadows could need a gaussian blur (otherwise big shadows look too sharp) - we'll hopefullly see that next time... (for the moment, i suggest to use bright shadows (1 - not 0) to lower this effect) +- disaligned menuchecks should no be (vertically) aligned +- hopefully fixed a polishment bug about combos on toolbars (?!) +===================================================== +AND: IMPORTANT TO ANYONE!!! DEACTIVATE KDE DROPSHADOWS!!! +(as they'll produce artefacts in traslucent menus + + artefacts within themselves + + artefacts in my shadows + + unnecessary slow down menus) +===================================================== + +0.3i +- fixed drawing error on horizontal splitters +- added new sliderarrow (thanks to Narcis Tesa for the picture) +!!! NOTICE: The new Image is (allthough applelike) very big and vertical asymmetrical displayed - this can lead to inadequate look if i can't change its size - e.g. if it settles on a toolbar (open juk to see what i mean) the only way to handle this, is resetting the toolbarsize to at least 24 pixels. As e.g. only provides a maximum of 22 pixels, you have to edit its config file by hand: open ~/.kde/share/config/jukrc, look for the [MainWindow Toolbar playToolBar] section and set "IconSize=24". - sorry for this. +- slightly changed the tabbarbase on icy buttons (by user request and because it was necessary:) +- scroller activation now also works with kwrite and dependent apps (gideon, etc) +- improved support for custom menu colors (child menu triangles, checkmarks, splitters) +- improved (generalized) toolbar color handling (background seperators leaded to uncolored konqueror completition box - this shouldn't happen to any widget anymore) +============================================================================ +=== R E A D T H I S ! ! ! ============================================================= +============================================================================ +I stole the whole menudropshadow stuff from kstyle (thanks to the developers) to call them at the moment I (yes: ME:-) want! +PLEASE TEST THEM EXCESSIVLY and tell me, if you notice any ghosts from them by doing anything. thanks. +I WON'T MODIFY FOREIGN APPS SETTINGS! therefore you have to DEACTIVATE KDE MENU DROPSHADOWS yourself! - sorry for the inconvenience. +as they're active by default it's a good idea to deactivate menudropshadows in kde's style settings +( i know that they're still ghost effects in the shadow itself - i'll try to fix that soon ) +============================================================================ +- stole kstyle function for double buffered sliders and adjusted it for use with shadowed groupboxes (allows slider moving without artefacts) - you can read it. i'm a thief. i stole it - their precious - and THEY WANTS IT! ;-) + +0.3h (for massive (!) but unserious bugfix) +- added smooth toolbuttons option +- hacked around smudge error on automoving sliders (does NOT hold for sliders on groupboxes, if shadows activated) +- you now can choose between liquid, old and newstyle baghira progress bar (honestly i prefer the original baghira style, too - well, apple's not always perfect ;-) +... +HOLY SH**, i can't believe, nobody mentioned that before: did you never try to change to a custom menu style (color, unstippled translucency???) didn't you see there was something terribly wrong??? e.g.: IT JUST DIDN'T WORK? +- fixed that, so menu styling now behaves as it should. (hell on earth, i've to do everything myself - even kickin' my butt... ;-) +(head over to resexcellence and look at the milk screenshot, if you want to know why - black translucent menus look really cool (imho), allthough qt seems to have problems displaying bright text on a dark background) +- kde's menu dropshadows sometimes still mess up with my code (and theirs, too) the reason is that I (and they) have to sync qt with xfree before i can take a screenshot - the result is that the menushadow can appear during this time and then is also captured (if i don't capture it, it will leave a white ghost instead of a black one). +for the moment i have to suggest to deactivate menu dropshadows to get better translucency results - i'll try to write my own dropshadows for a future release. +- fixed minor unpolishment bug (accidently removed moustracking for all scrollviews - bad on combos, if not reactivated by new style..., well, i guess you didn't do that anyway ;)) +- slightly changed colortheme +- made the splitter more decent + +0.3g (dedicated to howard shores score of "the return of the king", which kept me awake tonight =) +- corrected position of new triangles on srollbars etc. a bit +- found (tricky) solution for Toolbar Separators (please consult README about this!!! - especially if toolbuttons seem to misbehave): +[well, seems you did :) +OK, the following Part is a bit tricky! +QT uses the Button Color to draw seperators on Toolbars. +Unfortunately we cannot change this directly, so we have to set the button color of Toolbar Widgets to the background color. +Unhappy Effect: Toolbuttons will lose the ability to highlight, as their Buttoncolor now changed to Background mode. (f***!) +Solution: We reset the the Buttoncolor of Toolbuttons to Buttoncolor right after that. +Unhappy Effect: Toolbuttons loose the ability to use redefined colors. +Solution: Check, if button uses backgroud for color: then reset it to button +Unhappy effect: An application cannot be redefine a Toolbutton color to background color. +(The alternative would be to exclude apps like korn, that are known to redefine toolbutton color, but i think, this is the MUCH better way!)] +- ...well now korn (and other apps) now also can have redefined toolbutton colors if you enable "draw toolbutton frames" (tststs..., sometimes i wonder if i can code anyway... :) +- added an option to remove bevel around kicker (user request) +- changed look of progressbar to fit apple's bevel rather than liquids +- added an option to user liquid's progressbar (user request, as an offer, on the new progress bar groove - tell me your opinion) + +0.3f +- menu translucency should now be PERFECT (i really like the word - howerver: never say never again... :) + this means: there won't be any ghostshadows anymore - no matter what you do. also no menu will be calculated twice if not nessecary (but don't forget: this is only pseudo translucency, this means, you won't capture background changes (animations aso.) as long as you don't close the menu) + Also menu dropshadows are supported +- scrollbars now change to active (with visual notification, what means they're colored) when you enter a scrollable area. (unfortunately currently doesn't work with some apps that don't inherit QScrollview - e.g. kwrite, so ill try to catch that) +- Kicker now draws (improved) smooth headers +- fixed rect buttons stucked to non stipple background (thanks to RenderMan for the notice) +- further minor graphical improvements... +- i hate the groupshadows... :) anyway, i found a rather simple solution to put a proper background to the buttons and sliders... (i could also apply this to the combos, but as they are almost rectangular, it wouldn't make much a difference. anyway: if someone is annoyed cause he runs a 320x240 ressolution, i'll improve that by request) +- removed any (virtual) support for kde menutranslucency, as it's really not a good idea to have both enabled at the same time... +- fixed an error to LVH triangles (thanks to Narcis Tesa for the hint) +- changed triangles on scrollbars and menus to fit listview expander look +- removed bevel around kicker for user request. i'll make that configurable with the next release. +- improved header hover behaviour after scrolling (on slight speed loss) - however it's still not perfect. (header hovering is a bit a hack and qt seems to have a problem with updating the header position...) +=========================================== ++++ you can download the new enchicked wallpaper from here: +http://stud.uni-karlsruhe.de/~uhvh/panther-jolene.png.bz2 + +0.3e +- added a slider to configure degree of saturation for icy buttons +- forcing rect buttons now also affects combos - for a more consistent look... +- menutranslucency improvement (1): + submenus won't be creatd multiple times, as long as lowest level menu is shown + this also holds (in most cases) for menubar-popups (e.g. when flying through your menus) +- menutranslucency improvement (2): + BE BANISHED TO WHERE THOU CAMEST FROM, HELLISH GHASTLY GRIM GHOSTSHADOWS ON POPUPMENUS !!! :) + (also improves menu buildup speed, as they are partially taken out of memory. btw, how's kde 3.2 state on this? - still nice ghosts?:) + (notice: the function isn't perfect, yet: menus are not overcaptured, therefore menushadows will still draw (slim white) artefacts. Also, you can trick it if you don't move left - right, but follow a bow above the menubar, as then the pixmapbuffer probably will be deleted - i'll try to fix this in the next release. for the moment, need you for beta-testing. so please tell me, if you find more drawing errors!) + +0.3d +- added more saturation to the icy buttons (icy buttons are now active by default - i think :) +- again brighter shadows for buttons and combos +- minor graphical changes (e.g. a toolbutton frame) +- option to force rectangular buttons (sorry 'eggnogg' - combos as buttons looked really crap, especially when buttons and combos appear at the same time) +- sunken button effect now wanted - therefore constant behaviour (they sometimes did funny things before) +- some codeimprovements... +- header + kicker (was there?) flicker resettled to nirvana +- solved renderman's problem with disaligned submenu triangles (with massive help of renderman, to state this) +- toolbuttons now also can have individual colors (affects e.g. korn) + +0.3c +- changed look of smooth LVH (hope RenderMan can live with that now...) ;-) +- no smooth LVH for kicker (looked crap because of the shadow) +- new Images for the buttons (but of same style) +- slightly reworked comboboxes (smoother shape, lighter shadow) +- set toolbuttons back to iTunes style - independent of the smooth LVH (thanks to Ercin Eker for the hint) +- added new widget coloring function (it's slower at app startup, but you'll need a profiler to notice that on a current computer) +- new button pressing effect (to be honest, this happened due an accident - originally i wanted to use the outline as an alternative hover but set a wrong if check..., however it now looks like glow effect - tell me your opinion) + +for multiple request: +============ +1. you can download binaries (NO WARRANTY they will work) from here: +http://stud.uni-karlsruhe.de/~uhvh/baghira-binary.tar.bz2 +2. you can download the enchicked version of the wallpaper from here: +http://stud.uni-karlsruhe.de/~uhvh/panther-padma.png.bz2 + +0.3b +- fixed menu translucency behaviour (veeeeeery stupid bug...) +- flattened the menu indicator + use of highlightened text (blame or thank RenderMan...) :) +- changed listheader indicator arrow +- stipples aligned by default - also, removed brute force alignment (leads to some very unhappy errors) - if you seea widget, that is disharmonic stippled: just drop me a mail! (groupboxes work... partially) - therefore "Align Stipples" option is (currently) useless... +- made and fixed a stupid bug tthat allmost costed my brain... ;-) (sometimes i'm really so stupid...) +- rectangular combos (e.g. html) are now rather combos - not complete highlighted buttons +- combos however are reworked and base upon their own pixmaps - not perfect at all... need better submittal?! +- you (RenderMan) can activate smoother ListViewHeaders - basing upon the new combos... +- fixed some minor bugs +================== += REQUEST !!! ========= +================== +Apple seems to use a nonlinear coloring process for buttons and stuff (e.g. light parts tend to be yellow). +Mosfet's linear coloring function results in quite flat Buttons. +If anyone can recommand good literature about coloring precesses - thanks ;-) +================================================================= +================================================================= + +0.3a +heyheyhey... consistent source (./configure;make;make install from topdir)... finally. YEAHHH BABY! +ok, now the important stuff: +- tabs now also follow inactive button style +- fixed a popupmenu bug (for aligned stipples) +- reworked the polishment process -> should be much faster now, also lost some errors (e.g. open juk with 0.3, did nobody see this??? ) +- added icons for the kcmdialog - just copy the iconfolders in "icons" to your icon-directory +- new "iTunes" styled rect buttons + +0.3 +- configdialog of course! +- new centerd tabs (thanks to shm for the patch) +- faster html (and other stuff?) scrolling +- fixed color error to the toolbar +- fixed major (but uncritical) bug to kicker (and child process) groupboxes +- other stuff i forgot... +================================================================================ +NOTES to configuration +---------------------------------- +- usually inactive buttons follow the background: therefore they can appear flat to very bright backgrounds (on black backgrounds on the other hand you won't see them anymore)... try to set them to "original" +- custom translucency doesn't work as it should (inverse behaviour, may overrun the defined area what leads to funny colors...) +- stipple alignement is only partially implemented - therefore it's not really slow (but won't work on groupboxes) +- centertabs should work on qt 3.1.2 and above. below this it's not tested (but may work anyway) +- "fasten the filebrowser" will lead to a stippled background (if you use stipples) and will remove the possibility to choose custom backgrounds +==================================================================================== + +0.2b +- Better Support for unstippled Background +- No more flicker ?! +- New Button behaviour (to hopefully get some feedback) +- more graphical stuff corrected (eg line near groupboxes) +- you now can configure the first items (kcm will follow soon, probably next few days) +to ~/.qt/qtrc add and modify: + +[Baghira] +drawDotlines=true +drawGroupBoxShadow=true +plusMinus=false +squeezeSbSlider=true +shadowSbSlider=false + +... not colors so far, as you would have to set hexdecimals... + +0.2a +- Fixed some graphical... insufficiencies (thanks, craigD) +- redid lines for listview so that Marcel can handle his massive email traffic again ;-) + (this will be choosable when the confdialog...) +- also triangles should look a bit cleaner now +- feedback for checkboxes and radiobuttons +- shadowed groups now won't fall to button color if you use the button color for menus +- about menu effects: fade in and animation happily works, as long as you don't use transparent menus + if you use transp menus, always the button color will be used for the effect. I *can* fix that - on a little speed loss. + However I do suggest to NOT use transparent menus with menu effects, as the menu will become more solid everytime you open it. + (Maybe I will support qt transparency for the unstippled menu in the future) + + + +0.2 +- new icons in listview (nice triangles instead of windows like '+' & '-', no lines) +- 3d effect for editlines +- removed shadows and annoying triangle from active button text +- changed scrollbar -> hover effect (sunken when pushed), more grippy + + +To the people who sign responsable for mosfet's parting: +------------------------------------------------------------------------------------ +After working on mosfet's code for some days now, i think i'm really competent to say this. +I do not know, what you did or said or just why - but hey: you stole us a really great coder... shame on you. + + +mailto:baghira-style@gmx.net @@ -0,0 +1 @@ + diff --git a/bab/Makefile.am b/bab/Makefile.am new file mode 100644 index 0000000..bf7a71e --- /dev/null +++ b/bab/Makefile.am @@ -0,0 +1,22 @@ +## Makefile.am for bab + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +# these are the headers for your project +noinst_HEADERS = bab.h bab_iface.h styleconfdialog.h + +# let automoc handle all of the meta source files (moc) +METASOURCES = AUTO + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kdedcoptest.pot + +# this is the program that gets installed. it's name is used for all +# of the other Makefile.am variables +bin_PROGRAMS = bab + +# the application source, library search path, and link libraries +bab_SOURCES = main.cpp styleconfdialog.cpp bab_iface.skel +bab_LDFLAGS = $(KDE_RPATH) $(all_libraries) +bab_LDADD = $(LIB_KDEUI) diff --git a/bab/Themes/Brushed b/bab/Themes/Brushed new file mode 100644 index 0000000..0354f24 --- /dev/null +++ b/bab/Themes/Brushed @@ -0,0 +1,15 @@ +2 +2 +1 +2 +1 +1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +0 diff --git a/bab/Themes/Jaguar b/bab/Themes/Jaguar new file mode 100644 index 0000000..01bde8f --- /dev/null +++ b/bab/Themes/Jaguar @@ -0,0 +1,14 @@ +0 +0 +0 +0 +0 +1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 diff --git a/bab/Themes/Makefile.am b/bab/Themes/Makefile.am new file mode 100644 index 0000000..2ae716a --- /dev/null +++ b/bab/Themes/Makefile.am @@ -0,0 +1,3 @@ +lnkdir = $HOME/.baghira +lnk_DATA = Brushed Milk Jaguar Tiger Panther +EXTRA_DIST = $(lnk_DATA) diff --git a/bab/Themes/Milk b/bab/Themes/Milk new file mode 100644 index 0000000..83b9864 --- /dev/null +++ b/bab/Themes/Milk @@ -0,0 +1,15 @@ +4 +4 +4 +4 +1 +0 +-592138 +-4930834 +-1 +-16777216 +-13009982 +-1 +-16777216 +-1116417 +1 diff --git a/bab/Themes/Panther b/bab/Themes/Panther new file mode 100644 index 0000000..c313570 --- /dev/null +++ b/bab/Themes/Panther @@ -0,0 +1,14 @@ +1 +1 +1 +1 +1 +1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 diff --git a/bab/Themes/Tiger b/bab/Themes/Tiger new file mode 100644 index 0000000..825a5c1 --- /dev/null +++ b/bab/Themes/Tiger @@ -0,0 +1,14 @@ +3 +3 +1 +1 +1 +1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 +-1 diff --git a/bab/bab.desktop b/bab/bab.desktop new file mode 100644 index 0000000..534daa4 --- /dev/null +++ b/bab/bab.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=bab +Name[xx]=xxbabxx +Exec=bab %i %m -caption "%c" +Icon=baghira +Type=Application +DocPath= +Comment=Access to the big black cat +Terminal=0 diff --git a/bab/bab.h b/bab/bab.h new file mode 100644 index 0000000..cc28882 --- /dev/null +++ b/bab/bab.h @@ -0,0 +1,108 @@ +/*************************************************************************** + * Copyright (C) 2004 by Thomas Lübking * + * thomas@home * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _BAB_H_ +#define _BAB_H_ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif +//#include <dcopclient.h> +#include "bab_iface.h" +#include <qwidget.h> +#include <qpixmap.h> +#include <qsettings.h> +#include <kmainwindow.h> +#include <ksystemtray.h> + +class bab; + +class BabSwitcher : public KSystemTray , public babInterface{ + Q_OBJECT +public: + + enum State {Jaguar = 0, Panther, iTunes, Tiger, Milk}; + + BabSwitcher(bab *parent=0, const char *name=0); + ~BabSwitcher(); + + void toggle(); + void setStyle(QString); + QString style(); + void setDeco(QString); + QString deco(); + void start(QString name, QString settings); + void emitStyleChanged(); + static QPoint *globalPos; + +protected: + void mousePressEvent(QMouseEvent *e); + void paintEvent(QPaintEvent *ev); + +private: + + int state_; + int decoState_; + QPixmap JaguarIcon; + QPixmap PantherIcon; + QPixmap iTunesIcon; + QPixmap TigerIcon; + QPixmap MilkIcon; +}; + + +class QComboBox; +class QCheckBox; +/** + * @short Application Main Window + * @author Thomas Lübking <baghira-style@gmx.net> + * @version 0.1 + */ +class bab : public KMainWindow +{ + Q_OBJECT +public: + + enum TabState {Tab = 0, Clever, Chooser}; + bab(); + void showEvent(QShowEvent *e); + QCheckBox *cornerCheck; + virtual ~bab(); +private: + BabSwitcher* bSwitcher; + QComboBox *DefStyle; + +private slots: + void saveSettings(); + void configureBaghira(); + +}; + +class Corner : public QWidget +{ + Q_OBJECT + public: + enum Side {left = 0, right}; + Corner(Side side); +public slots: + void toggle(bool); +}; + +#endif // _BAB_H_ diff --git a/bab/bab.lsm b/bab/bab.lsm new file mode 100644 index 0000000..842281c --- /dev/null +++ b/bab/bab.lsm @@ -0,0 +1,16 @@ +Begin3 +Title: bab -- Some description +Version: 0.1 +Entered-date: +Description: +Keywords: KDE Qt +Author: Thomas Lübking <thomas@home> +Maintained-by: Thomas Lübking <thomas@home> +Home-page: +Alternate-site: +Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils + xxxxxx bab-0.1.tar.gz + xxx bab-0.1.lsm +Platform: Linux. Needs KDE +Copying-policy: GPL +End diff --git a/bab/bab_iface.h b/bab/bab_iface.h new file mode 100644 index 0000000..bf63d92 --- /dev/null +++ b/bab/bab_iface.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * Copyright (C) 2004 by Thomas Lübking * + * thomas@home * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _BAB_INTERFACE_H_ +#define _BAB_INTERFACE_H_ + +#include <dcopobject.h> + +class babInterface : virtual public DCOPObject +{ + K_DCOP + k_dcop: + + virtual void toggle() = 0; + virtual QString style() = 0; + virtual void setStyle(QString state) = 0; + virtual QString deco() = 0; + virtual void setDeco(QString state) = 0; + virtual void start(QString name, QString settings) = 0; + virtual void emitStyleChanged() = 0; + +}; + +#endif diff --git a/bab/main.cpp b/bab/main.cpp new file mode 100644 index 0000000..14b23d1 --- /dev/null +++ b/bab/main.cpp @@ -0,0 +1,615 @@ +/*************************************************************************** + * Copyright (C) 2004 by Thomas Lübking * + * thomas@home * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "bab.h" +#include <qpushbutton.h> +#include <qcheckbox.h> +#include <qcombobox.h> +#include <qdir.h> +#include <qlayout.h> +#include <qsettings.h> +#include <qtabwidget.h> +#include <qtooltip.h> +#include <qtimer.h> +#include <qvbox.h> +#include <qpainter.h> +#include <dcopclient.h> +#include <kapplication.h> +// #include <kconfig.h> +#include <kiconloader.h> +#include <kaboutdata.h> +#include <kcmdlineargs.h> +#include <kipc.h> +#include <klibloader.h> +#include <klocale.h> +#include <kprocess.h> +#if KDE_IS_VERSION(3,4,0) +#include <kwin.h> +#endif +#include <stdio.h> +#include <X11/Xlib.h> +#include <X11/extensions/shape.h> + +#include "styleconfdialog.h" + +static const char description[] = + I18N_NOOP("Baghira Aqua/Brushed"); + +static const char version[] = "cvs"; + +static KCmdLineOptions options[] = +{ +// { "+[URL]", I18N_NOOP( "Document to open." ), 0 }, + KCmdLineLastOption +}; + +int main(int argc, char **argv) +{ + KAboutData about("bab", I18N_NOOP("BAB - Baghira Aqua/Brushed Switcher"), version, description, + KAboutData::License_GPL, "(C) 2004/2005 Thomas Lübking", 0, 0, "baghira-style@gmx.net"); + about.addAuthor( "Thomas Lübking", 0, "baghira-style@gmx.net" ); + KCmdLineArgs::init(argc, argv, &about); + KCmdLineArgs::addCmdLineOptions( options ); + KApplication app; + DCOPClient* client = app.dcopClient(); + client->registerAs( "bab", false); + client->setDefaultObject( "babInterface" ); + bab* mainBAB = 0; + mainBAB = new bab; + app.setMainWidget(mainBAB); + Corner leftCorner(Corner::left); + Corner rightCorner(Corner::right); +#if KDE_IS_VERSION(3,4,0) + KWin::setShadowSize(leftCorner.winId(), 0); + KWin::setShadowSize(rightCorner.winId(), 0); +#endif + if (!mainBAB->cornerCheck->isChecked()) + { + leftCorner.hide(); + rightCorner.hide(); + } + leftCorner.connect( mainBAB->cornerCheck, SIGNAL(toggled(bool)), SLOT(toggle(bool)) ); + rightCorner.connect( mainBAB->cornerCheck, SIGNAL(toggled(bool)), SLOT(toggle(bool)) ); + + int ret = app.exec(); + if (mainBAB) delete mainBAB; + return ret; +} + + +bab::bab() : KMainWindow(0,"bab",Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ){ + bSwitcher = new BabSwitcher(this,"switcher"); + QToolTip::add(bSwitcher, i18n("leftclick toggles state<br>rightclick toggles setupmenu")); + bSwitcher->show(); + + QDir d( QDir::homeDirPath() + "/.baghira"); + if (!d.exists()) + d.mkdir(QDir::homeDirPath() + "/.baghira"); + d = QDir( QDir::homeDirPath() + "/.baghira/.bab"); + if (!d.exists()) + d.mkdir(QDir::homeDirPath() + "/.baghira/.bab"); + FILE *file = NULL; + QString tmpString = QDir::homeDirPath() + "/.baghira/Jaguar"; + if (!QFile::exists(tmpString)) + { + if( (file = fopen(tmpString.latin1(), "w")) != NULL ) + { + fprintf(file,"0\n0\n0\n0\n0\n1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n1\n"); + fclose(file); + } + } + tmpString = QDir::homeDirPath() + "/.baghira/Panther"; + if (!QFile::exists(tmpString)) + { + if( (file = fopen(tmpString.latin1(), "w")) != NULL ) + { + fprintf(file,"1\n1\n1\n1\n1\n1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n1\n"); + fclose(file); + } + } + tmpString = QDir::homeDirPath() + "/.baghira/Brushed"; + if (!QFile::exists(tmpString)) + { + if( (file = fopen(tmpString.latin1(), "w")) != NULL ) + { + fprintf(file,"2\n2\n1\n2\n1\n1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n0\n"); + fclose(file); + } + } + tmpString = QDir::homeDirPath() + "/.baghira/Tiger"; + if (!QFile::exists(tmpString)) + { + if( (file = fopen(tmpString.latin1(), "w")) != NULL ) + { + fprintf(file,"3\n3\n1\n1\n0\n1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n-1\n1\n"); + fclose(file); + } + } + tmpString = QDir::homeDirPath() + "/.baghira/Milk"; + if (!QFile::exists(tmpString)) + { + if( (file = fopen(tmpString.latin1(), "w")) != NULL ) + { + fprintf(file,"4\n4\n4\n4\n1\n0\n-592138\n-4930834\n-1\n-16777216\n-13009982\n-1\n-16777216\n-1116417\n1\n"); + fclose(file); + } + } + + QVBox *vb = new QVBox(this); + vb->setLineWidth(2); + vb->setMargin(2); +// vb->setFrameStyle(QFrame::Panel | QFrame::Plain ); + + QLabel *DefStyleLabel = new QLabel("Default Style is", vb); + DefStyle = new QComboBox(vb); + DefStyle->insertItem ( "Jaguar" ); + DefStyle->insertItem ( "Panther" ); + DefStyle->insertItem ( "Brushed" ); + DefStyle->insertItem ( "Tiger" ); + DefStyle->insertItem ( "Milk" ); + cornerCheck = new QCheckBox("Round upper screen corners", vb); + QSettings config; + config.beginGroup("/baghira/BAB"); + DefStyle->setCurrentItem(config.readNumEntry("defaultState", BabSwitcher::Panther )); + cornerCheck->setChecked( config.readBoolEntry("roundCorners", true ) ); + config.endGroup(); + QPushButton *configBaghira = new QPushButton("Configure Baghira", vb); + QPushButton *Quit = new QPushButton("Quit BAB", vb); + QPushButton *Close = new QPushButton("Close Menu", vb); + vb->adjustSize(); + bSwitcher->setStyle(DefStyle->currentText()); + bSwitcher->setDeco(DefStyle->currentText()); + + connect(DefStyle, SIGNAL(activated(int)), this, SLOT(saveSettings())); + connect(cornerCheck, SIGNAL(toggled(bool)), this, SLOT(saveSettings())); + connect(configBaghira, SIGNAL(clicked()), this, SLOT(configureBaghira())); + connect(Close, SIGNAL(clicked()), this, SLOT(hide())); + connect(Quit, SIGNAL(clicked()), this, SLOT(close())); + + resize(vb->width(),vb->height()); + +// show(); +} + +bab::~ bab() +{ + bSwitcher->setStyle(DefStyle->currentText()); + bSwitcher->setDeco(DefStyle->currentText()); + if (bSwitcher) delete bSwitcher; +} + +/*Taken from kcontrol, kcmshell style*/ +void bab::configureBaghira() +{ + + + // Use KLibLoader to get the library, handling + // any errors that arise + KLibLoader* loader = KLibLoader::self(); + + KLibrary* library = loader->library( QFile::encodeName("kstyle_baghira_config") ); + if (!library) + { + qWarning("There was an error loading the configuration dialog for this style."); + return; + } + + void* allocPtr = library->symbol("allocate_kstyle_config"); + + if (!allocPtr) + { + qWarning("There was an error loading the configuration dialog for this style."); + return; + } + + //Create the container dialog + StyleConfigDialog* dial = new StyleConfigDialog(this, "Baghira Configuration"); + dial->enableButtonSeparator(true); + + typedef QWidget*(* factoryRoutine)( QWidget* parent ); + + //Get the factory, and make the widget. + factoryRoutine factory = (factoryRoutine)(allocPtr); + QWidget* styleConfig = factory( dial ); + + QTabWidget* tw = (QTabWidget*)styleConfig->child("tabWidget"); + + QWidget* decoConfig = 0; + QObject *decoObject = 0; + if (tw) + { + KLibrary* library2 = loader->library( QFile::encodeName("kwin_baghira_config") ); + if (!library2) + { + qWarning("There was an error loading the configuration dialog for the deco."); + return; + } + void* allocPtr2 = library2->symbol("allocate_config"); + if (!allocPtr2) + { + qWarning("There was an error loading the configuration dialog for this style."); + return; + } + typedef QObject*(* factoryRoutine2)( KConfig* conf, QWidget* parent ); + factoryRoutine2 factory2 = (factoryRoutine2)(allocPtr2); + decoObject = factory2( 0, tw ); + decoConfig = (QWidget*)tw->child("ConfigDialog"); + tw->addTab(decoConfig, "Decoration"); + } + + //Insert it in... + dial->setMainWidget( styleConfig ); + + QWidget *desktop = QApplication::desktop(); + QPoint nPos((desktop->width() - dial->width())/2, (desktop->height() - dial->height() - 100)/2); + dial->move(nPos); + //..and connect it to the wrapper + connect(styleConfig, SIGNAL(changed(bool)), dial, SLOT(setStyleDirty(bool))); + connect(decoObject, SIGNAL(changed()), dial, SLOT(setDecoDirty())); + connect(dial, SIGNAL(defaults()), styleConfig, SLOT(defaults())); + connect(dial, SIGNAL(save()), styleConfig, SLOT(save())); + connect(dial, SIGNAL(defaults()), decoObject, SLOT(defaults())); + connect(dial, SIGNAL(save(KConfig*)), decoObject, SLOT(save(KConfig*))); + + if (dial->exec() == QDialog::Accepted) + { + //For now, ask all KDE apps to recreate their styles to apply the setitngs + if (dial->isStyleDirty()) + { + KIPC::sendMessageAll(KIPC::StyleChanged); + KIPC::sendMessageAll(KIPC::ToolbarStyleChanged); + } + if (dial->isDecoDirty()) + kapp->dcopClient()->send("kwin", "KWinInterface", "reconfigure()", QByteArray()); + } + tw->removeChild( decoObject ); + dial->insertChild( decoObject ); + decoConfig->reparent(dial, QPoint(0,0)); + delete dial; +} + +/* overwrite the show event for repositioning the window on top + of the icon, adapted from kkeyled */ +void bab::showEvent(QShowEvent *e){ + if ( bSwitcher->globalPos->x() >= 0) { + QWidget *desktop = QApplication::desktop(); + int w = desktop->width(); + QPoint nPos; + if (bSwitcher->globalPos->y() - height() >= 0 ) + { // it's not on top + nPos.setY(bSwitcher->globalPos->y() -height()); + nPos.setX(bSwitcher->globalPos->x() - (width() / 2)); + } + else if ( bSwitcher->globalPos->y() >= 0 ) + { + nPos.setY(bSwitcher->globalPos->y() + bSwitcher->height() ); + nPos.setX(bSwitcher->globalPos->x() - (width() / 2)); + } + if ( nPos.x() < 0 ) + { + nPos.setX(bSwitcher->globalPos->x() + bSwitcher->width()); + } + else if ( bSwitcher->globalPos->x() + (width() / 2) > w ) + { + nPos.setX(bSwitcher->globalPos->x() - width()); + } + move(nPos); + } + + // If it was set by the normal sessionmanagement it needs + // to set the Flags again + setWFlags(Qt::WStyle_StaysOnTop | Qt::WX11BypassWM); + QWidget::showEvent(e); // execute the normal showevent + raise(); +} + +void bab::saveSettings(){ + QSettings *config = new QSettings(); +// KConfig *config = new KConfig("baghirarc"); + config->beginGroup("/baghira/BAB"); + config->writeEntry("defaultState", DefStyle->currentItem()); + config->writeEntry("roundCorners", cornerCheck->isChecked()); + config->endGroup(); + delete config; +} + +QPoint *BabSwitcher::globalPos = new QPoint::QPoint(0,0); + +BabSwitcher::BabSwitcher(bab *parent, const char *name) + : KSystemTray(parent,name), DCOPObject("babInterface") { + KIconLoader* iLoader = KGlobal::iconLoader(); + JaguarIcon = iLoader->loadIcon("bab_jaguar", KIcon::Small, 22); + PantherIcon = iLoader->loadIcon("bab_panther", KIcon::Small, 22); + iTunesIcon = iLoader->loadIcon("bab_itunes", KIcon::Small, 22); + TigerIcon = iLoader->loadIcon("bab_tiger", KIcon::Small, 22); + MilkIcon = iLoader->loadIcon("bab_milk", KIcon::Small, 22); + installEventFilter(this); +} + +BabSwitcher::~BabSwitcher(){ +} + +void BabSwitcher::toggle() +{ + if ( state_ < Milk ) + state_++; + else + state_ = Jaguar; + decoState_ = state_; + QString nameString; + switch (state_) + { + case Jaguar: + nameString = "Jaguar"; + break; + case Panther: + nameString = "Panther"; + break; + case iTunes: + nameString = "Brushed"; + break; + case Tiger: + nameString = "Tiger"; + break; + case Milk: + nameString = "Milk"; + } + QString tmpString = QDir::homeDirPath() + "/.baghira/" + nameString; + QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.style"; + remove(tmpString2.latin1()); + symlink (tmpString.latin1(), tmpString2.latin1()); + tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.deco"; + remove(tmpString2.latin1()); + symlink (tmpString.latin1(), tmpString2.latin1()); + repaint(); +} + +void BabSwitcher::setStyle(QString style) +{ + if (style == "Jaguar") + state_ = Jaguar; + else if (style == "Brushed") + state_ = iTunes; + else if (style == "Tiger") + state_ = Tiger; + else if (style == "Milk") + state_ = Milk; + else + { + if (style != "Panther") + style = "Panther"; + state_ = Panther; + } + QString tmpString = QDir::homeDirPath() + "/.baghira/" + style; + QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.style"; + remove(tmpString2.latin1()); + symlink (tmpString.latin1(), tmpString2.latin1()); + repaint(); +} + +void BabSwitcher::setDeco(QString deco) +{ + if (deco == "Jaguar") + decoState_ = Jaguar; + else if (deco == "Brushed") + decoState_ = iTunes; + else if (deco == "Tiger") + decoState_ = Tiger; + else if (deco == "Milk") + decoState_ = Milk; + else + { + if (deco != "Panther") + deco = "Panther"; + decoState_ = Panther; + } + QString tmpString = QDir::homeDirPath() + "/.baghira/" + deco; + QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/.deco"; + remove(tmpString2.latin1()); + symlink (tmpString.latin1(), tmpString2.latin1()); +} + +QString BabSwitcher::style() +{ + switch (state_) + { + case Jaguar: + return "Jaguar"; + case Panther: + return "Panther"; + case iTunes: + return "Brushed"; + case Tiger: + return "Tiger"; + case Milk: + return "Milk"; + } +} + +QString BabSwitcher::deco() +{ + switch (decoState_) + { + case Jaguar: + return "Jaguar"; + case Panther: + return "Panther"; + case iTunes: + return "Brushed"; + case Tiger: + return "Tiger"; + case Milk: + return "Milk"; + } +} + +void BabSwitcher::start(QString name, QString settings) +{ + KProcess proc; + QString section; int i = 0; bool done = false; + if (name.contains(' ')) + { + while (!done) + { + section = name.section(' ',i,i); + if (i == 0) + { + QString tmpString = QDir::homeDirPath() + "/.baghira/" + settings; + QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/" + section; + remove(tmpString2.latin1()); + symlink (tmpString.latin1(), tmpString2.latin1()); + } + if (!section.isEmpty()) + proc << section; + else + done = true; + i++; + } + } + else + { + QString tmpString = QDir::homeDirPath() + "/.baghira/" + settings; + QString tmpString2 = QDir::homeDirPath() + "/.baghira/.bab/" + name; + remove(tmpString2.latin1()); + symlink (tmpString.latin1(), tmpString2.latin1()); + proc << name; + } + proc.start(KProcess::DontCare); + proc.detach(); +} + +void BabSwitcher::emitStyleChanged() +{ + KIPC::sendMessageAll(KIPC::StyleChanged); + KIPC::sendMessageAll(KIPC::ToolbarStyleChanged); +} + +void BabSwitcher::mousePressEvent(QMouseEvent *e){ + + QWidget *daddy = parentWidget(); + + globalPos->setX(e->globalX() - e->x()); + globalPos->setY(e->globalY() - e->y()); + + switch ( e->button() ) + { + case LeftButton: + { + toggle(); + break; + } + case RightButton: + default: + { + if ( daddy->isVisible() ) + daddy->hide(); + else + daddy->show(); + } + } +} + +void BabSwitcher::paintEvent(QPaintEvent *ev){ + KSystemTray::paintEvent(ev); + QPainter icyApainter(this); + switch (state_) + { + case Jaguar: + JaguarIcon.isNull() ? icyApainter.fillRect(rect(), Qt::blue) : icyApainter.drawPixmap(0, 0, JaguarIcon); + break; + case Panther: + PantherIcon.isNull() ? icyApainter.fillRect(rect(), Qt::black) : icyApainter.drawPixmap(0, 0, PantherIcon); + break; + case iTunes: + iTunesIcon.isNull() ? icyApainter.fillRect(rect(), Qt::gray) : icyApainter.drawPixmap(0, 0, iTunesIcon); + break; + case Tiger: + TigerIcon.isNull() ? icyApainter.fillRect(rect(), Qt::yellow) : icyApainter.drawPixmap(0, 0, TigerIcon); + break; + case Milk: + MilkIcon.isNull() ? icyApainter.fillRect(rect(), Qt::white) : icyApainter.drawPixmap(0, 0, MilkIcon); + default: + break; + } + icyApainter.end(); +} + +Corner::Corner(Side side) : QWidget(0, (side == left)?"left_corner":"right_corner", Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ) +{ + if (side == left) { + setFixedSize(5,4); + move(0,0); + show(); + setPaletteBackgroundColor(Qt::black); + XRectangle* xrects = new XRectangle[4]; + xrects[ 0 ].x = 0; + xrects[ 0 ].y = 0; + xrects[ 0 ].width = 5; + xrects[ 0 ].height = 1; + xrects[ 1 ].x = 0; + xrects[ 1 ].y = 1; + xrects[ 1 ].width = 3; + xrects[ 1 ].height = 1; + xrects[ 2 ].x = 0; + xrects[ 2 ].y = 2; + xrects[ 2 ].width = 2; + xrects[ 2 ].height = 1; + xrects[ 3 ].x = 0; + xrects[ 3 ].y = 3; + xrects[ 3 ].width = 1; + xrects[ 3 ].height = 2; + XShapeCombineRectangles( qt_xdisplay(), winId(), ShapeBounding, 0, 0, + xrects, 4, ShapeSet, 0 ); + delete[] xrects; + } + else { + setFixedSize(5,4); + move(QApplication::desktop()->width()-5,0); + show(); + setPaletteBackgroundColor(Qt::black); + XRectangle* xrects = new XRectangle[4]; + xrects[ 0 ].x = 0; + xrects[ 0 ].y = 0; + xrects[ 0 ].width = 5; + xrects[ 0 ].height = 1; + xrects[ 1 ].x = 2; + xrects[ 1 ].y = 1; + xrects[ 1 ].width = 3; + xrects[ 1 ].height = 1; + xrects[ 2 ].x = 3; + xrects[ 2 ].y = 2; + xrects[ 2 ].width = 2; + xrects[ 2 ].height = 1; + xrects[ 3 ].x = 4; + xrects[ 3 ].y = 3; + xrects[ 3 ].width = 1; + xrects[ 3 ].height = 2; + XShapeCombineRectangles( qt_xdisplay(), winId(), ShapeBounding, 0, 0, + xrects, 4, ShapeSet, 0 ); + delete[] xrects; + } +} + +void Corner::toggle(bool b) +{ + b?show():hide(); +} + +#include "bab.moc" diff --git a/bab/styleconfdialog.cpp b/bab/styleconfdialog.cpp new file mode 100644 index 0000000..245f5ab --- /dev/null +++ b/bab/styleconfdialog.cpp @@ -0,0 +1,63 @@ +/* + * KCMStyle's container dialog for custom style setup dialogs + * + * (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "styleconfdialog.h" +#include <klocale.h> + +StyleConfigDialog::StyleConfigDialog(QWidget* parent, QString styleName): + KDialogBase(parent, "StyleConfigDialog", + true, /*modal*/ + styleName, + KDialogBase::Default | KDialogBase::Ok | KDialogBase::Cancel, + KDialogBase::Cancel) +{ + m_styleDirty = false; + m_decoDirty = false; + connect( this, SIGNAL( defaultClicked() ), this, SIGNAL( defaults() )); + connect( this, SIGNAL( okClicked() ), this, SIGNAL( save() )); + connect( this, SIGNAL( okClicked() ), this, SLOT( saveDeco() )); +} + +void StyleConfigDialog::saveDeco() +{ + emit save(0); +} + +bool StyleConfigDialog::isStyleDirty() const +{ + return m_styleDirty; +} + +void StyleConfigDialog::setStyleDirty(bool dirty) +{ + m_styleDirty = dirty; +} + +bool StyleConfigDialog::isDecoDirty() const +{ + return m_decoDirty; +} + +void StyleConfigDialog::setDecoDirty() +{ + m_decoDirty = TRUE; +} + +#include <styleconfdialog.moc> diff --git a/bab/styleconfdialog.h b/bab/styleconfdialog.h new file mode 100644 index 0000000..9a125d7 --- /dev/null +++ b/bab/styleconfdialog.h @@ -0,0 +1,53 @@ +/* + * KCMStyle's container dialog for custom style setup dialogs + * + * (c) 2003 Maksim Orlovich <maksim.orlovich@kdemail.net> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef STYLE_CONF_DIALOG +#define STYLE_CONF_DIALOG + +#include <kdialogbase.h> + +class KConfig; +class StyleConfigDialog: public KDialogBase +{ + Q_OBJECT +public: + StyleConfigDialog(QWidget* parent, QString styleName); + + bool isStyleDirty() const; + bool isDecoDirty() const; + +public slots: + void setStyleDirty(bool dirty); + void setDecoDirty(); + +private slots: + void saveDeco(); + +signals: + void defaults(); + void save(); + void save(KConfig*); + +private: + bool m_styleDirty; + bool m_decoDirty; +}; + +#endif diff --git a/colorscheme/AquaBlue.kcsrc b/colorscheme/AquaBlue.kcsrc new file mode 100644 index 0000000..63a6847 --- /dev/null +++ b/colorscheme/AquaBlue.kcsrc @@ -0,0 +1,26 @@ +[Color Scheme]
+Name=Aqua Blue
+activeBackground=255,255,255
+activeBlend=225,225,225
+activeForeground=0,0,0
+activeTitleBtnBg=80,132,185
+alternateBackground=238,246,255
+background=250,250,250
+buttonBackground=97,136,215
+buttonForeground=0,0,0
+contrast=0
+foreground=0,0,0
+frame=255,255,255
+handle=255,255,255
+inactiveBackground=225,225,225
+inactiveBlend=225,225,225
+inactiveForeground=35,35,35
+inactiveFrame=255,255,255
+inactiveHandle=255,255,255
+inactiveTitleBtnBg=218,238,255
+linkColor=0,0,192
+selectBackground=57,109,181
+selectForeground=255,255,255
+visitedLinkColor=128,0,128
+windowBackground=255,255,255
+windowForeground=0,0,0
diff --git a/colorscheme/AquaGraphite.kcsrc b/colorscheme/AquaGraphite.kcsrc new file mode 100644 index 0000000..a34ddbc --- /dev/null +++ b/colorscheme/AquaGraphite.kcsrc @@ -0,0 +1,26 @@ +[Color Scheme]
+Name=Aqua Graphite
+activeBackground=255,255,255
+activeBlend=225,225,225
+activeForeground=0,0,0
+activeTitleBtnBg=131,142,155
+alternateBackground=238,246,255
+background=255,255,255
+buttonBackground=137,145,155
+buttonForeground=0,0,0
+contrast=0
+foreground=0,0,0
+frame=255,255,255
+handle=255,255,255
+inactiveBackground=225,225,225
+inactiveBlend=225,225,225
+inactiveForeground=35,35,35
+inactiveFrame=255,255,255
+inactiveHandle=255,255,255
+inactiveTitleBtnBg=218,238,255
+linkColor=0,0,192
+selectBackground=104,121,140
+selectForeground=255,255,255
+visitedLinkColor=128,0,128
+windowBackground=255,255,255
+windowForeground=0,0,0
diff --git a/colorscheme/Makefile.am b/colorscheme/Makefile.am new file mode 100644 index 0000000..1949d7d --- /dev/null +++ b/colorscheme/Makefile.am @@ -0,0 +1,3 @@ +lnkdir = $(kde_datadir)/kdisplay/color-schemes +lnk_DATA = AquaBlue.kcsrc AquaGraphite.kcsrc +EXTRA_DIST = $(lnk_DATA) diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..490b9f3 --- /dev/null +++ b/config.h.in @@ -0,0 +1,253 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Define to 1 if you have the <Carbon/Carbon.h> header file. */ +#undef HAVE_CARBON_CARBON_H + +/* Define if you have the CoreAudio API */ +#undef HAVE_COREAUDIO + +/* Define to 1 if you have the <crt_externs.h> header file. */ +#undef HAVE_CRT_EXTERNS_H + +/* Defines if your system has the crypt function */ +#undef HAVE_CRYPT + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have libjpeg */ +#undef HAVE_LIBJPEG + +/* Define if you have libpng */ +#undef HAVE_LIBPNG + +/* Define if you have a working libpthread (will enable threaded code) */ +#undef HAVE_LIBPTHREAD + +/* Define if you have libz */ +#undef HAVE_LIBZ + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define if your system needs _NSGetEnviron to set up the environment */ +#undef HAVE_NSGETENVIRON + +/* Define if you have res_init */ +#undef HAVE_RES_INIT + +/* Define if you have the res_init prototype */ +#undef HAVE_RES_INIT_PROTO + +/* Define if you have a STL implementation by SGI */ +#undef HAVE_SGI_STL + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define if you have strlcat */ +#undef HAVE_STRLCAT + +/* Define if you have the strlcat prototype */ +#undef HAVE_STRLCAT_PROTO + +/* Define if you have strlcpy */ +#undef HAVE_STRLCPY + +/* Define if you have the strlcpy prototype */ +#undef HAVE_STRLCPY_PROTO + +/* Define to 1 if you have the <sys/bitypes.h> header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the <X11/extensions/Xcomposite.h> header file. */ +#undef HAVE_X11_EXTENSIONS_XCOMPOSITE_H + +/* Define to 1 if you have the <X11/extensions/Xdamage.h> header file. */ +#undef HAVE_X11_EXTENSIONS_XDAMAGE_H + +/* Define to 1 if you have the <X11/extensions/Xrender.h> header file. */ +#undef HAVE_X11_EXTENSIONS_XRENDER_H + +/* Suffix for lib directories */ +#undef KDELIBSUFF + +/* Define a safe value for MAXPATHLEN */ +#undef KDEMAXPATHLEN + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of a `char *', as computed by sizeof. */ +#undef SIZEOF_CHAR_P + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* The size of a `size_t', as computed by sizeof. */ +#undef SIZEOF_SIZE_T + +/* The size of a `unsigned long', as computed by sizeof. */ +#undef SIZEOF_UNSIGNED_LONG + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Defined if compiling without arts */ +#undef WITHOUT_ARTS + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* + * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system + * headers and I'm too lazy to write a configure test as long as only + * unixware is related + */ +#ifdef _UNIXWARE +#define HAVE_BOOLEAN +#endif + + + +/* + * AIX defines FD_SET in terms of bzero, but fails to include <strings.h> + * that defines bzero. + */ + +#if defined(_AIX) +#include <strings.h> +#endif + + + +#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H) +# include <sys/time.h> +# include <crt_externs.h> +# define environ (*_NSGetEnviron()) +#endif + + + +#if !defined(HAVE_RES_INIT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +int res_init(void); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCAT_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcat(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +#if !defined(HAVE_STRLCPY_PROTO) +#ifdef __cplusplus +extern "C" { +#endif +unsigned long strlcpy(char*, const char*, unsigned long); +#ifdef __cplusplus +} +#endif +#endif + + + +/* + * On HP-UX, the declaration of vsnprintf() is needed every time ! + */ + +#if !defined(HAVE_VSNPRINTF) || defined(hpux) +#if __STDC__ +#include <stdarg.h> +#include <stdlib.h> +#else +#include <varargs.h> +#endif +#ifdef __cplusplus +extern "C" +#endif +int vsnprintf(char *str, size_t n, char const *fmt, va_list ap); +#ifdef __cplusplus +extern "C" +#endif +int snprintf(char *str, size_t n, char const *fmt, ...); +#endif + + + +#if defined(__SVR4) && !defined(__svr4__) +#define __svr4__ 1 +#endif + + +/* type to use in place of socklen_t if not defined */ +#undef kde_socklen_t + +/* type to use in place of socklen_t if not defined (deprecated, use + kde_socklen_t) */ +#undef ksize_t diff --git a/config/Makefile.am b/config/Makefile.am new file mode 100644 index 0000000..7cd149a --- /dev/null +++ b/config/Makefile.am @@ -0,0 +1,21 @@ +INCLUDES = $(all_includes) +noinst_HEADERS = about.h configdialog.h help.h kstyle_baghira_config.h colordialog.h colorpicker.h +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kstyle_baghira_config.la + +kstyle_baghira_config_la_SOURCES = kstyle_baghira_config.cpp colordialog.cpp colorpicker.cpp configdialog.ui help.ui about.ui +# kstyle_baghira_config_la_METASOURCES = AUTO +kstyle_baghira_config_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) +kstyle_baghira_config_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined $(KDE_PLUGIN) + + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/kstyle_baghira_config.pot + +pixmaps.h: $(srcdir)/generatePixmaps.sh + $(SHELL) $(srcdir)/generatePixmaps.sh $(top_srcdir) +CLEANFILES = pixmaps.h +kstyle_baghira_config.lo: pixmaps.h + diff --git a/config/about.ui b/config/about.ui new file mode 100644 index 0000000..bbe3ed7 --- /dev/null +++ b/config/about.ui @@ -0,0 +1,705 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>About</class> +<widget class="QDialog"> + <property name="name"> + <cstring>About</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>380</width> + <height>531</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>380</width> + <height>450</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>1000</width> + <height>1000</height> + </size> + </property> + <property name="caption"> + <string>About This Cat</string> + </property> + <property name="mouseTracking"> + <bool>true</bool> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="sizeGripEnabled"> + <bool>false</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>216</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget" row="12" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>crLabel</cstring> + </property> + <property name="paletteForegroundColor"> + <color> + <red>124</red> + <green>124</green> + <blue>124</blue> + </color> + </property> + <property name="text"> + <string></string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </hbox> + </widget> + <spacer row="11" column="1"> + <property name="name"> + <cstring>spacer19</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget" row="10" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonInfo</cstring> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>More Info...</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <spacer> + <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>111</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLabel" row="1" column="1"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </widget> + <spacer row="1" column="2"> + <property name="name"> + <cstring>spacer24</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>101</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer25</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>91</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="9" column="1"> + <property name="name"> + <cstring>spacer19_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget" row="8" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="4" column="3"> + <property name="name"> + <cstring>cpuLabel</cstring> + </property> + <property name="text"> + <string>unkonwn</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + </widget> + <widget class="QLabel" row="0" column="3"> + <property name="name"> + <cstring>kdeLabel</cstring> + </property> + <property name="text"> + <string>unknown</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + </widget> + <spacer row="3" column="2"> + <property name="name"> + <cstring>spacer20</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>5</width> + <height>16</height> + </size> + </property> + </spacer> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>5</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="4" column="2"> + <property name="name"> + <cstring>spacer18</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>5</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="4" column="4"> + <property name="name"> + <cstring>spacer19_6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="2" column="1"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>System</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <widget class="QLabel" row="2" column="3"> + <property name="name"> + <cstring>systemLabel</cstring> + </property> + <property name="text"> + <string>unknown</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>5</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="2" column="4"> + <property name="name"> + <cstring>spacer9_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="4" column="0"> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>100</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="4" column="1"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>CPU</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <spacer row="1" column="2"> + <property name="name"> + <cstring>spacer19_3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>5</width> + <height>16</height> + </size> + </property> + </spacer> + <spacer row="0" column="4"> + <property name="name"> + <cstring>spacer9_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="0" column="0"> + <property name="name"> + <cstring>spacer9_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>100</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="2" column="0"> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>104</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>KDE</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + </grid> + </widget> + <spacer row="7" column="1"> + <property name="name"> + <cstring>spacer19_4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget" row="6" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer5_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>91</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonDownload</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>NoFocus</enum> + </property> + <property name="text"> + <string>Download Update...</string> + </property> + <property name="autoDefault"> + <bool>false</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>91</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Version</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignRight</set> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>versionLabel</cstring> + </property> + <property name="text"> + <string>unknown</string> + </property> + <property name="alignment"> + <set>AlignVCenter|AlignLeft</set> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="font"> + <font> + <pointsize>18</pointsize> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Baghira/QT</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </hbox> + </widget> + <spacer row="5" column="1"> + <property name="name"> + <cstring>spacer19_5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer26</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<images> + <image name="image0"> + <data format="PNG" length="9906">89504e470d0a1a0a0000000d4948445200000080000000800806000000c33e61cb0000200049444154789ced7d7f9c1d5595e797ceed700a5ea05ee8403fa19516a374244043f8d14c1cd37cb29a6951b135cea4978c93561ce99575d83633a33de0ba6c66063391d519c30a6e83e28611c7880bf44427cb8b10ed08986684a115908e26c36b4da00afa993aa6afedfe513fdeadaa5bf5ea75f7cb0b6ebe7cf8dc54bf7a55e7dd3ae7dcf3eb9e028ee3388ee3388ee3ff539cd06802b2a0ebf22e83993b21703a244e80804d82f68eee197db9d1b4bdda71cc3340d78aae0d00de4339ba1802a71b304e70a46333f3e3ccbc8388fe7174cfe864a3e97cb5e2986580ce0b3b5711d1ff28b4152e686d6d854106880890eee756d9826ddb28ed2fbdc265fecce8e3a39b1a4b71189d2b3a9790a02600bf1add335a6e343d49382619a0f3c2ceeb0bad85cf777474a0b5a5152c1990004b0609028361920906030c8cef1bc7c4b3138f03e81bdd33fa6c2368ee5ed5bdc0b6edf791a07740e02212743680052cf96566fe5700df21a2af8cee193dd808fa9270cc3140e7859dd7b79fddfef98ee51d20106cb641c2937c516102ff180230c9c4c4e404c6c7c65fb1d97ee7d8e3630f1f659aaf25a28d85b6c252d3349137f300e032ab6438b6837da57d281d28bd04e0e3634f8cdd7934e94bc331c5009d1776beb5fdacf65d1d9d1d000066d63f7c0dcc9c89497b127b1fdb0b66febdd13da3dfaf37bd5d97772d65e62fb59fddfefb1d1d1da01c81406066977e78f40a9719260f4c62ef937b611fb2ef187b6aecc3f5a62f0b16349a001f5d97779120f1e8f9cbcf374493001f66a00990331202023cc3eee4ce30c48c7b2c9a0458baa37dd886699ac89f9cc7fe17f6af6b3bbbedab077e7ea06e5e42e78ace778926f1d0f2cee5e774beb9133cc3902cc187191212e5236508084829218f4830335a16b7a0edcc36d865fb6241a2edd02f0ffd9f7ad19715c70c03b4b5b6ddd2dede7e655b6b1bca87cb20419052829a5c354a4deeda4fa88c98018410807447795822d7928358209a0ffdf2d03b0e1c38f00ff5a0b5ebf2ae0db985b97fbcf4b24b45fb6bda61dbb6fb81bf2c79f444c1471862a1405b5b1bca2f952fca9d927b617272726f3d68cc8a638201ba56769d0e60fbb28e65e023aefa9433323e3601525646d1e469025446292596b42cc121fbd0692d8b5b4e3f70e0c0c8bcd27a79d73500be7ce9c597c25c6ce2d04b87b4742469aa3297410b098b4e5d84d281d2556daf6dfbc28103070ecf278db5a0a9513756c1cc1f2db4162aebbbd49ce449966f13f80696aa1118156fa1a3bd0300067a56f7ac982f3abb5777af84c4dd1d1d1d305b4cd8b61d7825513a82314aaf207099d1dad28af6a5ed277099ff7abee89b0d1ace005d2bbb9a007c8816b90fdf918e7e647764c9d54706284728b4166095ad79b1b8bb57779f66dbf68e7c6b1eed6755d4beeaa256a38b40c1b15db65138ab00103ed4b5b2eb8cf9a0713668380390a05524a860e64cb0641830e0c07147a98cc2d06b0640af1904c15c6202c0793d6b7a7ae74ca8c43f11d1c91ded1db0d9d6fd8e900d10d083644d659289f6d6f613b8ccd7cc99be59a2e10cc0ccef0c227c322cf95126f0ffae1ba31267b38d7c2e0fca111c76e61425ec59d3f311bb6caf2a140a00c5e9f47e877bb2c7a45a4da0d1149ee67bff5ce89b0b1ace0000de0200a0ca64fa93e84b7ea0116ad50c02c8e7f260e6737bafeaed9e0d71bd57f59ee2949d5b4d32619a2608a4bfbf40321d0aa2710dd33401e092ee95dda7cf86beb9a2a10cd0b3ba27cf922f308451099e4424c4914e45e224d235820cdb0c2408641048102cb63e361b1a2db63ecb60327206f2b93c2cb6aa6b24a9a127a2291c76028621a2135872d76ce89b2b1aca000e9c379320e14847bb86277e4f91bc906640583259b29b400260c07847efd5bd2db5d0d77355cfeb007c1012301799d9ef9f408faa297cfa0c61b87f03ceab7902e7010d65000346bbffef4003b0622d2b6b66746dd5495c48323daf01002000473a021257d744a0c44d8141e7ab7865798ade3fc98651e9d1690ceff7beb126dae6098dd60067fa120f59899dc7ac66c9557301404432bdd13fdf93b87766a5adf7eaded31ce9acf72594882a364a0a54498fd2133085a7197c78bffbccacb4cd271a6d042e6154ac76d54fd6f9cf356b06789a45000e1c0058d5b7ae6f6116c258f2070d18cdc143acfc3dd5ef0fe215aca727aa2998d9ff0da766a16bbed15806903825b08a1d5712229f57245fe74f57d30c8a55ee3dc45320912d3228d11f7c4f44fc7ac49932290e90e13efef793555b1dd1581b40180bfdc9b3ca16c01ac94ef00eb26a069bedb0ba9de64baad1d5bbb6f70248bc49d11c5a3a62f74fa033a04ba33926ad49ffef0dc9cb34da06384135b0ec291b269971495210ab0fd06806750dc6b4f23d17cbab12368df778967958fd83e3f717a46586c4dc80a2311c760086af617e3397b99c2d1aed051cf1ffcd60307310664d94a82c11376f6476ff0721582e20b1ac2a61127f10399ed5fdd34600e032c32a5b7e42a9ba85590734da089cf2252d4f7938ec0413ac9398403368a0954ce6f0e700207066dfdabe84ab00fdebfbcf60f045fef924c85d067c173063c40f50ce93f15c015051ff9e068827188e021acb00020743ea5a009665b9d28b94b5556785ab9229dc6376b4ccd4024262d895255f4220a1aa774318b09d2a9a292ae1510da1c63904c12edb706c4765e8176631837346a33540c95f638311066ccb0ee7d381d4b5342699d263002512a848f4490016a7d074b17f7ea8a6cfabf50be5ff235e40aa37a01c3318b66587bc17431813f336ab35a0a10c4082f6478323beba9d3c38190487008df5add3109e343133eca9783571f010402727d1c4929741284129e53eec70aa4b5ad51bf0ef6133ac4356e8fa0e9c67e6757233a2d14bc08f836c9faa09bc07694fd99584899a2b48a9bcf11f54b0e67b46bc699895638113934822d06ba3f7f38f6311cbb44a20cde82f4da552297c5d300c61fc683ea7362b1aca00dbefdb7ec081f3330386dec0937055a5a7ce03498646137816bf6d29b654335c37b019e069ae1c03bfd5d1d3bfbebf89a7b9529da3680eff3ef6546db64048f2bd87ef5f5b31584b8e74c66b99bbf942a36d00e429ff4300c1c35725c38fc0b1e3a9df298d81252be1549ee640d2a999d246bd1d4f38959ac96580e6047a40602be25d5459f301cdc357bf2ff0bde2cee24c0dd3366f68380340e0fbea8484c2bb8a7af71fb63d655718c2ff7f9a03096730a8b96aa1665215ee493ccd275133059a2309f6945d895cfa06a8d01c33832d46e96049fdcd15b889a25db39bbcb9a3e10c40cdf46d202269d151863582f7bdcad8ac1cabd6bbfe7abf868095408e11304f8206f155370982ed78cce8bba0fee06b24cb3546adb215d836a16ca57f3de081d9cddedcd17006d8f6f56d4f91a0676261557058a254786bba56d223ae58542201bc6890a1dd4e4ea0053a8d11b2217c28c52b702a9ac9b69451b29b02a68897232ad94008ec19d931f2b3f99ed7ac683803000004be514d7283355991c8d4f3233645704cb47fcbad5b821074840e276a9d6b354ef4fa4273be5f89a47837316f07409ef277659ca5bae098600032e82eade4abf0ad79686c83244d1185fbf9d3299f970138da448f7fdfa826f0109c1f4955fb080a5c6548134c33f89e4c9354271c130cb0ed9e6dcf988bcc5140b3662b9247a0745b2169546d07a2c793e83084f132093a987a3d23a20934de824e33c534010c18c2181e7960e495ec3335ffa8263331745ddef55e00ab019ca7f4ecf90524c688e811838c7f1ed931527b470c81bf86c0fda1e28ee85a9f5430aa865955bf5ddd8ee5076380ef2691b0e5d62dbfe9dfd07f00c06b438e62c4ca0f34423345e30bda14b11aa65635419ef29fa9799ee61999fb03745ddef5872cf9a6424b619999776be421dcd8bdc516b8ec1a3e4ed92941e0cebc99fffbedf76dd71a5b49e8bdbaf7c700de042098dce89aeb43f770a3f9fad843042686ef1c7e7d1a0d03d70edc65b3fd81688c3f041d33a0422f4fa787ad3dfabfb2fd81ed1fa8657eea814c1aa06b45d71789e8c39d1d9dc8b7e443bd7a00a05554dab84c4c4e1426f74f7eb234591ae8b9aa6768e48191ad59893117991fb3a7ec1d3ac98f529df4f0a38919753473e6bd1966e451027d20148f883241828d10780b487ff8de35fe22ebbcd413556d80ce159df7e65bf21fbea2eb0a145a0bee8f29578a2d5832ecb21d4845c71b3ad07949273a9676988eed7ca1674dcfb77ad7f6e6b210337cf7f0b7c9a022a613ac7c917ded37c98cfddd20e34bd56830c82846ef1bedf4917a7f4f63051149c49998886eaa553bd60ba90cd0b9a2f3d38596c2daae4bba5cae2f572a76d4d42be0256124075ba6dbcf6d47c7f20e5865eb5d6cf158efdade4c65cf44b41ecd988965fb74fe7992f5aff93b091ad972eb96e7aadd7fcbad5bc689683c94f049b1eefdfb850a46fd6540c92104df13787afb7ddb6fce32174703890cd0b5b26b1911ddd4b9bcd39d6c8ed7c4c5e01b625e24ac7056019dcb3be148e70d3cc5dfeb5bd757950986ef1cfe7733677e5027613a49d4497a302ab1f8bc99ffcb8c730212f4555d36306d54238480a70934df37179973dfa93c8f4864002ef3d68ea51d00b9929fb93247ad806197093a9676c061e775f694fd78dfbabeaadbb386ef1cbe0b02b7ab865c28c2a7d2195deb351a229fcb7f71d3e64d4f669d142367dc0ee037da1c45350de41b88d3e1cf190c7391b961db3ddb7e92958ea3012d03745ddeb5dc34cdb7e6cd7c10df0e24429387d7ba66f07ebcc7048542014ed96965877766216cdbdddbfe94043d1844dc40fe3f2af4a81138b5f247ade327fa19043e5acba46cd9bce5503e97ff5c703d44344d8a2d10d0d71cd644e622f3966df76cbbab163a8e06b46e60e78acecfb5b7b6ff676f0d0f6f6c54112973d2ba6270c3a276d9c6f8f8b83f19776efbfab6fe2c04f66fe8ff064beef51e66f5fb7af0cab7d8308df3b76cde5273f3c8c11b064fb4cad60148b4647205556f4186bd01739179dbb67bb60dd44a838f9e353d6758656b3524deca929792a0d358f20c817ece929f3273e67dc5ddc5476773ed180374afec6eb2d9fe496747e71bf2ad150d90faf065d860d2310be50813cf4d60b234091204336ff60cdf3dfccf59881cb876e0ef987930660324d8221e3d2fe673f9359b366f4a8cfc55c3e00d836fb16cebe1a00e202d2e00af7c4d2a4c31cd20833ebbed9e6d83b3b97fcf9a9ea54ed9b981c17d05b3702ae50966ce0ceee997be95264b60e611cad18da3bb476bea3a166380aecbbb2e0430d6b1bc03f99c5baa1d6bd220942dcf2ad224d3cb8d8f8f8ffbe5512f9a79f3cce13b877f9d85d081eb0656b3e4cf307367cc308c2c4b79cadf0fc247b66cde32e74adb81eb07d67399bfa2de0f40d80b12619bc87bf8d3e6227360f8eee1aaae6714831b074fd8fbd8de5b9879b0d05a686a6f6f779b53e87eaf64709931363e86d2be1240f8e8d8e3635fc87aafd876a4b6b3dade0e81abdb0a6d9090414b36a34961821965bfbb6a45ccb89311f4f7f389f45aa7898502f8b5db20490871124e8078f2a927ff6f16421f7bfcb1e7c7f68e7df16d6f7ddbb368c2020171064b36823e820bc9c2428c2cc92d19bae5d65b3e35fafdd1a9ac93907adf471ffbd195dd57fe0012ab59728e9a0812eeeff35bd7f90f5d1e916e7fc085d8d1726acb7b6fbff3f66fd77abfdeab7bcf1f7f66fcc145272d7a5fc7f28e1396bf69b93b6f1228731972c66d3a2966dc967312124484a5e72c85385160f285c99ec259057bf285c91f64b95f4c0374aee8fcef66ce1c6a5fdaae35ec000492aea63843d92eb5d841d1082699281d2a61dffe7d4191a49937970cdf397ca8d6891afac4d0c9903887259f4a443680894d7fb3a96e5db9076f186c71d8b99199d7015812ad0206709888ee87c0edc3770c3f349b7bf45eddbbb63459bab7d05a40c7f20e9864ba41b68c304d13e3cf8d636c740c94a3d5a37b46ab0a976e09b803021feaece84c0d14eb7af700488dd9fbcbc0c444a504de5c647e76f8eee159ad918dc0d0c6a1bcc5d62590b800122741c001f0148027b6deb675d64b4eefd5bdd7960e956e6f2fb4a3e3dc8e20f0566bbacecc99187d621413e31307cd16f3cce2aee274daf9710658d1752f086bdbdbdbe1b76e4bb2ee03443582622b84cef7ce2b4d962a75fbcd38dc6ab69eb1f58eadc76c4ffd7aa36f6ddfda89d2c4bd8596023a3a3a40822afd1234364e62ee03e4baa11278a8f81058f227c61e1ffbdbb47bc7e300020bc015bf3b693f7e0852df01c3dfee15db232742d73f8965e3fae4351a7debfa2e2859a57bf3b93cdadbdbb33f7c50cc0b0300b0eb2eb7b7b783cbbcb17b6577aa0ed10582a6191cae7f8fec8ed5edc7d7f5c0d175d38a65cfc060e60d739bc65727fad7f79f6c5bf6772081d6422bcc5c65cdd74558b53b8f3832c28dda9aa60933672e66c93d6934c4188004bda2eead0b41e5b80827eac2a13a8d108a174cc3fffea503d70db4d5367daf7ed853f6d720717a3e9747a1a5107b3946749f81aee055cd5904cb000379d36d92098977a5d110630006ff8204c1b2dd8e1db15dae69a38c7366b4278ec556e57c4f0378e787f7e4ff8ea3776deffb59f23b1c3830979895201287356aecd817ca94e7e2ffdbc819b0d94eed3fa8d30013fe0dec29db4d064945d2552455c624246e20dd0aa280b3a72b3606805975f27c35a26f7d5f33a6711ba4dbc9349fcbc7fa0fe8fa0a4653f0d540824082cee95ed95d483a476703fcd8cf5e59b6155ef3912ce9d5b2833ed1165bc1b9a12a5fe68bb2fdacdf0148fc054b5e0ce915998af43e8289a34c18119aff13012496c1c518c0dba57a90849bc0e1290e67dd7492ae409b355452a604021cb8bb74a72bde00807306ae1b38aba6897c15a27f437f8ea7f8937e202c28af1361c3593b56eb48aada5abe97e53eb7d392e88931c0c8ce9132041e03dc87e3251ad225bc068d1044b6943a7feff30548e1d4df1530f34700184a85900ba56a38714c927819f7be7c5bc05b9e13fb2168eb0108e4e6ec3de24a074b6149977a49d756e3fae7bb6ade6ddb22bc7cb962037856ecefbc0660873fe6ff5e7f9f43b44bfaaca1681248c029075e5762f5b7be2288107a9b15971993a5c990ab97e60df8be685403f8c5a400c2bb7911b83069ad5b5ef5e85fdfbf8a259f150baa4535a5cc3842337a9d512db6d4865bac21074002031477167f4a82dc65c0937cab6cc13e68eb1344513f34aa193cc26cc7ae1475789b29426b95e4936a98cf571d58f235414a59b189aa45fc1247a919bde7e30b9b779c98514a0e130afc4f485ca2c69a2ddb82231d14f285f0da2510043142912bffc79611ebd913dbebe7fe88babcc872f32d9bcf60e66e4874b2e437c3cde69d406e9f806748d0130c2e6eba7953ddba74f4adeb6b62c97f108ae8a93583febc413346cf8b8cc1bcfb3590228ff1836ef5150b06817e994457220318c2b89bc1b742e014f561729951e2921b69f25c18c0ad9953cf0b8a152483a7146fc1e77c65e78f52ce35afcd126ffef4cd6b9979fde4e4e4db01c49a447b93fe567ff206370e7edf24f36e087ce5c64fdd38afaf7223a20bd9e2d744133800aaaffd51ff5fd1b8b14d2ae406f1fc4c22093a0881e7932e9d58153cb273649a88b644833d7e8ca074a884d2c152653fbcd7d0c9663be8d5c35395871fe2642836c074487dbd98713e5371f3a76ffea3c18d837b6ddbbed72a5bef04b0309395cdb8a274a8749b7dc8fef1d0c6a1ebe783161fcc7c051089e92b91bf4c9156650c3aaa4673019231694dc22e071af9d9e2ae622233a7668a0c616c81c09fb3e49355c906104408c1950d8f6a674e1fa1d83fc275f3b18d9fe039354a18ba71e82d606cb60fd997558ba869b39795e29636879dcf0f5c3ff0a17c2eff679bfe6653712e7479b8305643e907c480e4355db3c647c7502e86dd743b515084f3581a51a93b8346768efc0a027fa95da3148343cdfa85d45974678c028d06f83581665533bff996cd0b06370edeca363f6cb1751910916c1119a14f54a9dff342b3e75b87ac87066f189cd35bc70080259f13ad2206e076208d58f5d1c86be8d88fccea34870026f64f84990a9cb81b1ac8b037b0b8abf80f00fe2d905c84253adaf12258e395f3d5e3944e1f4f6fbd63ebc16af44471f38d375f3e7960f22930fe2ccb3b7baabed3270a015865eb9383d70f3e3eb871b0a356fa7c10a82de41df9f3e12d9b7e44302ad9558f5129b79bdc3fe9bed052047f3f428252cbc232358820a2b5ba840f80a0e74d4cf295f3439f47ad7faf7e1e0235d7d10d7d62e8a3a543a55107ceb9b1fa03cd2be6027a915caf1040c9b6110856d9bad8b19dc707ae1fa8edbd4300fa37f49fc4d36c02610deadf576d3455b55bba662441d857da87d2a4db894c61b2ef147715531b50646280e2cee2783e97ff13dde68f682d608853115fa3621140ff58d057b3d0e26368e3d056cbb6fe3ef11d3dea9aaea95d4c2c6df711cd72fa710ac63707ae1fa869a7118045004e546d2855833aec043d104359d40c91411284c9d224ac49ab925b007c83fdae6adfafc9efee5ed57d1b337f24fa708d5c7812759b45428923bfc7ce345c6659447bb7ddb3ede22c340c7d62a899cbfc2d473ad5eb077ccda30b4f27206460f91a0cf1ef13d1a6adb76dfdab2cd7ec5fdf5f98b4269ff3cadfb49b4bbc8e21fe9b4411d3b851e1f3682a1d2c05f99508ddbf24a2c2e8eed1d4069435f5082aee2a5e4744f74763fffe4b1a0322107ef8fedf01546c00e5fb44f4e759ee3ff489a1455ce6ef3b5cfde16bad7f20ddef49a9788a4640997968e0da812d59e866309320a91506855eab6c056e75503ba919fdd8cac4fe0970d9a531aa794d323f57ede103b3681255dc557c1709fa66742db3d88a45b474d6bfdf4bc7765c6305cdf8c6f09dc355ebd7076f186cb56ceb87165b2bd4fb260553a25e49cc4b49a9a851253f35e7c1fc5ffaafedff5c35da21f13224caba9a3e955e7f39f0c3ee3cc595cea8debf4b074b28954a989874adfd587cc5a5ff5710a84e17343b83b260dfbe7d5f3bff8de7b796657945c0c933809c9158b4701124a4cb91337077ca00aee47bfcc8473cc96ac27ef364f3cab11f8da52ae8a18d438ba70e4f8db2e437e84aa2437e70563401901e7ddec83361c997d2fd1d72a6429e68f2ce87008321a4b8acf3b2cedf8eed1d4b74b79e7ceac9df762ceb58c733fc1a7f4751f4bacd4dcdee8eab2603d2fb8f99218fb8231f61940f972159baf3da248026851e857e10861e79f89154f74f9d86596164e7c87579caff09245e062a592aab6ce9235c5eaf7da57a75c25c645e317cf7706af877f086c1bc655b8f32f339fef5a2c111f5fea1114767e4327fba7f437fb5ddbf3f09bea7e92b107ba96484a975cb06005d59decf46778ffe5d155a02cca94fe0c8ce912f1b39e35c087c4925ce7f31b2c50a3328356f24e881d67ceb8ae1bb870fa45d7ff086c166879d224b3e4757fd9ab85942315013fd68cdf743750ed5ea1f22358fccfc85fe0dfd896f26a5667a2c1acb57bfafed28aad82e315bca875a3d0cc0cc997f9c36a751cc5bf6ad674dcf7900d63bd2e901705e106ef5395ae01512f45d18f8e2f6af6f7f30cb3507ae1df8aecdf6ef27fde8d0881a53ab912c5a929710f30a92cef78f05966dbb675b2cabd8b7b6ef5c7bca1ed7d28fca71a893a87a5d859e10e3a9cc4cf4d9d1dda3356db3ab4bfab5f7aadee51058c292cf2641bf05f0736aa6a7b77d7d5ba9ea973d0c5c37703797f99ac4b55ddd781a8d91d7f0f0539920ae5ef586ad7f9ec3a0663a40269d337cc770ac1f71cf553d4f40e202409313885e0fe160964a5f2ce7e2deffb1d13da397a6cfaa7e1ae71ddb1fd89eb91f8f0e03d70e7cca2edbd7e81e565472a2b1f09a46f5fb1cbebed6d6d06c8bd3c4f6cf32613e08e03f447f1719b4992dfeaa8e0e6d2f6120fef02311406ffc390456cf66ae1bf2bad2340c5c37d06b1fb66f9b95b5eff527f035839432fd5863dd6b251eecf603f0bfef7bd711eb5bce48882681f291f2eb2fb9e092a6279f7e72974adef8d3e34f2e5db6f41ae788b3b8b9a9d9b5c09adceb3537b90192c01b80eb0d184d86db9f4118eef56744701feffe2f12d1ef3df2f023bf98cd7c1f13cda27d0c5c3770b66ddbdf00aa58fb9a31aa1e636ff88ce6cdabbd9318fafb6a2551c969f8c7f6947d53dfbabed8ae1c12b43e50eb12611b0009594a258b19ead328f01c115d52dc559cf52be78e2906b0cbf683b15c42ca1a1eb2a623d6704c53447215a1f3658201a96a1e151afa8078eec09eb2bfd9b7ae2fd45c7efb7ddbf78070532885aed0a7be3f517dbf0000b5c60f44b493882e9dcbc3078ea125a06f7ddf3024dee6ab65bffd8a94f1919a28683b131a85004b86684a186784fe7b703f8fddcfa703085f074ad0689a810595e0164b77b960c9c00c722cf98dcf3ef3ec3fa9bff5d9679e7d78e91b970a7944febe9412cd68ae88a2ef0dcc84dfa3a868b4dfd042bab1b8bbf8e17dfbf6c52b706ac431c100fd1bfaff501e91f1a28be89a8e48efa1e8381371d9a2c769de419312f993719f50177163306801414ebb6bb37f1d5f73c81909cce0bce5e72d7f62fcc7e3a16297679f7bb6b8ecbc65cfc819f916c9f2e4e6a66638479c900de0480738e232974b04eea51cfd51715771fb7ccd7d5ddcc05ad0bfa1bf85cbfc02839bab1a7c3aff3fa2ce55972e748c4ad955e2753488c501fceca0ff56312fa399e44a7ad6fdcb4454d87edff658d4b3e7aa9ec590f8a0c34e0f2456b264a1d0e500788204fd0b80af15771593df76324b349c01fad6f5fd0ba4ebc2e8ea071291160788c603923e4ff2c33d446d00b58845fb5e80e8f594e04e9ef25fdafec0f66bd37e52cf9a9eb3009ce64867b1218c92231dbbb8b33899712a6785863240fffafe3fb6a7ec2f27bee72fea97eb62e169986d1d40c2b20120c866aadfd3dd4367cde773f9ceed0f6c7fa2b61f515f34cc0be85fdf7f9a3d657f29a80ecef2f0333ecc00359c9f2957a0bc4cd2ef069e745f5dc32c66beb3c65f5077348c016cb6ff178066b53a184048adfa634d71808cc7a151eafdfa907f3f1dd600ecb0ab15347ebc3f466b0e1de95cd8b3a6e7fdb399af7aa1214b40dfbabe6e76f82100b1172fc5f60b64d50c550c44ddf989de81b2c6ab6b7d080ad3a87f8b2674a2b17c4318ff0ee0b5233b471af2aee0281aa201d8e12f0612e744242baa09a29258a366483b3ffad083fba668243f7ae7f73aca22f9a1f3d83913027f3aab89ab038e3a03f4adebbb16c0d26ad67e502dacbe3d6cbac6946fb5713a2cf1ed2a95070000066d4944415421d74e4524c2c89211ab46ceb2cfc03f9f9d4fcddf8cce0d473d10d4d2d23262909153d570908869aa1c872282d1710120a7e761d45c5f4df404f408259278c45df79d1907cd680e45ec5475ef07934211c4ca7572ed6f6c7f7edff3fb7e7434e63c0d47550374afeefe4f9038c3b2adf4d87c0aa292aa6a0a758c7eae3d4e4252ae4059f375fb0d74929fe45d40e2bfd53a7ff5c051d300ddabbb9bc17890c1869c919047240c3242b1f5605462f831cd704406295420414320fe79f4988fe8af1f92d468ae2022f940c6dc8177bdd0f27384cda5e72e1ddbf7fcbe86be43e8a8690003c6008317fb3b632001cbb610ec9449cac2452471be4a5852b382ba94b0444ce27d7f3f1835d74f8c2b0802181be7e7d7cc1e478d01acb2f57140b1cae1560997ec1258b236151b3a3f5241536b5c20f388f068b1db15256917b1ae1772744caa6b60c92bbb5775b7cf6e46e707478501ba5775bf070267a96bbc2af94129b95f01945607806cbb66a37e7fb4b033cd3b00e04a3c2b7b09a36bbc4e13a5d51744e9aba0a18db28f8e0690f8589a4412dcb6264ed9a9ec7fd71559e8fe5ecdcfcf2089b1f3b97ae7cea4fdf9c11865e6240dc6dcd0c860dd2381ddabba5fcfcc3f0dfea0cbe245d77ee1f6d09d377f5fa74974f7571a5cfb059a4a042fbe853c0569e707cce6b57423419dc5ddc5862489eaae0158f27f04108b99eb2422d8f8e8d9060e3ba1b5b9d6c85fe218adca6577479317af07a08de085ae93f27bf5e72bbf5b29ebf2bff68ed48bd611f55f0224de9b69cd5477f4c05b43cb0ca7ecc0293b41ec3db44346ce7e04dc87e4b0535db215faabc629223589a1e3a837233c2610b8329d80faa1ae4b40f7aaee73ecb2fd9c2e91a345868a1f00f0edb4a4f716ea108dd1a7198ceab1ca742a6afd7e95f115838cd347768c647a87e27ca22e1b437cb0e4d559ebfa132b7aa2a3b776120816acf8c349d9e1a3aee9a97186a8c648a057bd5feaf7ab8fa700380fc00f6b9ee439a2be4b80c415695677ad63e83a8a4dc092830da8c128e379fe4c3b8412e20ea971855a77246946473a0de9945e6f1be0bca47c7e3509d34952c80688f8eda9f183481c21533c206a33cc4eb2338f8630ceacf3b3d0a26e0cd0b5b22b0789f64c113ec4254d2b7109129beaffd7e01ac6be5feb1ec36a9a255d032c99f787900175630012b484c1f95409833e829788044954bfaff526b230414423a55e3fe97e3a4d95c56b016008a321d559756300967c4acd1287e435374096b538e9f32aa3ff30637f9f65c431913e8da670a4f352cd933c0fa8a706f86d4d11ba882465ad0f08618e6bf6ac228baa26d3792d691a00210db06fde26bf06d453031c22d4c00419bd85986688b87c99acf684314ba2288b268bfd9e14c957e87f642ef33d5bd44f03802601ec9b75cc3ecd465035c33cd60754cd46ce92fe34c9f72282f78fec1899d5fefeb9a26e0c50dc5d9c81c077e692b001aaaca9296392a648d310356513b3d09f4df2670c61ccebbb096a415de3002468cbbc67f312344335bf3df5387a3d40bb8667d210b5483e00838c778fec1899d37b12e682bad604eefbf9be97da5edbf6b298116be68d096622fbf393f6fb571f7f2a841803f01312f40abbbb724f0efa0f480ef723881ea7d12722b585225ee308000619ef1bd931f2ad7a3e836a382abe67d7caae8f83b1795e35418a046a6c0607024f03f82e113d06602f249e2fee2e068ab8674dcfa98e749602b89299df4ea02b55d7306b1c419bc88a63ca93fcf97813c99c70d4820f5d2bbbde0dc66d0c2ed49d0940003006814721b09304ed29ee2a1ea885deee55dd6f06f07e967c0d80d767721553b27e4a0af8070619eb471e187976fe67b9761cd5e853d7ca2e9340ffd57b7dea89f32cf9cf00d84d82f600f86e7177f199f9a0b967758f70e0f442623d4bbe6a0e92ff1b43187f3bb273e4afe683aef94243c28fdd2bbb5fc792fb00bc9b255f368b877d10c01880e720f03d02fd6b7177f1dfea4d77cfea9e658e74d60278174bbe2893e403af1864fc6f009f1dd931f25cbd69ac150def10d2bdaafbf52cf90202bd8925b742a0151227c3ddbf3305815f41e220093ac8e09f92a0e701bc50dc559c6a24dd3d6b7ace83c42a001738d2b908c0a9001641600a122f1bc2d80b815108dc3ff2c048cdef423a5a683803a8e85ed97d1a839790a09358f234817ec5e0c324e8c5e2ae6274cbe63101afadcb72473a7903c66207ce4b86302c004f8dec18d9df68fa8ee3388ee3388ee3388ee33874f87fa1ff8da830a4956c0000000049454e44ae426082</data> + </image> +</images> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/config/colordialog.cpp b/config/colordialog.cpp new file mode 100644 index 0000000..3466082 --- /dev/null +++ b/config/colordialog.cpp @@ -0,0 +1,300 @@ +#include "colordialog.h" +#include <qlabel.h> +#include <qdir.h> +#include <qcombobox.h> +#include <qlayout.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qpushbutton.h> +#include <qstyle.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kcolordialog.h> +#include <kiconloader.h> +#include "colorpicker.h" +#include "pixmaps.h" + +#include "config.h" + +#ifndef CLAMP +#define CLAMP(x,l,u) x < l ? l :\ +x > u ? u :\ +x +#endif + +#define SATURATION_COLOR2(S,R,G,B) \ +int max = (int)(255+0.65*(100-S)); \ +destR = CLAMP((srcR + R - 128), 0, max); \ +destG = CLAMP((srcG + G - 128), 0, max); \ +destB = CLAMP((srcB + B - 128), 0, max); \ +destR = (S*destR + (100-S)*R)/100; \ +destG = (S*destG + (100-S)*G)/100; \ +destB = (S*destB + (100-S)*B)/100; + +#define COLOR_SPACE(R,G,B) \ +if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \ +if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \ +if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255; + +ColorDialog::ColorDialog(QWidget* parent, const char* name) : QDialog( parent, name) +{ + QVBoxLayout *vertical = new QVBoxLayout(this); + QHBoxLayout *top = new QHBoxLayout(vertical); + demo = new DemoWindow(this); + top->addWidget(demo); + QVBoxLayout *topRight = new QVBoxLayout(top); + QLabel *info = new QLabel("<qt>Select custom colors or grab directly from screen.<br>Click image left to switch between items.</qt>",this); + topRight->addWidget(info); + QIconSet icon = KGlobal::iconLoader()->loadIconSet("colorpicker", KIcon::Small); + buttonCP = new QPushButton(icon, QString::null, this); + topRight->addWidget(buttonCP); + QLabel *lb = new QLabel("From other app:",this); + topRight->addWidget(lb); + other = new QComboBox(this); + topRight->addWidget(other); + topRight->addStretch(); + buttonOk = new QPushButton("&Ok", this); + topRight->addWidget(buttonOk); + buttonCancel = new QPushButton("&Cancel", this); + topRight->addWidget(buttonCancel); + const char *title[NUMCOLORS] = {"Background", "Button", "Base", "Text", "Highlight", "Highlighted Text", "Button Text", "Alternate Background"}; + for (int i = 0; i < NUMCOLORS; i++) + { + picker[i] = new ColorPicker(this, title[i]); + vertical->addWidget(picker[i]); + connect (picker[i], SIGNAL(colorChanged(QColor)), demo, SLOT(smartRepaint())); + picker[i]->hide(); + } + for (int i = 0; i < NUMCOLORS; i++) + picker[i]->blockSignals(true); + picker[Back]->setColor(colorGroup().background()); + picker[Button]->setColor(colorGroup().button()); + picker[Base]->setColor(colorGroup().base()); + picker[Text]->setColor(colorGroup().text()); + picker[High]->setColor(colorGroup().highlight()); + picker[HighText]->setColor(colorGroup().highlightedText()); + picker[ButText]->setColor(colorGroup().buttonText ()); + picker[Alternate]->setColor(KGlobalSettings::alternateBackgroundColor()); + for (int i = 0; i < NUMCOLORS; i++) + picker[i]->blockSignals(false); +// demo->repaint(false); + + picker[Button]->show(); + connect (buttonOk, SIGNAL(clicked()), this, SLOT(close())); + connect (buttonCP, SIGNAL(clicked()), this, SLOT(grabColor())); + connect (buttonCancel, SIGNAL(clicked()), this, SLOT(close())); + connect (other, SIGNAL(activated (const QString &)), this, SLOT(getFromOther(const QString &))); +} + +ColorDialog::~ColorDialog() +{ +} + +void ColorDialog::show() +{ + other->clear(); + QDir d( QDir::homeDirPath() + "/.baghira", 0L, QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable | QDir::Writable ); + if (d.exists()) + { + for ( uint i = 0; i < d.count(); i++ ) + other->insertItem(d[i]); + } + QDialog::show(); + demo->show(); +// demo->repaint(false); +} + +void ColorDialog::getFromOther( const QString & string ) +{ + FILE *file = NULL; + QString tmpString = QDir::homeDirPath() + "/.baghira/" + string; + if( (file = fopen(tmpString.latin1(), "r")) != NULL ) + { + uint k; + int colors[NUMCOLORS]; + for (int i = 0; i < NUMCOLORS; i++) + colors[i] = -1; + fscanf(file,"%u\n%u\n%u\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",&k,&k,&k,&k,&k,&k,&colors[0],&colors[1],&colors[2],&colors[3],&colors[4],&colors[5],&colors[6],&colors[7]); + fclose(file); + for (int i = 0; i < NUMCOLORS; i++) + { + picker[i]->blockSignals(true); + if (colors[i] != -1) picker[i]->setColor(QColor(colors[i])); + picker[i]->blockSignals(false); + } + demo->repaint(false); + } +} + +void ColorDialog::grabColor() +{ + gettingColorFromScreen = true; + grabMouse(crossCursor); + grabKeyboard(); +} + +void ColorDialog::mouseReleaseEvent(QMouseEvent* me) +{ + if (gettingColorFromScreen) + { + gettingColorFromScreen = false; + releaseMouse(); + releaseKeyboard(); + for (int i = 0; i < NUMCOLORS; i++) + { + if (picker[i]->isShown()) + { + picker[i]->setColor(KColorDialog::grabColor(me->globalPos())); + break; + } + } + } + else + QDialog::mouseReleaseEvent(me); +} + +//extern QImage uic_findiImage(const QString& name); +//extern void qInitImages_baghira(); +//extern void qCleanupImages_baghira(); + + +DemoWindow::DemoWindow( ColorDialog* parent, const char* name) : QWidget(parent, name) +{ + setBackgroundMode ( Qt::NoBackground ); + colorDialog_ = parent; + setFixedSize(320,120); + pm = new QPixmap(320,120); + pp = new QPainter(); + p = new QPainter(); + (const_cast<QFont*>(&p->font()))->setPixelSize(16); + baseRect = QRect(20, 10, 200, 100); + buttonRect = QRect(230, 90, 37, 21); + buttonTextRect = QRect(236, 91, 20, 18); + highlightRect = QRect(21, 42, 198, 22); + textRect = QRect(25, 21, 100, 18); + highTextRect = QRect(25, 42, 120, 22); + alternateRect = QRect(21, 86, 198, 22); + baseImage = uic_findImage("button-base"); + dest = QImage( baseImage.width(), baseImage.height(), 32 ); + dest.setAlphaBuffer( true ); +} + +DemoWindow::~DemoWindow(){} + +void DemoWindow::mousePressEvent ( QMouseEvent * me ) +{ + for (int i = 0; i < NUMCOLORS; i++) + colorDialog_->picker[i]->hide(); + + if (buttonTextRect.contains(me->pos())) + colorDialog_->picker[ButText]->show(); + else if (buttonRect.contains(me->pos())) + colorDialog_->picker[Button]->show(); + else if (textRect.contains(me->pos())) + colorDialog_->picker[Text]->show(); + else if (highTextRect.contains(me->pos())) + colorDialog_->picker[HighText]->show(); + else if (highlightRect.contains(me->pos())) + colorDialog_->picker[High]->show(); + else if (alternateRect.contains(me->pos())) + colorDialog_->picker[Alternate]->show(); + else if (baseRect.contains(me->pos())) + colorDialog_->picker[Base]->show(); + else + colorDialog_->picker[Back]->show(); +} + +void DemoWindow::paintEvent ( QPaintEvent * ) +{ + pp->begin(pm); + pp->fillRect(0,0,pm->width(),pm->height(), colorDialog_->picker[Back]->color()); + style().drawPrimitive( QStyle::PE_PanelLineEdit, pp, rect(), colorGroup() ); + pp->fillRect(baseRect, colorDialog_->picker[Base]->color()); + pp->fillRect(highlightRect, colorDialog_->picker[High]->color()); + pp->fillRect(alternateRect, colorDialog_->picker[Alternate]->color()); + pp->setPen ( colorDialog_->picker[Text]->color() ); + pp->drawText ( textRect, Qt::AlignAuto | Qt::AlignVCenter, "Common Text"); + pp->drawText ( alternateRect, Qt::AlignAuto | Qt::AlignVCenter, "Alt. Background"); + pp->setPen ( colorDialog_->picker[HighText]->color() ); + pp->drawText ( highTextRect, Qt::AlignAuto | Qt::AlignVCenter, "Highlighted Text"); + pp->drawPixmap(buttonRect, tintButton(baseImage, colorDialog_->picker[Button]->color())); + pp->setPen ( colorDialog_->picker[ButText]->color() ); + pp->drawText ( buttonTextRect, Qt::AlignCenter, "B"); + style().drawPrimitive( QStyle::PE_PanelLineEdit, pp, baseRect, colorGroup()); + pp->end(); + p->begin(this); + p->drawPixmap(0,0, *pm); + p->end(); +} + +void DemoWindow::smartRepaint() +{ + if (colorDialog_->picker[Back]->isShown()) + { + QWidget::repaint(false); + return; + } + if (colorDialog_->picker[Button]->isShown()) + { + QWidget::repaint(buttonRect, false); + return; + } + if (colorDialog_->picker[Base]->isShown()) + { + QWidget::repaint(false); + return; + } + if (colorDialog_->picker[Text]->isShown()) + { + QWidget::repaint(textRect, false); + return; + } + if (colorDialog_->picker[High]->isShown()) + { + QWidget::repaint(highlightRect, false); + return; + } + if (colorDialog_->picker[HighText]->isShown()) + { + QWidget::repaint(highTextRect, false); + return; + } + if (colorDialog_->picker[Alternate]->isShown()) + { + QWidget::repaint(alternateRect, false); + return; + } + if (colorDialog_->picker[ButText]->isShown()) + { + QWidget::repaint(buttonTextRect, false); + return; + } +} + +QImage & DemoWindow::tintButton(QImage &src, QColor & c) +{ +// dest = QImage( src.width(), src.height(), 32, 0, _ENDIAN_ ); + unsigned int *data = ( unsigned int * ) src.bits(); + unsigned int *destData = ( unsigned int* ) dest.bits(); + int total = src.width() * src.height(); + int red, green, blue; + int destR, destG, destB, alpha; + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + int hue, s, v; + c.getHsv( &hue, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + // float srcPercent, destPercent; + for ( int current = 0 ; current < total ; ++current ) { + alpha = qAlpha( data[ current ] ); + blue = qBlue( data[ current ] ); + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + SATURATION_COLOR2(sq, red, green, blue); + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} diff --git a/config/colordialog.h b/config/colordialog.h new file mode 100644 index 0000000..23c4808 --- /dev/null +++ b/config/colordialog.h @@ -0,0 +1,90 @@ +#ifndef COLORDIALOG_H +#define COLORDIALOG_H + +#include <qdialog.h> +#include <qrect.h> +#include <qimage.h> + +class QPushButton; +class QComboBox; +class QGroupBox; +class QPainter; +class ColorDialog; +class QImage; +class QPixmap; + +enum Colors { Back = 0, Button, Base, Text, High, HighText, ButText, Alternate, NUMCOLORS }; + +class DemoWindow : public QWidget +{ + Q_OBJECT + +public: + DemoWindow( ColorDialog* parent = 0, const char* name = 0); + ~DemoWindow(); + +private slots: + void smartRepaint(); + +protected: + void mousePressEvent ( QMouseEvent * e ); + void paintEvent ( QPaintEvent * ); + +private: + QPainter *p; + QPainter *pp; + QPixmap *pm; + ColorDialog* colorDialog_; + QRect baseRect; + QRect buttonRect; + QRect buttonTextRect; + QRect highlightRect; + QRect textRect; + QRect highTextRect; + QRect alternateRect; + QImage baseImage; + QImage dest; + +private: + QImage & tintButton(QImage &src, QColor & c); + +signals: + void selected(Colors c); + +}; + +class ColorPicker; + +class ColorDialog : public QDialog +{ + friend class DemoWindow; + friend class AppSetter; + Q_OBJECT + +public: + ColorDialog( QWidget* parent = 0, const char* name = 0); + ~ColorDialog(); + QPushButton *buttonOk; + QPushButton *buttonCancel; + void show(); + +protected: + ColorPicker *picker[NUMCOLORS]; + void mouseReleaseEvent(QMouseEvent* me); + DemoWindow *demo; + +private: + QPushButton *buttonCP; + bool gettingColorFromScreen; + QComboBox *other; + +private slots: + void grabColor(); + void getFromOther( const QString & string ); + +signals: + void colorChanged(QColor color); + +}; + +#endif // COLORPICKER_H diff --git a/config/colorpicker.cpp b/config/colorpicker.cpp new file mode 100644 index 0000000..263ef0d --- /dev/null +++ b/config/colorpicker.cpp @@ -0,0 +1,81 @@ +#include "colorpicker.h" +#include <qcolor.h> +#include <qlayout.h> +#include <knuminput.h> + +ColorPicker::ColorPicker(QWidget* parent, const char* name) : QGroupBox( parent, name) +{ + setTitle(name); + setColumnLayout(0, Qt::Vertical ); + layout()->setSpacing( 6 ); + layout()->setMargin( 11 ); + + QVBoxLayout *vLayout = new QVBoxLayout(layout()); + + red = new KIntNumInput(this, "red"); + red->setRange(0, 255, 1, true); + red->setLabel("R"); + vLayout->addWidget(red); + green = new KIntNumInput(this, "green"); + green->setRange(0, 255, 1, true); + green->setLabel("G"); + vLayout->addWidget(green); + blue = new KIntNumInput(this, "blue"); + blue->setRange(0, 255, 1, true); + blue->setLabel("B"); + vLayout->addWidget(blue); + connect (red, SIGNAL(valueChanged( int )), this, SLOT(emitChange())); + connect (green, SIGNAL(valueChanged( int )), this, SLOT(emitChange())); + connect (blue, SIGNAL(valueChanged( int )), this, SLOT(emitChange())); +} + +ColorPicker::~ColorPicker() +{ +} + +void ColorPicker::emitChange() +{ + emit colorChanged(QColor(red->value(), green->value(), blue->value())); +} + +void ColorPicker::setColor(const QColor & color) +{ + red->setValue( color.red() ); + green->setValue( color.green() ); + blue->setValue( color.blue() ); + emit colorChanged(color); +} + +void ColorPicker::setRed(int r) +{ + red->setValue( r ); + emit colorChanged(QColor(r, green->value(), blue->value())); +} + +void ColorPicker::setGreen(int g) +{ + green->setValue( g ); + emit colorChanged(QColor(red->value(), g, blue->value())); +} + +void ColorPicker::setBlue(int b) +{ + blue->setValue( b ); + emit colorChanged(QColor(red->value(), green->value(), b)); +} + +QColor & ColorPicker::color() +{ + color__ = QColor(red->value(), green->value(), blue->value()); + return color__; +} + +void ColorPicker::reset() +{ + setColor(color_); +} + +void ColorPicker::init() +{ + color_ = color(); +} diff --git a/config/colorpicker.h b/config/colorpicker.h new file mode 100644 index 0000000..6f813b2 --- /dev/null +++ b/config/colorpicker.h @@ -0,0 +1,39 @@ +#ifndef COLORPICKER_H +#define COLORPICKER_H + +#include <qgroupbox.h> + +class KIntNumInput; +class QColor; + +class ColorPicker : public QGroupBox +{ + Q_OBJECT + +public: + ColorPicker( QWidget* parent = 0, const char* name = 0); + ~ColorPicker(); + QColor & color(); + +public slots: + void setColor(const QColor & color); + void setRed(int red); + void emitChange(); + void setGreen(int green); + void setBlue(int blue); + void reset(); + void init(); + +protected: + KIntNumInput *red; + KIntNumInput *green; + KIntNumInput *blue; + QColor color_; + QColor color__; + +signals: + void colorChanged(QColor color); + +}; + +#endif // COLORPICKER_H diff --git a/config/configdialog.ui b/config/configdialog.ui new file mode 100644 index 0000000..870e4cf --- /dev/null +++ b/config/configdialog.ui @@ -0,0 +1,3039 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Config</class> +<widget class="QWidget"> + <property name="name"> + <cstring>Config</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>643</width> + <height>646</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="caption"> + <string>Configure Your Cat</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout55</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonAbout</cstring> + </property> + <property name="text"> + <string>About</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer37_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>210</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>statusWarning</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer35_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>160</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonLoad</cstring> + </property> + <property name="text"> + <string>Load...</string> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonSaveAs</cstring> + </property> + <property name="text"> + <string>Save As...</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>Widget8</cstring> + </property> + <attribute name="title"> + <string>General Design</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="4" column="2"> + <property name="name"> + <cstring>spacer35_5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>38</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>groupBox13</cstring> + </property> + <property name="title"> + <string>Groupboxes</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout22</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shadowGroups</cstring> + </property> + <property name="text"> + <string>Sink Groupboxes</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Depth</string> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>shadowIntensity</cstring> + </property> + <property name="maxValue"> + <number>10</number> + </property> + <property name="lineStep"> + <number>1</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>Below</enum> + </property> + <property name="tickInterval"> + <number>10</number> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="text"> + <string>Flat</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>81</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="text"> + <string>Deep</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </vbox> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="3"> + <property name="name"> + <cstring>groupBox12</cstring> + </property> + <property name="title"> + <string>Coloring</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel12</cstring> + </property> + <property name="text"> + <string>Color function</string> + </property> + </widget> + <widget class="QComboBox" row="1" column="0"> + <item> + <property name="text"> + <string>Aquarius</string> + </property> + </item> + <item> + <property name="text"> + <string>Liquid (depreached)</string> + </property> + </item> + <property name="name"> + <cstring>colorMode</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>"Aquarius" is very Aqua like<br>"Liquid" bases upon mosfet's original Code</string> + </property> + </widget> + <widget class="QLayoutWidget" row="4" column="0"> + <property name="name"> + <cstring>layout123</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Fixed</string> + </property> + </item> + <item> + <property name="text"> + <string>Background</string> + </property> + </item> + <item> + <property name="text"> + <string>Active Button</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom</string> + </property> + </item> + <property name="name"> + <cstring>inactiveColorType</cstring> + </property> + <property name="toolTip" stdset="0"> + <string>"Background" is ok, as long as you don't use a very dark color scheme. In this case use "Fixed" or "Custom" to get more control over the appereance</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>customInactiveColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel13</cstring> + </property> + <property name="text"> + <string>Unhovered / Inactive Widget Color</string> + </property> + </widget> + <widget class="Line" row="2" column="0"> + <property name="name"> + <cstring>line14_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="3"> + <property name="name"> + <cstring>groupBox11</cstring> + </property> + <property name="title"> + <string>Scanlines</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>stippleBackground</cstring> + </property> + <property name="text"> + <string>Use Scanlines in Aqua Design</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout4</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Scanline contrast</string> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>stippleContrast</cstring> + </property> + <property name="maxValue"> + <number>10</number> + </property> + <property name="lineStep"> + <number>1</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="tracking"> + <bool>true</bool> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>NoMarks</enum> + </property> + <property name="tickInterval"> + <number>10</number> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Low</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>221</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>High</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="Line" row="1" column="0"> + <property name="name"> + <cstring>line13</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="3" column="0" rowspan="1" colspan="4"> + <property name="name"> + <cstring>groupButtonPreview</cstring> + </property> + <property name="title"> + <string>Button Color</string> + </property> + <property name="toolTip" stdset="0"> + <string><b>This now will affect your button color, but <i>not</i> touch the color settings</b></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout59</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout58</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer38</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>10</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>pixmapButtonPreview</cstring> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer39</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>10</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout55</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_5</cstring> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_5</cstring> + </property> + <property name="text"> + <string>G</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_4</cstring> + </property> + <property name="text"> + <string>B</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout53</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSlider"> + <property name="name"> + <cstring>sliderButtonRed</cstring> + </property> + <property name="maxValue"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>sliderButtonGreen</cstring> + </property> + <property name="maxValue"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>sliderButtonBlue</cstring> + </property> + <property name="maxValue"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout56</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>valueButtonRed</cstring> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>valueButtonGreen</cstring> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>valueButtonBlue</cstring> + </property> + <property name="text"> + <string>0</string> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel1_10</cstring> + </property> + <property name="text"> + <string>Color presets</string> + </property> + </widget> + <widget class="QComboBox" row="2" column="1"> + <property name="name"> + <cstring>colorPresets</cstring> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer36_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>207</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="2" column="3"> + <property name="name"> + <cstring>spacer37_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>316</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>animateButtons</cstring> + </property> + <property name="text"> + <string>Animate Buttons</string> + </property> + </widget> + <widget class="QGroupBox" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>groupBox10</cstring> + </property> + <property name="title"> + <string>Generation</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="Line" row="0" column="1" rowspan="4" colspan="1"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>VLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="0" rowspan="4" colspan="1"> + <property name="name"> + <cstring>layout48</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Default Design is</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>iTunes</string> + </property> + </item> + <item> + <property name="text"> + <string>Tiger</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <property name="name"> + <cstring>defaultStyle</cstring> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line14</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer36_3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>49</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QLabel" row="0" column="2"> + <property name="name"> + <cstring>textLabel1_9</cstring> + </property> + <property name="text"> + <string>Buttons look like</string> + </property> + </widget> + <widget class="QLabel" row="2" column="2"> + <property name="name"> + <cstring>textLabel2_8</cstring> + </property> + <property name="text"> + <string>Toolbuttons look like</string> + </property> + </widget> + <widget class="QComboBox" row="1" column="2"> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>iTunes</string> + </property> + </item> + <item> + <property name="text"> + <string>Tiger</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle</cstring> + </property> + </widget> + <widget class="QComboBox" row="3" column="2"> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>iTunes</string> + </property> + </item> + <item> + <property name="text"> + <string>Tiger</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <property name="name"> + <cstring>toolbuttonStyle</cstring> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>Widget9</cstring> + </property> + <attribute name="title"> + <string>Special Widgets</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="2" column="1"> + <property name="name"> + <cstring>groupBox9</cstring> + </property> + <property name="title"> + <string>Tabs</string> + </property> + <property name="toolTip" stdset="0"> + <string><qt>Panther introduced so called choosers<br>Qt has only Tabs, but you can influence their appereance here a bit</qt></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="5" column="0"> + <item> + <property name="text"> + <string>Tabs</string> + </property> + </item> + <item> + <property name="text"> + <string>Clever</string> + </property> + </item> + <item> + <property name="text"> + <string>Choosers</string> + </property> + </item> + <property name="name"> + <cstring>brushedTabs</cstring> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel3_7</cstring> + </property> + <property name="text"> + <string>Brushed Tabs are</string> + </property> + </widget> + <widget class="QComboBox" row="3" column="0"> + <item> + <property name="text"> + <string>Tabs</string> + </property> + </item> + <item> + <property name="text"> + <string>Clever</string> + </property> + </item> + <item> + <property name="text"> + <string>Choosers</string> + </property> + </item> + <property name="name"> + <cstring>aquaTabs</cstring> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel2_7</cstring> + </property> + <property name="text"> + <string>Aqua tabs are</string> + </property> + </widget> + <widget class="Line" row="1" column="0"> + <property name="name"> + <cstring>line4</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>centerTabs</cstring> + </property> + <property name="text"> + <string>Center Align Tabs</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="1" rowspan="2" colspan="1"> + <property name="name"> + <cstring>groupBox2</cstring> + </property> + <property name="title"> + <string>Scrollbars</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>animateSlider</cstring> + </property> + <property name="text"> + <string>Animate Hovered Slider</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>squeezeSlider</cstring> + </property> + <property name="text"> + <string>Squeeze pressed Slider</string> + </property> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>shadowSlider</cstring> + </property> + <property name="text"> + <string>Shadow Slider</string> + </property> + </widget> + </grid> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer31_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox1</cstring> + </property> + <property name="title"> + <string>ListViews</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout68</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout67</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>drawTreeLines</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Draw Tree Lines</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer60</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout66</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel8</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Expanders look like</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer61</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout65</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>useCustomExpanderColor</cstring> + </property> + <property name="text"> + <string>Use Custom Expander Color</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer59</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="2" column="1"> + <property name="name"> + <cstring>layout71</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout70</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Lines</string> + </property> + </item> + <item> + <property name="text"> + <string>Dots</string> + </property> + </item> + <property name="name"> + <cstring>treeLineMode</cstring> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>treeLineColor</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> + </hbox> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Apple</string> + </property> + </item> + <item> + <property name="text"> + <string>M$</string> + </property> + </item> + <property name="name"> + <cstring>expanderMode</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Expanders are the little icons you can click to open a new Layer in the tree</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout69</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>150</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>customExpanderColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line5</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>useRectLVH</cstring> + </property> + <property name="text"> + <string>Use flatter Listview Header</string> + </property> + <property name="toolTip" stdset="0"> + <string>Makes Listview Headers look like the rectangular Buttons</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>bevelHighlights</cstring> + </property> + <property name="text"> + <string>Use Bevel as Highlight Color</string> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="title"> + <string>Kicker</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>roundTasks</cstring> + </property> + <property name="text"> + <string>Use Round Taskbuttons</string> + </property> + </widget> + <widget class="Line" row="4" column="0"> + <property name="name"> + <cstring>line6</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0"> + <property name="name"> + <cstring>replaceMenubar</cstring> + </property> + <property name="text"> + <string>Replace menubar extension (display app name)</string> + </property> + </widget> + <widget class="QLayoutWidget" row="6" column="0"> + <property name="name"> + <cstring>layout49</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_11</cstring> + </property> + <property name="text"> + <string>Maximum width</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>menuMaxWidth</cstring> + </property> + <property name="suffix"> + <string>px</string> + </property> + <property name="maxValue"> + <number>10000</number> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>startKRuler</cstring> + </property> + <property name="text"> + <string>Start KRuler</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer37_5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>removeKickerBevel</cstring> + </property> + <property name="text"> + <string>Remove Bevel</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout53</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox3</cstring> + </property> + <property name="title"> + <string>Progressbars</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout39</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel11</cstring> + </property> + <property name="text"> + <string>Style</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Apple</string> + </property> + </item> + <item> + <property name="text"> + <string>Liquid</string> + </property> + </item> + <item> + <property name="text"> + <string>Baghira</string> + </property> + </item> + <property name="name"> + <cstring>progressType</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout52</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>showProgressValue</cstring> + </property> + <property name="text"> + <string>Show Value</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer39_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>120</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="1"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="title"> + <string>Toolbars</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="2" column="0"> + <item> + <property name="text"> + <string>Aqua</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed Metal</string> + </property> + </item> + <item> + <property name="text"> + <string>Both</string> + </property> + </item> + <item> + <property name="text"> + <string>None</string> + </property> + </item> + <property name="name"> + <cstring>unhoveredToolButtons</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_8</cstring> + </property> + <property name="text"> + <string>Show unhovered buttons for</string> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>layout50</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_12</cstring> + </property> + <property name="text"> + <string>Highlight Color</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>toolbuttonHighColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer38_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>91</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </grid> + </widget> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Menus</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer row="0" column="0"> + <property name="name"> + <cstring>spacer36</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="0" column="0"> + <property name="name"> + <cstring>spacer37_3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>transGroup</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="title"> + <string>Look</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout64</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Background</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Default</string> + </property> + </item> + <item> + <property name="text"> + <string>Plain</string> + </property> + </item> + <item> + <property name="text"> + <string>Stipples</string> + </property> + </item> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <property name="name"> + <cstring>menuBackground</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Solid is fastest, Gradient is slowest - choose by your personal preferences and the speed of your machine</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="10" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout55</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>drawMenuStripe</cstring> + </property> + <property name="text"> + <string>Draw menu stripe</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>menuStripeColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer27_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>481</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line10</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="Line" row="8" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line7</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout61</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>Opacity</string> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>menuOpacity</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="lineStep"> + <number>1</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>NoMarks</enum> + </property> + <property name="tickInterval"> + <number>10</number> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout28</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_2</cstring> + </property> + <property name="text"> + <string>Translucent</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>81</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4_2</cstring> + </property> + <property name="text"> + <string>Opaque</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="Line" row="6" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>line8</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout54</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_4</cstring> + </property> + <property name="text"> + <string>Text</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>menuTextColorHigh</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer29_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_6</cstring> + </property> + <property name="text"> + <string>Background</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>menuColorHigh</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1_7</cstring> + </property> + <property name="text"> + <string>Highlighted</string> + </property> + </widget> + <widget class="Line" row="4" column="1"> + <property name="name"> + <cstring>line9</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout62</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Text</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>menuTextColor</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> + <property name="name"> + <cstring>spacer37</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>280</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_3</cstring> + </property> + <property name="text"> + <string>Background</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>menuColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_3_2</cstring> + </property> + <property name="text"> + <string>Background 2</string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>menuColor2</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout46</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>4</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Color</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Background</string> + </property> + </item> + <item> + <property name="text"> + <string>Button</string> + </property> + </item> + <item> + <property name="text"> + <string>Custom</string> + </property> + </item> + <property name="name"> + <cstring>menuColorMode</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip" stdset="0"> + <string>Qt usually uses the button color for the menus... well, Apple does not.</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="11" column="0"> + <property name="name"> + <cstring>glossyMenus</cstring> + </property> + <property name="text"> + <string>Use glossy highlights</string> + </property> + </widget> + <widget class="QCheckBox" row="9" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>shadowMenuText</cstring> + </property> + <property name="text"> + <string>Shadow itemtext</string> + </property> + </widget> + </grid> + </widget> + <spacer row="3" column="0"> + <property name="name"> + <cstring>spacer34_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="2" column="0"> + <property name="name"> + <cstring>groupBox14</cstring> + </property> + <property name="title"> + <string>Sidebar</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="0" column="4"> + <item> + <property name="text"> + <string>16x16</string> + </property> + </item> + <item> + <property name="text"> + <string>22x22</string> + </property> + </item> + <item> + <property name="text"> + <string>32x32</string> + </property> + </item> + <item> + <property name="text"> + <string>48x48</string> + </property> + </item> + <item> + <property name="text"> + <string>64x64</string> + </property> + </item> + <item> + <property name="text"> + <string>128x128</string> + </property> + </item> + <property name="name"> + <cstring>linkIconSize</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_13</cstring> + </property> + <property name="text"> + <string>Hardware Iconsize</string> + </property> + </widget> + <widget class="QLabel" row="0" column="3"> + <property name="name"> + <cstring>textLabel2_9</cstring> + </property> + <property name="text"> + <string>Link Iconsize</string> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <item> + <property name="text"> + <string>16x16</string> + </property> + </item> + <item> + <property name="text"> + <string>22x22</string> + </property> + </item> + <item> + <property name="text"> + <string>32x32</string> + </property> + </item> + <item> + <property name="text"> + <string>48x48</string> + </property> + </item> + <item> + <property name="text"> + <string>64x64</string> + </property> + </item> + <item> + <property name="text"> + <string>128x128</string> + </property> + </item> + <property name="name"> + <cstring>hwIconSize</cstring> + </property> + </widget> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer39_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Custom Colors</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>useCustomColors</cstring> + </property> + <property name="text"> + <string>Use Custom Widget Colors</string> + </property> + <property name="toolTip" stdset="0"> + <string>These Widgets default to the Button Color, however you can customize them here</string> + </property> + </widget> + <widget class="QFrame" row="1" column="0"> + <property name="name"> + <cstring>colorFrame</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout62</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout58</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel4_3</cstring> + </property> + <property name="text"> + <string>Radiobutton ("Off")</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer27</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>radioOffColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout60</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5_3</cstring> + </property> + <property name="text"> + <string>Unchecked Box</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer31</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>checkOffColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout62</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel7_3</cstring> + </property> + <property name="text"> + <string>Scrollbar Slider</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer30</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>121</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>sliderColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout64</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel9_2</cstring> + </property> + <property name="text"> + <string>Pressed Slider</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer33</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>111</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>pressedSliderColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout65</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel11_3</cstring> + </property> + <property name="text"> + <string>Inactive Tab</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer34</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveTabColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="2"> + <property name="name"> + <cstring>layout61</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout59</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_3</cstring> + </property> + <property name="text"> + <string>Radiobutton ("On")</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer28</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>radioOnColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout61</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel6_3</cstring> + </property> + <property name="text"> + <string>Checked Box</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer29</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>checkOnColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout63</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel8_3</cstring> + </property> + <property name="text"> + <string>Hovered Slider</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer32</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>121</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>hoverSliderColorColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout52</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Slider Groove</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer35_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>231</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>sliderGrooveColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout66</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel10</cstring> + </property> + <property name="text"> + <string>Active Tab</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer35</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>71</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeTabColor</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="Line" row="0" column="1"> + <property name="name"> + <cstring>line11</cstring> + </property> + <property name="frameShape"> + <enum>VLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + <spacer row="4" column="2"> + <property name="name"> + <cstring>spacer32_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>51</height> + </size> + </property> + </spacer> + <widget class="QGroupBox" row="3" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>brushBox</cstring> + </property> + <property name="title"> + <string>Tint the Brush</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="1"> + <property name="name"> + <cstring>layout62</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout59</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_6</cstring> + </property> + <property name="text"> + <string>R</string> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>sliderBrushRed</cstring> + </property> + <property name="maxValue"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout60</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_6</cstring> + </property> + <property name="text"> + <string>G</string> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>sliderBrushGreen</cstring> + </property> + <property name="maxValue"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout61</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3_5</cstring> + </property> + <property name="text"> + <string>B</string> + </property> + </widget> + <widget class="QSlider"> + <property name="name"> + <cstring>sliderBrushBlue</cstring> + </property> + <property name="maxValue"> + <number>255</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>pixmapBrushPreview</cstring> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + </widget> + </grid> + </widget> + <widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>tintBrush</cstring> + </property> + <property name="text"> + <string>Tint Brushed Metal</string> + </property> + </widget> + <widget class="Line" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>line12</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + </grid> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> +</includehints> +</UI> diff --git a/config/generatePixmaps.sh b/config/generatePixmaps.sh new file mode 100755 index 0000000..e0de14c --- /dev/null +++ b/config/generatePixmaps.sh @@ -0,0 +1,13 @@ +#!/bin/sh +top_srcdir="${1:-../..}" +imagebase="$top_srcdir/imagebase" +UIC=$(grep "UIC = " ../Makefile | cut -f3- -d" ") +echo -e "#ifndef SCPIXMAPS_H\n#define SCPIXMAPS_H\n" > pixmaps.h +$UIC -embed baghira \ +$imagebase/button-base \ +$imagebase/button-shadow \ +$imagebase/brush-me | \ +sed -e "s/void qInitImages_baghira()$/static void qInitImages_baghira()/" -e "s/void qCleanupImages_baghira()$/static void qCleanupImages_baghira()/ ">> pixmaps.h +echo -e "#endif //SCPIXMAPS_H\n" >> pixmaps.h + +#$imagebase/AboutBaghira \ diff --git a/config/help.ui b/config/help.ui new file mode 100644 index 0000000..5fdae0a --- /dev/null +++ b/config/help.ui @@ -0,0 +1,305 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>Help</class> +<widget class="QDialog"> + <property name="name"> + <cstring>Help</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>457</width> + <height>720</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>32767</width> + <height>32767</height> + </size> + </property> + <property name="caption"> + <string>Baghira Help</string> + </property> + <property name="sizeGripEnabled"> + <bool>false</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>closeButton</cstring> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>BAB</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>startBAB</cstring> + </property> + <property name="text"> + <string>Start BAB</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="KActiveLabel" row="0" column="0"> + <property name="name"> + <cstring>kActiveLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="resizePolicy"> + <enum>Manual</enum> + </property> + <property name="vScrollBarMode"> + <enum>Auto</enum> + </property> + <property name="hScrollBarMode"> + <enum>Auto</enum> + </property> + <property name="text"> + <string><b>"BAB"</b> is a little Systray Application to give you more control about the look of your Baghiranced Desktop.<br> +You can start if from a shell or the KDE executor or by just simply clicking the button below.<br> +<br> +<b>How does it work?</b><br> +a) Simply leftclick the icon to switch between the different generations ( Blue:Jaguar, Black:Panther, Grey:Brushed Metal, Yellow:Tiger, White:Milk)<br><br> +b) Righclick to get a config menu, providing direct acces to Baghiras config dialog<br><br> +c) BAB is also a DCOP interface to the Baghira Style and Windeco</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>DCOP</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel" row="0" column="0"> + <property name="name"> + <cstring>kActiveLabel4</cstring> + </property> + <property name="text"> + <string><br><b>How to acces bab via DCOP</br> +<br>Well, if you're a coder, i assume you know hot to access the dcop server from within your code +<br>If you're a user, the main way to acces dcop is the <b>dcop command line tool</b><br><br> +To see, which functions are provided by bab (the list will probably grow), open a shell and enter<br><br> +<i><b>dcop bab default</b></i><br> +<br> +The most interesting function is<br><br> +<i><b>start(QString name,QString settings)</b></i><br> +<br> +use it like:<br><br> +<i><b>start &lt;appName&gt; &lt;design&gt;</b></i><br><br> +where <i><b>&lt;appName&gt;</b></i> is the (KDE) application command (try "konqueror") you want to start and <i><b>&lt;design&gt;</b></i> is a predefined Design you set in the rules section (Baghiracomes with "Jaguar", "Panther", "Brushed", "Tiger" and "Milk")</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Coloring</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel" row="0" column="0"> + <property name="name"> + <cstring>kActiveLabel3</cstring> + </property> + <property name="text"> + <string>The new coloring Function <i>"Aquarius"</i> replaces the former "<i>icy</i>" style. +<br>Though you can use any color, i suggest to avoid very high or very low saturated colors. +<br>- High saturation will lead to a flat look +<br>- Low saturation will look uncolored +<br> +<br>I suggest to use a button color like rgb = 84,140,242 as a starting Point and modify the color to yoour wishes +<br><b>Notice</b> that the coloring function is probably not fixed yet - especially not in the high saturated area +<br>So please do not complain if you worked hard to optimize the color and get a different result in one of the next versions. +<br> +<br>Additionally, there are two color schemes by Christian Lehmann included.</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Credits</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KActiveLabel" row="1" column="0"> + <property name="name"> + <cstring>kActiveLabel1</cstring> + </property> + <property name="vScrollBarMode"> + <enum>Auto</enum> + </property> + <property name="hScrollBarMode"> + <enum>Auto</enum> + </property> + <property name="text"> + <string><b>Apple Computer, Inc.</b><br>For being such great Designers =)<p> +<b>Christian Lehmann</b><br>For the SuSE binaries and Supporting my Ego<p> +<b>Elias Probst</b><br>For the Gentoo ebuild<p> +<b>Mosfet</b> (Of Course)<br>For the initial Liquid Code<p> +<b>Narcis Tesa</b><br>For the Mandrake binaries and being the worst nitpicker on this Planet<p><b>Timur</b><br>For the cute icons<p> +Everyone else who supported me with suggestions, bug reports and Help on the fores.<p> +<a href="http://www.kde-look.org/">KDE-Look</a><br> +and<br> +<a href="http://www.sf.net/">Sourceforge</a><br> +for hosting the Project</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Thanks To (alphabetical):</string> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>closeButton</sender> + <signal>clicked()</signal> + <receiver>Help</receiver> + <slot>close()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kactivelabel.h</includehint> + <includehint>kactivelabel.h</includehint> + <includehint>kactivelabel.h</includehint> + <includehint>kactivelabel.h</includehint> +</includehints> +</UI> diff --git a/config/kstyle_baghira_config.cpp b/config/kstyle_baghira_config.cpp new file mode 100644 index 0000000..1e838e8 --- /dev/null +++ b/config/kstyle_baghira_config.cpp @@ -0,0 +1,1243 @@ +/*************************************************************************** + * Copyright (C) 2004 by Thomas Lübking * + * thomas@home * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <qdesktopwidget.h> +#include <qlayout.h> +#include <qpushbutton.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qdir.h> +#include <qfile.h> +#include <qfileinfo.h> +#include <qgroupbox.h> +#include <kfiledialog.h> +#include <qpainter.h> +//#include <qpalette.h> +// #include <qsettings.h> +#include <qslider.h> +#include <qspinbox.h> +#include <qstringlist.h> +#include <qlabel.h> +#include <qlineedit.h> +#include <qpixmap.h> +#include <klistview.h> +#include <qtabwidget.h> +#include <qtimer.h> +#include <dcopclient.h> +#include <kapplication.h> +#include <kcolorbutton.h> +#include <kconfig.h> +#include <kimageeffect.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kprocess.h> +#include <kparts/genericfactory.h> + +#include <X11/Xlib.h> +#include <X11/Xatom.h> +#include <X11/Xutil.h> +#include <fixx11h.h> + +#include "kstyle_baghira_config.h" +#include "pixmaps.h" +#include "colordialog.h" +#include "colorpicker.h" + +#include "config.h" + +//#define VERSION "0.7" + +#ifndef KDE_VERSION_STRING +#define KDE_VERSION_STRING "error" +#endif +#ifndef QT_BUILD_KEY +#define QT_BUILD_KEY "error error error error" +#endif + +#define CLAMP(x,l,u) x < l ? l :\ + x > u ? u :\ + x + +#define SATURATION_COLOR(R,G,B) \ + grey = (299 * R + 587 * G + 114 * B) / 1000; \ + delta = 255 - grey; \ + grey = (grey *(10 - 5)) / 10; \ + iGrey = 255 - grey;\ + destR = (iGrey * (srcR - delta) + grey * R) / 255; \ + destG = (iGrey * (srcG - delta) + grey * G) / 255; \ + destB = (iGrey * (srcB - delta) + grey * B) / 255; + +#define SATURATION_COLOR2(S,R,G,B) \ + int max = (int)(255+0.65*(100-S)); \ + destR = CLAMP((srcR + R - 128), 0, max); \ + destG = CLAMP((srcG + G - 128), 0, max); \ + destB = CLAMP((srcB + B - 128), 0, max); \ + destR = (S*destR + (100-S)*R)/100; \ + destG = (S*destG + (100-S)*G)/100; \ + destB = (S*destB + (100-S)*B)/100; + +#define COLOR_SPACE(R,G,B) \ + if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \ + if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \ + if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255; + + +void kstyle_baghira_config::openHtml1() +{ + QStringList args; + args << "exec" << "http://baghira.sf.net/"; + kapp->kdeinitExec("kfmclient", args); +} + +void kstyle_baghira_config::openHtml2() +{ + QStringList args; + args << "exec" << "http://www.sf.net/projects/baghira/files/"; + kapp->kdeinitExec("kfmclient", args); +} + +void kstyle_baghira_config::startBab() +{ + kapp->kdeinitExec("bab"); +} + +void kstyle_baghira_config::startKRuler() +{ + kapp->kdeinitExec("kruler"); +} + +QImage* kstyle_baghira_config::tintButton(QImage &src, QColor c) +{ + QImage *dest = new QImage( src.width(), src.height(), 32, 0 ); + dest->setAlphaBuffer( true ); + unsigned int *data = ( unsigned int * ) src.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = src.width() * src.height(); + int red, green, blue; + int destR, destG, destB, alpha; + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + int hue, s, v; + c.getHsv( &hue, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + // float srcPercent, destPercent; + for ( int current = 0 ; current < total ; ++current ) { + alpha = qAlpha( data[ current ] ); + blue = qBlue( data[ current ] ); + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + SATURATION_COLOR2(sq, red, green, blue); + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} + +QImage* kstyle_baghira_config::tintBrush( QImage &img, QColor c) +{ + QImage *dest = new QImage( img.width(), img.height(), 32, 0 ); + unsigned int *data = ( unsigned int * ) img.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = img.width() * img.height(); + int current; + int delta; + int red, green, blue, grey, iGrey; + int destR, destG, destB, alpha; + + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + + + // float srcPercent, destPercent; + for ( current = 0 ; current < total ; ++current ) { + alpha = qAlpha( data[ current ] ); + blue = qBlue( data[ current ] ); + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + SATURATION_COLOR(red, green, blue); + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} + +void kstyle_baghira_config::sliderButtonRedChanged(int value) +{ + sliderButtonRedValue = value; + dialog_->valueButtonRed->setNum(value); + dialog_->pixmapButtonPreview->setPixmap(*tintButton(baseImage, QColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue))); + dialog_->pixmapButtonPreview->repaint(false); + configChanged(); +} + +void kstyle_baghira_config::sliderButtonGreenChanged(int value) +{ + sliderButtonGreenValue = value; + dialog_->valueButtonGreen->setNum(value); + dialog_->pixmapButtonPreview->setPixmap(*tintButton(baseImage, QColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue))); + dialog_->pixmapButtonPreview->repaint(false); + configChanged(); +} + +void kstyle_baghira_config::sliderButtonBlueChanged(int value) +{ + sliderButtonBlueValue = value; + dialog_->valueButtonBlue->setNum(value); + dialog_->pixmapButtonPreview->setPixmap(*tintButton(baseImage, QColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue))); + dialog_->pixmapButtonPreview->repaint(false); + configChanged(); +} + +void kstyle_baghira_config::sliderBrushRedChanged(int value) +{ + sliderBrushRedValue = value; + dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, QColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue))); + dialog_->pixmapBrushPreview->repaint(false); + configChanged(); +} + +void kstyle_baghira_config::sliderBrushGreenChanged(int value) +{ + sliderBrushGreenValue = value; + dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, QColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue))); + dialog_->pixmapBrushPreview->repaint(false); + configChanged(); +} + +void kstyle_baghira_config::sliderBrushBlueChanged(int value) +{ + sliderBrushBlueValue = value; + dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, QColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue))); + dialog_->pixmapBrushPreview->repaint(false); + configChanged(); +} + +// void kstyle_baghira_config::sliderBrushSaturationChanged(int value) +// { +// sliderBrushSaturationValue = value; +// dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, QColor(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue), sliderBrushSaturationValue)); +// dialog_->pixmapBrushPreview->repaint(false); +// emit changed(true); +// } + +// button color preset table - internal only, AND DON'T CHANGE ONLY ONE! + +enum ColorPreset {Aqua = 0, Graphite, GraphiteDark, Orange, Lime, Black, Smoke, Girlie, Smaragd, Emerald, Yellow, DeepBlueSea, Blood, Turquoise, Lilac, NUMBEROFCOLORS}; + +const char * presetColorName[NUMBEROFCOLORS] = { + "Aqua", "Graphite", "Graphite (Dark)", "Orange", "Lime", "Black", "Smoke", "Girlie", "Smaragd", "Emerald", "Yellow", "Deep Blue Sea", "Blood", "Turquoise", "Lilac" +}; + +int presetColor[NUMBEROFCOLORS][3] = {{84,144,218},{130,170,190},{103,118,134},{200,130,30},{130,180,80},{0,0,0},{106,110,120},{255,130,200},{100,160,75},{255,100,90},{160,160,70},{50,100,200},{150,25,25},{60,170,190},{150,130,220}}; + +// -------------------------------- + +typedef KGenericFactory<kstyle_baghira_config, QWidget> kstyle_baghira_configFactory; +K_EXPORT_COMPONENT_FACTORY( kcm_kstyle_baghira_config, kstyle_baghira_configFactory("kcmkstyle_baghira_config")) + +//extern QImage uic_findImage(const QString& name); +//extern void qInitImages_baghira(); +//extern void qCleanupImages_baghira(); + +void kstyle_baghira_config::updateCR() +{ + if (!about_->isShown()) + { + timer->stop(); + return; + } + if (crCurrent < 2) + crCurrent++; + else + crCurrent = 0; + about_->crLabel->setText(crNotes[crCurrent]); +} + +void kstyle_baghira_config::showAbout() +{ + crCurrent = 0; + about_->crLabel->setText(crNotes[0]); + timer->start( 4000 ); + about_->exec(); +} + +kstyle_baghira_config::kstyle_baghira_config(QWidget *parent, const char *name, const QStringList&) : QWidget(parent, name )//, myAboutData(0) +{ + loadDone = false; + if (parent) parent->setCaption("Configure Your Cat"); + QVBoxLayout *layout = new QVBoxLayout(this); + dialog_ = new Config(this); + + for (int i = 0; i < NUMBEROFCOLORS; i++) + dialog_->colorPresets->insertItem ( presetColorName[i], i ); + + QWidget *rulesWidget = new QWidget(dialog_->tabWidget); + QHBoxLayout *rwlh = new QHBoxLayout(rulesWidget); + applist = new KListView(rulesWidget); + applist->setFullWidth(true); +#if KDE_IS_VERSION(3,3,91) + applist->setShadeSortColumn(false); +#endif + applist->setAllColumnsShowFocus( true ); + applist->setSelectionMode(QListView::Single); + applist->addColumn ( i18n("Name") ); + applist->addColumn ( i18n("Links to") ); + QDir d( QDir::homeDirPath() + "/.baghira", 0L, QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::Readable | QDir::Writable ); + if (!d.exists()) + d.mkdir(QDir::homeDirPath() + "/.baghira"); + else + { + for ( uint i = 0; i < d.count(); i++ ) + { + QFileInfo FI = QFileInfo(d, d[i]); + if (FI.isSymLink()) + applist->insertItem(new KListViewItem(applist, d[i], FI.readLink().section('/',-1,-1))); + else + applist->insertItem(new KListViewItem(applist, d[i])); + } + } + rwlh->addWidget(applist); +// rwlh->addLayout(rwlv); + QVBoxLayout *rwlv = new QVBoxLayout(rwlh); + rwlv->addStretch(); + QPushButton *btnNew = new QPushButton("New...", rulesWidget); + QPushButton *btnEdit = new QPushButton("Edit...", rulesWidget); + QPushButton *btnDel = new QPushButton("Remove", rulesWidget); + QPushButton *btnDet = new QPushButton("Detect", rulesWidget); + rwlv->addWidget(btnNew); + rwlv->addWidget(btnEdit); + rwlv->addWidget(btnDel); + rwlv->addSpacing( 5 ); + rwlv->addWidget(btnDet); + rwlv->addStretch(); + dialog_->tabWidget->addTab( rulesWidget, QString("Rules") ); + appsetter = new AppSetter(this); + connect(btnNew, SIGNAL(clicked()), appsetter, SLOT(show())); + connect(btnEdit, SIGNAL(clicked()), this, SLOT(editApp())); + connect(this, SIGNAL(editApp(QString, QString)), appsetter, SLOT(show(QString, QString))); + connect(btnDel, SIGNAL(clicked()), this, SLOT(removeApp())); + connect(btnDet, SIGNAL(clicked()), this, SLOT(selectWindow())); + connect(appsetter, SIGNAL(addApp(QString, QString)), this, SLOT(addApp(QString, QString))); + connect(appsetter, SIGNAL(removeApp(QString)), this, SLOT(removeApp(QString))); + // preview stuff + baseImage = uic_findImage("button-base"); + + layout->addWidget(dialog_); + + dialog_->show(); + help_ = new Help(dialog_); + about_ = new About(dialog_); + about_->versionLabel->setText(VERSION); + about_->kdeLabel->setText(KDE_VERSION_STRING); + crCurrent = 0; + crNotes[0] = "<qt>© 2003-2005 by Thomas Lübking<br>http://baghira.SourceForge.net</qt>"; + crNotes[1] = "<qt>© \"Design\" 2001-2005 by Apple inc.<br>http://www.apple.com"; + crNotes[2] = "<qt>© \"Milk\" 2002-2005 by Max Rudberg<br>http://www.maxthemes.com</qt>"; + timer = new QTimer(); + connect( timer, SIGNAL(timeout()), this, SLOT(updateCR()) ); + QString tmpString(QT_BUILD_KEY); + about_->systemLabel->setText(tmpString.section(' ',1,1)); + about_->cpuLabel->setText(tmpString.section(' ',0,0)); + about_->setFixedSize (380, 430); + + // connections + // buttons + connect(dialog_->buttonHelp, SIGNAL(clicked()), help_, SLOT(exec())); + connect(dialog_->buttonAbout, SIGNAL(clicked()), this, SLOT(showAbout())); + connect(about_->buttonInfo, SIGNAL(clicked()), this, SLOT(openHtml1())); + connect(about_->buttonDownload, SIGNAL(clicked()), this, SLOT(openHtml2())); + connect(help_->startBAB, SIGNAL(clicked()), this, SLOT(startBab())); + connect(dialog_->startKRuler, SIGNAL(clicked()), this, SLOT(startKRuler())); + connect(dialog_->buttonLoad, SIGNAL(clicked()), this, SLOT(buttonLoadAction())); + connect(dialog_->buttonSaveAs, SIGNAL(clicked()), this, SLOT(buttonSaveAsAction())); + connect(dialog_->colorPresets, SIGNAL(activated(int)), this, SLOT(setPresetColor(int))); + + // changes + connect(dialog_->defaultStyle, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->buttonStyle, SIGNAL(activated(int)), this, SLOT(handleButtonStyles(int))); + connect(dialog_->toolbuttonStyle, SIGNAL(activated(int)), this, SLOT(handleButtonStyles(int))); + connect(dialog_->animateButtons, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->stippleBackground, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->bevelHighlights, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->stippleContrast, SIGNAL(valueChanged (int)), this, SLOT(configChanged())); + connect(dialog_->shadowGroups, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->shadowIntensity, SIGNAL(valueChanged (int)), this, SLOT(configChanged())); + connect(dialog_->centerTabs, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->colorMode, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->inactiveColorType, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->animateSlider, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->shadowSlider, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->squeezeSlider, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->unhoveredToolButtons, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->aquaTabs, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->brushedTabs, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->drawTreeLines, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->useCustomExpanderColor, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->treeLineMode, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->expanderMode, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->useCustomExpanderColor, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->useRectLVH, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->removeKickerBevel, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->replaceMenubar, SIGNAL(toggled(bool)), this, SLOT(menuToggled(bool))); + connect(dialog_->roundTasks, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->showProgressValue, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->progressType, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->menuBackground, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->menuOpacity, SIGNAL(valueChanged (int)), this, SLOT(configChanged())); + connect(dialog_->shadowMenuText, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->menuColorMode, SIGNAL(activated(int)), this, SLOT(configChanged())); + connect(dialog_->useCustomColors, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->drawMenuStripe, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + connect(dialog_->glossyMenus, SIGNAL(stateChanged(int)), this, SLOT(configChanged())); + + connect(dialog_->customInactiveColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); +connect(dialog_->toolbuttonHighColor, SIGNAL(changed(const QColor &)), this, SLOT(changeTooluttonHighlightColor(const QColor &))); + connect(dialog_->treeLineColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->customExpanderColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->menuTextColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->menuTextColorHigh, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->menuColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->menuColorHigh, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->menuColor2, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->radioOffColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->radioOnColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->checkOffColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->checkOnColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->sliderColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->hoverSliderColorColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->pressedSliderColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->inactiveTabColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->activeTabColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + connect(dialog_->menuStripeColor, SIGNAL(changed(const QColor &)), this, SLOT(configChanged())); + + connect(dialog_->sliderButtonRed, SIGNAL(valueChanged (int)), this, SLOT(sliderButtonRedChanged(int))); + connect(dialog_->sliderButtonGreen, SIGNAL(valueChanged (int)), this, SLOT(sliderButtonGreenChanged(int))); + connect(dialog_->sliderButtonBlue, SIGNAL(valueChanged (int)), this, SLOT(sliderButtonBlueChanged(int))); + + connect(dialog_->sliderBrushRed, SIGNAL(valueChanged (int)), this, SLOT(sliderBrushRedChanged(int))); + connect(dialog_->sliderBrushGreen, SIGNAL(valueChanged (int)), this, SLOT(sliderBrushGreenChanged(int))); + connect(dialog_->sliderBrushBlue, SIGNAL(valueChanged (int)), this, SLOT(sliderBrushBlueChanged(int))); + + // GUI + connect (dialog_->defaultStyle, SIGNAL(activated(int)), this, SLOT(setDesign(int))); + connect (dialog_->inactiveColorType, SIGNAL(activated(int)), this, SLOT(enableInButtonColor(int))); + connect (dialog_->drawTreeLines, SIGNAL(toggled(bool)), dialog_->treeLineMode, SLOT(setEnabled(bool))); + connect (dialog_->drawTreeLines, SIGNAL(toggled(bool)), dialog_->treeLineColor, SLOT(setEnabled(bool))); + connect (dialog_->useCustomExpanderColor, SIGNAL(toggled(bool)), dialog_->customExpanderColor, SLOT(setEnabled(bool))); + connect (dialog_->menuColorMode, SIGNAL(activated(int)), this, SLOT(enableMenuColorStuff(int))); + connect (dialog_->menuBackground, SIGNAL(activated(int)), this, SLOT(enableMenuColorStuff(int))); + connect (dialog_->drawMenuStripe, SIGNAL(toggled(bool)), dialog_->menuStripeColor, SLOT(setEnabled(bool))); +// connect (dialog_->tintBrush, SIGNAL(toggled(bool)), dialog_->brushBox, SLOT(setEnabled(bool))); + connect (dialog_->useCustomColors, SIGNAL(toggled(bool)), dialog_->colorFrame, SLOT(setEnabled(bool))); + + // load settings + load(); + loadDone = true; + + dialog_->pixmapButtonPreview->setPixmap(*tintButton(baseImage, QColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue))); + +}; + +kstyle_baghira_config::~kstyle_baghira_config() +{ + if (timer) delete timer; +} + +void kstyle_baghira_config::setPresetColor(int i) +{ + dialog_->sliderButtonRed->setValue(presetColor[i][0]); + dialog_->sliderButtonGreen->setValue(presetColor[i][1]); + dialog_->sliderButtonBlue->setValue(presetColor[i][2]); +} + +void kstyle_baghira_config::load() +{ + QString tmpString = QDir::homeDirPath() + "/.qt/baghirarc"; + load (tmpString); +} + +void kstyle_baghira_config::load(QString &fileName) +{ + KConfig *config = new KConfig(fileName); +// QSettings config; + config->setGroup("BAB"); + // general Design + dialog_->defaultStyle->setCurrentItem(config->readNumEntry("defaultState", 0 )); +// config->endGroup(); + config->setGroup("Style"); + dialog_->buttonStyle->setCurrentItem(config->readNumEntry("Special_ButtonStyle", 1 )); + dialog_->toolbuttonStyle->setCurrentItem(config->readNumEntry("Special_ToolbuttonStyle", 1 )); + dialog_->stippleBackground->setChecked( config->readBoolEntry( "Design_StippleBackground", true)); + dialog_->animateButtons->setChecked( config->readBoolEntry( "Design_AnimateButtons", true)); + dialog_->stippleContrast->setValue( config->readNumEntry( "Design_StippleContrast", 3)); + dialog_->shadowGroups->setChecked( config->readBoolEntry( "Design_ShadowGroupBoxes", true)); + dialog_->shadowIntensity->setValue( config->readNumEntry( "Design_GroupBoxeShadowDarkness", 6)); + dialog_->bevelHighlights->setChecked( config->readBoolEntry( "Design_BevelAsHighlight", true)); + dialog_->colorMode->setCurrentItem(config->readNumEntry("Design_ButtonStyle", 0)); + dialog_->inactiveColorType->setCurrentItem(config->readNumEntry( "Design_InactiveButtonStyle", 1)); + dialog_->customInactiveColor->setColor(QColor(config->readNumEntry("Design_InactiveButtonColor",(int)colorGroup().background().rgb()))); + dialog_->centerTabs->setChecked( config->readBoolEntry( "Design_CenterTabs", true)); + // button color stuff + QColor tmpColor = QColor(config->readNumEntry("Design_ButtonColor",(int)colorGroup().button().rgb())); + dialog_->sliderButtonRed->setValue(sliderButtonRedValue = tmpColor.red()); + dialog_->sliderButtonGreen->setValue(sliderButtonGreenValue = tmpColor.green()); + dialog_->sliderButtonBlue->setValue(sliderButtonBlueValue = tmpColor.blue()); + dialog_->valueButtonRed->setNum(sliderButtonRedValue); + dialog_->valueButtonGreen->setNum(sliderButtonGreenValue); + dialog_->valueButtonBlue->setNum(sliderButtonBlueValue); + + // special Widgets + //ListViews + dialog_->useRectLVH->setChecked( config->readBoolEntry( "Special_UseFlatLVH", false)); + dialog_->drawTreeLines->setChecked( config->readBoolEntry( "Special_DrawTreeLines", false)); + dialog_->treeLineMode->setCurrentItem(config->readNumEntry( "Special_TreelineStyle", 0)); + dialog_->treeLineColor->setColor( QColor( config->readNumEntry( "Special_TreelineColor", (int) colorGroup().mid().rgb()))); + dialog_->expanderMode->setCurrentItem(config->readNumEntry( "Special_ExpanderStyle", 0)); + dialog_->useCustomExpanderColor->setChecked( config->readBoolEntry( "Special_CustomExpanderColor", false)); + dialog_->customExpanderColor->setColor( QColor( config->readNumEntry( "Special_ExpanderColor", (int) colorGroup().text().rgb()))); + //Kicker + dialog_->removeKickerBevel->setChecked( config->readBoolEntry( "Special_RemoveKickerBevel", true)); + dialog_->roundTasks->setChecked( config->readBoolEntry( "Special_RoundTaskbuttons", false)); + QFile file(QDir::homeDirPath() + "/.kde/share/apps/kicker/applets/menuapplet.desktop"); + dialog_->replaceMenubar->setChecked( menuReplaced = file.exists() ); + //Scrollbars + dialog_->animateSlider->setChecked( config->readBoolEntry( "Special_AnimateSlider", true)); + dialog_->shadowSlider->setChecked( config->readBoolEntry( "Special_ShadowSlider", false)); + dialog_->squeezeSlider->setChecked( config->readBoolEntry( "Special_SqueezeSlider", false)); + //Progress + dialog_->progressType->setCurrentItem( config->readNumEntry( "Special_ProgressStyle", 0)); + dialog_->showProgressValue->setChecked( config->readBoolEntry( "Special_ShowProgressValue", false)); + //Toolbars + dialog_->unhoveredToolButtons->setCurrentItem(config->readNumEntry( "Special_UnhoveredToolButtons", 2)); + //Tabs + dialog_->aquaTabs->setCurrentItem(config->readNumEntry("Design_TabStyleAqua", 0 )); + dialog_->brushedTabs->setCurrentItem(config->readNumEntry("Design_TabStyleBrushed", 1 )); + + // menus + dialog_->menuBackground->setCurrentItem( config->readNumEntry( "Menu_Background", 0)); + dialog_->menuOpacity->setValue( config->readNumEntry( "Menu_Opacity", 70)); + //Look + dialog_->shadowMenuText->setChecked( config->readBoolEntry( "Menu_ShadowText", true)); + dialog_->menuColorMode->setCurrentItem(config->readNumEntry("Menu_ColorStyle")); + dialog_->menuTextColor->setColor( QColor( config->readNumEntry( "Menu_TextColor", (int) colorGroup().text().rgb()))); + dialog_->menuTextColorHigh->setColor( QColor( config->readNumEntry( "Menu_TextColorHighlight", (int) colorGroup().highlightedText().rgb()))); + dialog_->menuColor->setColor( QColor( config->readNumEntry( "Menu_Color1", (int) colorGroup().background().rgb()))); + dialog_->menuColor2->setColor( QColor( config->readNumEntry( "Menu_Color2", (int) colorGroup().background().dark(130).rgb()))); + dialog_->menuColorHigh->setColor( QColor( config->readNumEntry( "Menu_ColorHighlight", (int) colorGroup().highlight().rgb()))); + dialog_->drawMenuStripe->setChecked(config->readBoolEntry( "Menu_DrawMenuStripe", false)); + dialog_->glossyMenus->setChecked(config->readBoolEntry( "Menu_Glossy", true)); + dialog_->menuStripeColor->setColor( QColor( config->readNumEntry( "Menu_StripeColor", (int) Qt::white.rgb()))); + + // custom colors + dialog_->useCustomColors->setChecked( config->readBoolEntry( "Colors_UseCustomColors", false)); + dialog_->radioOffColor->setColor( QColor( config->readNumEntry( "Colors_RadioOff", ( int ) colorGroup().background().rgb()))); + dialog_->radioOnColor->setColor( QColor( config->readNumEntry( "Colors_RadioOn", ( int ) colorGroup().button().rgb()))); + dialog_->checkOffColor->setColor( QColor( config->readNumEntry( "Colors_CheckOff", ( int ) colorGroup().background().rgb()))); + dialog_->checkOnColor->setColor( QColor( config->readNumEntry( "Colors_CheckOn", ( int ) colorGroup().button().rgb()))); + dialog_->sliderColor->setColor( QColor( config->readNumEntry( "Colors_Slider", ( int ) colorGroup().button().rgb()))); + dialog_->hoverSliderColorColor->setColor(QColor(config->readNumEntry("Colors_SliderHovered",(int)colorGroup().button().rgb()))); + dialog_->pressedSliderColor->setColor(QColor(config->readNumEntry("Colors_SliderPressed",(int) colorGroup().button().dark(110).rgb()))); + dialog_->sliderGrooveColor->setColor(QColor(config->readNumEntry("Colors_SliderGroove",(int)colorGroup().background().rgb()))); + dialog_->inactiveTabColor->setColor(QColor(config->readNumEntry("Colors_TabInactive",(int) colorGroup().background().rgb()))); + dialog_->activeTabColor->setColor(QColor(config->readNumEntry("Colors_TabActive",(int)colorGroup().button().rgb()))); + dialog_->tintBrush->setChecked( config->readBoolEntry( "Colors_TintBrushedMetal", false)); + brushTint = QColor(config->readNumEntry("Colors_BrushTint",(int)colorGroup().background().rgb())); +// dialog_->brushTintSaturaion->setValue(settings.readNumEntry( "/qt/Baghira/brushTintSaturation", 3)); + baseImage2 = uic_findImage("brush-me"); + dialog_->pixmapBrushPreview->setPixmap(*tintBrush(baseImage2, brushTint)); + dialog_->sliderBrushRed->setValue(sliderBrushRedValue = brushTint.red()); + dialog_->sliderBrushGreen->setValue(sliderBrushGreenValue = brushTint.green()); + dialog_->sliderBrushBlue->setValue(sliderBrushBlueValue = brushTint.blue()); + config->setGroup("Menubar"); + dialog_->menuMaxWidth->setValue(config->readNumEntry("Width", QDesktopWidget().availableGeometry().width())); + config->setGroup("Sidebar"); + delete config; + + config = new KConfig("kdeglobals"); + config->setGroup( "Toolbar style" ); + dialog_->toolbuttonHighColor->setColor(config->readColorEntry("HighlightColor", new QColor(103,141,178)) ); + delete config; +} + + +void kstyle_baghira_config::defaults() +{ + dialog_->defaultStyle->setCurrentItem(0); + dialog_->buttonStyle->setCurrentItem(1); + dialog_->toolbuttonStyle->setCurrentItem(1); + dialog_->animateButtons->setChecked( true); + dialog_->stippleBackground->setChecked( true); + dialog_->stippleContrast->setValue( 30); + dialog_->shadowGroups->setChecked( true); + dialog_->shadowIntensity->setValue( 50); + dialog_->bevelHighlights->setChecked( true ); + dialog_->centerTabs->setChecked( true); + dialog_->colorMode->setCurrentItem(0); + dialog_->inactiveColorType->setCurrentItem(1); + dialog_->customInactiveColor->setColor(colorGroup().background().rgb()); + // button color stuff + dialog_->sliderButtonRed->setValue(sliderButtonRedValue = colorGroup().button().red()); + dialog_->sliderButtonGreen->setValue(sliderButtonGreenValue = colorGroup().button().green()); + dialog_->sliderButtonBlue->setValue(sliderButtonBlueValue = colorGroup().button().blue()); + dialog_->valueButtonRed->setNum(sliderButtonRedValue); + dialog_->valueButtonGreen->setNum(sliderButtonGreenValue); + dialog_->valueButtonBlue->setNum(sliderButtonBlueValue); + + // special Widgets +// dialog_->animateSlider; + dialog_->shadowSlider->setChecked( false); + dialog_->squeezeSlider->setChecked( false); + dialog_->unhoveredToolButtons->setCurrentItem(2); + dialog_->toolbuttonHighColor->setColor( QColor(103,141,178) ); + dialog_->drawTreeLines->setChecked( false); + dialog_->useCustomExpanderColor->setChecked( false); + dialog_->treeLineMode->setCurrentItem(0); + dialog_->treeLineColor->setColor( colorGroup().mid().rgb()); + dialog_->expanderMode->setCurrentItem(0); + dialog_->customExpanderColor->setColor( colorGroup().text().rgb()); + dialog_->useRectLVH->setChecked( false); + dialog_->removeKickerBevel->setChecked( true); + dialog_->roundTasks->setChecked( false); + dialog_->showProgressValue->setChecked( false); + dialog_->progressType->setCurrentItem( 0); + dialog_->aquaTabs->setCurrentItem( 0 ); + dialog_->brushedTabs->setCurrentItem(1); + + // menus +// dialog_->transGroup; + dialog_->menuBackground->setCurrentItem(0); + dialog_->menuOpacity->setValue( 70); + dialog_->shadowMenuText->setChecked( true); + dialog_->menuColorMode->setCurrentItem(0); + dialog_->menuTextColor->setColor( colorGroup().text().rgb()); + dialog_->menuTextColorHigh->setColor( colorGroup().highlightedText().rgb()); + dialog_->menuColor->setColor( colorGroup().background().rgb()); + dialog_->menuColor2->setColor( colorGroup().background().dark(130).rgb()); + dialog_->menuColorHigh->setColor( colorGroup().highlight().rgb()); + dialog_->drawMenuStripe->setChecked(false); + dialog_->glossyMenus->setChecked(true); + dialog_->menuStripeColor->setColor( Qt::white.rgb()); + + // custom colors + dialog_->useCustomColors->setChecked( false); + dialog_->radioOffColor->setColor( colorGroup().background().rgb()); + dialog_->radioOnColor->setColor( colorGroup().button().rgb()); + dialog_->checkOffColor->setColor( colorGroup().background().rgb()); + dialog_->checkOnColor->setColor( colorGroup().button().rgb()); + dialog_->sliderColor->setColor( colorGroup().button().rgb()); + dialog_->hoverSliderColorColor->setColor(colorGroup().button().rgb()); + dialog_->pressedSliderColor->setColor(colorGroup().button().dark(110).rgb()); + dialog_->sliderGrooveColor->setColor(colorGroup().background().rgb()); + dialog_->inactiveTabColor->setColor(colorGroup().background().rgb()); + dialog_->activeTabColor->setColor(colorGroup().button().rgb()); + dialog_->tintBrush->setChecked( false); + emit changed(true); +} + +void kstyle_baghira_config::save() +{ + QString tmpString = QDir::homeDirPath() + "/.qt/baghirarc"; + save(tmpString); +// emit changed(true); +} + +void kstyle_baghira_config::changeTooluttonHighlightColor(const QColor & color) +{ + KConfig *config = new KConfig("kdeglobals"); + config->setGroup( "Toolbar style" ); + config->writeEntry("HighlightColor", color); + delete config; +} + +void kstyle_baghira_config::handleButtonStyles(int i) +{ + if (i != 2 && sender() == dialog_->buttonStyle && dialog_->toolbuttonStyle->currentItem() != 2) + dialog_->toolbuttonStyle->setCurrentItem(i); + else if (i != 2 && sender() == dialog_->toolbuttonStyle && dialog_->buttonStyle->currentItem() != 2) + dialog_->buttonStyle->setCurrentItem(i); + configChanged(); +} + +void kstyle_baghira_config::save(QString &fileName) +{ +// QSettings *config = new QSettings; + KConfig *config = new KConfig(fileName); + config->setGroup("BAB"); + //General Design + config->writeEntry("defaultState", dialog_->defaultStyle->currentItem()); +// config->endGroup(); + config->setGroup("Style"); + config->writeEntry("Special_ButtonStyle", dialog_->buttonStyle->currentItem()); + config->writeEntry("Special_ToolbuttonStyle", dialog_->toolbuttonStyle->currentItem()); + config->writeEntry("Design_AnimateButtons", dialog_->animateButtons->isOn()); + config->writeEntry("Design_Default", dialog_->defaultStyle->currentItem()); + config->writeEntry("Design_StippleBackground", dialog_->stippleBackground->isOn()); + config->writeEntry("Design_StippleContrast", dialog_->stippleContrast->value()); + config->writeEntry("Design_ShadowGroupBoxes", dialog_->shadowGroups->isOn()); + config->writeEntry("Design_GroupBoxeShadowDarkness", dialog_->shadowIntensity->value()); + config->writeEntry("Design_BevelAsHighlight", dialog_->bevelHighlights->isOn()); + config->writeEntry("Design_ButtonStyle", dialog_->colorMode->currentItem()); + config->writeEntry("Design_InactiveButtonStyle", dialog_->inactiveColorType->currentItem()); + config->writeEntry("Design_InactiveButtonColor", (int)dialog_->customInactiveColor->color().rgb()); + config->writeEntry("Design_CenterTabs", dialog_->centerTabs->isOn()); + //button color stuff + config->writeEntry("Design_ButtonColor", (int)(QColor(sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue).rgb())); + + // special Widgets + //listviews +// dialog_->animateSlider; + config->writeEntry("Special_UseFlatLVH", dialog_->useRectLVH->isOn()); + config->writeEntry("Special_DrawTreeLines", dialog_->drawTreeLines->isOn()); + config->writeEntry("Special_TreelineStyle", dialog_->treeLineMode->currentItem()); + config->writeEntry("Special_TreelineColor", (int)dialog_->treeLineColor->color().rgb()); + config->writeEntry("Special_ExpanderStyle", dialog_->expanderMode->currentItem()); + config->writeEntry("Special_CustomExpanderColor", dialog_->useCustomExpanderColor->isOn()); + config->writeEntry("Special_ExpanderColor", (int)dialog_->customExpanderColor->color().rgb()); + //Kicker + config->writeEntry("Special_RemoveKickerBevel", dialog_->removeKickerBevel->isOn()); + config->writeEntry("Special_RoundTaskbuttons", dialog_->roundTasks->isOn()); + QDir tmpDir(QDir::homeDirPath() + "/.kde"); + if (!tmpDir.exists()) tmpDir.mkdir(QDir::homeDirPath() + "/.kde"); + tmpDir.setPath(QDir::homeDirPath() + "/.kde/share"); + if (!tmpDir.exists()) tmpDir.mkdir(QDir::homeDirPath() + "/.kde/share"); + tmpDir.setPath(QDir::homeDirPath() + "/.kde/share/apps"); + if (!tmpDir.exists()) tmpDir.mkdir(QDir::homeDirPath() + "/.kde/share/apps"); + tmpDir.setPath(QDir::homeDirPath() + "/.kde/share/apps/kicker"); + if (!tmpDir.exists()) tmpDir.mkdir(QDir::homeDirPath() + "/.kde/share/apps/kicker"); + tmpDir.setPath(QDir::homeDirPath() + "/.kde/share/apps/kicker/applets"); + if (!tmpDir.exists()) tmpDir.mkdir(QDir::homeDirPath() + "/.kde/share/apps/kicker/applets"); + QFile file(QDir::homeDirPath() + "/.kde/share/apps/kicker/applets/menuapplet.desktop"); + if (dialog_->replaceMenubar->isOn()) + { + file.open(IO_WriteOnly); + const char *msg = +"[Desktop Entry]\n\ +Hidden=true\n\ +Type=Plugin\n\ +Encoding=UTF-8\n\ +Name=BaghiraMenu\n\ +X-KDE-Library=b_menu_panelapplet\n\ +X-KDE-UniqueApplet=true\n"; + file.writeBlock( msg, qstrlen(msg) ); + file.close(); + } + else + file.remove(); + if (dialog_->replaceMenubar->isOn() != menuReplaced) + KApplication::dcopClient()->send("kicker", "default", "restart()", ""); + //Srollbars + config->writeEntry("Special_AnimateSlider", dialog_->animateSlider->isOn()); + config->writeEntry("Special_ShadowSlider", dialog_->shadowSlider->isOn()); + config->writeEntry("Special_SqueezeSlider", dialog_->squeezeSlider->isOn()); + //Progress + config->writeEntry("Special_ProgressStyle", dialog_->progressType->currentItem()); + config->writeEntry("Special_ShowProgressValue", dialog_->showProgressValue->isOn()); + //Toolbars + config->writeEntry("Special_UnhoveredToolButtons", dialog_->unhoveredToolButtons->currentItem()); + //Tabs + config->writeEntry("Design_TabStyleAqua", dialog_->aquaTabs->currentItem() ); + config->writeEntry("Design_TabStyleBrushed", dialog_->brushedTabs->currentItem() ); + // menus + config->writeEntry("Menu_Background", dialog_->menuBackground->currentItem()); + config->writeEntry("Menu_Opacity", dialog_->menuOpacity->value()); + //Look + config->writeEntry("Menu_ShadowText", dialog_->shadowMenuText->isOn()); + config->writeEntry("Menu_ColorStyle", dialog_->menuColorMode->currentItem()); + config->writeEntry("Menu_TextColor", (int)dialog_->menuTextColor->color().rgb()); + config->writeEntry("Menu_TextColorHighlight", (int)dialog_->menuTextColorHigh->color().rgb()); + config->writeEntry("Menu_Color1", (int)dialog_->menuColor->color().rgb()); + config->writeEntry("Menu_Color2", (int)dialog_->menuColor2->color().rgb()); + config->writeEntry("Menu_ColorHighlight", (int)dialog_->menuColorHigh->color().rgb()); + config->writeEntry("Menu_DrawMenuStripe", dialog_->drawMenuStripe->isOn()); + config->writeEntry("Menu_Glossy", dialog_->glossyMenus->isOn()); + config->writeEntry("Menu_StripeColor", (int)dialog_->menuStripeColor->color().rgb()); + + // custom colors + config->writeEntry("Colors_UseCustomColors", dialog_->useCustomColors->isOn()); + config->writeEntry("Colors_RadioOff", (int)dialog_->radioOffColor->color().rgb()); + config->writeEntry("Colors_RadioOn", (int)dialog_->radioOnColor->color().rgb()); + config->writeEntry("Colors_CheckOff",(int) dialog_->checkOffColor->color().rgb()); + config->writeEntry("Colors_CheckOn", (int)dialog_->checkOnColor->color().rgb()); + config->writeEntry("Colors_Slider",(int) dialog_->sliderColor->color().rgb()); + config->writeEntry("Colors_SliderHovered", (int)dialog_->hoverSliderColorColor->color().rgb()); + config->writeEntry("Colors_SliderPressed", (int)dialog_->pressedSliderColor->color().rgb()); + config->writeEntry("Colors_SliderGroove",(int) dialog_->sliderGrooveColor->color().rgb()); + config->writeEntry("Colors_TabInactive",(int) dialog_->inactiveTabColor->color().rgb()); + config->writeEntry("Colors_TabActive", (int)dialog_->activeTabColor->color().rgb()); + config->writeEntry("Colors_TintBrushedMetal", dialog_->tintBrush->isOn()); + config->writeEntry("Colors_BrushTint",(int)qRgb(sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue)); + config->setGroup("Menubar"); + config->writeEntry("Width", dialog_->menuMaxWidth->value()); + config->sync(); +// config->endGroup(); + delete config; +} + + +void kstyle_baghira_config::configChanged() +{ + if (loadDone) + { + dialog_->statusWarning->setText("Config changed"); + emit changed(true); + } +} + + +QString kstyle_baghira_config::quickHelp() const +{ + return i18n("Configure Your Cat"); +} + +void kstyle_baghira_config::setDesign(int d) +{ + bool b = (d == 0); + dialog_->stippleBackground->setEnabled(b); + dialog_->stippleContrast->setEnabled(b); + dialog_->shadowGroups->setEnabled(b); + dialog_->shadowIntensity->setEnabled(b); +} + +void kstyle_baghira_config::enableInButtonColor(int d) +{ + dialog_->customInactiveColor->setEnabled(d == 3); +} + +void kstyle_baghira_config::enableMenuColorStuff(int d) +{ + bool b = (d == 2); + dialog_->menuTextColor->setEnabled(b); + dialog_->menuColor->setEnabled(b && dialog_->menuBackground->currentItem() > 0); + dialog_->menuColor2->setEnabled(b && dialog_->menuBackground->currentItem() > 1); +} + +void kstyle_baghira_config::buttonLoadAction() +{ + QString tmpString = KFileDialog::getOpenFileName(QDir::homeDirPath(), "*", this, "Select a Baghira config file"); + if (!tmpString.isEmpty()) + load(tmpString); +} + +void kstyle_baghira_config::buttonSaveAsAction() +{ + QString tmpString = KFileDialog::getSaveFileName(QDir::homeDirPath(), "*", this, "Save current Baghira configuration as"); + save(tmpString); +} + +void kstyle_baghira_config::editApp() +{ + emit editApp(applist->currentItem()->text(0), applist->currentItem()->text(1)); +} + +void kstyle_baghira_config::removeApp() +{ + QString string = QDir::homeDirPath() + "/.baghira/" + applist->currentItem()->text(0); + QFile::remove(string); + applist->takeItem(applist->currentItem()); +} + +void kstyle_baghira_config::removeApp(QString name) +{ + QString string = QDir::homeDirPath() + "/.baghira/" + name; + QFile::remove(string); + applist->takeItem(applist->findItem(name, 0, Qt::ExactMatch)); +} + +void kstyle_baghira_config::addApp(QString string, QString linkString) +{ + applist->insertItem(new KListViewItem(applist, string, linkString)); + applist->sort(); +} + +void kstyle_baghira_config::selectWindow() +// taken from kcmkwin +{ + // use a dialog, so that all user input is blocked + // use WX11BypassWM and moving away so that it's not actually visible + // grab only mouse, so that keyboard can be used e.g. for switching windows + grabber = new QDialog( NULL, NULL, true, WX11BypassWM ); + grabber->move( -1000, -1000 ); + grabber->show(); + grabber->grabMouse( crossCursor ); + grabber->installEventFilter( this ); +} + +Atom wm_state = XInternAtom( qt_xdisplay(), "WM_STATE", False ); +// Atom wm_state = XInternAtom( qt_xdisplay(), "WM_COMMAND", False ); + +bool kstyle_baghira_config::eventFilter( QObject* o, QEvent* e ) +// adapted from kcmkwin... again ;) +{ + if( o != grabber ) + return false; + if( e->type() != QEvent::MouseButtonRelease ) + return false; + delete grabber; + grabber = NULL; + if( static_cast< QMouseEvent* >( e )->button() != LeftButton ) + return true; + WId winId = findWindow(); + XClassHint classHint; + if (XGetClassHint(qt_xdisplay(), winId, &classHint)) + { + QString tmpString = QString( classHint.res_class ).lower() + " (uncertain)"; + appsetter->show(tmpString, QString()); +// qWarning("class: %s",QString( classHint.res_class ).lower().ascii()); + XFree( classHint.res_name ); + XFree( classHint.res_class ); + } + return true; +} + +WId kstyle_baghira_config::findWindow() +// taken from kcmkwin... as well =) +{ + Window root; + Window child; + uint mask; + int rootX, rootY, x, y; + Window parent = qt_xrootwin(); +// Atom wm_state = XInternAtom( qt_xdisplay(), "WM_STATE", False ); + for( int i = 0; + i < 10; + ++i ) + { + XQueryPointer( qt_xdisplay(), parent, &root, &child, + &rootX, &rootY, &x, &y, &mask ); + if( child == None ) + return 0; + Atom type; + int format; + unsigned long nitems, after; + unsigned char* prop; + if( XGetWindowProperty( qt_xdisplay(), child, wm_state, 0, 0, False, AnyPropertyType, &type, &format, &nitems, &after, &prop ) == Success ) + { + if( prop != NULL ) + XFree( prop ); + if( type != None ) + return child; + } + parent = child; + } + return 0; +} + + +void kstyle_baghira_config::menuToggled(bool active) +{ + if (!active || !loadDone) + return; + KConfigGroup menuConfig(KGlobal::config(), "KDE"); + if (!menuConfig.readBoolEntry("macStyle", false)) + if (KMessageBox::questionYesNo(0, i18n("<qt>You just selected to replace kickers menu applet for the Mac like Menubar on top of the screen, but the Mac like style isn't selected anyway<br>Do you want to activate it now?</qt>"), 0L, KStdGuiItem::yes(), KStdGuiItem::no()) == KMessageBox::Yes) + { + KProcess proc; + proc << "kcmshell" << "desktopbehavior"; + proc.start(KProcess::DontCare); + proc.detach(); + } + configChanged(); +} + +////////////////////////////////////////////////////////////////////////////// +// Plugin Stuff // +////////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + QWidget* allocate_kstyle_config(QWidget* parent){ + return(new kstyle_baghira_config(parent, "BaghiraConfig")); + } +} + +AppSetter::AppSetter(QWidget *parent, const char *name) : QWidget(parent, name, Qt::WType_Dialog | Qt::WShowModal ) +{ + isEdit = FALSE; + + QLabel *label1 = new QLabel(i18n("<qt><b>Application Name</b></qt>"), this); + command = new QLineEdit(this); + + QLabel *linkTo = new QLabel(i18n("<qt><b>Just like</b></qt>"),this); + link = new QComboBox(this); + + box = new QGroupBox(2,Qt::Horizontal,i18n("Custom Settings"),this); + box->setCheckable( true ); + + new QLabel(i18n("<qt><b>Style</b></qt>"), box); + new QLabel("<qt><b>Deco</b></qt>", box); + + style = new QComboBox(box); + style->insertItem(i18n("Don't set")); + style->insertItem("Jaguar"); + style->insertItem("Panther"); + style->insertItem("Brushed Metal"); + style->insertItem("Tiger"); + style->insertItem("Milk"); + + deco = new QComboBox(box); + deco->insertItem(i18n("Don't set")); + deco->insertItem("Jaguar"); + deco->insertItem("Panther"); + deco->insertItem("Brushed Metal"); + deco->insertItem("Tiger"); + deco->insertItem("Milk"); + + new QLabel(i18n("<qt><b>Buttons</b></qt>"), box); + new QLabel(i18n("<qt><b>Toolbuttons</b></qt>"), box); + + buttons = new QComboBox(box); + buttons->insertItem("Jaguar"); + buttons->insertItem("Panther"); + buttons->insertItem("iTunes"); + buttons->insertItem("Tiger"); + buttons->insertItem("Milk"); + + + toolButtons = new QComboBox(box); + toolButtons->insertItem("Jaguar"); + toolButtons->insertItem("Panther"); + toolButtons->insertItem("iTunes"); + toolButtons->insertItem("Tiger"); + toolButtons->insertItem("Milk"); + + new QLabel(i18n("<qt><b>Tab vs. Chooser</b></qt>"), box); + new QLabel(i18n("<qt>Inactive Button</qt>"), box); + + tabs = new QComboBox(box); + tabs->insertItem(i18n("Don't set")); + tabs->insertItem("Tabs"); + tabs->insertItem("Adaptive"); + tabs->insertItem("Choosers"); + + + inbutton = new QComboBox(box); + inbutton->insertItem("Fixed"); + inbutton->insertItem("Background"); + inbutton->insertItem("Active Button"); + + scanlines = new QCheckBox("Show scanlines", box); + + QWidget *dumb = new QWidget(box); + customColors = new QCheckBox(dumb); + buttonColors = new QPushButton("Custom Colors", dumb); + QHBoxLayout *clh = new QHBoxLayout(dumb); + clh->addWidget(customColors); + clh->addWidget(buttonColors); + + QVBoxLayout *lv = new QVBoxLayout(this,11,6); + lv->addWidget(label1); + lv->addWidget(command); + QHBoxLayout *lh0 = new QHBoxLayout(lv); + lh0->addWidget(linkTo); + lh0->addWidget(link); + lv->addWidget(box); + QHBoxLayout *lh = new QHBoxLayout(lv); + QPushButton *cancel = new QPushButton("Cancel",this); + lh->addWidget(cancel); + QPushButton *ok = new QPushButton("Ok",this); + lh->addWidget(ok); + + colorDialog = new ColorDialog(this); + + connect(box, SIGNAL(toggled( bool )), link, SLOT(setDisabled(bool))); + connect(box, SIGNAL(toggled( bool )), linkTo, SLOT(setDisabled(bool))); + connect(style, SIGNAL(activated( int )), this, SLOT(handler(int))); + connect(buttons, SIGNAL(activated( int )), this, SLOT(handleButtonStyles(int))); + connect(toolButtons, SIGNAL(activated( int )), this, SLOT(handleButtonStyles(int))); + connect(cancel, SIGNAL(clicked()), this, SLOT(reset())); + connect(ok, SIGNAL(clicked()), this, SLOT(save())); + connect(customColors, SIGNAL(toggled( bool )), buttonColors, SLOT(setEnabled(bool))); + connect(buttonColors, SIGNAL(clicked()), colorDialog, SLOT(exec())); + connect(colorDialog->buttonOk, SIGNAL(clicked()), this, SLOT(updateColors())); + connect(colorDialog->buttonCancel, SIGNAL(clicked()), this, SLOT(resetColorPicker())); + reset(); +} + +AppSetter::~AppSetter() +{ +} + +void AppSetter::handleButtonStyles(int i) +{ + if (i != 2 && sender() == buttons && toolButtons->currentItem() != 2) + toolButtons->setCurrentItem(i); + else if (i != 2 && sender() == toolButtons && buttons->currentItem() != 2) + buttons->setCurrentItem(i); +} + +void AppSetter::handler(int i) +{ + scanlines->setEnabled(i != 3); +} + +void AppSetter::updateColors() +{ + for (int i = 0; i < 8; i++) + colors[i] = (int)colorDialog->picker[i]->color().rgb(); +} + +void AppSetter::show() +{ + link->clear(); + QDir d( QDir::homeDirPath() + "/.baghira", 0L, QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::NoSymLinks | QDir::Readable | QDir::Writable ); + for ( uint i = 0; i < d.count(); i++ ) + link->insertItem(d[i]); + QWidget::show(); +} + +void AppSetter::show(QString appName, QString linkString) +{ + isEdit = true; + oldName = appName; + oldLink = linkString; + command->setText(appName); + FILE *file = NULL; + QString tmpString = QDir::homeDirPath() + "/.baghira/" + appName; + if( (file = fopen(tmpString.latin1(), "r")) != NULL ) + { + uint s, d, b, t, tc, sc, ib; + s = d = 4; + b = t = sc = 2; + tc = 3; + for (int i = 0; i < 8; i++) + colors[i] = -1; + fscanf(file,"%u\n%u\n%u\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",&s,&d,&b,&t,&tc,&sc,&colors[0],&colors[1],&colors[2],&colors[3],&colors[4],&colors[5],&colors[6],&colors[7],&ib); + fclose(file); + if (s < 5) style->setCurrentItem(s+1); + if (d < 5) deco->setCurrentItem(d+1); + if (b < 5) buttons->setCurrentItem(b); + if (t < 5) toolButtons->setCurrentItem(t); + if (tc < 3) tabs->setCurrentItem(tc+1); + if (ib < 3) inbutton->setCurrentItem(ib); + scanlines->setChecked(sc < 2 ? sc : true); + scanlines->setEnabled(s != 2); + customColors->setChecked(colors[0] != -1); + buttonColors->setEnabled(customColors->isChecked()); + resetColorPicker(); + } + show(); + if (!linkString.isNull()) + { + for (int i = 0; i < link->count(); i++) + { + if (link->text(i) == linkString) + { + link->setCurrentItem(i); + break; + } + } + } + else + { + box->setChecked(true); + } +} + +void AppSetter::resetColorPicker() +{ + if (colors[0] != -1) + { + for (int i = 0; i < 8; i++) + { + colorDialog->picker[i]->blockSignals(true); + colorDialog->picker[i]->setColor(QColor(colors[i])); + colorDialog->picker[i]->blockSignals(false); + } + ((QWidget*)colorDialog->demo)->repaint(false); + } + else + { + for (int i = 0; i < 8; i++) + colorDialog->picker[i]->blockSignals(true); + colorDialog->picker[Back]->setColor(colorGroup().background()); + colorDialog->picker[Button]->setColor(colorGroup().button()); + colorDialog->picker[Base]->setColor(colorGroup().base()); + colorDialog->picker[Text]->setColor(colorGroup().text()); + colorDialog->picker[High]->setColor(colorGroup().highlight()); + colorDialog->picker[HighText]->setColor(colorGroup().highlightedText()); + colorDialog->picker[ButText]->setColor(colorGroup().buttonText ()); + colorDialog->picker[Alternate]->setColor(KGlobalSettings::alternateBackgroundColor()); + for (int i = 0; i < 8; i++) + colorDialog->picker[i]->blockSignals(false); + ((QWidget*)colorDialog->demo)->repaint(false); + } +} + +void AppSetter::save() +{ + if (command->text() != "" && (!box->isChecked() || (style->currentItem() != 0 && deco->currentItem() != 0))) + { + if (!isEdit) + emit addApp(command->text(), box->isChecked() ? QString() : link->currentText()); + else if (command->text() != oldName || link->currentText() != oldLink) + { + emit removeApp(oldName); + emit addApp(command->text(), box->isChecked() ? QString() : link->currentText()); + } + if (!customColors->isChecked()) + { + for (int i = 0; i < 8; i++) + colors[i] = -1; + } + FILE *file = NULL; + QString tmpString = QDir::homeDirPath() + "/.baghira/" + command->text(); + if (box->isChecked()) // custom settings + { + if( (file = fopen(tmpString.latin1(), "w")) != NULL ) + { + fprintf(file,"%u\n%u\n%u\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",style->currentItem()-1, deco->currentItem()-1, buttons->currentItem(), toolButtons->currentItem(), tabs->currentItem()-1, scanlines->isChecked(), colors[0], colors[1], colors[2], colors[3], colors[4], colors[5], colors[6], colors[7], inbutton->currentItem()); + fclose(file); + } + } + else // just link + { + QString tmpString2 = QDir::homeDirPath() + "/.baghira/" + link->currentText(); + QFile::remove(tmpString); // just to be sure ;) + symlink (tmpString2.latin1(), tmpString.latin1()); + } + } + reset(); +} + +void AppSetter::reset() +{ + hide(); + isEdit = false; + style->setCurrentItem(0); + deco->setCurrentItem(0); + buttons->setCurrentItem(1); + inbutton->setCurrentItem(0); + toolButtons->setCurrentItem(1); + tabs->setCurrentItem(0); + scanlines->setChecked(false); + command->clear(); + customColors->setChecked(false); + for (int i = 0; i < 8; i++) + colors[i] = -1; + box->setChecked ( false ); +} + +#include "kstyle_baghira_config.moc" diff --git a/config/kstyle_baghira_config.h b/config/kstyle_baghira_config.h new file mode 100644 index 0000000..35830dd --- /dev/null +++ b/config/kstyle_baghira_config.h @@ -0,0 +1,163 @@ +/*************************************************************************** + * Copyright (C) 2004 by Thomas Lübking * + * thomas@home * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _KSTYLE_BAGHIRA_CONFIG_H_ +#define _KSTYLE_BAGHIRA_CONFIG_H_ + +//#include <kcmodule.h> +#include <qcolor.h> +#include <qimage.h> +#include <kaboutdata.h> +#include "configdialog.h" +#include "help.h" +#include "about.h" + +class KListView; +class QPushButton; +class AppSetter; +class QTimer; +class QCheckBox; +class QComboBox; +class QGroupBox; + +class kstyle_baghira_config: public QWidget +{ + Q_OBJECT + +public: + kstyle_baghira_config( QWidget *parent=0, const char *name=0, const QStringList& = QStringList() ); + ~kstyle_baghira_config(); + + virtual void load(); + void load(QString &fileName); + void save(QString &fileName); +// virtual int buttons(); + virtual QString quickHelp() const; + virtual const KAboutData *aboutData()const + { return myAboutData; }; + +public slots: + void configChanged(); + void openHtml1(); + void openHtml2(); + void startBab(); + void startKRuler(); + void sliderButtonRedChanged(int); + void sliderButtonGreenChanged(int); + void sliderButtonBlueChanged(int); + void sliderBrushRedChanged(int); + void sliderBrushGreenChanged(int); + void sliderBrushBlueChanged(int); + virtual void save(); + virtual void defaults(); + +signals: + void changed(bool); + void editApp(QString, QString); + +protected: + bool eventFilter( QObject* o, QEvent* e ); + +private: + QString crNotes[3]; + AppSetter *appsetter; + KListView *applist; + QImage* tintButton(QImage &src, QColor c); + QImage* tintBrush( QImage &img, QColor c/*, int saturation*/ ); + WId findWindow(); + KAboutData *myAboutData; + Config *dialog_; + Help* help_; + About* about_; + QImage baseImage, baseImage2; + QDialog *grabber; + QColor buttonColor; + QColor brushTint; + int sliderButtonRedValue, sliderButtonGreenValue, sliderButtonBlueValue; + int sliderBrushRedValue, sliderBrushGreenValue, sliderBrushBlueValue/*, sliderBrushSaturationValue*/; + bool loadDone; + bool menuReplaced; + QTimer *timer; + int crCurrent; +private slots: + void updateCR(); + void showAbout(); + void editApp(); + void addApp(QString, QString); + void removeApp(); + void removeApp(QString); + void setDesign(int); + void menuToggled(bool); + void enableInButtonColor(int d); + void enableMenuColorStuff(int d); + void buttonLoadAction(); + void buttonSaveAsAction(); + void setPresetColor(int i); + void selectWindow(); + void changeTooluttonHighlightColor(const QColor &); + void handleButtonStyles(int i); +}; + +class ColorDialog; + +class AppSetter : public QWidget +{ +Q_OBJECT +public: + AppSetter(QWidget *parent=0, const char *name=0); + ~AppSetter(); +public slots: + void show(); + void show(QString appName, QString link); + +private: + bool isEdit; + int index_; + int colors[8]; + QString oldName; + QString oldLink; + QLineEdit *command; + QComboBox *link; + QGroupBox *box; + QComboBox *style; + QComboBox *deco; + QComboBox *buttons; + QComboBox *toolButtons; + QComboBox *tabs; + QComboBox *inbutton; + QCheckBox *scanlines; + QCheckBox *customColors; + QPushButton *buttonColors; + ColorDialog *colorDialog; + +signals: + void addApp(QString, QString); + void removeApp(QString); + +private slots: + void save(); + void reset(); + void handler(int); + void updateColors(); + void resetColorPicker(); + void handleButtonStyles(int i); +}; + +#endif diff --git a/configure.files b/configure.files new file mode 100644 index 0000000..09c5968 --- /dev/null +++ b/configure.files @@ -0,0 +1,5 @@ +./admin/configure.in.min +configure.in.in +./kickermenu/configure.in.in +./sidebar/configure.in.in +./style/configure.in.in diff --git a/configure.in.in b/configure.in.in new file mode 100644 index 0000000..778345c --- /dev/null +++ b/configure.in.in @@ -0,0 +1,6 @@ +#MIN_CONFIG(3.0.0) +KDE_USE_QT(3.3.0) + +AM_INIT_AUTOMAKE(baghira, cvs) +AC_C_BIGENDIAN +AC_CHECK_KDEMAXPATHLEN diff --git a/deco/Doxyfile b/deco/Doxyfile new file mode 100644 index 0000000..f90d99c --- /dev/null +++ b/deco/Doxyfile @@ -0,0 +1,247 @@ +# Doxyfile 1.3.5-KDevelop + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +PROJECT_NAME = baghira_deco.kdevelop +PROJECT_NUMBER = $VERSION$ +OUTPUT_DIRECTORY = +OUTPUT_LANGUAGE = English +USE_WINDOWS_ENCODING = NO +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +DISTRIBUTE_GROUP_DOC = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +HIDE_UNDOC_MEMBERS = NO +HIDE_UNDOC_CLASSES = NO +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /home/thomas/Desktop/baghira-deco-2/client +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.C \ + *.H \ + *.tlh \ + *.diff \ + *.patch \ + *.moc \ + *.xpm \ + *.dox +RECURSIVE = yes +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = yes +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = NO +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +MAX_DOT_GRAPH_WIDTH = 1024 +MAX_DOT_GRAPH_HEIGHT = 1024 +MAX_DOT_GRAPH_DEPTH = 1000 +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/deco/Makefile.am b/deco/Makefile.am new file mode 100644 index 0000000..6d435f2 --- /dev/null +++ b/deco/Makefile.am @@ -0,0 +1,28 @@ +AUTOMAKE_OPTIONS = foreign + +SUBDIRS = config + +KDE_CXXFLAGS = -DQT_PLUGIN + +INCLUDES = $(all_includes) -I$(kde_includes)/kwin + +kwindir = $(kde_datadir)/kwin/ +kwin_DATA = baghira.desktop + +EXTRA_DIST = $(kwin_DATA) images + +noinst_HEADERS = baghiraclient.h pixmaps.h masks.h + +kde_module_LTLIBRARIES = kwin3_baghira.la +kwin3_baghira_la_SOURCES = baghiraclient.cc +kwin3_baghira_la_LIBADD = $(kde_libraries)/libkdecorations.la +kwin3_baghira_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -lkdecore -module +kwin3_baghira_la_METASOURCES = AUTO + +DISTCLEANFILES = $(kwin3_baghira_la_METASOURCES) + +pixmaps.h: $(srcdir)/generatePixmaps.sh + $(SHELL) $(srcdir)/generatePixmaps.sh $(top_srcdir) +CLEANFILES = pixmaps.h +baghiraclient.lo: pixmaps.h + diff --git a/deco/baghira.desktop b/deco/baghira.desktop new file mode 100644 index 0000000..1514386 --- /dev/null +++ b/deco/baghira.desktop @@ -0,0 +1,5 @@ +# KDE Desktop Entry +[Desktop Entry] +Encoding=UTF-8 +Name=Baghira +X-KDE-Library=kwin3_baghira diff --git a/deco/baghiraclient.cc b/deco/baghiraclient.cc new file mode 100644 index 0000000..30d6c8d --- /dev/null +++ b/deco/baghiraclient.cc @@ -0,0 +1,2636 @@ +////////////////////////////////////////////////////////////////////////////// +// baghiraclient.h +// ------------------- +// Baghira window decoration for KDE +// ------------------- +// Copyright (c) 2004, 2005 Thomas Lübking +// Please see the header file for copyright and license information. +////////////////////////////////////////////////////////////////////////////// + +// #include <kconfig.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <kimageeffect.h> +#include <klocale.h> +#include <kpixmapeffect.h> +#include <kwin.h> +#include <kwinmodule.h> +#include <qapplication.h> +#include <qbitmap.h> +#include <qcursor.h> +#include <qdir.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qpainter.h> +#include <qtimer.h> +#include <qtooltip.h> +#include <qsettings.h> +#include <stdio.h> + +#include <X11/Xatom.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/extensions/shape.h> +#include "baghiraclient.h" +#include "pixmaps.h" +#include "masks.h" +#include "config.h" + +#define COLOR_SPACE(R,G,B) \ + if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \ + if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \ + if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255; + +#define SATURATION_COLOR(R,G,B) \ + grey = (299 * R + 587 * G + 114 * B) / 1000; \ + delta = 255 - grey; \ + grey = (grey *(10 - 5)) / 10; \ + iGrey = 255 - grey;\ + destR = (iGrey * (srcR - delta) + grey * R) / 255; \ + destG = (iGrey * (srcG - delta) + grey * G) / 255; \ + destB = (iGrey * (srcB - delta) + grey * B) / 255; + +#define CLAMP(x,l,u) x < l ? l :\ + x > u ? u :\ + x + +#define SATURATION_COLOR2(S,R,G,B,cR,cG,cB) \ + int max = 255+0.65*(100-S); \ + destR = CLAMP((cR + R - 128), 0, max); \ + destG = CLAMP((cG + G - 128), 0, max); \ + destB = CLAMP((cB + B - 128), 0, max); \ + destR = (S*destR + (100-S)*R)/100; \ + destG = (S*destG + (100-S)*G)/100; \ + destB = (S*destB + (100-S)*B)/100; + +using namespace Baghira; + +static const int BUTTONSIZE = 15; +static const int MENUBUTTONWIDTH = 20; +static const int DECOSIZE = 8; +int TITLESIZE;// = 26; +static const int TITLESIZESMALL = 18; +static const int MARGIN = 6; + +////////////////////////////////////////////////////////////////////////////// +// BaghiraFactory Class // +////////////////////////////////////////////////////////////////////////////// + +bool BaghiraFactory::initialized_ = false; +Baghira::TitlebarType BaghiraFactory::effect_[5][2]; +Qt::AlignmentFlags BaghiraFactory::titlealign_; +QColor BaghiraFactory::colors_[5][ ColorTypeCount ][ 2 ]; +KPixmap BaghiraFactory::pix_[5][ PixmapTypeCount ][ 2 ][ 2 ]; +int BaghiraFactory::bordersize_[5] = {0,0,6,0,0};//{BorderTiny, BorderTiny, BorderVeryHuge}; +QPixmap BaghiraFactory::ButtonPixmap_[5][WindowStateAmount][ButtonTypeAmount][ButtonStateAmount][2]; +QColor BaghiraFactory::brushedMetalColor; +QColor BaghiraFactory::ButtonColor_[ButtonTypeAmount+1]; +QPixmap BaghiraFactory::nostalgia_[5][3][2]; +int BaghiraFactory::contrast_; +int BaghiraFactory::_3DImpact_[5]; +int BaghiraFactory::LineImpact_[5]; +bool BaghiraFactory::bgStipple_; +bool BaghiraFactory::comicFrame_; +bool BaghiraFactory::addAutoSpacing_; +bool BaghiraFactory::maxResizable_; +bool BaghiraFactory::shape_ul[5]; +bool BaghiraFactory::shape_ur[5]; +bool BaghiraFactory::shape_ll[5]; +bool BaghiraFactory::shape_lr[5]; +bool BaghiraFactory::allowEasyClosing_; +bool BaghiraFactory::resizeGrip_; +uint BaghiraFactory::defaultMode_; +bool BaghiraFactory::drawIcon_[5]; +bool BaghiraFactory::tintBrush_; +bool BaghiraFactory::showTitle_; +QColor BaghiraFactory::brushTint; +int BaghiraFactory::minimumTitleHeight_; +ButtonStyle BaghiraFactory::buttonStyle_[5]; + +QBitmap BaghiraFactory::helpMask; +QBitmap BaghiraFactory::jaguarDownMask; +QBitmap BaghiraFactory::jaguarMenuDownMask; +QBitmap BaghiraFactory::jaguarMenuMask; +QBitmap BaghiraFactory::jaguarMask; +QBitmap BaghiraFactory::milkMenuDownMask; +QBitmap BaghiraFactory::milkMenuMask; +QBitmap BaghiraFactory::milkMask; +QBitmap BaghiraFactory::pantherMenuMask; +QBitmap BaghiraFactory::pantherMask; +QBitmap BaghiraFactory::milkDownMask; +QBitmap BaghiraFactory::arrowUp; +QBitmap BaghiraFactory::arrowDown; +DeMaximizer BaghiraFactory::deMaximizer_; +bool BaghiraFactory::fullSpec_; +bool BaghiraFactory::noModalDeco_; +bool BaghiraFactory::delAppname_; + +Atom baghira_deco_design = XInternAtom(qt_xdisplay(), "BAGHIRA_DECO_DESIGN", False); + +extern "C" KDecorationFactory* create_factory() { + return new Baghira::BaghiraFactory(); +} + +DeMaximizer::DeMaximizer() : QWidget(0, "deMaximizer", Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WX11BypassWM ) +{ + client_ = 0L; + setFixedSize(16,16); + setMouseTracking(TRUE); + setAutoMask(TRUE); + move(QApplication::desktop()->availableGeometry().right()-17,QApplication::desktop()->availableGeometry().top()+2); + setBackgroundMode( NoBackground ); +// setBackgroundMode (Qt::X11ParentRelative); +// setPaletteBackgroundColor(Qt::green); +} + +void DeMaximizer::mouseReleaseEvent( QMouseEvent *) +{ + hasMouse()?setState(1):setState(0); + if (client_) client_->demaxButtonPressed(); +} + +void DeMaximizer::mousePressEvent ( QMouseEvent *) +{ + setState(2); +} + +void DeMaximizer::enterEvent ( QEvent *) +{ + setState(1); +} + +void DeMaximizer::leaveEvent ( QEvent *) +{ + setState(0); +} + +void DeMaximizer::setState(int i) +{ + erase(); + QPainter p(this); + p.drawPixmap(0,0,pixmap[i]); + p.end(); +} + +void DeMaximizer::setPixmap(int i, QImage &image ) +{ + pixmap[i] = QPixmap(image); +} + + +void DeMaximizer::setClient(BaghiraClient *client) +{ + if (client_) + { + QObject::disconnect ( client_, SIGNAL(hide()), this, SLOT(hide()) ); + client_ = 0L; + } + if (client) + { + client_ = client; + connect ( client_, SIGNAL(hide()), SLOT(hide()) ); + setState(0); + } +// repaint(); +} + +#if KDE_IS_VERSION(3,3,91) +////////////////////////////////////////////////////////////////////////////// +// ResizeHandle() +// --------------- +// Constructor +ResizeHandle::ResizeHandle(BaghiraClient * parent) : QWidget(parent->widget(), 0, 0) +{ + if (!parent->widget()) + return; + client = parent; + setCursor(QCursor(Qt::SizeFDiagCursor)); + setFixedSize(16,16); + updateLook(FALSE); + WId root, daddy = 0; + WId *kids = 0L; + uint numKids = 0; + XQueryTree(qt_xdisplay(), parent->windowId(), &root, &daddy, &kids, &numKids); + if (daddy) + XReparentWindow( qt_xdisplay(), winId(), daddy, 0, 0 ); + else return; + move(client->width()-2*BaghiraFactory::borderSize(parent->currentStyle)-16,client->height()-client->titleheight_-16); + shape(); + parent->widget()->installEventFilter(this); + raise(); + show(); +} + +void ResizeHandle::updateLook(bool rp) +{ + pix = QPixmap(16,16); + QPainter p(&pix); + p.fillRect(pix.rect(), BaghiraFactory::effect(client->currentStyle, client->isActive()) == Baghira::Brushed ? BaghiraFactory::BrushedMetalColor().light(110):paletteBackgroundColor()); + p.setPen( BaghiraFactory::effect(client->currentStyle, client->isActive()) == Baghira::Brushed ? Qt::black:paletteForegroundColor() ); + p.drawLine(0,16,16,0); + p.drawLine(4,16,16,4); + p.drawLine(8,16,16,8); + p.drawLine(12,16,16,12); + p.end(); + setPaletteBackgroundPixmap(pix); + if (rp) repaint(); +} + +void ResizeHandle::shape() +{ + XRectangle* xrects = new XRectangle[16]; + for (int i = 0; i < 16; i++) + { + xrects[ i ].x = 15-i; + xrects[ i ].y = i; + xrects[ i ].width = i+1; + xrects[ i ].height = 1; + } + XShapeCombineRectangles( qt_xdisplay(), winId(), ShapeBounding, 0, 0, + xrects, 16, ShapeSet, 0 ); + delete[] xrects; +} + +bool ResizeHandle::eventFilter(QObject *obj, QEvent *e) +{ + if ( obj != parent() ) + return false; + if ( e->type() == QEvent::Resize) + { + if (client->maximizeMode() == BaghiraClient::MaximizeFull) + move(client->width() - 16, client->height() - client->titleheight_ - 16); + else + move(client->width() - 2*BaghiraFactory::borderSize(client->currentStyle) - 16, client->height() - client->titleheight_ - BaghiraFactory::borderSize(client->currentStyle) - 16); +// shape(); + return FALSE; + } + return FALSE; +} + +void ResizeHandle::mousePressEvent ( QMouseEvent * ) +{ + client->performWindowOperation(/*Unrestricted*/KDecoration::ResizeOp); +} +void ResizeHandle::mouseReleaseEvent ( QMouseEvent * ) +{ + client->performWindowOperation(KDecoration::NoOp); + repaint(TRUE); +} +void ResizeHandle::paintEvent ( QPaintEvent * ) +{ + QPainter p(this); + p.drawPixmap(0,0,pix); +} + +#endif + +////////////////////////////////////////////////////////////////////////////// +// BaghiraFactory() +// --------------- +// Constructor + +BaghiraFactory::BaghiraFactory() { + helpMask = QBitmap( 14, 15, help_bits, true ); + jaguarDownMask = QBitmap( 14, 15, jaguar2_bits, true ); + jaguarMenuDownMask = QBitmap( 20, 15, jaguar_menu_down_bits, true ); + jaguarMenuMask = QBitmap( 20, 15, jaguar_menu_bits, true ); + jaguarMask = QBitmap( 14, 15, jaguar_bits, true ); + milkMenuDownMask = QBitmap( 20, 15, milk_menu_down_bits, true ); + milkMenuMask = QBitmap( 20, 15, milk_menu_bits, true ); + milkMask = QBitmap( 14, 15, milk_bits, true ); + pantherMenuMask = QBitmap( 20, 15, panther_menu_bits, true ); + pantherMask = QBitmap( 14, 15, panther_bits, true ); + milkDownMask = QBitmap( 14, 15, milk_pressed_bits, true ); + arrowUp = QBitmap( 8, 4, arrowUp_bits, true ); + arrowUp.setMask( arrowUp ); + arrowDown = QBitmap( 8, 4, arrowDown_bits, true ); + arrowDown.setMask( arrowDown ); + readConfig(); + createPixmaps(); + initialized_ = true; +} + +////////////////////////////////////////////////////////////////////////////// +// ~BaghiraFactory() +// ---------------- +// Destructor + +BaghiraFactory::~BaghiraFactory() +{ + deMaximizer_.setClient(NULL); + initialized_ = false; +} + +////////////////////////////////////////////////////////////////////////////// +// createDecoration() +// ------------------ +// Create the decoration + +KDecoration* BaghiraFactory::createDecoration( KDecorationBridge* b ) { + return new BaghiraClient( b, this ); +} + +////////////////////////////////////////////////////////////////////////////// +// reset() +// ------- +// Reset the handler. Returns true if decorations need to be remade + +QString BaghiraFactory::indexedString(QString s, int i){ + QString result; + result.setNum(i+1); + result.prepend("_"); + result.prepend(s); +// qWarning("%s",result.ascii()); + return result; +} + +bool BaghiraFactory::reset( unsigned long changed ) { + initialized_ = false; + changed |= readConfig(); + if ( changed & ( SettingColors | SettingDecoration | SettingBorder ) ) { + createPixmaps(); + } + initialized_ = true; + + if ( changed & ( SettingColors | SettingDecoration | SettingFont | + SettingButtons | SettingBorder ) ) { + return true; + } else { + resetDecorations( changed ); + return false; + } +} + +////////////////////////////////////////////////////////////////////////////// +// readConfig() +// ------------ +// Read in the configuration file + +unsigned long BaghiraFactory::readConfig() { + + QSettings config; + config.beginGroup("/baghira/Style"); +// KConfig config( "baghirarc" ); +// config.setGroup( "Style" ); + bgStipple_ = config.readBoolEntry( "Design_StippleBackground", false); + contrast_ = config.readNumEntry( "Design_StippleContrast", 30 ); + tintBrush_ = config.readBoolEntry( "Colors_TintBrushedMetal", false ); + if (tintBrush_) + brushTint.setRgb( config.readNumEntry( "Colors_BrushTint")); + + QColor oldcolor; + unsigned long changed = 0; + oldcolor = colors_[3][ Baghira::ColorTitleBar ][ false ]; + colors_[3][ Baghira::ColorTitleBar ][ false ] = qApp->palette().active().background(); + if ( oldcolor != colors_[3][ Baghira::ColorTitleBar ][ false ] ) + changed |= SettingColors; + + oldcolor = colors_[3][ Baghira::ColorTitleBlend ][ false ]; + colors_[3][ Baghira::ColorTitleBlend ][ false ] = colors_[3][ Baghira::ColorTitleBar ][ false ].dark(100 + config.readNumEntry( "Design_StippleContrast", 3)); + if ( oldcolor != colors_[3][ Baghira::ColorTitleBlend ][ false ] ) + changed |= SettingColors; + + config.endGroup(); + config.beginGroup( "/baghira/Deco" ); + + + // common settings + + bool oldNoModalDeco = noModalDeco_; + noModalDeco_ = config.readBoolEntry( "NoModalDeco", false ); + if (oldNoModalDeco != noModalDeco_) + changed |= SettingDecoration; + + bool oldDelAppname = delAppname_; + delAppname_ = config.readBoolEntry( "RemoveAppname", true ); + if (oldDelAppname != delAppname_) + changed |= SettingDecoration; + + int oldMinTH = minimumTitleHeight_; + minimumTitleHeight_ = (ButtonStyle) config.readNumEntry( "minimumTitleHeight", 18 ); + if ( oldMinTH != minimumTitleHeight_ ) + { + QFontMetrics fm(options()->font(true, false)); + TITLESIZE = QMAX(minimumTitleHeight_, fm.height()); + changed |= SettingFont; + changed |= SettingDecoration; + } + + bool allowEasyClosing__ = allowEasyClosing_; + allowEasyClosing_ = config.readBoolEntry( "allowEasyClosing", false ); + if ( allowEasyClosing__ != allowEasyClosing_ ) + changed |= SettingDecoration; + + bool resizeGrip__ = resizeGrip_; + resizeGrip_ = config.readBoolEntry( "ResizeGrip", false ); + if ( resizeGrip__ != resizeGrip_ ) + changed |= SettingDecoration; + + bool defaultMode__ = defaultMode_; + defaultMode_ = config.readNumEntry( "defaultMode", 1 ); + if ( defaultMode__ != defaultMode_ ) + changed |= SettingDecoration; + + Qt::AlignmentFlags oldalign = titlealign_; + QString value = config.readEntry( "TitleAlignment", "AlignHCenter" ); + showTitle_ = TRUE; + if ( value == "AlignLeft" ) + titlealign_ = Qt::AlignLeft; + else if ( value == "AlignHCenter" ) + titlealign_ = Qt::AlignHCenter; + else if ( value == "AlignRight" ) + titlealign_ = Qt::AlignRight; + else if ( value == "noTitle" ) + { + showTitle_ = FALSE; + titlealign_ = Qt::AlignAuto; + } + if ( oldalign != titlealign_ ) + changed |= SettingFont; + + bool oldComic = comicFrame_; + comicFrame_ = config.readBoolEntry( "DrawComicFrame", false ); + if ( oldComic != comicFrame_ ) + changed |= SettingBorder; changed |= SettingDecoration; + + bool oldAutoSpacing = addAutoSpacing_; + addAutoSpacing_ = config.readBoolEntry( "AddAutoSpacing", true ); + if ( oldAutoSpacing != addAutoSpacing_ ) + changed |= SettingDecoration; + + bool oldMaxResizable = maxResizable_; + maxResizable_ = config.readBoolEntry( "MaxResizable", true ); + if ( oldMaxResizable != maxResizable_ ) + changed |= SettingDecoration; + + bool oldSpec = fullSpec_; + fullSpec_ = config.readBoolEntry( "FullSpec", false ); + if ( oldSpec != fullSpec_ ) + changed |= SettingDecoration; + + // custom settings + + for (int i = 0; i < 5; i++){ + + int oldbordersize = bordersize_[i]; + bordersize_[i] = config.readNumEntry( indexedString("BorderSize",i), i == 2 ? 6 : 0 ); + if ( oldbordersize != bordersize_[i] ) + changed |= SettingBorder; + + ButtonStyle oldButtons = buttonStyle_[i]; + buttonStyle_[i] = (ButtonStyle) config.readNumEntry( indexedString("ButtonStyle",i), i == 0 ? 1 : 0 ); + if ( oldButtons != buttonStyle_[i] ) + changed |= SettingDecoration; + + + bool oldShUL = shape_ul[i]; + shape_ul[i] = config.readBoolEntry( indexedString("ShapeUL",i), true ); + if ( oldShUL != shape_ul[i] ){ + changed |= SettingBorder; changed |= SettingDecoration; + } + + bool oldShUR = shape_ur[i]; + shape_ur[i] = config.readBoolEntry( indexedString("ShapeUR",i), true ); + if ( oldShUR != shape_ur[i] ){ + changed |= SettingBorder; changed |= SettingDecoration; + } + + bool oldShLL = shape_ll[i]; + shape_ll[i] = config.readBoolEntry( indexedString("ShapeLL",i), i == 2 ); + if ( oldShLL != shape_ll[i] ){ + changed |= SettingBorder; changed |= SettingDecoration; + } + + bool oldShLR = shape_lr[i]; + shape_lr[i] = config.readBoolEntry( indexedString("ShapeLR",i), i == 2 ); + if ( oldShLR != shape_lr[i] ){ + changed |= SettingBorder; changed |= SettingDecoration; + } + + + bool oldDrawIcon_ = drawIcon_[i]; + drawIcon_[i] = config.readBoolEntry( indexedString("drawIcon",i), true ); + if ( oldDrawIcon_ = drawIcon_[i] ) + changed |= SettingFont; + changed |= SettingDecoration; + + if (i != 3) + { + Baghira::TitlebarType oldeffect = effect_[i][1]; + effect_[i][1] = ( Baghira::TitlebarType ) config.readNumEntry( indexedString("TitleEffect",i), i == 0 ? Baghira::Stipples : (i == 1 || i == 4) ? Baghira::Gradient : Baghira::Brushed); + // qWarning("%d",effect_[i]); + if ( oldeffect != effect_[i][1] ) + changed |= SettingDecoration; + + oldeffect = effect_[i][0]; + effect_[i][0] = ( Baghira::TitlebarType ) config.readNumEntry( indexedString("inactiveTitleEffect",i), i == 0 ? Baghira::Stipples : (i == 1 || i == 4) ? Baghira::Gradient : Baghira::Brushed); + // qWarning("%d",effect_[i]); + if ( oldeffect != effect_[i][0] ) + changed |= SettingDecoration; + + int oldLineImpact = LineImpact_[i]; + LineImpact_[i] = config.readNumEntry( indexedString("LineImpact",i), i == 2 ? 0 : 40 ); + if ( oldLineImpact != LineImpact_[i] ) + changed |= SettingDecoration; + + oldcolor = colors_[i][ Baghira::ColorTitleBar ][ false ]; + colors_[i][ Baghira::ColorTitleBar ][ false ].setRgb((unsigned int)config.readNumEntry( indexedString("inactiveColor1",i), i == 0 ? QColor(204,214,230).rgb() : i == 1 ? QColor(246,242,246).rgb() : i == 3 ? QColor(200,200,200).rgb() : QColor(230,230,230).rgb())); + if ( oldcolor != colors_[i][ Baghira::ColorTitleBar ][ false ] ) + changed |= SettingColors; + + oldcolor = colors_[i][ Baghira::ColorTitleBlend ][ false ]; + colors_[i][ Baghira::ColorTitleBlend ][ false ].setRgb((unsigned int)config.readNumEntry( indexedString("inactiveColor2",i), i == 0 ? QColor(194,196,211).rgb() : i == 1 ? QColor(238,238,238).rgb() : i == 3 ? QColor(150,150,150).rgb() : QColor(250,250,250).rgb())); + if ( oldcolor != colors_[i][ Baghira::ColorTitleBlend ][ false ] ) + changed |= SettingColors; + } + else + { + effect_[3][1] = Baghira::Gradient; + effect_[3][0] = Baghira::FlatStipples; + LineImpact_[3] = 0; + } + + int old3DImpact = _3DImpact_[i]; + _3DImpact_[i] = config.readNumEntry( indexedString("3DImpact",i), 20 ); + if ( old3DImpact != _3DImpact_[i] ) + changed |= SettingDecoration; + + oldcolor = colors_[i][ Baghira::ColorTitleBar ][ true ]; + colors_[i][ Baghira::ColorTitleBar ][ true ].setRgb((unsigned int)config.readNumEntry( indexedString("activeColor1",i), i == 0 ? QColor(255,255,255).rgb() : i == 1 ? QColor(238,238,238).rgb() : i == 2 ? QColor(202,202,202).rgb() : i == 3 ? QColor(238,238,238).rgb() : QColor(250,250,250).rgb())); + if ( oldcolor != colors_[i][ Baghira::ColorTitleBar ][ true ] ) + changed |= SettingColors; + + oldcolor = colors_[i][ Baghira::ColorTitleBlend ][ true ]; + colors_[i][ Baghira::ColorTitleBlend ][ true ].setRgb((unsigned int)config.readNumEntry( indexedString("activeColor2",i), i == 0 ? QColor(238,234,238).rgb() : i == 1 ? QColor(205,202,205).rgb() : i == 2 ? QColor(150,150,150).rgb() : i == 3 ? QColor(211,208,211).rgb() : QColor(230,230,230).rgb())); + if ( oldcolor != colors_[i][ Baghira::ColorTitleBlend ][ true ] ) + changed |= SettingColors; + + } + + oldcolor = ButtonColor_[MinButton]; + ButtonColor_[MinButton].setRgb((unsigned int)config.readNumEntry( "MinButtonColor", QColor(230,155,40).rgb() )); + if ( oldcolor != ButtonColor_[MinButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[MaxButton]; + ButtonColor_[MaxButton].setRgb((unsigned int)config.readNumEntry( "MaxButtonColor", QColor(121,180,54).rgb() )); + if ( oldcolor != ButtonColor_[MaxButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[CloseButton]; + ButtonColor_[CloseButton].setRgb((unsigned int)config.readNumEntry( "CloseButtonColor", QColor(200,85,70).rgb() )); + if ( oldcolor != ButtonColor_[CloseButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[StickyButton]; + ButtonColor_[StickyButton].setRgb((unsigned int)config.readNumEntry( "StickyButtonColor", QColor(74,140,242).rgb() )); + if ( oldcolor != ButtonColor_[StickyButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[AboveBelowButton]; + ButtonColor_[AboveBelowButton].setRgb((unsigned int)config.readNumEntry( "AboveButtonColor", QColor(74,140,242).rgb() )); + if ( oldcolor != ButtonColor_[AboveBelowButton] ) + changed |= SettingColors; + oldcolor = ButtonColor_[ShadeButton]; + ButtonColor_[ShadeButton].setRgb((unsigned int)config.readNumEntry( "ShadeButtonColor", QColor(74,140,242).rgb() )); + if ( oldcolor != ButtonColor_[ShadeButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[MenuButton]; + ButtonColor_[MenuButton].setRgb((unsigned int)config.readNumEntry( "MenuButtonColor", QColor(74,140,242).rgb() )); + if ( oldcolor != ButtonColor_[MenuButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[HelpButton]; + ButtonColor_[HelpButton].setRgb((unsigned int)config.readNumEntry( "HelpButtonColor", QColor(0,0,0).rgb() )); + if ( oldcolor != ButtonColor_[HelpButton] ) + changed |= SettingColors; + + oldcolor = ButtonColor_[InactiveButton]; + ButtonColor_[InactiveButton].setRgb((unsigned int)config.readNumEntry( "InactiveButtonColor", QColor(255,255,255).rgb() )); + if ( oldcolor != ButtonColor_[InactiveButton] ) + changed |= SettingColors; + + + config.endGroup(); + return changed; +} + +QImage* BaghiraFactory::tintGlossy( const QImage &src, const QColor &c ) const +{ + QImage *dest = new QImage( src.width(), src.height(), 32); + dest->setAlphaBuffer( true ); + unsigned int *data = ( unsigned int * ) src.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = src.width() * src.height(); + int u3rd = src.width()*4; + int red, green, blue; + int destR, destG, destB, alpha; + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + int hue, s, v; + c.getHsv( &hue, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + // float srcPercent, destPercent; + for ( int current = 0 ; current < total ; ++current ) { + alpha = qAlpha( data[ current ] ); + if (alpha < 230){ + destData[ current ] = data[ current ]; + continue; //do not handle translucent parts to not affect blending + } + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + blue = qBlue( data[ current ] ); + if ( current > u3rd || red < 223 ){ + SATURATION_COLOR2(sq, red, green, blue, srcR, srcG, srcB) + } else { + SATURATION_COLOR2(sq, red, green, blue, 255, 255, 255); + } + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} + +QImage* BaghiraFactory::tintBrush( const QImage &img, const QColor &c ) const +{ + +// if ( img.depth() != 32 ) +// img = img.convertDepth( 32 ); + QImage *dest = new QImage( img.width(), img.height(), 32); + unsigned int *data = ( unsigned int * ) img.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = img.width() * img.height(); + int current; + int delta; + int red, green, blue, grey, iGrey; + int destR, destG, destB, alpha; + + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + + SATURATION_COLOR(180, 180, 180); + COLOR_SPACE(destR, destG, destB); + brushedMetalColor = QColor(destR, destG, destB); + + // float srcPercent, destPercent; + for ( current = 0 ; current < total ; ++current ) { + alpha = qAlpha( data[ current ] ); + blue = qBlue( data[ current ] ); + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + SATURATION_COLOR(red, green, blue); + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} + +void BaghiraFactory::createOS8Buttons(int style){ + QPainter p; + QColor initColor; + for ( int active = 0; active <= 1; ++active ){ + for (int t = 0; t < 3; t++){ + initColor = QColor(color(style, Baghira::ColorTitleBar, active ).dark(100 + t*15)); + nostalgia_[style][t][active] = QPixmap(BUTTONSIZE, BUTTONSIZE); + p.begin(&nostalgia_[style][t][active]); + p.setPen(color(style, Baghira::ColorTitleBar, active )); + p.drawPoint(0,BUTTONSIZE-1); + p.drawPoint(BUTTONSIZE-1,0); + p.setPen(initColor); + // dark color + // outer relief =============================== + p.drawLine(0,0,0,BUTTONSIZE-2); + p.drawLine(0,0,BUTTONSIZE-2,0); + // ============================================= + // inner relief ================================ + if (t < 2){ + p.drawLine(3,BUTTONSIZE-3,BUTTONSIZE-3,BUTTONSIZE-3); + p.drawLine(BUTTONSIZE-3,3,BUTTONSIZE-3,BUTTONSIZE-3); + } + else{ + p.drawLine(2,2,2,BUTTONSIZE-4); + p.drawLine(2,2,BUTTONSIZE-4,2); + } + // ======================================== + for (int i = 0; i < BUTTONSIZE - 6; i++){ + if (i == BUTTONSIZE - 7){ + p.drawPoint(2, BUTTONSIZE - 3); + p.drawPoint(BUTTONSIZE - 3, 2); + } + for (int j = 0; j < i+1; j++){ + p.setPen(initColor.light(100 + (i + j)*3)); + p.drawPoint(i+3,j+3); + if (i != j) p.drawPoint(j+3,i+3); + } + } + // Color is now Bright ;-) + // inner relief =============================== + if (t < 2){ + p.drawLine(2,2,2,BUTTONSIZE-4); + p.drawLine(2,2,BUTTONSIZE-4,2); + } + else{ + p.drawLine(3,BUTTONSIZE-3,BUTTONSIZE-3,BUTTONSIZE-3); + p.drawLine(BUTTONSIZE-3,3,BUTTONSIZE-3,BUTTONSIZE-3); + } + // ================================ + // outer relief ====================================== + p.drawLine(1,BUTTONSIZE-1,BUTTONSIZE-1,BUTTONSIZE-1); + p.drawLine(BUTTONSIZE-1,1,BUTTONSIZE-1,BUTTONSIZE-1); + //================================== + // black frame + p.setPen(Qt::black); + p.drawRect(1,1,BUTTONSIZE-2,BUTTONSIZE-2); + p.end(); + } + } +} + +QPixmap &BaghiraFactory::ButtonPixmap( Baghira::WindowState wState, + Baghira::ButtonType type, Baghira::ButtonState state, int style, bool small ) { + return ButtonPixmap_[style][ wState ][ type ][ state ][small]; +} + +QImage* BaghiraFactory::DecoImage( QPixmap *pix, int x, int y, int width, int height ) { + QPixmap tmpPix( width, height ); + bitBlt ( &tmpPix, 0, 0, pix, x, y, width, height ); + QImage *returnImage = new QImage( tmpPix.convertToImage() ); + return returnImage; +} + +/////////////////////////////////////////////////////////////////////////// +// createGradient() +// ---------------- +// Create a gradient + +void BaghiraFactory::createGradient(KPixmap &pix, const QColor &light, const QColor &dark, Baghira::TitlebarType effect) +{ + if (pix.width() == 0) return; + + QPainter p; + switch( effect ){ + case Baghira::Stipples: + KPixmapEffect::unbalancedGradient(pix, light, light.dark(110), KPixmapEffect::VerticalGradient, 0); + p.begin(&pix); + p.setPen(dark); + for( int i = 0; i < pix.height(); i+=4 ){ + p.drawLine(0,i,pix.width(),i); + p.drawLine(0,i+1,pix.width(),i+1); + } + p.end(); + break; + case Baghira::FlatStipples: + { + p.begin(&pix); + p.fillRect(pix.rect(),light); + QColor mid; + mid.setRgb((light.red()+2*dark.red())/3,(light.green()+2*dark.green())/3,(light.blue()+2*dark.blue())/3); + p.setPen(mid); + for( int i = pix.height() - 1; i > 0; i-=4 ) + { + p.drawLine(0,i,pix.width(),i); + p.drawLine(0,i-2,pix.width(),i-2); + } + p.setPen(dark); + for( int i = pix.height() - 2; i > 0; i-=4 ) + { + p.drawLine(0,i,pix.width(),i); + } + p.end(); + break; + } + case Baghira::Nostalgia: + p.begin(&pix); + p.fillRect(pix.rect(),light); + p.setPen(light.light(120)); + for (int i = (pix.height() - 1) / 4; i < (pix.height() - 1) / 4 * 3 + 1; i +=2) + p.drawLine(0,i,pix.width()-1,i); + p.setPen(light.dark(120)); + for (int i = (pix.height() - 1) / 4; i < (pix.height() - 1) / 4 * 3 + 1; i +=2) + p.drawLine(0,i+1,pix.width()-1,i+1); + p.end(); + break; + case Baghira::Gradient: + default: + KPixmapEffect::gradient(pix, light, dark, KPixmapEffect::VerticalGradient, 0); + break; + } +} + +static bool blend( const QImage & upper, const QImage & lower, QImage & output) +// adopted from kimageeffect::blend - what is not endian safe... +{ + if + ( + upper.width() > lower.width() || + upper.height() > lower.height() || + upper.depth() != 32 || + lower.depth() != 32 + ) + return false; + + output = lower.copy(); + + register uchar *i, *o; + register int a; + register int col; + register int w = upper.width(); + int row(upper.height() - 1); + + do + { + i = upper.scanLine(row); + o = output.scanLine(row); + + col = w << 2; + + --col; + + do + { +#ifdef WORDS_BIGENDIAN + while (!(a = i[col-3]) && (col != 3)) +#else + while (!(a = i[col]) && (col != 3)) +#endif + { + --col; --col; --col; --col; + } +#ifndef WORDS_BIGENDIAN + --col; +#endif + o[col] += ((i[col] - o[col]) * a) >> 8; + + --col; + o[col] += ((i[col] - o[col]) * a) >> 8; + + --col; + o[col] += ((i[col] - o[col]) * a) >> 8; + +#ifdef WORDS_BIGENDIAN + --col; +#endif + + } while (col--); + } while (row--); + return true; +} + +////////////////////////////////////////////////////////////////////////////// +// createPixmaps() +// --------------- +// Create all our pixmaps +void BaghiraFactory::createPixmaps() { +// QPainter painter; + QColorGroup group; + QPainter icyAPainter; + QImage tmpResult; + QImage tmpResult2; + QImage tmpDeco; + QImage buttonImage; + QImage btnIcons[MenuButton]; + btnIcons[AboveBelowButton] = QImage(); + // load icon images - useless for nostalgia style, but i assume they'll be used at least once ;) + btnIcons[MinButton] = uic_findImage( "icon_minimize" ); + btnIcons[MaxButton] = uic_findImage( "icon_maximize" ); + btnIcons[CloseButton] = uic_findImage( "icon_close" ); + btnIcons[StickyButton] = uic_findImage( "icon_sticky" ); +// btnIcons[AboveBelowButton] = uic_findImage( "icon_above" ); + btnIcons[ShadeButton] = uic_findImage( "icon_shade" ); + + int B_3 = 0; + int B_6 = 0; +// int bt, bs; + int xoff = 0; + int yoff = 1; + bool brushedMode; + + for (int style = 0; style < 5; style++){ + for ( int active = 0; active <= 1; ++active ) { + for ( int small = 0; small <= 1; ++small ) { + KPixmap &tbar = pix_[style][ TitleBar ][ active ][ small ]; + KPixmap &tcenter = pix_[style][ TitleCenter ][ active ][ small ]; + brushedMode = effect_[style][active] == Baghira::Brushed; + + // create gradients and fills + // if (effect_ == Baghira::Gradient || effect_ == Baghira::Stipples /*|| effect_ == Baghira::Glossy * / + if (effect_[style][active] < Baghira::Glossy || effect_[style][active] == Baghira::FlatStipples){ + // resize pixmap + tbar.resize( 100, small ? TITLESIZESMALL : TITLESIZE ); + createGradient( tbar, color(style, Baghira::ColorTitleBar, active ), color(style, Baghira::ColorTitleBlend, active ), effect_[style][active] ); + } + else if (brushedMode){ + QPixmap brushTile; + QPixmap brushGradient; + if (tintBrush_){ + brushTile = QPixmap(*tintBrush(uic_findImage( "brushed-tile" ), brushTint)); + brushGradient = QPixmap(*tintBrush(uic_findImage( "brushed-gradient" ), brushTint)); + } + else{ + brushTile = uic_findImage( "brushed-tile" ); + brushGradient = uic_findImage( "brushed-gradient" ); + brushedMetalColor = QColor(180,180,180); + } + // resize pixmap + tbar.resize( 256, small ? TITLESIZESMALL : TITLESIZE ); + tcenter.resize( 1024, small ? TITLESIZESMALL : TITLESIZE ); + QPainter painter(&tbar); + painter.drawTiledPixmap( 0,0, tbar.width(), tbar.height(), brushTile ); + painter.end(); + painter.begin(&tcenter); + painter.drawTiledPixmap( 0,0, tcenter.width(), tcenter.height(), brushGradient ); + } + else{ + tbar.resize( 32, small ? TITLESIZESMALL : TITLESIZE); + KPixmap tmp = QPixmap(*tintGlossy(uic_findImage( "deco_glossy" ), color(style, Baghira::ColorTitleBar, active ))); + if (tbar.height() > 18){ + for (int i = 8; i < tbar.height() - 10; i++){ + bitBlt(&tbar, 0, i, &tmp, 0, 8, 32, 1); + } + } + bitBlt(&tbar, 0, tbar.height() - 11, &tmp, 0, 9, 32, 10); + bitBlt(&tbar, 0, 0, &tmp, 0, 0, 32, 8); + } + + switch ( buttonStyle_[style] ) { + + // Load Jaguar Buttons ========================================================================= + + case Jaguar: + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, BUTTONSIZE, BUTTONSIZE ); + + // unpressed buttons + buttonImage = uic_findImage( "button_jaguar"); + + for (int bt = MinButton; bt < MenuButton; bt++){ + for (int bs = ButtonInactive; bs < Pressed; bs++){ + tmpResult2 = *tintGlossy( buttonImage, bs == ButtonInactive ? + ButtonColor_[InactiveButton] : + ButtonColor_[bt] ); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + if (bs > ButtonActive) blend( btnIcons[bt], tmpResult, tmpResult ); + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap( tmpResult ); + } + } + + // pressed buttons // as jaguar buttons shift + buttonImage = uic_findImage( "button_jaguar_down"); + + for (int bt = MinButton; bt < MenuButton; bt++){ + tmpResult2 = *tintGlossy( buttonImage, ButtonColor_[bt].dark(120)); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + KImageEffect::blendOnLower( xoff, yoff, btnIcons[bt], tmpResult); // must shift as well + ButtonPixmap_[style][ active ][ bt ][ Pressed ][small] = QPixmap( tmpResult ); + } + + + // HelpButton + buttonImage = uic_findImage( "icon_help"); + for (int bs = ButtonInactive; bs < ButtonStateAmount; bs++){ + tmpResult2 = *tintGlossy( buttonImage, bs == ButtonInactive ? + ButtonColor_[InactiveButton] : + bs == Hovered ? + ButtonColor_[HelpButton].light(120) : + bs == Pressed ? + ButtonColor_[HelpButton].dark(120) : + ButtonColor_[HelpButton] ); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ HelpButton ][ bs ][small] = QPixmap( tmpResult ); + } + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, MENUBUTTONWIDTH, BUTTONSIZE ); + + // MenuButton + buttonImage = uic_findImage( "button_jaguar_menu"); + for (int bs = ButtonInactive; bs < Pressed; bs++){ + tmpResult2 = *tintGlossy( buttonImage, bs < Hovered ? + ButtonColor_[InactiveButton] : + ButtonColor_[MenuButton] ); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ MenuButton ][ bs ][small] = QPixmap( tmpResult ); + } + + + + // pressed MenuButton // as jaguar buttons shift + buttonImage = uic_findImage( "button_jaguar_menu_down"); + tmpResult2 = *tintGlossy( buttonImage, ButtonColor_[MenuButton].dark(120)); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ MenuButton ][ Pressed ][small] = QPixmap( tmpResult ); + + + break; + + // Load Milk Buttons ========================================================================= + + case Milk: + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, BUTTONSIZE, BUTTONSIZE ); + + // unpressed buttons + buttonImage = uic_findImage( "button_milk"); + + + for (int bt = MinButton; bt < MenuButton; bt++){ + for (int bs = ButtonInactive; bs < Pressed; bs++){ + /*brushedMode ? blend( buttonImage, tmpDeco, tmpResult ) : */blend( buttonImage, tmpDeco, tmpResult ); + if (bs > ButtonActive) blend( btnIcons[bt], tmpResult, tmpResult ); + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap( tmpResult ); + } + } + + // pressed buttons // as pressed milk buttons differ + buttonImage = uic_findImage( "button_milk_down"); + for (int bt = MinButton; bt < MenuButton; bt++){ + /*brushedMode ? blend( buttonImage, tmpDeco, tmpResult ) : */blend( buttonImage, tmpDeco, tmpResult ); + blend( btnIcons[bt], tmpResult, tmpResult ); + ButtonPixmap_[style][ active ][ bt ][ Pressed ][small] = QPixmap( tmpResult ); + } + + // HelpButton + buttonImage = uic_findImage( "icon_help"); + for (int bs = ButtonInactive; bs < ButtonStateAmount; bs++){ + /*brushedMode ? blend( buttonImage, tmpDeco, tmpResult ) : */blend( buttonImage, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ HelpButton ][ bs ][small] = QPixmap( tmpResult ); + } + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, MENUBUTTONWIDTH, BUTTONSIZE ); + + // MenuButton + buttonImage = uic_findImage( "button_milk_menu"); + for (int bs = ButtonInactive; bs < Pressed; bs++){ + /*brushedMode ? blend( buttonImage, tmpDeco, tmpResult ) : */blend( buttonImage, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ MenuButton ][ bs ][small] = QPixmap( tmpResult ); + } + + // pressed MenuButton // as pressed milk buttons differ + buttonImage = uic_findImage( "button_milk_menu_down"); + /*brushedMode ? blend( buttonImage, tmpDeco, tmpResult ) : */blend( buttonImage, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ MenuButton ][ Pressed ][small] = QPixmap( tmpResult ); + + break; + + // Create Nostalgia Buttons ========================================================================= + + case NostalgiaButton: + createOS8Buttons(style); + B_3 = (int)((BUTTONSIZE -1 )/ 3); + B_6 = B_3*2; + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, MENUBUTTONWIDTH, BUTTONSIZE ); + + for (int bt = MinButton; bt < ButtonTypeAmount; bt++){ + for (int bs = ButtonInactive; bs < ButtonStateAmount; bs++){ + if (bs < Hovered) + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap( nostalgia_[style][1][active] ); + else if (bs == Hovered) + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap( nostalgia_[style][0][active] ); + else + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap( nostalgia_[style][2][active] ); + if (bs > ButtonInactive){ + icyAPainter.begin(&ButtonPixmap_[style][ active ][ bt ][ bs ][small]); + icyAPainter.setPen(Qt::black); + if (bt == MinButton){ + icyAPainter.drawLine(2,B_3,BUTTONSIZE - 3,B_3); + icyAPainter.drawLine(2,B_6,BUTTONSIZE - 3,B_6); + icyAPainter.end(); + continue; + } + if (bt == MaxButton){ + icyAPainter.drawLine(2,B_6,B_6,B_6); + icyAPainter.drawLine(B_6,2,B_6,B_6); + icyAPainter.end(); + continue; + } + if (bt == StickyButton){ + icyAPainter.fillRect(BUTTONSIZE/2-1,BUTTONSIZE/2-1,2,2,Qt::black); + icyAPainter.end(); + continue; + } + if (bt == ShadeButton){ + icyAPainter.drawLine(2,B_3,BUTTONSIZE-3,B_3); + icyAPainter.drawLine(2,B_3+3,BUTTONSIZE-3,B_3+3); + icyAPainter.drawLine(2,B_3+6,BUTTONSIZE-3,B_3+6); + icyAPainter.end(); + continue; + } + if (bt == HelpButton){ + QFont tmpFont = QFont(options() ->font( true, false )); + tmpFont.setPixelSize(BUTTONSIZE - 4); + icyAPainter.setFont(tmpFont); + icyAPainter.drawText( 0, 0, BUTTONSIZE, BUTTONSIZE, Qt::AlignHCenter | Qt::AlignVCenter, "?" ); + icyAPainter.end(); + continue; + } + if (bt == MenuButton){ + icyAPainter.drawLine(2,B_3,BUTTONSIZE-3,B_3); + icyAPainter.end(); + + } + icyAPainter.end(); + } + if (bt == MenuButton){ + buttonImage = ButtonPixmap_[style][ active ][ bt ][ bs ][small].convertToImage(); + blend( buttonImage , tmpDeco, tmpDeco ); + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap(tmpDeco); + } + } + } + break; + + // Load Panther Buttons ========================================================================= + + case Panther: + default: + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, BUTTONSIZE, BUTTONSIZE ); + + // unpressed buttons + buttonImage = uic_findImage( "button_panther"); + + for (int bt = MinButton; bt < MenuButton; bt++){ + for (int bs = ButtonInactive; bs < ButtonStateAmount; bs++){ + tmpResult2 = *tintGlossy( buttonImage, bs == ButtonInactive ? + ButtonColor_[InactiveButton] : + bs == Pressed ? + ButtonColor_[bt].dark(120) : + ButtonColor_[bt] ); + if (bs > ButtonActive) blend( btnIcons[bt], tmpResult2, tmpResult2 ); + if (bt == MaxButton && bs > ButtonInactive) deMaximizer_.setPixmap(bs - 1, tmpResult2); + blend( tmpResult2, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ bt ][ bs ][small] = QPixmap( tmpResult ); + } + } + + + // HelpButton + buttonImage = uic_findImage( "icon_help"); + for (int bs = ButtonInactive; bs < ButtonStateAmount; bs++){ + tmpResult2 = *tintGlossy( buttonImage, bs == ButtonInactive ? + ButtonColor_[InactiveButton] : + bs == Hovered ? + ButtonColor_[HelpButton].light(120) : + bs == Pressed ? + ButtonColor_[HelpButton].dark(120) : + ButtonColor_[HelpButton] ); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ HelpButton ][ bs ][small] = QPixmap( tmpResult ); + } + + tmpDeco = *DecoImage( &tbar, 0, ( tbar.height() - BUTTONSIZE ) / 2, MENUBUTTONWIDTH, BUTTONSIZE ); + + // MenuButton + buttonImage = uic_findImage( "button_panther_menu"); + for (int bs = ButtonInactive; bs < ButtonStateAmount; bs++){ + tmpResult2 = *tintGlossy( buttonImage, bs < Hovered ? + ButtonColor_[InactiveButton] : + bs == Pressed ? + ButtonColor_[MenuButton].dark(120) : + ButtonColor_[MenuButton] ); + /*brushedMode ? blend( tmpResult2, tmpDeco, tmpResult ) : */blend( tmpResult2, tmpDeco, tmpResult ); + ButtonPixmap_[style][ active ][ MenuButton ][ bs ][small] = QPixmap( tmpResult ); + } + } + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +// borderSizes() +// ------------- +// Return list of valid border sizes + +QValueList<BaghiraFactory::BorderSize> BaghiraFactory::borderSizes() const { + return QValueList<BorderSize>() << BorderTiny << BorderNormal + << BorderLarge << BorderVeryLarge + << BorderHuge << BorderVeryHuge; +} + +////////////////////////////////////////////////////////////////////////////// +// BaghiraButton Class // +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// BaghiraButton() +// -------------- +// Constructor + +BaghiraButton::BaghiraButton( BaghiraClient *parent, const char *name, const QString& tip, bool small, ButtonType type, int style ) +: QButton( parent->widget(), name ), client_( parent ), type_( type ), deco_( 0 ), icon_(), small_( small ), lastmouse_( 0 ), mouseover_( false ), _blocked(false) { + setBackgroundMode( NoBackground ); + setCursor( arrowCursor ); + QToolTip::add( this, tip ); + down_ = false; + mouseover_ = false; + mask = NULL; + maskDown = NULL; + + setFixedSize( type == Baghira::MenuButton ? MENUBUTTONWIDTH : BUTTONSIZE, BUTTONSIZE ); + for ( int bs = Baghira::ButtonInactive; bs <= Baghira::Pressed; bs++ ) { + pixmap[ Baghira::WindowInactive ][ ( Baghira::ButtonState ) bs ] = + &BaghiraFactory::ButtonPixmap( Baghira::WindowInactive, type, + ( Baghira::ButtonState ) bs, style, small ); + pixmap[ Baghira::WindowActive ][ ( Baghira::ButtonState ) bs ] = + &BaghiraFactory::ButtonPixmap( Baghira::WindowActive, type, + ( Baghira::ButtonState ) bs, style, small ); + } +} + +BaghiraButton::~BaghiraButton() +{ + if ( deco_ ) + delete deco_; +} + + +////////////////////////////////////////////////////////////////////////////// +// sizeHint() +// ---------- +// Return size hint + +QSize BaghiraButton::sizeHint() const { + return QSize( BUTTONSIZE, BUTTONSIZE ); +} + +////////////////////////////////////////////////////////////////////////////// +// enterEvent() +// ------------ +// Mouse has entered the button + +void BaghiraButton::enterEvent( QEvent *e ) { +#if 0 + if (type_ == CloseButton) + { + _blocked = true; + QTimer::singleShot(250,this,SLOT(delayedEnterEvent())); + QButton::enterEvent( e ); + return; + } +#endif + mouseover_ = true; + repaint( false ); + QButton::enterEvent( e ); +} + +void BaghiraButton::delayedEnterEvent() +{ + if (hasMouse()) + { + _blocked = false; + mouseover_ = true; + repaint( false ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// leaveEvent() +// ------------ +// Mouse has left the button + +void BaghiraButton::leaveEvent( QEvent *e ) +{ + mouseover_ = false; + if ( type_ == Baghira::MenuButton ) + down_ = false; + repaint( false ); + QButton::leaveEvent( e ); +} + +////////////////////////////////////////////////////////////////////////////// +// mousePressEvent() +// ----------------- +// Button has been pressed + +void BaghiraButton::mousePressEvent( QMouseEvent* e ) +{ + if (_blocked && !(e->state() & Qt::ControlButton)) + return; + lastmouse_ = e->button(); + + //update mask + if (maskDown) + { + clearMask(); + setMask(*maskDown); + } + // translate and pass on mouse event + int button = LeftButton; + if ( ( type_ != MaxButton ) && ( e->button() != LeftButton ) ) + { + button = NoButton; // middle & right buttons inappropriate + } + down_ = true; + QMouseEvent me( e->type(), e->pos(), e->globalPos(), button, e->state() ); + repaint( false ); + QButton::mousePressEvent( &me ); +} + +// void BaghiraButton::setOn(bool on) +// { +// QButton::setOn(on); +// } + +////////////////////////////////////////////////////////////////////////////// +// mouseReleaseEvent() +// ----------------- +// Button has been released + +void BaghiraButton::mouseReleaseEvent( QMouseEvent* e ) { + lastmouse_ = e->button(); + + if (mask){ + clearMask(); + setMask(*mask); + } + // translate and pass on mouse event + int button = LeftButton; + if ( ( type_ != MaxButton ) && ( e->button() != LeftButton ) ) { + button = NoButton; // middle & right buttons inappropriate + } + down_ = false; + QMouseEvent me( e->type(), e->pos(), e->globalPos(), button, e->state() ); + repaint( false ); + QButton::mouseReleaseEvent( &me ); +} + +inline ButtonState BaghiraButton::state() { + if ( down_ || isDown() ) + return Pressed; + else if ( mouseover_ ) + return Hovered; + else if ( client_->isActive() ) + return ButtonActive; + else + return ButtonInactive; +} + +////////////////////////////////////////////////////////////////////////////// +// drawButton() +// ------------ +// Draw the button + +void BaghiraButton::drawButton( QPainter *painter ) { + if ( !BaghiraFactory::initialized() ) + return ; + + bool active = client_->isActive(); + + if ( type_ == Baghira::StickyButton && client_->isOnAllDesktops() ) + painter->drawPixmap( 0, 0, BaghiraFactory::ButtonPixmap( ( Baghira::WindowState ) active, type_, state() == Pressed ? Pressed : Hovered, client_->currentStyle, client_->isTool() )); + else + painter->drawPixmap( 0, 0, BaghiraFactory::ButtonPixmap( ( Baghira::WindowState ) active, type_, state() , client_->currentStyle, client_->isTool() )); + + if (type_ == Baghira::AboveBelowButton) + { + if (client_->keepAbove()) + { + painter->drawPixmap((width()-8)/2,height()/2-4,BaghiraFactory::arrowUp); + } + else if (client_->keepBelow()) + { + painter->drawPixmap((width()-8)/2,height()/2,BaghiraFactory::arrowDown); + } + } +} + +void BaghiraButton::setMasks(QBitmap *bitmask, QBitmap *bitmaskDown){ + clearMask(); + mask = bitmask; + maskDown = bitmaskDown; + if (mask) setMask(*mask); +} +////////////////////////////////////////////////////////////////////////////// +// BaghiraClient Class // +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// BaghiraClient() +// ------------- +// Constructor + +BaghiraClient::BaghiraClient( KDecorationBridge *b, KDecorationFactory *f ) + : KDecoration( b, f ) +{ + ; +} + +BaghiraClient::~BaghiraClient() +{ + if (noDeco_) + return; + BaghiraFactory::deMaximizer().setClient(NULL); + for ( int n = 0; n < ButtonTypeAmount; n++ ) + { + if ( button[ n ] ) + delete button[ n ]; + } +} + +////////////////////////////////////////////////////////////////////////////// +// init() +// ------ +// Real initialization + +void BaghiraClient::init() +{ + if (BaghiraFactory::noModalDeco() && isModal() && !isMinimizable() && !isResizable()) + { + noDeco_ = true; + createMainWidget( WResizeNoErase | WRepaintNoErase ); + widget() ->setBackgroundMode( NoBackground ); + return; + } + noDeco_ = false; +#if KDE_IS_VERSION(3,3,91) + //first try if there's an X setting + unsigned char *data = 0; + Atom actual; + int format, result; + unsigned long n, left; + currentStyle = BaghiraFactory::defaultMode(); + result = XGetWindowProperty(qt_xdisplay(), windowId(), baghira_deco_design, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, &data); + if (result == Success && data != None) // found set design + { + memcpy (¤tStyle, data, sizeof (unsigned int)); + currentStyle = currentStyle>4?4:currentStyle; + } + else // try if there's a definition file + { + XClassHint classHint; + FILE *file = NULL; + if ( XGetClassHint( qt_xdisplay(), windowId(), &classHint ) ) + { + QString tmpString; + // overwrite file from bab starter? - don't worry, if there's been one and deleted by the style we've got the X setting (much better as it will take care of all subwindows) + tmpString = QDir::homeDirPath() + "/.baghira/.bab/" + QString( classHint.res_class ).lower(); + if( (file = fopen(tmpString.latin1(), "r")) != NULL ) + { + fscanf(file,"%d\n%d\n", &format, ¤tStyle); + fclose(file); + remove(tmpString.latin1()); // this is only temporary + } + else + { + tmpString = QDir::homeDirPath() + "/.baghira/" + QString( classHint.res_class ).lower(); + if( (file = fopen(tmpString.latin1(), "r")) != NULL ) + { + fscanf(file,"%d\n%d\n", &format, ¤tStyle); + fclose(file); + } + } + XFree( classHint.res_name ); + XFree( classHint.res_class ); + } + if (file == NULL) + { + QString tmpString = QDir::homeDirPath() + "/.baghira/.bab/.deco"; + if( (file = fopen(tmpString.latin1(), "r")) != NULL ) + { + fscanf(file,"%d\n%d\n", &format, ¤tStyle); + fclose(file); + } + } + } + if (currentStyle > 4) + currentStyle = BaghiraFactory::defaultMode(); +#else + QSettings config; + config.beginGroup("/baghira/Style"); + if (config.readBoolEntry( "Design_Default", 1 ) == 2) + { + currentStyle = 2; + config.endGroup(); + } + else + { + config.endGroup(); + config.beginGroup("/baghira/Deco"); + int tmp = config.readNumEntry( "defaultMode", 1 ); + currentStyle = (tmp > -1 && tmp < 5) ? tmp : 1; + config.endGroup(); + } +#endif + createMainWidget( WResizeNoErase | WRepaintNoErase ); + widget() ->installEventFilter( this ); + widget() ->setBackgroundMode( NoBackground ); + + if ( isTool() ) // tool windows have tiny titlebars + titleheight_ = TITLESIZESMALL; + else + titleheight_ = TITLESIZE; + + // setup layout + QVBoxLayout *mainlayout = new QVBoxLayout( widget() ); + QHBoxLayout *titlelayout = new QHBoxLayout(); + windowlayout = new QHBoxLayout(); + + titlebar_ = new QSpacerItem( 1, titleheight_, QSizePolicy::Expanding, QSizePolicy::Fixed ); + mainlayout->setResizeMode( QLayout::FreeResize ); + mainlayout->addLayout( titlelayout ); + mainlayout->addLayout( windowlayout ); + + windowlayout->addSpacing( BaghiraFactory::borderSize(currentStyle) ); + if ( isPreview() ) + windowlayout->addWidget( new QLabel( i18n( "<b><center>Baghira preview</center></b>" ), widget() ) ); + else + windowlayout->addItem( new QSpacerItem( 0, 18 ) ); + + windowlayout->addSpacing( BaghiraFactory::borderSize(currentStyle) ); + + leftClose = false; + rightClose = false; + performEasyClose = false; + + // setup titlebar + for ( int n = 0; n < ButtonTypeAmount; n++ ) + button[ n ] = 0; + plusminus = 1; + addButtons( titlelayout, options() ->titleButtonsLeft() ); + titlelayout->addItem( titlebar_ ); + plusminus = -1; + isFaded = false; + addButtons( titlelayout, options() ->titleButtonsRight() ); +#if KDE_IS_VERSION(3,3,91) + grip = 0; +#endif + + if (BaghiraFactory::effect(currentStyle, true) >= Baghira::Brushed || BaghiraFactory::effect(currentStyle, false) >= Baghira::Brushed) + HandlePix = QPixmap(BaghiraFactory::pix(currentStyle, TitleBar, isActive(), false )); + else if ( BaghiraFactory::bgStipple() ) + { + HandlePix = QPixmap( 32, 32); + QPainter painter; + QColor c = widget()->colorGroup().background(); + HandlePix.fill(c); + painter.begin( &HandlePix ); + painter.setPen( c.dark( 100 + (BaghiraFactory::contrast()/2) ) ); + + for ( int i = 1; i < 32; i += 4 ) + { + painter.drawLine( 0, i, 31, i ); + painter.drawLine( 0, i+2, 31, i+2 ); + } + + painter.setPen( c.dark( 100 + BaghiraFactory::contrast() ) ); + + for ( int i = 2; i < 31; i += 4 ) + painter.drawLine( 0, i, 31, i ); + + painter.end(); + } +} + +QString BaghiraClient::caption() const +{ + if (!BaghiraFactory::delAppname()) + return KDecoration::caption(); + if (caption_.isNull()) + // generate first + { + const_cast<BaghiraClient*>( this )->caption_ = KDecoration::caption(); + int pos; + if (caption_.startsWith( "tvtime" )) + { + pos = caption_.find(": "); + if (pos > -1) + const_cast<BaghiraClient*>( this )->caption_ = const_cast<BaghiraClient*>( this )->caption_.remove(0, pos+1); + } + else + { + pos = caption_.findRev(" - "); + if (pos > -1) + const_cast<BaghiraClient*>( this )->caption_ = caption_.left(pos); + } + } + return caption_; +} + +////////////////////////////////////////////////////////////////////////////// +// addButtons() +// ------------ +// Add buttons to title layout + +void BaghiraClient::addButtons( QBoxLayout *layout, const QString& s ) +{ + if (noDeco_) + return; + // const unsigned char *bitmap; + QString tip; + QBitmap *m = NULL; + QBitmap *mn = NULL; + QBitmap *mD = NULL; + QBitmap *mnD = NULL; + QBitmap *mH = NULL; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed){ + m = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + &BaghiraFactory::pantherMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkMask : + NULL; + mn = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + &BaghiraFactory::pantherMenuMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarMenuMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkMenuMask : + NULL; + mD = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + NULL : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarDownMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkDownMask : + NULL; + mnD = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + NULL : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarMenuDownMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkMenuDownMask : + NULL; + mH = &BaghiraFactory::helpMask; + } + if ( s.length() > 0 ) { +// qWarning("%s",s.ascii()); + layout->addSpacing( MARGIN ); + excursion = excursion + plusminus * MARGIN; + bool buttonAdded; + for ( unsigned n = 0; n < s.length(); n++ ) { + buttonAdded = false; + switch ( s[ n ].latin1() ) { + case 'M': // Menu button + if ( !button[ MenuButton ] ) { + button[ MenuButton ] = new BaghiraButton( this, "menu", + i18n( "Menu" ), isTool(), MenuButton ); + connect( button[ MenuButton ], SIGNAL( pressed() ), this, + SLOT( menuButtonPressed() ) ); + layout->addWidget( button[ MenuButton ] ); + buttonAdded = true; + excursion = excursion + plusminus * MENUBUTTONWIDTH; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ MenuButton ]->setMasks(mn, mnD); + } + break; + + case 'S': // Sticky button + if ( !button[ StickyButton ] ) { + if ( isOnAllDesktops() ) { + tip = i18n( "Un-Sticky" ); + } else { + tip = i18n( "Sticky" ); + } + button[ StickyButton ] = new BaghiraButton( this, "sticky", + tip, isTool(), StickyButton ); + connect( button[ StickyButton ], SIGNAL( clicked() ), this, + SLOT( toggleOnAllDesktops() ) ); + layout->addWidget( button[ StickyButton ] ); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ StickyButton ]->setMasks(m, mD); + } + break; + + case 'H': // Help button + if ( ( !button[ HelpButton ] ) && providesContextHelp() ) { + button[ HelpButton ] = new BaghiraButton( this, "help", + i18n( "Help" ), isTool(), HelpButton ); + connect( button[ HelpButton ], SIGNAL( clicked() ), this, + SLOT( showContextHelp() ) ); + layout->addWidget( button[ HelpButton ] ); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ HelpButton ]->setMasks(mH, NULL); + } + break; + + case 'I': // Minimize button + if ( ( !button[ MinButton ] ) && isMinimizable() ) { + button[ MinButton ] = new BaghiraButton( this, "iconify", + i18n( "Minimize" ), isTool(), MinButton ); + connect( button[ MinButton ], SIGNAL( clicked() ), this, + SLOT( minimize() ) ); + layout->addWidget( button[ MinButton ] ); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ MinButton ]->setMasks(m, mD); + } + break; + + case 'A': // Maximize button + if ( ( !button[ MaxButton ] ) && isMaximizable() ) { + if ( maximizeMode() == MaximizeFull ) { + tip = i18n( "Restore" ); + } else { + tip = i18n( "Maximize" ); + } + button[ MaxButton ] = new BaghiraButton( this, "maximize", + tip, isTool(), MaxButton ); + connect( button[ MaxButton ], SIGNAL( clicked() ), this, + SLOT( maxButtonPressed() ) ); + layout->addWidget( button[ MaxButton ] ); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ MaxButton ]->setMasks(m, mD); + } + break; + + case 'X': // Close button + if ( ( !button[ CloseButton ] ) && isCloseable() ) { + button[ CloseButton ] = new BaghiraButton( this, "close", + i18n( "Close" ), isTool(), CloseButton ); + connect( button[ CloseButton ], SIGNAL( clicked() ), this, + SLOT( closeWindow() ) ); + layout->addWidget( button[ CloseButton ] ); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (plusminus == 1 && n == 0) // left Button + leftClose = true; + if (plusminus == -1 && n == s.length() - 1) // right Button + rightClose = true; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ CloseButton ]->setMasks(m, mD); + } + break; + + case 'F': // Above button + case 'B': // Below button + if ((!button[AboveBelowButton])) + { + button[AboveBelowButton] = new BaghiraButton(this, "above", i18n("Keep Above/Below Others"), isTool(), AboveBelowButton); + button[AboveBelowButton]->setDown( keepAbove() || keepBelow() ); + connect(button[AboveBelowButton], SIGNAL(clicked()), this, SLOT(aboveBelowButtonPressed())); + layout->addWidget(button[AboveBelowButton]); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ AboveBelowButton ]->setMasks(m, mD); + } + break; + case 'L': // Shade button + if ((!button[ShadeButton] && isShadeable())) { + button[ShadeButton] = new BaghiraButton(this, "shade", isSetShade() ? tip = i18n("Unshade") : tip = i18n("Shade"), isTool(), ShadeButton); + button[ShadeButton]->setDown( isShade() ); + connect(button[ShadeButton], SIGNAL(clicked()), this, SLOT(shadeButtonPressed())); + layout->addWidget(button[ShadeButton]); + buttonAdded = true; + excursion = excursion + plusminus * BUTTONSIZE; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ ShadeButton ]->setMasks(m, mD); + } + break; +// case 'R': // Shade button +// if ((!button[ShadeButton] && isShadeable())) { +// button[ShadeButton] = new BaghiraButton(this, "shade", isSetShade() ? tip = i18n("Unshade") : tip = i18n("Shade"), isTool(), ShadeButton); +// button[ShadeButton]->setDown( isShade() ); +// connect(button[ShadeButton], SIGNAL(clicked()), this, SLOT(shadeButtonPressed())); +// layout->addWidget(button[ShadeButton]); +// buttonAdded = true; +// excursion = excursion + plusminus * BUTTONSIZE; +// if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed) button[ ShadeButton ]->setMasks(m, mD); +// } +// break; + + case '_': // Spacer item + layout->addSpacing( MARGIN ); + excursion = excursion + plusminus * MARGIN; + } + if (BaghiraFactory::addAutoSpacing() && buttonAdded){ + layout->addSpacing( MARGIN ); + excursion = excursion + plusminus * MARGIN; + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +// eventFilter() +// ------------- +// Event filter + +bool BaghiraClient::eventFilter( QObject *obj, QEvent *e ) +{ + if ( obj != widget() ) + return false; + + switch ( e->type() ) { + case QEvent::MouseButtonDblClick: { + mouseDoubleClickEvent( static_cast<QMouseEvent *>( e ) ); + return true; + } + case QEvent::MouseButtonPress: { + if (titlebar_->geometry().contains( static_cast<QMouseEvent *>(e)->pos() ) && static_cast<QMouseEvent *>(e)->state() == Qt::ControlButton){ + currentStyle < 4 ? currentStyle++ : currentStyle = 0; +#if KDE_IS_VERSION(3,3,91) + unsigned long wmDesign = currentStyle; + XChangeProperty(qt_xdisplay(), windowId(), baghira_deco_design, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &wmDesign, 1L); +#endif + widget()->repaint(); + QBitmap *m = NULL; + QBitmap *mn = NULL; + QBitmap *mD = NULL; + QBitmap *mnD = NULL; + QBitmap *mH = NULL; + if (BaghiraFactory::effect(currentStyle, true) == Baghira::Brushed){ + m = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + &BaghiraFactory::pantherMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkMask : + NULL; + mn = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + &BaghiraFactory::pantherMenuMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarMenuMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkMenuMask : + NULL; + mD = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + NULL : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarDownMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkDownMask : + NULL; + mnD = BaghiraFactory::buttonStyle(currentStyle) == Baghira::Panther ? + NULL : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Jaguar ? + &BaghiraFactory::jaguarMenuDownMask : + BaghiraFactory::buttonStyle(currentStyle) == Baghira::Milk ? + &BaghiraFactory::milkMenuDownMask : + NULL; + mH = &BaghiraFactory::helpMask; + } + for (int i = 0; i < ButtonTypeAmount; i++){ + if (button[i]){ + button[i]->setMasks(i < Baghira::MenuButton ? m : + i == Baghira::MenuButton ? mn : + mH, i < Baghira::MenuButton ? mD : + i == Baghira::MenuButton ? mnD : + NULL); + button[i]->repaint(); + } + } +#if KDE_IS_VERSION(3,3,91) + if (grip) + grip->updateLook(TRUE); +#endif + doShape(); + return true; + } + if (BaghiraFactory::allowEasyClosing()){ + if (maximizeMode() == MaximizeFull && isActive() && (leftClose && static_cast<QMouseEvent *>( e )->x() == 0 && static_cast<QMouseEvent *>( e )->y() == 0) || (rightClose && static_cast<QMouseEvent *>( e )->x() == ((QWidget *)obj)->width() -1 && static_cast<QMouseEvent *>( e )->y() == 0)) + performEasyClose = true; + else processMousePressEvent( static_cast<QMouseEvent *>( e ) ); + } + else processMousePressEvent( static_cast<QMouseEvent *>( e ) ); + return true; + } + case QEvent::MouseButtonRelease:{ + if (performEasyClose && maximizeMode() == MaximizeFull && (leftClose && static_cast<QMouseEvent *>( e )->x() == 0 && static_cast<QMouseEvent *>( e )->y() == 0) || (rightClose && static_cast<QMouseEvent *>( e )->x() == ((QWidget *)obj)->width() -1 && static_cast<QMouseEvent *>( e )->y() == 0)){ + closeWindow(); + performEasyClose = false; + return true; + } + return FALSE; + } + case QEvent::Paint: { + paintEvent( static_cast<QPaintEvent *>( e ) ); + return true; + } + case QEvent::Resize: { + resizeEvent( static_cast<QResizeEvent *>( e ) ); + return true; + } + case QEvent::Show: { +#if KDE_IS_VERSION(3,3,91) + if (!grip && BaghiraFactory::resizeGrip() && isResizable()) grip = new ResizeHandle(this); +#endif + showEvent( static_cast<QShowEvent *>( e ) ); + return true; + } + case QEvent::Hide: { + emit hide(); + } + case QEvent::Wheel: { + wheelEvent(static_cast<QWheelEvent *>( e )); + return true; + } + default: { + return false; + } + } + + return false; +} + +////////////////////////////////////////////////////////////////////////////// +// mouseCoubleClickEvent() +// ----------------------- +// Doubleclick on title + +void BaghiraClient::mouseDoubleClickEvent( QMouseEvent *e ) +{ + if ( titlebar_->geometry().contains( e->pos() ) ) + titlebarDblClickOperation(); +} + +void BaghiraClient::wheelEvent( QWheelEvent *e ) +{ + if (titlebar_->geometry().contains( e->pos() ) && e->state() == Qt::ControlButton){ + // surf through the desktops :) + int target, cD; + if (e->delta() > 0){ + (cD = KWin::currentDesktop()) == KWin::numberOfDesktops() ? target = 1 : target = cD + 1; + } + else{ + (cD = KWin::currentDesktop()) == 1 ? target = KWin::numberOfDesktops() : target = cD - 1; + } + setDesktop (target); + KWin::setCurrentDesktop (target); + } +} + +////////////////////////////////////////////////////////////////////////////// +// paintEvent() +// ------------ +// Repaint the window + +void BaghiraClient::paintEvent( QPaintEvent* ) +{ + if ( !BaghiraFactory::initialized() || noDeco_) + return ; + + QPainter painter( widget() ); + QColorGroup group; + + QRect title( 0, 0, width(), titlebar_->geometry().height() ); + QRect left( 0, title.height(), BaghiraFactory::borderSize(currentStyle), height() - + title.height() ); + QRect right( width() - BaghiraFactory::borderSize(currentStyle), title.height(), + BaghiraFactory::borderSize(currentStyle), height() - title.height() ); + QRect handle( 0, height() - BaghiraFactory::borderSize(currentStyle), + width(), BaghiraFactory::borderSize(currentStyle) ); + + int x, y, x2, y2, h, w; + + title.rect( &x, &y, &w, &h ); + + // draw title bar + if (BaghiraFactory::effect(currentStyle, isActive()) == Baghira::Brushed) + { + if (w > 1024) + { + int w1 = (w - 1024)/2; + int w2 = w - 1024 - w1; + painter.drawTiledPixmap( 0,0, w1, h, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ),256-w1,0 ); + painter.drawPixmap( w1, 0/*, 1024, h*/, BaghiraFactory::pix(currentStyle, TitleCenter, isActive(), isTool() ) ); + painter.drawTiledPixmap( w1 + 1024, 0, w2, h, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ) ); + } + else + painter.drawTiledPixmap( 0, 0, w, h, BaghiraFactory::pix(currentStyle, TitleCenter, isActive(), isTool() ), (1024-w)/2, 0 ); + } + else + painter.drawTiledPixmap( title, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ) ); + + x2 = title.right(); + y2 = title.bottom(); + int shapeW = w; + + const QColor *ttbar = &(BaghiraFactory::color(currentStyle, Baghira::ColorTitleBar, isActive())); + + int tmp3Dimpact_ = 100 + BaghiraFactory::_3DImpact(currentStyle); + + painter.setPen( ttbar->light(tmp3Dimpact_)); + painter.drawLine( x+1, y+1, x2-1, y+1 ); + + if (!(BaghiraFactory::allowEasyClosing() && maximizeMode() == MaximizeFull)) + { + // draw around the corners ;-) + if (BaghiraFactory::shapeUL(currentStyle)) + { + // Draw edge of top-left corner inside the area removed by the mask. + painter.drawPoint( 3, 2 ); + painter.drawPoint( 4, 2 ); + painter.drawPoint( 2, 3 ); + painter.drawPoint( 2, 4 ); + } + if (BaghiraFactory::shapeUR(currentStyle)) + { + // Draw edge of top-right corner inside the area removed by the mask. + painter.drawPoint( shapeW - 5, 2 ); + painter.drawPoint( shapeW - 4, 2 ); + painter.drawPoint( shapeW - 3, 3 ); + painter.drawPoint( shapeW - 3, 4 ); + } + } + + + painter.setPen( ttbar->dark(tmp3Dimpact_) ); + if (BaghiraFactory::drawComicFrame() && !(BaghiraFactory::allowEasyClosing() && maximizeMode() == MaximizeFull)) + { + painter.drawLine(x,y,x, y2); + painter.drawLine(x2,y,x2, y2); + } + painter.drawLine( x, y, x2, y ); + + if (!(BaghiraFactory::allowEasyClosing() && maximizeMode() == MaximizeFull)) + { + // draw around the corners ;-) + if (BaghiraFactory::shapeUL(currentStyle)) + { + // Draw edge of top-left corner inside the area removed by the mask. + painter.drawPoint( 3, 1 ); + painter.drawPoint( 4, 1 ); + painter.drawPoint( 2, 2 ); + painter.drawPoint( 1, 3 ); + painter.drawPoint( 1, 4 ); + } + if (BaghiraFactory::shapeUR(currentStyle)) + { + // Draw edge of top-right corner inside the area removed by the mask. + painter.drawPoint( shapeW - 5, 1 ); + painter.drawPoint( shapeW - 4, 1 ); + painter.drawPoint( shapeW - 3, 2 ); + painter.drawPoint( shapeW - 2, 3 ); + painter.drawPoint( shapeW - 2, 4 ); + } + } + + const QColor *ttblend = &(BaghiraFactory::color(currentStyle, Baghira::ColorTitleBlend, isActive())); + + if (BaghiraFactory::LineImpact(currentStyle) > 0) + { + painter.setPen( ttblend->dark(100 + BaghiraFactory::LineImpact(currentStyle)) ); + painter.drawLine( x, y2, x2, y2 ); + } + + // draw title text + titlebar_->geometry().rect( &x, &y, &w, &h ); + int iconLeft; + int iconWidth; + if (BaghiraFactory::showTitle()) + { + painter.setFont( options() ->font( isActive(), isTool() ) ); + painter.setPen( options()->color( ColorFont, isActive() ) ); + BaghiraFactory::drawIcon(currentStyle) ? iconWidth = 16 : iconWidth = 0; + if (BaghiraFactory::drawIcon(currentStyle) || BaghiraFactory::effect(currentStyle, isActive()) == Baghira::Nostalgia) + { + QRect textBound = painter.boundingRect ( x + 2 * MARGIN + iconWidth, y, w - MARGIN * 2 - iconWidth, h, BaghiraFactory::titleAlign() | AlignVCenter, caption() ); + iconLeft = textBound.x() - MARGIN - iconWidth; + if ( iconLeft < x + MARGIN ) iconLeft = x + MARGIN; + + if (BaghiraFactory::drawIcon(currentStyle)) + { + ICONX = iconLeft; + ICONY = y + ( titleheight_ - 16 ) / 2; + painter.drawPixmap( ICONX, ICONY, icon().pixmap( QIconSet::Small, QIconSet::Normal ) ); + } + + if (BaghiraFactory::effect(currentStyle, isActive()) == Baghira::Nostalgia) + { + painter.fillRect( iconLeft - 5, y + 1, textBound.right() - iconLeft + 10, h - 2, BaghiraFactory::color(currentStyle, Baghira::ColorTitleBar, isActive() ) ); + painter.fillRect( title.x(), y + 1, x - title.x()+5, h - 2, *ttbar ); + painter.fillRect( x+w-5, y + 1, title.right() - w + 5, h - 2, *ttbar ); + } + } + painter.drawText( x + 2 * MARGIN + iconWidth, y, w - MARGIN * 2 - iconWidth, h, BaghiraFactory::titleAlign() | AlignVCenter, caption() ); + } + else if (BaghiraFactory::drawIcon(currentStyle)) + { + iconLeft = (width()-16)/2; + if ( iconLeft < x + MARGIN ) + iconLeft = x + MARGIN; + ICONX = iconLeft; + ICONY = y + ( titleheight_ - 16 ) / 2; + painter.drawPixmap( ICONX, ICONY, icon().pixmap( QIconSet::Small, QIconSet::Normal ) ); + } + + // draw outer frame + if ( !isShade() ) + { + QColor background = widget() ->colorGroup().background(); + + // left side + left.rect( &x, &y, &w, &h ); + if (w > 0){ + if (BaghiraFactory::effect(currentStyle,isActive()) == Baghira::Brushed) + { + width() > 1024 ? + painter.drawTiledPixmap( x, y, w, h, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ) ) : + painter.drawTiledPixmap( x, y, w, h, BaghiraFactory::pix(currentStyle, TitleCenter, isActive(), isTool() ), (1024-width())/2 ); + } + else + { + BaghiraFactory::bgStipple() ? + painter.drawTiledPixmap( x, y, w, h, HandlePix ) : + painter.fillRect( x, y, w, h, background ); + } + } + + // right side + right.rect( &x, &y, &w, &h ); + if (w > 0){ + if (BaghiraFactory::effect(currentStyle,isActive()) == Baghira::Brushed) + { + width() > 1024 ? + painter.drawTiledPixmap( x, y, w, h, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ) ) : + painter.drawTiledPixmap( x, y, w, h, BaghiraFactory::pix(currentStyle, TitleCenter, isActive(), isTool() ), (1024-width())/2+width()-w ); + } + else + { + BaghiraFactory::bgStipple() ? + painter.drawTiledPixmap( x, y, w, h, HandlePix ) : + painter.fillRect( x, y, w, h, background ); + } + } + + // draw handle ===================================================== + // bottom bar + // handle middle + handle.rect( &x, &y, &w, &h ); + if (BaghiraFactory::effect(currentStyle,isActive()) == Baghira::Brushed){ + if (w > 1024){ + int w1 = (w - 1024)/2; + int w2 = w - 1024 - w1; + painter.drawTiledPixmap( 0, y, w1, h, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ) ); + painter.drawPixmap( w1, y, BaghiraFactory::pix(currentStyle, TitleCenter, isActive(), isTool() ) ); + painter.drawTiledPixmap( w1 + 1024, y, w2, h, BaghiraFactory::pix(currentStyle, TitleBar, isActive(), isTool() ) ); + } + else{ + painter.drawPixmap( x, y, BaghiraFactory::pix(currentStyle, TitleCenter, isActive(), isTool() ), (1024-w)/2, 0, w, h ); + } + + int b = handle.bottom() - 1; +// painter.setPen( ttbar->light(tmp3Dimpact_)); + painter.setPen( ttbar->dark(tmp3Dimpact_*1.1) ); + painter.drawLine( x, b, w-1, b ); + if (maximizeMode() != MaximizeFull) + { + if (BaghiraFactory::shapeLL(currentStyle)){ + // Draw edge of bottom-left corner inside the area removed by the mask. + painter.drawPoint(3, b); + painter.drawPoint(4, b); + painter.drawPoint(2, b-1); + painter.drawPoint(1, b-2); + painter.drawPoint(1, b-3); + painter.drawPoint(0, b-4); + } + if (BaghiraFactory::shapeLR(currentStyle)){ + // Draw edge of bottom-right corner inside the area removed by the mask. + painter.drawPoint(shapeW - 5, b); + painter.drawPoint(shapeW - 4, b); + painter.drawPoint(shapeW - 3, b-1); + painter.drawPoint(shapeW - 2, b-2); + painter.drawPoint(shapeW - 2, b-3); + painter.drawPoint(shapeW - 1, b-4); + } + } + painter.setPen( ttbar->dark(tmp3Dimpact_*1.3) ); + painter.drawLine( x+1, b+1, w-2, b+1 ); + if (maximizeMode() != MaximizeFull) + { + if (BaghiraFactory::shapeLL(currentStyle)){ + // Draw edge of bottom-left corner inside the area removed by the mask. + painter.drawPoint(4, b); + painter.drawPoint(5, b); + painter.drawPoint(3, b-1); + painter.drawPoint(2, b-2); +// painter.drawPoint(2, b-3); + } + if (BaghiraFactory::shapeLR(currentStyle)){ + // Draw edge of bottom-right corner inside the area removed by the mask. + painter.drawPoint(shapeW - 6, b); + painter.drawPoint(shapeW - 5, b); + painter.drawPoint(shapeW - 4, b-1); + painter.drawPoint(shapeW - 3, b-2); +// painter.drawPoint(shapeW - 3, b-3); + } + } + if (BaghiraFactory::drawComicFrame()) + { + painter.drawLine(x,title.y(),x, b); + painter.drawLine(handle.right(),title.y(),x2, b); + } + } + else{ + BaghiraFactory::bgStipple() ? painter.drawTiledPixmap( x, y, w, h, HandlePix ) : + painter.fillRect( x, y, w, h, background ); + + x2 = handle.right(); + y2 = handle.bottom(); + if (BaghiraFactory::drawComicFrame() && maximizeMode() != MaximizeFull){ + painter.setPen(ttblend->dark(tmp3Dimpact_)); + painter.drawLine( handle.x()/*+7*/, y2, x2/*-7*/, y2 ); + painter.drawLine(0,title.bottom(),0, y2); + painter.drawLine(x2,title.bottom(),x2, y2); + } + } + if (BaghiraFactory::drawComicFrame() && maximizeMode() != MaximizeFull){ + int b = handle.bottom() - 1; + if (BaghiraFactory::shapeLL(currentStyle)){ + // Draw edge of bottom-left corner inside the area removed by the mask. + painter.drawPoint(3, b); + painter.drawPoint(4, b); + painter.drawPoint(2, b-1); + painter.drawPoint(1, b-2); + painter.drawPoint(1, b-3); + } + if (BaghiraFactory::shapeLR(currentStyle)){ + // Draw edge of bottom-right corner inside the area removed by the mask. + painter.drawPoint(shapeW - 5, b); + painter.drawPoint(shapeW - 4, b); + painter.drawPoint(shapeW - 3, b-1); + painter.drawPoint(shapeW - 2, b-2); + painter.drawPoint(shapeW - 2, b-3); + } + } + } +} + +////////////////////////////////////////////////////////////////////////////// +// resizeEvent() +// ------------- +// Window is being resized + +void BaghiraClient::resizeEvent( QResizeEvent* ) +{ + if (noDeco_) + return; + /*if ( widget() ->isShown() ) { + QRegion region = widget() ->rect(); + region = region.subtract( titlebar_->geometry() ); + widget() ->erase( region ); + }*/ +// widget()->repaint(); + doShape(); +} + +///////////////////////////////////////////////////////////////////////////// +// shape Corners +// =) ==================================================================0 + +void BaghiraClient::doShape() +{ +// return; + QRegion mask; + + if (!(BaghiraFactory::allowEasyClosing() && maximizeMode() == MaximizeFull)){ + int r = width(); + int b = height() - 1; + mask = QRegion( 0, 0, r, b+1 ); + + if (BaghiraFactory::shapeUL(currentStyle)){ + // Remove top-left corner. + mask -= QRegion( 0, 0, 5, 1 ); + mask -= QRegion( 0, 1, 3, 1 ); + mask -= QRegion( 0, 2, 2, 1 ); + mask -= QRegion( 0, 3, 1, 2 ); + } + if (BaghiraFactory::shapeUR(currentStyle)){ + // Remove top-right corner. + mask -= QRegion( r - 5, 0, 5, 1 ); + mask -= QRegion( r - 3, 1, 3, 1 ); + mask -= QRegion( r - 2, 2, 2, 1 ); + mask -= QRegion( r - 1, 3, 1, 2 ); + } + + if (BaghiraFactory::shapeLL(currentStyle)){ + // Remove bottom-left corner. + mask -= QRegion(0, b-0, 5, 1); + mask -= QRegion(0, b-1, 3, 1); + mask -= QRegion(0, b-2, 2, 1); + mask -= QRegion(0, b-4, 1, 2); + } + if (BaghiraFactory::shapeLR(currentStyle)){ + // Remove bottom-right corner. + mask -= QRegion(r - 5, b-0, 5, 1); + mask -= QRegion(r - 3, b-1, 3, 1); + mask -= QRegion(r - 2, b-2, 2, 1); + mask -= QRegion(r - 1, b-4, 1, 2); + } + } + setMask( mask, 1 ); +} + + +////////////////////////////////////////////////////////////////////////////// +// showEvent() +// ----------- +// Window is being shown + +void BaghiraClient::showEvent( QShowEvent* ) +{ + if (noDeco_) + return; + doShape(); + widget() ->repaint(); +} + +////////////////////////////////////////////////////////////////////////////// +// activeChange() +// -------------- +// window active state has changed + +void BaghiraClient::activeChange() +{ + if (noDeco_) + return; + if (BaghiraFactory::fullSpec() && maximizeMode() == MaximizeFull) + { + if (isActive()) + { + BaghiraFactory::deMaximizer().show(); + BaghiraFactory::deMaximizer().setClient(this); + } + } + else + { + BaghiraFactory::deMaximizer().hide(); + for ( int n = 0; n < ButtonTypeAmount; n++ ) + { + if ( button[ n ] ) + { + button[n]->setAutoMask( BaghiraFactory::effect(currentStyle, isActive()) == Baghira::Brushed); + button[ n ] ->reset(); + } + } + widget() ->repaint( false ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// captionChange() +// --------------- +// The title has changed + +void BaghiraClient::captionChange() +{ + if (noDeco_) + return; + if (BaghiraFactory::showTitle()) + { + if (BaghiraFactory::delAppname()) + { + caption_ = KDecoration::caption(); + int pos; + if (caption_.startsWith( "tvtime" )) + { + pos = caption_.find(": "); + if (pos > -1) + caption_ = caption_.remove(0, pos+1); + } + else + { + pos = caption_.findRev(" - "); + if (pos > -1) + caption_ = caption_.left(pos); + } + } + widget() ->repaint( titlebar_->geometry(), false ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// desktopChange() +// --------------- +// Sticky state has changed + +void BaghiraClient::desktopChange() +{ + if (noDeco_) + return; + bool d = isOnAllDesktops(); + if ( button[ StickyButton ] ) + { + QToolTip::remove + ( button[ StickyButton ] ); + QToolTip::add + ( button[ StickyButton ], d ? i18n( "Un-Sticky" ) : i18n( "Sticky" ) ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// iconChange() +// ------------ +// The title has changed + +void BaghiraClient::iconChange() +{ + if (noDeco_) + return; + if (BaghiraFactory::drawIcon(currentStyle)) widget()->repaint(ICONX, ICONY, 16, 16, false); +} + +////////////////////////////////////////////////////////////////////////////// +// maximizeChange() +// ---------------- +// Maximized state has changed + +void BaghiraClient::maximizeChange() +{ + if (noDeco_) //shouldn't happen - windo's not maximizable + return; + bool m = ( maximizeMode() == MaximizeFull ); + if (BaghiraFactory::fullSpec() && m){ + if (isActive()){ + BaghiraFactory::deMaximizer().show(); + BaghiraFactory::deMaximizer().setClient(this); + } + } + else { + BaghiraFactory::deMaximizer().setClient(NULL); + BaghiraFactory::deMaximizer().hide(); + } + if ( button[ MaxButton ] ) { + QToolTip::remove + ( button[ MaxButton ] ); + QToolTip::add + ( button[ MaxButton ], m ? i18n( "Restore" ) : i18n( "Maximize" ) ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// shadeChange() +// ------------- +// Called when window shading changes + +void BaghiraClient::shadeChange() { + ; +} + +////////////////////////////////////////////////////////////////////////////// +// borders() +// ---------- +// Get the size of the borders + +void BaghiraClient::borders( int &l, int &r, int &t, int &b ) const +{ + if (noDeco_) + { + l = r = t = b = 0; + return; + } + bool m = ( maximizeMode() == MaximizeFull); + t = (BaghiraFactory::fullSpec() && m) ? 0 : titleheight_; + if (m || maximizeMode() == MaximizeHorizontal) + l = r = BaghiraFactory::maxResizable() ? 1 : 0; + else + l = r = BaghiraFactory::borderSize(currentStyle); + if ( m || isShade() || (maximizeMode() == MaximizeVertical)) + b = BaghiraFactory::maxResizable() ? 1 : 0; + else + b = BaghiraFactory::borderSize(currentStyle); +} + +////////////////////////////////////////////////////////////////////////////// +// resize() +// -------- +// Called to resize the window + +void BaghiraClient::resize( const QSize &size ) +{ + if (noDeco_) + return; + widget() ->resize( size ); +} + +////////////////////////////////////////////////////////////////////////////// +// minimumSize() +// ------------- +// Return the minimum allowable size for this decoration + +QSize BaghiraClient::minimumSize() const +{ + return QSize( 100, 60 ); +} + +////////////////////////////////////////////////////////////////////////////// +// mousePosition() +// --------------- +// Return mouse position (for resizing) + +KDecoration::Position BaghiraClient::mousePosition( const QPoint &point ) const +{ + if (noDeco_) + return PositionCenter; + Position pos = PositionCenter; + if ( point.y() < ( height() - BaghiraFactory::borderSize(currentStyle) ) ) { // inside client + pos = KDecoration::mousePosition( point ); + } else { + if ( point.x() >= ( width() - 16 ) ) + pos = PositionBottomRight; + else if ( point.x() <= 16 ) + pos = PositionBottomLeft; + else + pos = PositionBottom; + } + return pos; +} + + +////////////////////////////////////////////////////////////////////////////// +// maxButtonPressed() +// ----------------- +// Max button was pressed + + +void BaghiraClient::demaxButtonPressed() { + maxButtonPressed(); +} + +void BaghiraClient::maxButtonPressed() { + if ( !BaghiraFactory::fullSpec() || (maximizeMode() != MaximizeFull) && button[ MaxButton ]) { + switch ( button[ MaxButton ] ->lastMousePress() ) { + case MidButton: + maximize( maximizeMode() ^ MaximizeVertical ); + break; + case RightButton: + maximize( maximizeMode() ^ MaximizeHorizontal ); + break; + default: + if ( maximizeMode() == MaximizeFull ) { + maximize( MaximizeRestore ); + } + else { + maximize( MaximizeFull ); + } + } + } + else{ + maximize( MaximizeRestore ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// menuButtonPressed() +// ------------------- +// Menu button was pressed + +void BaghiraClient::menuButtonPressed() { + if ( button[ MenuButton ] ) { + QPoint pt( button[ MenuButton ] ->rect().bottomLeft().x(), + button[ MenuButton ] ->rect().bottomLeft().y() + 4 ); + KDecorationFactory* f = factory(); + showWindowMenu( button[ MenuButton ] ->mapToGlobal( pt ) ); + if ( !f->exists( this ) ) + return ; // we have been destroyed + button[ MenuButton ] ->setDown( false ); + } +} + +////////////////////////////////////////////////////////////////////////////// +// new stuff + +void BaghiraClient::aboveBelowButtonPressed() +{ + if (keepAbove()) + { + button[ AboveBelowButton ] ->setDown(true); + setKeepAbove(false ); + setKeepBelow(true ); + button[ AboveBelowButton ] ->repaint( false ); + } + else if (keepBelow()) + { + button[ AboveBelowButton ] ->setDown(false); + setKeepBelow(false ); + setKeepAbove(false ); + button[ AboveBelowButton ] ->repaint( false ); + } + else + { + button[ AboveBelowButton ] ->setDown(true); + setKeepBelow(false ); + setKeepAbove(true ); + button[ AboveBelowButton ] ->repaint( false ); + } +} + +void BaghiraClient::shadeButtonPressed(){ + button[ ShadeButton ]->setDown(!isShade()); + setShade( !isShade() ); +} + +////////////////////////////////////////////////////////////////////////////// +// isTool() +// -------- +// Is this a tool window? + +bool BaghiraClient::isTool() const { + static const unsigned long winmask = NET::DesktopMask | NET::DialogMask | + NET::DockMask | NET::MenuMask | + NET::NormalMask | NET::OverrideMask | + NET::SplashMask | NET::ToolbarMask | + NET::TopMenuMask | NET::UtilityMask; + + NET::WindowType type = windowType( winmask ); + return ( type == NET::Menu || type == NET::Toolbar || type == NET::Utility ); +} + +#include "baghiraclient.moc" diff --git a/deco/baghiraclient.h b/deco/baghiraclient.h new file mode 100644 index 0000000..c77ea0d --- /dev/null +++ b/deco/baghiraclient.h @@ -0,0 +1,445 @@ +////////////////////////////////////////////////////////////////////////////// +// baghiraclient.h +// ------------------- +// Baghira window decoration for KDE +// ------------------- +// Copyright (c) 2004, 2005 Thomas Lübking +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +////////////////////////////////////////////////////////////////////////////// + +#ifndef BAGHIRACLIENT_H +#define BAGHIRACLIENT_H + +#include <qcolor.h> +#include <qbutton.h> +#include <kdecoration.h> +#include <kdecorationfactory.h> +#include <kpixmap.h> +#include <kdeversion.h> +/* +#define BUTTONSIZE 15; +#define MENUBUTTONWIDTH 20; +#define DECOSIZE 8; +#define TITLESIZESMALL 18; +#define MARGIN 4;*/ + +class QSpacerItem; +class QPoint; +class QBitmap; +class KWinModule; + +namespace Baghira { + + +enum PixmapType { + TitleBar = 0, + TitleCenter, + PixmapTypeCount +}; + +enum ColorType { + ColorTitleBar=0, + ColorTitleBlend, + ColorTypeCount +}; + +enum ButtonType{ + MinButton = 0, + MaxButton, + CloseButton, + StickyButton, + ShadeButton, + AboveBelowButton, + MenuButton, + HelpButton, + ButtonTypeAmount, + InactiveButton = ButtonTypeAmount +}; + +enum ButtonStyle{ + Panther = 0, + Jaguar, + Milk, + NostalgiaButton +}; + +enum ButtonState{ + ButtonInactive, + ButtonActive, + Hovered, + Pressed, + ButtonStateAmount +}; + +enum WindowState{ + WindowInactive, + WindowActive, + WindowStateAmount +}; + +enum TitlebarType{ + Gradient, + Stipples, + Nostalgia, + Glossy, + Brushed, + FlatStipples +}; + +class BaghiraClient; + +// #if KDE_IS_VERSION(3,3,91) +class ResizeHandle : public QWidget +{ +//#if KDE_IS_VERSION(3,3,91) +friend class BaghiraClient; + Q_OBJECT +#if KDE_IS_VERSION(3,3,91) +public: + ResizeHandle(BaghiraClient *parent); +protected: + virtual void mousePressEvent ( QMouseEvent * ); + virtual void mouseReleaseEvent ( QMouseEvent * ); + virtual void paintEvent ( QPaintEvent * ); + void updateLook(bool rp = FALSE); +private: + bool eventFilter(QObject *obj, QEvent *e); + void shape(); + BaghiraClient *client; + QPixmap pix; +#endif +}; +// #endif + +class DeMaximizer : public QWidget +{ +friend class BaghiraClient; +friend class BaghiraFactory; + Q_OBJECT +public: + DeMaximizer(); + void setClient(BaghiraClient *); +protected: + void mouseReleaseEvent( QMouseEvent * e ); + void mousePressEvent ( QMouseEvent * e ); + void enterEvent ( QEvent * e ); + void leaveEvent ( QEvent * e ); + void setPixmap(int i, QImage &image); +private: + BaghiraClient *client_; + QPixmap pixmap[5]; + void setState(int i); +}; + +// BaghiraFactory ////////////////////////////////////////////////////////////// + +class BaghiraFactory: public KDecorationFactory +{ +public: + BaghiraFactory(); + virtual ~BaghiraFactory(); + virtual KDecoration *createDecoration(KDecorationBridge *b); + virtual bool reset(unsigned long changed); + virtual QValueList<BorderSize> borderSizes() const; + static QPixmap &ButtonPixmap(Baghira::WindowState wState, Baghira::ButtonType type, Baghira::ButtonState state, int current, bool small); + QImage* DecoImage(QPixmap *pix, int x, int y, int width, int height); + + static QBitmap helpMask, jaguarDownMask, jaguarMenuDownMask, + jaguarMenuMask, jaguarMask, milkMenuDownMask, + milkMenuMask, milkMask, pantherMenuMask, pantherMask, milkDownMask, arrowUp, arrowDown; + + static bool initialized(); + static bool noModalDeco(); + static bool delAppname(); + static QColor &color(int current, Baghira::ColorType c, bool active=true); + static KPixmap &pix(int current, PixmapType p, bool active=true, bool small=false); + static TitlebarType &effect(int current, bool active); + static ButtonStyle buttonStyle(int current); + static Qt::AlignmentFlags titleAlign(); + static int borderSize(int current); + static int contrast(); + static int _3DImpact(int current); + static int LineImpact(int current); + static bool bgStipple(); + static bool resizeGrip(); + static uint defaultMode(); + static bool drawComicFrame(); + static bool shapeUL(int current); + static bool shapeUR(int current); + static bool shapeLL(int current); + static bool shapeLR(int current); + static bool drawIcon(int current); + static bool showTitle(); + static bool allowEasyClosing(); + static bool addAutoSpacing(); + static bool maxResizable(); + TitlebarType titleEffect(); + static DeMaximizer &deMaximizer(); + static bool fullSpec(); + static QColor &BrushedMetalColor(); + +private: +// bool blend( const QImage & upper, const QImage & lower, QImage & output); + unsigned long readConfig(); + void createPixmaps(); + void createGradient(KPixmap &pix, const QColor &light, const QColor &dark, Baghira::TitlebarType effect); + void createOS8Buttons(int style); + QString indexedString(QString s, int index); + QImage* tintBrush( const QImage &img, const QColor &c ) const; + QImage* tintGlossy(const QImage &src, const QColor &c ) const; + +private: + + static bool initialized_; + static bool noModalDeco_; + static bool delAppname_; + static bool bgStipple_; + static bool comicFrame_; + static bool resizeGrip_; + static bool shape_ul[5], shape_ur[5], shape_ll[5], shape_lr[5]; + static bool allowEasyClosing_; + static bool addAutoSpacing_; + static bool maxResizable_; + static bool drawIcon_[5]; + static ButtonStyle buttonStyle_[5]; + static TitlebarType effect_[5][2]; + static Qt::AlignmentFlags titlealign_; + static QColor colors_[5][ColorTypeCount][2]; + static KPixmap pix_[5][PixmapTypeCount][2][2]; + static QPixmap ButtonPixmap_[5][WindowStateAmount][ButtonTypeAmount][ButtonStateAmount][2]; + static QColor ButtonColor_[ButtonTypeAmount+1]; + static QColor brushedMetalColor; + static QPixmap nostalgia_[5][3][2]; + + static int contrast_; + static int bordersize_[5]; + static uint defaultMode_; + static int minimumTitleHeight_; + static int _3DImpact_[5]; + static int LineImpact_[5]; + + static bool tintBrush_; + static bool showTitle_; + static QColor brushTint; + static DeMaximizer deMaximizer_; + static bool fullSpec_; + +}; + +inline bool BaghiraFactory::fullSpec() + { return fullSpec_; } +inline bool BaghiraFactory::noModalDeco() +{ return noModalDeco_; } +inline bool BaghiraFactory::delAppname() +{ return delAppname_; } + +inline DeMaximizer &BaghiraFactory::deMaximizer() + { return deMaximizer_; } + +inline bool BaghiraFactory::shapeUL(int current) + { return shape_ul[current]; } +inline bool BaghiraFactory::shapeUR(int current) + { return shape_ur[current]; } +inline bool BaghiraFactory::shapeLL(int current) + { return shape_ll[current]; } +inline bool BaghiraFactory::shapeLR(int current) + { return shape_lr[current]; } + +inline bool BaghiraFactory::allowEasyClosing() + { return allowEasyClosing_; } + +inline bool BaghiraFactory::addAutoSpacing() + { return addAutoSpacing_; } + +inline bool BaghiraFactory::maxResizable() + { return maxResizable_; } + +inline bool BaghiraFactory::resizeGrip() + { return resizeGrip_; } + +inline uint BaghiraFactory::defaultMode() + { return defaultMode_; } + +inline bool BaghiraFactory::drawIcon(int current) + { return drawIcon_[current]; } + +inline bool BaghiraFactory::showTitle() +{ return showTitle_; } + +inline int BaghiraFactory::contrast() + { return contrast_; } + +inline int BaghiraFactory::_3DImpact(int current) + { return _3DImpact_[current]; } + +inline int BaghiraFactory::LineImpact(int current) + { return LineImpact_[current]; } + +inline bool BaghiraFactory::drawComicFrame() + { return comicFrame_; } + +inline bool BaghiraFactory::bgStipple() + { return bgStipple_; } + +inline ButtonStyle BaghiraFactory::buttonStyle(int current) + { return BaghiraFactory::buttonStyle_[current]; } + +inline bool BaghiraFactory::initialized() + { return initialized_; } + +inline QColor &BaghiraFactory::BrushedMetalColor() + { return brushedMetalColor; } + +inline QColor &BaghiraFactory::color(int current, Baghira::ColorType c, bool active) + { return colors_[current][c][active]; } + +inline KPixmap &BaghiraFactory::pix(int current, PixmapType p, bool active, bool small) + { return pix_[current][p][active][small]; } + +inline Baghira::TitlebarType &BaghiraFactory::effect(int current, bool active) + { return effect_[current][active]; } + +inline Qt::AlignmentFlags BaghiraFactory::titleAlign() + { return titlealign_; } + +inline int BaghiraFactory::borderSize(int current) +{ return bordersize_[current]; } + +// BaghiraButton /////////////////////////////////////////////////////////////// + +class BaghiraButton : public QButton +{ + Q_OBJECT +public: + BaghiraButton(BaghiraClient *parent=0, const char *name=0, const QString &tip=NULL, bool small=false, ButtonType type=MinButton, int style=0); + ~BaghiraButton(); + + QSize sizeHint() const; + int lastMousePress() const; + void reset(); + inline void setMasks(QBitmap *bitmask, QBitmap *bitmaskDown); + Baghira::ButtonState state(); + inline void setType(Baghira::ButtonType type) + {type_ = type; } + QBitmap *mask; + QBitmap *maskDown; + +private: + void enterEvent(QEvent *e); + void leaveEvent(QEvent *e); + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + void drawButton(QPainter *painter); + +private slots: + void delayedEnterEvent(); + +private: + bool _blocked; + BaghiraClient *client_; + ButtonType type_; + QBitmap *deco_; + QPixmap *pixmap[2][5]; + KPixmap icon_; + bool small_; + int lastmouse_; + bool mouseover_; + bool down_; +}; + +inline int BaghiraButton::lastMousePress() const + { return lastmouse_; } + +inline void BaghiraButton::reset() + { repaint(false); } + +// BaghiraClient /////////////////////////////////////////////////////////////// + +class BaghiraClient : public KDecoration +{ +friend class BaghiraButton; +friend class ResizeHandle; + Q_OBJECT +public: + BaghiraClient(KDecorationBridge *b, KDecorationFactory *f); + virtual ~BaghiraClient(); + + virtual void init(); + QString caption() const; + + virtual void activeChange(); + virtual void desktopChange(); + virtual void captionChange(); + virtual void iconChange(); + virtual void maximizeChange(); + virtual void shadeChange(); + void demaxButtonPressed(); + + virtual void borders(int &l, int &r, int &t, int &b) const; + virtual void resize(const QSize &size); + virtual QSize minimumSize() const; + virtual Position mousePosition(const QPoint &point) const; + uint currentStyle; + +signals: + void hide(); + +protected: + bool isTool() const; + int titleheight_; + +private: + void addButtons(QBoxLayout* layout, const QString& buttons); + + bool eventFilter(QObject *obj, QEvent *e); + void mouseDoubleClickEvent(QMouseEvent *e); + void wheelEvent(QWheelEvent *e); + void paintEvent(QPaintEvent *); + void resizeEvent(QResizeEvent *); + void showEvent(QShowEvent *); + +private slots: + void doShape(); + void maxButtonPressed(); + void menuButtonPressed(); + void aboveBelowButtonPressed(); + void shadeButtonPressed(); + +private: + BaghiraButton *button[ButtonTypeAmount]; + + QSpacerItem *titlebar_; + QPixmap HandlePix; + int excursion; // skewness because of unequality of left/right buttons - bad for center aligned titles... + int plusminus; + bool isFaded; + bool leftClose; + bool rightClose; + bool performEasyClose; + bool noDeco_; + QHBoxLayout *windowlayout; + int ICONX, ICONY; + ResizeHandle *grip; + QString caption_; +}; + +} // namespace Baghira + +#endif // BAGHIRACLIENT_H diff --git a/deco/config/Makefile.am b/deco/config/Makefile.am new file mode 100644 index 0000000..b9b97ae --- /dev/null +++ b/deco/config/Makefile.am @@ -0,0 +1,23 @@ +AUTOMAKE_OPTIONS = foreign + +KDE_CXXFLAGS = -DQT_PLUGIN + +INCLUDES = $(all_includes) -I$(srcdir)/../../config + +noinst_HEADERS = baghiraconfig.h aquariusbutton.h colorpicker.h pixmaps.h + +kde_module_LTLIBRARIES = kwin_baghira_config.la +kwin_baghira_config_la_SOURCES = baghiraconfig.cc aquariusbutton.cc colorpicker.cc configdialog.ui +kwin_baghira_config_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +kwin_baghira_config_la_LIBADD = $(LIB_KDEUI) +kwin_baghira_config_la_METASOURCES = AUTO + +DISTCLEANFILES = $(kwin_baghira_config_la_METASOURCES) + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kwin_baghira_config.pot + +pixmaps.h: $(srcdir)/generatePixmaps.sh + $(SHELL) $(srcdir)/generatePixmaps.sh $(top_srcdir) +CLEANFILES = pixmaps.h +baghiraconfig.lo: pixmaps.h diff --git a/deco/config/aquariusbutton.cc b/deco/config/aquariusbutton.cc new file mode 100644 index 0000000..6201abc --- /dev/null +++ b/deco/config/aquariusbutton.cc @@ -0,0 +1,162 @@ +#include "aquariusbutton.h" +#include <qcolor.h> +#include <qpixmap.h> +#include <qpainter.h> +#include <kimageeffect.h> +#include "config.h" + + +#define COLOR_SPACE(R,G,B) \ + if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \ + if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \ + if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255; + +#define SATURATION_COLOR(R,G,B) \ + grey = (299 * R + 587 * G + 114 * B) / 1000; \ + delta = 255 - grey; \ + grey = (grey *(10 - 5)) / 10; \ + iGrey = 255 - grey;\ + destR = (iGrey * (srcR - delta) + grey * R) / 255; \ + destG = (iGrey * (srcG - delta) + grey * G) / 255; \ + destB = (iGrey * (srcB - delta) + grey * B) / 255; + +#define CLAMP(x,l,u) x < l ? l :\ + x > u ? u :\ + x + +#define SATURATION_COLOR2(S,R,G,B) \ + int max = 255+0.65*(100-S); \ + destR = CLAMP((srcR + R - 128), 0, max); \ + destG = CLAMP((srcG + G - 128), 0, max); \ + destB = CLAMP((srcB + B - 128), 0, max); \ + destR = (S*destR + (100-S)*R)/100; \ + destG = (S*destG + (100-S)*G)/100; \ + destB = (S*destB + (100-S)*B)/100; + +static bool blend( const QImage & upper, const QImage & lower, QImage & output) +// adopted from kimageeffect::blend - what is not endian safe... +{ + if + ( + upper.width() > lower.width() || + upper.height() > lower.height() || + upper.depth() != 32 || + lower.depth() != 32 + ) + return false; + + output = lower.copy(); + + register uchar *i, *o; + register int a; + register int col; + register int w = upper.width(); + int row(upper.height() - 1); + + do + { + i = upper.scanLine(row); + o = output.scanLine(row); + + col = w << 2; + + --col; + + do + { +#ifdef WORDS_BIGENDIAN + while (!(a = i[col-3]) && (col != 3)) +#else + while (!(a = i[col]) && (col != 3)) +#endif + { + --col; --col; --col; --col; + } +#ifndef WORDS_BIGENDIAN + --col; +#endif + o[col] += ((i[col] - o[col]) * a) >> 8; + + --col; + o[col] += ((i[col] - o[col]) * a) >> 8; + + --col; + o[col] += ((i[col] - o[col]) * a) >> 8; + +#ifdef WORDS_BIGENDIAN + --col; +#endif + + } while (col--); + } while (row--); + return true; +} + +AquariusButton::AquariusButton( QPixmap &pixmap, QWidget* parent, const char* name) : QWidget( parent, name){ + pixmap = pixmap; + image = pixmap.convertToImage(); + setFixedSize( pixmap.size() ); +} + +AquariusButton::~AquariusButton(){ +} + +QColor AquariusButton::Color(){ + return color; +} + +void AquariusButton::setColor(QColor c){ + color = c; + tint(color); + repaint(false); +} + +void AquariusButton::tint(QColor &c){ + QImage dest( image.width(), image.height(), 32, 0 ); + dest.setAlphaBuffer( true ); + unsigned int *data = ( unsigned int * ) image.bits(); + unsigned int *destData = ( unsigned int* ) dest.bits(); + int total = image.width() * image.height(); + int red, green, blue; + int destR, destG, destB, alpha; + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + int hue, s, v; + c.getHsv( &hue, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + // float srcPercent, destPercent; + for ( int current = 0 ; current < total ; ++current ) { + alpha = qAlpha( data[ current ] ); + if (alpha < 230){ + destData[ current ] = data[ current ]; + continue; //do not handle translucent parts to not affect blending + } + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + blue = qBlue( data[ current ] ); + SATURATION_COLOR2(sq, red, green, blue); + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + QPixmap backPix = QPixmap(dest.size()); + QPainter tmpPainter(&backPix); + tmpPainter.fillRect(0, 0, dest.width(),dest.height(), backgroundBrush()); + tmpPainter.end(); + QImage back = backPix.convertToImage(); + blend(dest,back,back); + pixmap = QPixmap(back); +} + +void AquariusButton::mousePressEvent( QMouseEvent *e ){ + emit clicked(); +} + +void AquariusButton::paintEvent( QPaintEvent *e){ + QPainter tmpPainter(this); + tmpPainter.drawPixmap(0,0, pixmap); +} + +// void AquariusButton::clicked(){ +// } diff --git a/deco/config/aquariusbutton.h b/deco/config/aquariusbutton.h new file mode 100644 index 0000000..04fec0d --- /dev/null +++ b/deco/config/aquariusbutton.h @@ -0,0 +1,37 @@ +#ifndef AQUARIUSBUTTON_H +#define AQUARIUSBUTTON_H + +//#include <qvariant.h> +#include <qwidget.h> +#include <qimage.h> + +class QPixmap; +class QColor; + +class AquariusButton : public QWidget +{ + Q_OBJECT + +public: + AquariusButton( QPixmap &pixmap, QWidget* parent = 0, const char* name = 0); + ~AquariusButton(); + QColor Color(); + +public slots: + void setColor(QColor c); + +protected: + QPixmap pixmap; + QImage image; + QColor color; + void tint(QColor &c); + void mousePressEvent( QMouseEvent *e ); + void paintEvent( QPaintEvent *e); + + +signals: + void clicked(); + +}; + +#endif // AQUARIUSBUTTON_H diff --git a/deco/config/baghiraconfig.cc b/deco/config/baghiraconfig.cc new file mode 100644 index 0000000..2054976 --- /dev/null +++ b/deco/config/baghiraconfig.cc @@ -0,0 +1,729 @@ +////////////////////////////////////////////////////////////////////////////// +// baghiraconfig.cc +// ------------------- +// Config module for Baghira window decoration +// ------------------- +// Copyright (c) 2004 Thomas Lübking +// Please see the header file for copyright and license information. +////////////////////////////////////////////////////////////////////////////// + +#include <kconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <kcolorbutton.h> +#include <qbutton.h> +#include <qbuttongroup.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qfont.h> +#include <qgroupbox.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qsettings.h> +#include <qspinbox.h> +#include <qwhatsthis.h> + +#include "baghiraconfig.h" +#include "configdialog.h" +#include "pixmaps.h" + +////////////////////////////////////////////////////////////////////////////// +// BaghiraConfig Class // +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// BaghiraConfig() +// ------------- +// Constructor + +BaghiraConfig::BaghiraConfig(KConfig*, QWidget* parent) + : QObject(parent), /*config_(0),*/ dialog_(0) +{ +// config_ = new KConfig("baghirarc"); +// config_ = new QSettings; +// config_->beginGroup("/baghira/Deco"); + KGlobal::locale()->insertCatalogue("kwin_baghira_config"); + + dialog_ = new ConfigDialog(parent); + buttonDialog_ = new ButtonColors(parent, "Button Colors"); + load(0L); + + dialog_->show(); + + connect(dialog_->ButtonColorConfig, SIGNAL(clicked()), buttonDialog_, SLOT(exec())); + connect(buttonDialog_->ok, SIGNAL(clicked()), SIGNAL(changed())); + + // connections + connect(dialog_->titlealign, SIGNAL(clicked(int)), SIGNAL(changed())); + connect(dialog_->drawComicFrame, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->addAutoSpacing, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->allowEasyClosing, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->ResizeGrip, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->maxResizable, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->fullSpec, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->noModalDeco, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->delAppname, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->defaultMode, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->minTH, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_J, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_J, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_J, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_J, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_J, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_J, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_P, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_P, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_P, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_P, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_P, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_P, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_B, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_B, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_B, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_B, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_B, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_B, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_T, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_T, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_T, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->_3DImpact_T, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_T, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_S, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_S, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_S, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_S, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_S, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_S, SIGNAL(valueChanged(int)), SIGNAL(changed())); +// config_->endGroup(); + +} + +////////////////////////////////////////////////////////////////////////////// +// ~BaghiraConfig() +// -------------- +// Destructor + +BaghiraConfig::~BaghiraConfig() +{ + if (dialog_) delete dialog_; +// if (config_) delete config_; +} + +////////////////////////////////////////////////////////////////////////////// +// load() +// ------ +// Load configuration data + +void BaghiraConfig::load(KConfig*) +{ + QSettings *config_ = new QSettings; + config_->beginGroup("/baghira/Deco"); + + QString value = config_->readEntry("TitleAlignment", "AlignHCenter"); + QRadioButton *button = (QRadioButton*)dialog_->titlealign-> + child((const char *)value.latin1()); + if (button) button->setChecked(true); + + dialog_->minTH->setValue(config_->readNumEntry("minimumTitleHeight",18)); + dialog_->ResizeGrip->setChecked(config_->readBoolEntry("ResizeGrip",false)); + dialog_->allowEasyClosing->setChecked(config_->readBoolEntry("allowEasyClosing",false)); + dialog_->drawComicFrame->setChecked(config_->readBoolEntry("DrawComicFrame",false)); + dialog_->maxResizable->setChecked(config_->readBoolEntry("MaxResizable",false)); + dialog_->fullSpec->setChecked(config_->readBoolEntry("FullSpec",false)); + dialog_->addAutoSpacing->setChecked(config_->readBoolEntry("AddAutoSpacing",true)); + dialog_->defaultMode->setCurrentItem(config_->readNumEntry("defaultMode",1)); + dialog_->noModalDeco->setChecked(config_->readBoolEntry("NoModalDeco",false)); + dialog_->delAppname->setChecked(config_->readBoolEntry("RemoveAppname",false)); + + dialog_->activeColor1_J->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_1",QColor(255,255,255).rgb()))); + dialog_->inactiveColor1_J->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_1",QColor(204,214,230).rgb()))); + dialog_->activeColor2_J->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_1",QColor(238,234,238).rgb()))); + dialog_->inactiveColor2_J->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_1",QColor(194,196,211).rgb()))); + dialog_->buttonStyle_J->setCurrentItem(config_->readNumEntry("ButtonStyle_1",1)); + dialog_->titleeffect_J->setCurrentItem(config_->readNumEntry("TitleEffect_1", 1)); + dialog_->i_titleeffect_J->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_1", 1)); + dialog_->shapeUL_J->setChecked(config_->readBoolEntry("ShapeUL_1",true)); + dialog_->shapeUR_J->setChecked(config_->readBoolEntry("ShapeUR_1",true)); + dialog_->shapeLL_J->setChecked(config_->readBoolEntry("ShapeLL_1",false)); + dialog_->shapeLR_J->setChecked(config_->readBoolEntry("ShapeLR_1",false)); + dialog_->drawIcon_J->setChecked(config_->readBoolEntry("drawIcon_1",true)); + dialog_->_3DImpact_J->setValue(config_->readNumEntry("3DImpact_1",20)); + dialog_->LineImpact_J->setValue(config_->readNumEntry("LineImpact_1",40)); + dialog_->borderSize_J->setValue(config_->readNumEntry("BorderSize_1",0)); + + dialog_->activeColor1_P->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_2",QColor(238,238,238).rgb()))); + dialog_->inactiveColor1_P->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_2",QColor(246,242,246).rgb()))); + dialog_->activeColor2_P->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_2",QColor(205,202,205).rgb()))); + dialog_->inactiveColor2_P->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_2",QColor(238,238,238).rgb()))); + dialog_->buttonStyle_P->setCurrentItem(config_->readNumEntry("ButtonStyle_2",0)); + dialog_->titleeffect_P->setCurrentItem(config_->readNumEntry("TitleEffect_2", 0)); + dialog_->i_titleeffect_P->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_2", 0)); + dialog_->shapeUL_P->setChecked(config_->readBoolEntry("ShapeUL_2",true)); + dialog_->shapeUR_P->setChecked(config_->readBoolEntry("ShapeUR_2",true)); + dialog_->shapeLL_P->setChecked(config_->readBoolEntry("ShapeLL_2",false)); + dialog_->shapeLR_P->setChecked(config_->readBoolEntry("ShapeLR_2",false)); + dialog_->drawIcon_P->setChecked(config_->readBoolEntry("drawIcon_2",true)); + dialog_->_3DImpact_P->setValue(config_->readNumEntry("3DImpact_2",20)); + dialog_->LineImpact_P->setValue(config_->readNumEntry("LineImpact_2",40)); + dialog_->borderSize_P->setValue(config_->readNumEntry("BorderSize_2",0)); + + dialog_->activeColor1_B->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_3",QColor(202,202,202).rgb()))); + dialog_->inactiveColor1_B->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_3",QColor(200,200,200).rgb()))); + dialog_->activeColor2_B->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_3",QColor(150,150,150).rgb()))); + dialog_->inactiveColor2_B->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_3",QColor(150,150,150).rgb()))); + dialog_->buttonStyle_B->setCurrentItem(config_->readNumEntry("ButtonStyle_3",0)); + dialog_->titleeffect_B->setCurrentItem(config_->readNumEntry("TitleEffect_3", 4)); + dialog_->i_titleeffect_B->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_3", 4)); + dialog_->shapeUL_B->setChecked(config_->readBoolEntry("ShapeUL_3",true)); + dialog_->shapeUR_B->setChecked(config_->readBoolEntry("ShapeUR_3",true)); + dialog_->shapeLL_B->setChecked(config_->readBoolEntry("ShapeLL_3",true)); + dialog_->shapeLR_B->setChecked(config_->readBoolEntry("ShapeLR_3",true)); + dialog_->drawIcon_B->setChecked(config_->readBoolEntry("drawIcon_3",true)); + dialog_->_3DImpact_B->setValue(config_->readNumEntry("3DImpact_3",20)); + dialog_->LineImpact_B->setValue(config_->readNumEntry("LineImpact_3",0)); + dialog_->borderSize_B->setValue(config_->readNumEntry("BorderSize_3",6)); + + dialog_->activeColor1_T->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_4",QColor(238,238,238).rgb()))); + dialog_->activeColor2_T->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_4",QColor(205,202,205).rgb()))); + dialog_->buttonStyle_T->setCurrentItem(config_->readNumEntry("ButtonStyle_4",0)); + dialog_->shapeUL_T->setChecked(config_->readBoolEntry("ShapeUL_4",true)); + dialog_->shapeUR_T->setChecked(config_->readBoolEntry("ShapeUR_4",true)); + dialog_->shapeLL_T->setChecked(config_->readBoolEntry("ShapeLL_4",false)); + dialog_->shapeLR_T->setChecked(config_->readBoolEntry("ShapeLR_4",false)); + dialog_->drawIcon_T->setChecked(config_->readBoolEntry("drawIcon_4",true)); + dialog_->_3DImpact_T->setValue(config_->readNumEntry("3DImpact_4",20)); + dialog_->borderSize_T->setValue(config_->readNumEntry("BorderSize_4",0)); + + dialog_->activeColor1_S->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_5",QColor(250,250,250).rgb()))); + dialog_->inactiveColor1_S->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_5",QColor(230,230,230).rgb()))); + dialog_->activeColor2_S->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_5",QColor(230,230,230).rgb()))); + dialog_->inactiveColor2_S->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_5",QColor(250,250,250).rgb()))); + dialog_->buttonStyle_S->setCurrentItem(config_->readNumEntry("ButtonStyle_5",0)); + dialog_->titleeffect_S->setCurrentItem(config_->readNumEntry("TitleEffect_5", 0)); + dialog_->i_titleeffect_S->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_5", 0)); + dialog_->shapeUL_S->setChecked(config_->readBoolEntry("ShapeUL_5",true)); + dialog_->shapeUR_S->setChecked(config_->readBoolEntry("ShapeUR_5",true)); + dialog_->shapeLL_S->setChecked(config_->readBoolEntry("ShapeLL_5",false)); + dialog_->shapeLR_S->setChecked(config_->readBoolEntry("ShapeLR_5",false)); + dialog_->drawIcon_S->setChecked(config_->readBoolEntry("drawIcon_5",true)); + dialog_->_3DImpact_S->setValue(config_->readNumEntry("3DImpact_5",20)); + dialog_->LineImpact_S->setValue(config_->readNumEntry("LineImpact_5",30)); + dialog_->borderSize_S->setValue(config_->readNumEntry("BorderSize_5",0)); + + buttonDialog_->inactiveColor->setColor(QColor((unsigned int)config_->readNumEntry("InactiveButtonColor", QColor(255,255,255).rgb()))); + buttonDialog_->closeColor->setColor(QColor((unsigned int)config_->readNumEntry("CloseButtonColor", QColor(200,85,70).rgb()))); + buttonDialog_->minColor->setColor(QColor((unsigned int)config_->readNumEntry("MinButtonColor", QColor(230,155,40).rgb()))); + buttonDialog_-> maxColor->setColor(QColor((unsigned int)config_->readNumEntry("MaxButtonColor", QColor(121,180,54).rgb()))); + buttonDialog_->menuColor->setColor(QColor((unsigned int)config_->readNumEntry("MenuButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->helpColor->setColor(QColor((unsigned int)config_->readNumEntry("HelpButtonColor", QColor(0,0,0).rgb()))); + buttonDialog_->stickyColor->setColor(QColor((unsigned int)config_->readNumEntry("StickyButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->aboveColor->setColor(QColor((unsigned int)config_->readNumEntry("AboveButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->behindColor->setColor(QColor((unsigned int)config_->readNumEntry("BehindButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->shadeColor->setColor(QColor((unsigned int)config_->readNumEntry("ShadeButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->init(); + config_->endGroup(); + delete config_; + +} + +////////////////////////////////////////////////////////////////////////////// +// save() +// ------ +// Save configuration data + +void BaghiraConfig::save(KConfig*) +{ + QSettings *config_ = new QSettings; + config_->beginGroup("/baghira/Deco"); + + QRadioButton *button = (QRadioButton*)dialog_->titlealign->selected(); + if (button) config_->writeEntry("TitleAlignment", QString(button->name())); + config_->writeEntry("DrawComicFrame", dialog_->drawComicFrame->isChecked()); + config_->writeEntry("AddAutoSpacing", dialog_->addAutoSpacing->isChecked()); + config_->writeEntry("ResizeGrip", dialog_->ResizeGrip->isChecked()); + config_->writeEntry("allowEasyClosing", dialog_->allowEasyClosing->isChecked()); + config_->writeEntry("MaxResizable", dialog_->maxResizable->isChecked()); + config_->writeEntry("FullSpec", dialog_->fullSpec->isChecked()); + config_->writeEntry("defaultMode", dialog_->defaultMode->currentItem()); + config_->writeEntry("minimumTitleHeight", dialog_->minTH->value()); + config_->writeEntry("NoModalDeco", dialog_->noModalDeco->isChecked()); + config_->writeEntry("RemoveAppname", dialog_->delAppname->isChecked()); + + config_->writeEntry("activeColor1_1", (int)dialog_->activeColor1_J->color().rgb()); + config_->writeEntry("activeColor2_1", (int)dialog_->activeColor2_J->color().rgb()); + config_->writeEntry("inactiveColor1_1", (int)dialog_->inactiveColor1_J->color().rgb()); + config_->writeEntry("inactiveColor2_1", (int)dialog_->inactiveColor2_J->color().rgb()); + config_->writeEntry("ButtonStyle_1", dialog_->buttonStyle_J->currentItem()); + config_->writeEntry("TitleEffect_1", dialog_->titleeffect_J->currentItem()); + config_->writeEntry("inactiveTitleEffect_1", dialog_->i_titleeffect_J->currentItem()); + config_->writeEntry("ShapeUL_1", dialog_->shapeUL_J->isChecked()); + config_->writeEntry("ShapeUR_1", dialog_->shapeUR_J->isChecked()); + config_->writeEntry("ShapeLL_1", dialog_->shapeLL_J->isChecked()); + config_->writeEntry("ShapeLR_1", dialog_->shapeLR_J->isChecked()); + config_->writeEntry("drawIcon_1", dialog_->drawIcon_J->isChecked()); + config_->writeEntry("3DImpact_1", dialog_->_3DImpact_J->value()); + config_->writeEntry("LineImpact_1", dialog_->LineImpact_J->value()); + config_->writeEntry("BorderSize_1", dialog_->borderSize_J->value()); + + config_->writeEntry("activeColor1_2", (int)dialog_->activeColor1_P->color().rgb()); + config_->writeEntry("activeColor2_2", (int)dialog_->activeColor2_P->color().rgb()); + config_->writeEntry("inactiveColor1_2", (int)dialog_->inactiveColor1_P->color().rgb()); + config_->writeEntry("inactiveColor2_2", (int)dialog_->inactiveColor2_P->color().rgb()); + config_->writeEntry("ButtonStyle_2", dialog_->buttonStyle_P->currentItem()); + config_->writeEntry("TitleEffect_2", dialog_->titleeffect_P->currentItem()); + config_->writeEntry("inactiveTitleEffect_2", dialog_->i_titleeffect_P->currentItem()); + config_->writeEntry("ShapeUL_2", dialog_->shapeUL_P->isChecked()); + config_->writeEntry("ShapeUR_2", dialog_->shapeUR_P->isChecked()); + config_->writeEntry("ShapeLL_2", dialog_->shapeLL_P->isChecked()); + config_->writeEntry("ShapeLR_2", dialog_->shapeLR_P->isChecked()); + config_->writeEntry("drawIcon_2", dialog_->drawIcon_P->isChecked()); + config_->writeEntry("3DImpact_2", dialog_->_3DImpact_P->value()); + config_->writeEntry("LineImpact_2", dialog_->LineImpact_P->value()); + config_->writeEntry("BorderSize_2", dialog_->borderSize_P->value()); + + config_->writeEntry("activeColor1_3", (int)dialog_->activeColor1_B->color().rgb()); + config_->writeEntry("activeColor2_3", (int)dialog_->activeColor2_B->color().rgb()); + config_->writeEntry("inactiveColor1_3", (int)dialog_->inactiveColor1_B->color().rgb()); + config_->writeEntry("inactiveColor2_3", (int)dialog_->inactiveColor2_B->color().rgb()); + config_->writeEntry("ButtonStyle_3", dialog_->buttonStyle_B->currentItem()); + config_->writeEntry("TitleEffect_3", dialog_->titleeffect_B->currentItem()); + config_->writeEntry("inactiveTitleEffect_3", dialog_->i_titleeffect_B->currentItem()); + config_->writeEntry("ShapeUL_3", dialog_->shapeUL_B->isChecked()); + config_->writeEntry("ShapeUR_3", dialog_->shapeUR_B->isChecked()); + config_->writeEntry("ShapeLL_3", dialog_->shapeLL_B->isChecked()); + config_->writeEntry("ShapeLR_3", dialog_->shapeLR_B->isChecked()); + config_->writeEntry("drawIcon_3", dialog_->drawIcon_B->isChecked()); + config_->writeEntry("3DImpact_3", dialog_->_3DImpact_B->value()); + config_->writeEntry("LineImpact_3", dialog_->LineImpact_B->value()); + config_->writeEntry("BorderSize_3", dialog_->borderSize_B->value()); + + config_->writeEntry("activeColor1_4", (int)dialog_->activeColor1_T->color().rgb()); + config_->writeEntry("activeColor2_4", (int)dialog_->activeColor2_T->color().rgb()); + config_->writeEntry("ButtonStyle_4", dialog_->buttonStyle_T->currentItem()); + config_->writeEntry("ShapeUL_4", dialog_->shapeUL_T->isChecked()); + config_->writeEntry("ShapeUR_4", dialog_->shapeUR_T->isChecked()); + config_->writeEntry("ShapeLL_4", dialog_->shapeLL_T->isChecked()); + config_->writeEntry("ShapeLR_4", dialog_->shapeLR_T->isChecked()); + config_->writeEntry("drawIcon_4", dialog_->drawIcon_T->isChecked()); + config_->writeEntry("3DImpact_4", dialog_->_3DImpact_T->value()); + config_->writeEntry("BorderSize_4", dialog_->borderSize_T->value()); + + config_->writeEntry("activeColor1_5", (int)dialog_->activeColor1_S->color().rgb()); + config_->writeEntry("activeColor2_5", (int)dialog_->activeColor2_S->color().rgb()); + config_->writeEntry("inactiveColor1_5", (int)dialog_->inactiveColor1_S->color().rgb()); + config_->writeEntry("inactiveColor2_5", (int)dialog_->inactiveColor2_S->color().rgb()); + config_->writeEntry("ButtonStyle_5", dialog_->buttonStyle_S->currentItem()); + config_->writeEntry("TitleEffect_5", dialog_->titleeffect_S->currentItem()); + config_->writeEntry("inactiveTitleEffect_5", dialog_->i_titleeffect_S->currentItem()); + config_->writeEntry("ShapeUL_5", dialog_->shapeUL_S->isChecked()); + config_->writeEntry("ShapeUR_5", dialog_->shapeUR_S->isChecked()); + config_->writeEntry("ShapeLL_5", dialog_->shapeLL_S->isChecked()); + config_->writeEntry("ShapeLR_5", dialog_->shapeLR_S->isChecked()); + config_->writeEntry("drawIcon_5", dialog_->drawIcon_S->isChecked()); + config_->writeEntry("3DImpact_5", dialog_->_3DImpact_S->value()); + config_->writeEntry("LineImpact_5", dialog_->LineImpact_S->value()); + config_->writeEntry("BorderSize_5", dialog_->borderSize_S->value()); + + if (buttonDialog_->save){ + config_->writeEntry("InactiveButtonColor", (int)buttonDialog_->inactiveColor->Color().rgb()); + config_->writeEntry("CloseButtonColor", (int)buttonDialog_->closeColor->Color().rgb()); + config_->writeEntry("MinButtonColor", (int)buttonDialog_->minColor->Color().rgb()); + config_->writeEntry("MaxButtonColor", (int)buttonDialog_->maxColor->Color().rgb()); + config_->writeEntry("MenuButtonColor", (int)buttonDialog_->menuColor->Color().rgb()); + config_->writeEntry("HelpButtonColor", (int)buttonDialog_->helpColor->Color().rgb()); + config_->writeEntry("StickyButtonColor", (int)buttonDialog_->stickyColor->Color().rgb()); + config_->writeEntry("AboveButtonColor", (int)buttonDialog_->aboveColor->Color().rgb()); + config_->writeEntry("BehindButtonColor", (int)buttonDialog_->behindColor->Color().rgb()); + config_->writeEntry("ShadeButtonColor", (int)buttonDialog_->shadeColor->Color().rgb()); + } + config_->endGroup(); + delete config_; + +// config_->sync(); +} + +////////////////////////////////////////////////////////////////////////////// +// defaults() +// ---------- +// Set configuration defaults + +void BaghiraConfig::defaults() +{ + QRadioButton *button = (QRadioButton*)dialog_->titlealign->child("AlignHCenter"); + if (button) button->setChecked(true); + dialog_->allowEasyClosing->setChecked(false); + dialog_->minTH->setValue(22); + dialog_->ResizeGrip->setChecked(false); + dialog_->drawComicFrame->setChecked(false); + dialog_->addAutoSpacing->setChecked(true); + dialog_->maxResizable->setChecked(false); + dialog_->fullSpec->setChecked(false); + dialog_->defaultMode->setCurrentItem(1); + dialog_->noModalDeco->setChecked(false); + dialog_->delAppname->setChecked(false); + + dialog_->activeColor1_J->setColor(QColor(255,255,255)); + dialog_->inactiveColor1_J->setColor(QColor(204,214,230)); + dialog_->activeColor2_J->setColor(QColor(238,234,238)); + dialog_->inactiveColor2_J->setColor(QColor(194,196,211)); + dialog_->buttonStyle_J->setCurrentItem(1); + dialog_->titleeffect_J->setCurrentItem(1); + dialog_->i_titleeffect_J->setCurrentItem(1); + dialog_->shapeUL_J->setChecked(true); + dialog_->shapeUR_J->setChecked(true); + dialog_->shapeLL_J->setChecked(false); + dialog_->shapeLR_J->setChecked(false); + dialog_->drawIcon_J->setChecked(true); + dialog_->_3DImpact_J->setValue(20); + dialog_->LineImpact_J->setValue(40); + dialog_->borderSize_J->setValue(0); + + dialog_->activeColor1_P->setColor(QColor(238,238,238)); + dialog_->inactiveColor1_P->setColor(QColor(246,242,246)); + dialog_->activeColor2_P->setColor(QColor(205,202,205)); + dialog_->inactiveColor2_P->setColor(QColor(238,238,238)); + dialog_->buttonStyle_P->setCurrentItem(0); + dialog_->titleeffect_P->setCurrentItem(0); + dialog_->i_titleeffect_P->setCurrentItem(0); + dialog_->shapeUL_P->setChecked(true); + dialog_->shapeUR_P->setChecked(true); + dialog_->shapeLL_P->setChecked(false); + dialog_->shapeLR_P->setChecked(false); + dialog_->drawIcon_P->setChecked(true); + dialog_->_3DImpact_P->setValue(20); + dialog_->LineImpact_P->setValue(30); + dialog_->borderSize_P->setValue(0); + + dialog_->activeColor1_B->setColor(QColor(210,210,210)); + dialog_->inactiveColor1_B->setColor(QColor(200,200,200)); + dialog_->activeColor2_B->setColor(QColor(150,150,150)); + dialog_->inactiveColor2_B->setColor(QColor(140,140,140)); + dialog_->buttonStyle_B->setCurrentItem(0); + dialog_->titleeffect_B->setCurrentItem(4); + dialog_->i_titleeffect_B->setCurrentItem(4); + dialog_->shapeUL_B->setChecked(true); + dialog_->shapeUR_B->setChecked(true); + dialog_->shapeLL_B->setChecked(false); + dialog_->shapeLR_B->setChecked(false); + dialog_->drawIcon_B->setChecked(true); + dialog_->_3DImpact_B->setValue(20); + dialog_->LineImpact_B->setValue(0); + dialog_->borderSize_B->setValue(6); + + dialog_->activeColor1_T->setColor(QColor(238,238,238)); + dialog_->activeColor2_T->setColor(QColor(211,208,211)); + dialog_->buttonStyle_T->setCurrentItem(0); + dialog_->shapeUL_T->setChecked(true); + dialog_->shapeUR_T->setChecked(true); + dialog_->shapeLL_T->setChecked(false); + dialog_->shapeLR_T->setChecked(false); + dialog_->drawIcon_T->setChecked(true); + dialog_->_3DImpact_T->setValue(20); + dialog_->borderSize_T->setValue(0); + + dialog_->activeColor1_S->setColor(QColor(250,250,250)); + dialog_->inactiveColor1_S->setColor(QColor(230,230,230)); + dialog_->activeColor2_S->setColor(QColor(230,230,230)); + dialog_->inactiveColor2_S->setColor(QColor(250,250,250)); + dialog_->buttonStyle_S->setCurrentItem(0); + dialog_->titleeffect_S->setCurrentItem(0); + dialog_->i_titleeffect_S->setCurrentItem(0); + dialog_->shapeUL_S->setChecked(true); + dialog_->shapeUR_S->setChecked(true); + dialog_->shapeLL_S->setChecked(false); + dialog_->shapeLR_S->setChecked(false); + dialog_->drawIcon_S->setChecked(true); + dialog_->_3DImpact_S->setValue(20); + dialog_->LineImpact_S->setValue(30); + dialog_->borderSize_S->setValue(0); + +// buttonDialog_->defaults(); + + +} + +enum ColorPresets{Aqua = 0, Graphite, GraphiteDark, NUMBEROFCOLORS}; + +const char * presetColorName[NUMBEROFCOLORS] = {"Aqua", "Graphite", "Graphite (Dark)" }; + +typedef int ColorTable[10][3]; + +const int aquaPreset[10][3] = {{255,255,255},{200,85,70},{230,155,40},{121,180,54},{74,140,242},{0,0,0},{74,140,242},{74,140,242},{74,140,242},{74,140,242}}; +const int graphitePreset[10][3] = {{255,255,255},{130,170,190},{130,170,190},{130,170,190},{130,170,190},{0,0,0},{130,170,190},{130,170,190},{130,170,190},{130,170,190}}; +const int graphiteDarkPreset[10][3] = {{255,255,255},{103,118,134},{103,118,134},{103,118,134},{103,118,134},{0,0,0},{103,118,134},{103,118,134},{103,118,134},{103,118,134}}; +const ColorTable* presetColors[NUMBEROFCOLORS] = {&aquaPreset, &graphitePreset, &graphiteDarkPreset}; + + +ButtonColors::ButtonColors(QWidget *parent, const char * name) : QDialog(parent, name){ + save = false; + layout = new QGridLayout(this,2,2,11,6, "Grid"); + buttonLayout = new QVBoxLayout(0,0,6); + + QPixmap tmpPix = QPixmap(uic_findImage("preview")); + inactiveButton = new AquariusButton(tmpPix,this, "Inactive Button"); + buttonLayout->addWidget(inactiveButton); + closeButton = new AquariusButton(tmpPix,this, "Close Button"); + buttonLayout->addWidget(closeButton); + minButton = new AquariusButton(tmpPix,this, "Minimize Button"); + buttonLayout->addWidget(minButton); + maxButton = new AquariusButton(tmpPix,this, "Maximize Button"); + buttonLayout->addWidget(maxButton); + stickyButton = new AquariusButton(tmpPix,this, "Sticky Button"); + buttonLayout->addWidget(stickyButton); + aboveButton = new AquariusButton(tmpPix,this, "Above Button"); + buttonLayout->addWidget(aboveButton); + behindButton = new AquariusButton(tmpPix,this, "Behind Button"); + buttonLayout->addWidget(behindButton); + shadeButton = new AquariusButton(tmpPix,this, "Shade Button"); + buttonLayout->addWidget(shadeButton); + tmpPix = QPixmap(uic_findImage("preview-menu")); + menuButton = new AquariusButton(tmpPix,this, "Menu Button"); + buttonLayout->addWidget(menuButton); + tmpPix = QPixmap(uic_findImage("icon_help")); + helpButton = new AquariusButton(tmpPix,this, "Help Button"); + buttonLayout->addWidget(helpButton); + + + twoButts = new QHBoxLayout(0,0,6); + presets_ = new QComboBox(this); + for (int i = 0; i < NUMBEROFCOLORS; i++) + presets_->insertItem ( presetColorName[i], i ); + twoButts->addWidget(presets_); + cancel = new QPushButton("Cancel", this); + cancel->setDefault( true ); + twoButts->addWidget(cancel); + twoButts->addStretch(); + layout->addLayout(twoButts,1,0); + ok = new QPushButton("OK", this); + layout->addWidget(ok,1,1); + + layout->addLayout(buttonLayout,0,1); + + pickerLayout = new QVBoxLayout(0,0,6,0); + + indicator = new QLabel(inactiveButton->name(), this); + indicator->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter | Qt::ExpandTabs); + QFont tmpFont = font(); + tmpFont.setBold( true ); + tmpFont.setPointSize( 24 ); + indicator->setFont(tmpFont); + pickerLayout->addWidget(indicator); + + inactiveColor = new ColorPicker(this); + pickerLayout->addWidget(inactiveColor); + currentPicker = inactiveColor; + closeColor = new ColorPicker(this); + pickerLayout->addWidget(closeColor); + closeColor->hide(); + minColor = new ColorPicker(this); + pickerLayout->addWidget(minColor); + minColor->hide(); + maxColor = new ColorPicker(this); + pickerLayout->addWidget(maxColor); + maxColor->hide(); + menuColor = new ColorPicker(this); + pickerLayout->addWidget(menuColor); + menuColor->hide(); + helpColor = new ColorPicker(this); + pickerLayout->addWidget(helpColor); + helpColor->hide(); + stickyColor = new ColorPicker(this); + pickerLayout->addWidget(stickyColor); + stickyColor->hide(); + aboveColor = new ColorPicker(this); + pickerLayout->addWidget(aboveColor); + aboveColor->hide(); + behindColor = new ColorPicker(this); + pickerLayout->addWidget(behindColor); + behindColor->hide(); + shadeColor = new ColorPicker(this); + pickerLayout->addWidget(shadeColor); + shadeColor->hide(); + + indicator->lower(); + + layout->addLayout(pickerLayout,0,0); + + resize( QSize(485, 177).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); + + connect(presets_,SIGNAL(activated(int)), this, SLOT(setColorGroup(int))); + connect(ok, SIGNAL(clicked()), this, SLOT(setSave())); + connect(ok, SIGNAL(clicked()), this, SLOT(close()) ); + connect(ok, SIGNAL(clicked()), this, SLOT(init()) ); + connect(cancel, SIGNAL(clicked()), this, SLOT(close()) ); + connect(cancel, SIGNAL(clicked()), this, SLOT(reset()) ); + + connect(inactiveButton, SIGNAL(clicked()), this, SLOT(activateInactive()) ); + connect(closeButton, SIGNAL(clicked()), this, SLOT(activateClose()) ); + connect(minButton, SIGNAL(clicked()), this, SLOT(activateMin()) ); + connect(maxButton, SIGNAL(clicked()), this, SLOT(activateMax()) ); + connect(menuButton, SIGNAL(clicked()), this, SLOT(activateMenu()) ); + connect(helpButton, SIGNAL(clicked()), this, SLOT(activateHelp()) ); + connect(stickyButton, SIGNAL(clicked()), this, SLOT(activateSticky()) ); + connect(aboveButton, SIGNAL(clicked()), this, SLOT(activateAbove()) ); + connect(behindButton, SIGNAL(clicked()), this, SLOT(activateBehind()) ); + connect(shadeButton, SIGNAL(clicked()), this, SLOT(activateShade()) ); + + connect(inactiveColor, SIGNAL(colorChanged(QColor)), inactiveButton, SLOT(setColor(QColor)) ); + connect(closeColor, SIGNAL(colorChanged(QColor)), closeButton, SLOT(setColor(QColor)) ); + connect(minColor, SIGNAL(colorChanged(QColor)), minButton, SLOT(setColor(QColor)) ); + connect(maxColor, SIGNAL(colorChanged(QColor)), maxButton, SLOT(setColor(QColor)) ); + connect(menuColor, SIGNAL(colorChanged(QColor)), menuButton, SLOT(setColor(QColor)) ); + connect(helpColor, SIGNAL(colorChanged(QColor)), helpButton, SLOT(setColor(QColor)) ); + connect(stickyColor, SIGNAL(colorChanged(QColor)), stickyButton, SLOT(setColor(QColor)) ); + connect(aboveColor, SIGNAL(colorChanged(QColor)), aboveButton, SLOT(setColor(QColor)) ); + connect(behindColor, SIGNAL(colorChanged(QColor)), behindButton, SLOT(setColor(QColor)) ); + connect(shadeColor, SIGNAL(colorChanged(QColor)), shadeButton, SLOT(setColor(QColor)) ); + +} + +ButtonColors::~ButtonColors(){ +} + +void ButtonColors::setColorGroup(int i){ + inactiveColor->setColor(QColor((*presetColors[i])[0][0],(*presetColors[i])[0][1],(*presetColors[i])[0][2]).rgb()); + closeColor->setColor(QColor((*presetColors[i])[1][0],(*presetColors[i])[1][1],(*presetColors[i])[1][2]).rgb()); + minColor->setColor(QColor((*presetColors[i])[2][0],(*presetColors[i])[2][1],(*presetColors[i])[2][2]).rgb()); + maxColor->setColor(QColor((*presetColors[i])[3][0],(*presetColors[i])[3][1],(*presetColors[i])[3][2]).rgb()); + menuColor->setColor(QColor((*presetColors[i])[4][0],(*presetColors[i])[4][1],(*presetColors[i])[4][2]).rgb()); + helpColor->setColor(QColor((*presetColors[i])[5][0],(*presetColors[i])[5][1],(*presetColors[i])[5][2]).rgb()); + stickyColor->setColor(QColor((*presetColors[i])[6][0],(*presetColors[i])[6][1],(*presetColors[i])[6][2]).rgb()); + aboveColor->setColor(QColor((*presetColors[i])[7][0],(*presetColors[i])[7][1],(*presetColors[i])[7][2]).rgb()); + behindColor->setColor(QColor((*presetColors[i])[8][0],(*presetColors[i])[8][1],(*presetColors[i])[8][2]).rgb()); + shadeColor->setColor(QColor((*presetColors[i])[9][0],(*presetColors[i])[9][1],(*presetColors[i])[9][2]).rgb()); +} + +void ButtonColors::setPicker(ColorPicker *picker){ + if (currentPicker) currentPicker->hide(); + currentPicker = picker; + currentPicker->show(); +} + +void ButtonColors::activateInactive(){ + setPicker(inactiveColor); + indicator->setText( inactiveButton->name() ); +} +void ButtonColors::activateClose(){ + setPicker(closeColor); + indicator->setText( closeButton->name() ); +} +void ButtonColors::activateMin(){ + setPicker(minColor); + indicator->setText( minButton->name() ); +} +void ButtonColors::activateMax(){ + setPicker(maxColor); + indicator->setText( maxButton->name() ); +} +void ButtonColors::activateMenu(){ + setPicker(menuColor); + indicator->setText( menuButton->name() ); +} +void ButtonColors::activateHelp(){ + setPicker(helpColor); + indicator->setText( helpButton->name() ); +} +void ButtonColors::activateSticky(){ + setPicker(stickyColor); + indicator->setText( stickyButton->name() ); +} +void ButtonColors::activateAbove(){ + setPicker(aboveColor); + indicator->setText( aboveButton->name() ); +} +void ButtonColors::activateBehind(){ + setPicker(behindColor); + indicator->setText( behindButton->name() ); +} +void ButtonColors::activateShade(){ + setPicker(shadeColor); + indicator->setText( shadeButton->name() ); +} + +void ButtonColors::reset(){ + inactiveColor->reset(); + closeColor->reset(); + minColor->reset(); + maxColor->reset(); + menuColor->reset(); + helpColor->reset(); + stickyColor->reset(); + aboveColor->reset(); + behindColor->reset(); + shadeColor->reset(); +} + +void ButtonColors::init(){ + inactiveColor->init(); + closeColor->init(); + minColor->init(); + maxColor->init(); + menuColor->init(); + helpColor->init(); + stickyColor->init(); + aboveColor->init(); + behindColor->init(); + shadeColor->init(); +} + +////////////////////////////////////////////////////////////////////////////// +// Plugin Stuff // +////////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + QObject* allocate_config(KConfig* config, QWidget* parent) { + return(new BaghiraConfig(config, parent)); + } +} + +#include "baghiraconfig.moc" diff --git a/deco/config/baghiraconfig.cc.new b/deco/config/baghiraconfig.cc.new new file mode 100644 index 0000000..8d83666 --- /dev/null +++ b/deco/config/baghiraconfig.cc.new @@ -0,0 +1,730 @@ +////////////////////////////////////////////////////////////////////////////// +// baghiraconfig.cc +// ------------------- +// Config module for Baghira window decoration +// ------------------- +// Copyright (c) 2004 Thomas Lübking +// Please see the header file for copyright and license information. +////////////////////////////////////////////////////////////////////////////// + +#include <kconfig.h> +#include <klocale.h> +#include <kglobal.h> +#include <kcolorbutton.h> +#include <qbutton.h> +#include <qbuttongroup.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qlayout.h> +#include <qlabel.h> +#include <qfont.h> +#include <qgroupbox.h> +#include <qpushbutton.h> +#include <qradiobutton.h> +#include <qsettings.h> +#include <qspinbox.h> +#include <qwhatsthis.h> + +#include "baghiraconfig.h" +#include "configdialog.h" +#include "customdecosettings.h" +#include "pixmaps.h" + +////////////////////////////////////////////////////////////////////////////// +// BaghiraConfig Class // +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +// BaghiraConfig() +// ------------- +// Constructor + +BaghiraConfig::BaghiraConfig(KConfig*, QWidget* parent) + : QObject(parent), /*config_(0),*/ dialog_(0) +{ +// config_ = new KConfig("baghirarc"); +// config_ = new QSettings; +// config_->beginGroup("/baghira/Deco"); + KGlobal::locale()->insertCatalogue("kwin_baghira_config"); + + dialog_ = new ConfigDialog(parent); + buttonDialog_ = new ButtonColors(parent, "Button Colors"); + load(0L); + + dialog_->show(); + + connect(dialog_->ButtonColorConfig, SIGNAL(clicked()), buttonDialog_, SLOT(exec())); + connect(buttonDialog_->ok, SIGNAL(clicked()), SIGNAL(changed())); + + // connections + connect(dialog_->titlealign, SIGNAL(clicked(int)), SIGNAL(changed())); + connect(dialog_->drawComicFrame, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->addAutoSpacing, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->allowEasyClosing, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->ResizeGrip, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->maxResizable, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->fullSpec, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->noModalDeco, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->delAppname, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->defaultMode, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->minTH, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_J, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_J, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_J, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_J, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_J, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_J, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_J, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_J, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_P, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_P, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_P, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_P, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_P, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_P, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_P, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_P, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_B, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_B, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_B, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_B, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_B, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_B, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_B, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_B, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_T, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_T, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_T, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_T, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->_3DImpact_T, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_T, SIGNAL(valueChanged(int)), SIGNAL(changed())); + + connect(dialog_->activeColor1_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->activeColor2_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor1_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->inactiveColor2_S, SIGNAL(clicked()), SIGNAL(changed())); + connect(dialog_->buttonStyle_S, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->shapeUL_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeUR_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLL_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->shapeLR_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->drawIcon_S, SIGNAL(toggled(bool)), SIGNAL(changed())); + connect(dialog_->titleeffect_S, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->i_titleeffect_S, SIGNAL(activated(int)), SIGNAL(changed())); + connect(dialog_->_3DImpact_S, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->LineImpact_S, SIGNAL(valueChanged(int)), SIGNAL(changed())); + connect(dialog_->borderSize_S, SIGNAL(valueChanged(int)), SIGNAL(changed())); +// config_->endGroup(); + +} + +////////////////////////////////////////////////////////////////////////////// +// ~BaghiraConfig() +// -------------- +// Destructor + +BaghiraConfig::~BaghiraConfig() +{ + if (dialog_) delete dialog_; +// if (config_) delete config_; +} + +////////////////////////////////////////////////////////////////////////////// +// load() +// ------ +// Load configuration data + +void BaghiraConfig::load(KConfig*) +{ + QSettings *config_ = new QSettings; + config_->beginGroup("/baghira/Deco"); + + QString value = config_->readEntry("TitleAlignment", "AlignHCenter"); + QRadioButton *button = (QRadioButton*)dialog_->titlealign-> + child((const char *)value.latin1()); + if (button) button->setChecked(true); + + dialog_->minTH->setValue(config_->readNumEntry("minimumTitleHeight",18)); + dialog_->ResizeGrip->setChecked(config_->readBoolEntry("ResizeGrip",false)); + dialog_->allowEasyClosing->setChecked(config_->readBoolEntry("allowEasyClosing",false)); + dialog_->drawComicFrame->setChecked(config_->readBoolEntry("DrawComicFrame",false)); + dialog_->maxResizable->setChecked(config_->readBoolEntry("MaxResizable",false)); + dialog_->fullSpec->setChecked(config_->readBoolEntry("FullSpec",false)); + dialog_->addAutoSpacing->setChecked(config_->readBoolEntry("AddAutoSpacing",true)); + dialog_->defaultMode->setCurrentItem(config_->readNumEntry("defaultMode",1)); + dialog_->noModalDeco->setChecked(config_->readBoolEntry("NoModalDeco",false)); + dialog_->delAppname->setChecked(config_->readBoolEntry("RemoveAppname",false)); + + dialog_->activeColor1_J->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_1",QColor(255,255,255).rgb()))); + dialog_->inactiveColor1_J->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_1",QColor(204,214,230).rgb()))); + dialog_->activeColor2_J->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_1",QColor(238,234,238).rgb()))); + dialog_->inactiveColor2_J->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_1",QColor(194,196,211).rgb()))); + dialog_->buttonStyle_J->setCurrentItem(config_->readNumEntry("ButtonStyle_1",1)); + dialog_->titleeffect_J->setCurrentItem(config_->readNumEntry("TitleEffect_1", 1)); + dialog_->i_titleeffect_J->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_1", 1)); + dialog_->shapeUL_J->setChecked(config_->readBoolEntry("ShapeUL_1",true)); + dialog_->shapeUR_J->setChecked(config_->readBoolEntry("ShapeUR_1",true)); + dialog_->shapeLL_J->setChecked(config_->readBoolEntry("ShapeLL_1",false)); + dialog_->shapeLR_J->setChecked(config_->readBoolEntry("ShapeLR_1",false)); + dialog_->drawIcon_J->setChecked(config_->readBoolEntry("drawIcon_1",true)); + dialog_->_3DImpact_J->setValue(config_->readNumEntry("3DImpact_1",20)); + dialog_->LineImpact_J->setValue(config_->readNumEntry("LineImpact_1",40)); + dialog_->borderSize_J->setValue(config_->readNumEntry("BorderSize_1",0)); + + dialog_->activeColor1_P->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_2",QColor(238,238,238).rgb()))); + dialog_->inactiveColor1_P->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_2",QColor(246,242,246).rgb()))); + dialog_->activeColor2_P->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_2",QColor(205,202,205).rgb()))); + dialog_->inactiveColor2_P->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_2",QColor(238,238,238).rgb()))); + dialog_->buttonStyle_P->setCurrentItem(config_->readNumEntry("ButtonStyle_2",0)); + dialog_->titleeffect_P->setCurrentItem(config_->readNumEntry("TitleEffect_2", 0)); + dialog_->i_titleeffect_P->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_2", 0)); + dialog_->shapeUL_P->setChecked(config_->readBoolEntry("ShapeUL_2",true)); + dialog_->shapeUR_P->setChecked(config_->readBoolEntry("ShapeUR_2",true)); + dialog_->shapeLL_P->setChecked(config_->readBoolEntry("ShapeLL_2",false)); + dialog_->shapeLR_P->setChecked(config_->readBoolEntry("ShapeLR_2",false)); + dialog_->drawIcon_P->setChecked(config_->readBoolEntry("drawIcon_2",true)); + dialog_->_3DImpact_P->setValue(config_->readNumEntry("3DImpact_2",20)); + dialog_->LineImpact_P->setValue(config_->readNumEntry("LineImpact_2",40)); + dialog_->borderSize_P->setValue(config_->readNumEntry("BorderSize_2",0)); + + dialog_->activeColor1_B->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_3",QColor(202,202,202).rgb()))); + dialog_->inactiveColor1_B->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_3",QColor(200,200,200).rgb()))); + dialog_->activeColor2_B->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_3",QColor(150,150,150).rgb()))); + dialog_->inactiveColor2_B->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_3",QColor(150,150,150).rgb()))); + dialog_->buttonStyle_B->setCurrentItem(config_->readNumEntry("ButtonStyle_3",0)); + dialog_->titleeffect_B->setCurrentItem(config_->readNumEntry("TitleEffect_3", 4)); + dialog_->i_titleeffect_B->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_3", 4)); + dialog_->shapeUL_B->setChecked(config_->readBoolEntry("ShapeUL_3",true)); + dialog_->shapeUR_B->setChecked(config_->readBoolEntry("ShapeUR_3",true)); + dialog_->shapeLL_B->setChecked(config_->readBoolEntry("ShapeLL_3",true)); + dialog_->shapeLR_B->setChecked(config_->readBoolEntry("ShapeLR_3",true)); + dialog_->drawIcon_B->setChecked(config_->readBoolEntry("drawIcon_3",true)); + dialog_->_3DImpact_B->setValue(config_->readNumEntry("3DImpact_3",20)); + dialog_->LineImpact_B->setValue(config_->readNumEntry("LineImpact_3",0)); + dialog_->borderSize_B->setValue(config_->readNumEntry("BorderSize_3",6)); + + dialog_->activeColor1_T->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_4",QColor(238,238,238).rgb()))); + dialog_->activeColor2_T->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_4",QColor(205,202,205).rgb()))); + dialog_->buttonStyle_T->setCurrentItem(config_->readNumEntry("ButtonStyle_4",0)); + dialog_->shapeUL_T->setChecked(config_->readBoolEntry("ShapeUL_4",true)); + dialog_->shapeUR_T->setChecked(config_->readBoolEntry("ShapeUR_4",true)); + dialog_->shapeLL_T->setChecked(config_->readBoolEntry("ShapeLL_4",false)); + dialog_->shapeLR_T->setChecked(config_->readBoolEntry("ShapeLR_4",false)); + dialog_->drawIcon_T->setChecked(config_->readBoolEntry("drawIcon_4",true)); + dialog_->_3DImpact_T->setValue(config_->readNumEntry("3DImpact_4",20)); + dialog_->borderSize_T->setValue(config_->readNumEntry("BorderSize_4",0)); + + dialog_->activeColor1_S->setColor(QColor((unsigned int)config_->readNumEntry("activeColor1_5",QColor(250,250,250).rgb()))); + dialog_->inactiveColor1_S->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor1_5",QColor(230,230,230).rgb()))); + dialog_->activeColor2_S->setColor(QColor((unsigned int)config_->readNumEntry("activeColor2_5",QColor(230,230,230).rgb()))); + dialog_->inactiveColor2_S->setColor(QColor((unsigned int)config_->readNumEntry("inactiveColor2_5",QColor(250,250,250).rgb()))); + dialog_->buttonStyle_S->setCurrentItem(config_->readNumEntry("ButtonStyle_5",0)); + dialog_->titleeffect_S->setCurrentItem(config_->readNumEntry("TitleEffect_5", 0)); + dialog_->i_titleeffect_S->setCurrentItem(config_->readNumEntry("inactiveTitleEffect_5", 0)); + dialog_->shapeUL_S->setChecked(config_->readBoolEntry("ShapeUL_5",true)); + dialog_->shapeUR_S->setChecked(config_->readBoolEntry("ShapeUR_5",true)); + dialog_->shapeLL_S->setChecked(config_->readBoolEntry("ShapeLL_5",false)); + dialog_->shapeLR_S->setChecked(config_->readBoolEntry("ShapeLR_5",false)); + dialog_->drawIcon_S->setChecked(config_->readBoolEntry("drawIcon_5",true)); + dialog_->_3DImpact_S->setValue(config_->readNumEntry("3DImpact_5",20)); + dialog_->LineImpact_S->setValue(config_->readNumEntry("LineImpact_5",30)); + dialog_->borderSize_S->setValue(config_->readNumEntry("BorderSize_5",0)); + + buttonDialog_->inactiveColor->setColor(QColor((unsigned int)config_->readNumEntry("InactiveButtonColor", QColor(255,255,255).rgb()))); + buttonDialog_->closeColor->setColor(QColor((unsigned int)config_->readNumEntry("CloseButtonColor", QColor(200,85,70).rgb()))); + buttonDialog_->minColor->setColor(QColor((unsigned int)config_->readNumEntry("MinButtonColor", QColor(230,155,40).rgb()))); + buttonDialog_-> maxColor->setColor(QColor((unsigned int)config_->readNumEntry("MaxButtonColor", QColor(121,180,54).rgb()))); + buttonDialog_->menuColor->setColor(QColor((unsigned int)config_->readNumEntry("MenuButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->helpColor->setColor(QColor((unsigned int)config_->readNumEntry("HelpButtonColor", QColor(0,0,0).rgb()))); + buttonDialog_->stickyColor->setColor(QColor((unsigned int)config_->readNumEntry("StickyButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->aboveColor->setColor(QColor((unsigned int)config_->readNumEntry("AboveButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->behindColor->setColor(QColor((unsigned int)config_->readNumEntry("BehindButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->shadeColor->setColor(QColor((unsigned int)config_->readNumEntry("ShadeButtonColor", QColor(74,140,242).rgb()))); + buttonDialog_->init(); + config_->endGroup(); + delete config_; + +} + +////////////////////////////////////////////////////////////////////////////// +// save() +// ------ +// Save configuration data + +void BaghiraConfig::save(KConfig*) +{ + QSettings *config_ = new QSettings; + config_->beginGroup("/baghira/Deco"); + + QRadioButton *button = (QRadioButton*)dialog_->titlealign->selected(); + if (button) config_->writeEntry("TitleAlignment", QString(button->name())); + config_->writeEntry("DrawComicFrame", dialog_->drawComicFrame->isChecked()); + config_->writeEntry("AddAutoSpacing", dialog_->addAutoSpacing->isChecked()); + config_->writeEntry("ResizeGrip", dialog_->ResizeGrip->isChecked()); + config_->writeEntry("allowEasyClosing", dialog_->allowEasyClosing->isChecked()); + config_->writeEntry("MaxResizable", dialog_->maxResizable->isChecked()); + config_->writeEntry("FullSpec", dialog_->fullSpec->isChecked()); + config_->writeEntry("defaultMode", dialog_->defaultMode->currentItem()); + config_->writeEntry("minimumTitleHeight", dialog_->minTH->value()); + config_->writeEntry("NoModalDeco", dialog_->noModalDeco->isChecked()); + config_->writeEntry("RemoveAppname", dialog_->delAppname->isChecked()); + + config_->writeEntry("activeColor1_1", (int)dialog_->activeColor1_J->color().rgb()); + config_->writeEntry("activeColor2_1", (int)dialog_->activeColor2_J->color().rgb()); + config_->writeEntry("inactiveColor1_1", (int)dialog_->inactiveColor1_J->color().rgb()); + config_->writeEntry("inactiveColor2_1", (int)dialog_->inactiveColor2_J->color().rgb()); + config_->writeEntry("ButtonStyle_1", dialog_->buttonStyle_J->currentItem()); + config_->writeEntry("TitleEffect_1", dialog_->titleeffect_J->currentItem()); + config_->writeEntry("inactiveTitleEffect_1", dialog_->i_titleeffect_J->currentItem()); + config_->writeEntry("ShapeUL_1", dialog_->shapeUL_J->isChecked()); + config_->writeEntry("ShapeUR_1", dialog_->shapeUR_J->isChecked()); + config_->writeEntry("ShapeLL_1", dialog_->shapeLL_J->isChecked()); + config_->writeEntry("ShapeLR_1", dialog_->shapeLR_J->isChecked()); + config_->writeEntry("drawIcon_1", dialog_->drawIcon_J->isChecked()); + config_->writeEntry("3DImpact_1", dialog_->_3DImpact_J->value()); + config_->writeEntry("LineImpact_1", dialog_->LineImpact_J->value()); + config_->writeEntry("BorderSize_1", dialog_->borderSize_J->value()); + + config_->writeEntry("activeColor1_2", (int)dialog_->activeColor1_P->color().rgb()); + config_->writeEntry("activeColor2_2", (int)dialog_->activeColor2_P->color().rgb()); + config_->writeEntry("inactiveColor1_2", (int)dialog_->inactiveColor1_P->color().rgb()); + config_->writeEntry("inactiveColor2_2", (int)dialog_->inactiveColor2_P->color().rgb()); + config_->writeEntry("ButtonStyle_2", dialog_->buttonStyle_P->currentItem()); + config_->writeEntry("TitleEffect_2", dialog_->titleeffect_P->currentItem()); + config_->writeEntry("inactiveTitleEffect_2", dialog_->i_titleeffect_P->currentItem()); + config_->writeEntry("ShapeUL_2", dialog_->shapeUL_P->isChecked()); + config_->writeEntry("ShapeUR_2", dialog_->shapeUR_P->isChecked()); + config_->writeEntry("ShapeLL_2", dialog_->shapeLL_P->isChecked()); + config_->writeEntry("ShapeLR_2", dialog_->shapeLR_P->isChecked()); + config_->writeEntry("drawIcon_2", dialog_->drawIcon_P->isChecked()); + config_->writeEntry("3DImpact_2", dialog_->_3DImpact_P->value()); + config_->writeEntry("LineImpact_2", dialog_->LineImpact_P->value()); + config_->writeEntry("BorderSize_2", dialog_->borderSize_P->value()); + + config_->writeEntry("activeColor1_3", (int)dialog_->activeColor1_B->color().rgb()); + config_->writeEntry("activeColor2_3", (int)dialog_->activeColor2_B->color().rgb()); + config_->writeEntry("inactiveColor1_3", (int)dialog_->inactiveColor1_B->color().rgb()); + config_->writeEntry("inactiveColor2_3", (int)dialog_->inactiveColor2_B->color().rgb()); + config_->writeEntry("ButtonStyle_3", dialog_->buttonStyle_B->currentItem()); + config_->writeEntry("TitleEffect_3", dialog_->titleeffect_B->currentItem()); + config_->writeEntry("inactiveTitleEffect_3", dialog_->i_titleeffect_B->currentItem()); + config_->writeEntry("ShapeUL_3", dialog_->shapeUL_B->isChecked()); + config_->writeEntry("ShapeUR_3", dialog_->shapeUR_B->isChecked()); + config_->writeEntry("ShapeLL_3", dialog_->shapeLL_B->isChecked()); + config_->writeEntry("ShapeLR_3", dialog_->shapeLR_B->isChecked()); + config_->writeEntry("drawIcon_3", dialog_->drawIcon_B->isChecked()); + config_->writeEntry("3DImpact_3", dialog_->_3DImpact_B->value()); + config_->writeEntry("LineImpact_3", dialog_->LineImpact_B->value()); + config_->writeEntry("BorderSize_3", dialog_->borderSize_B->value()); + + config_->writeEntry("activeColor1_4", (int)dialog_->activeColor1_T->color().rgb()); + config_->writeEntry("activeColor2_4", (int)dialog_->activeColor2_T->color().rgb()); + config_->writeEntry("ButtonStyle_4", dialog_->buttonStyle_T->currentItem()); + config_->writeEntry("ShapeUL_4", dialog_->shapeUL_T->isChecked()); + config_->writeEntry("ShapeUR_4", dialog_->shapeUR_T->isChecked()); + config_->writeEntry("ShapeLL_4", dialog_->shapeLL_T->isChecked()); + config_->writeEntry("ShapeLR_4", dialog_->shapeLR_T->isChecked()); + config_->writeEntry("drawIcon_4", dialog_->drawIcon_T->isChecked()); + config_->writeEntry("3DImpact_4", dialog_->_3DImpact_T->value()); + config_->writeEntry("BorderSize_4", dialog_->borderSize_T->value()); + + config_->writeEntry("activeColor1_5", (int)dialog_->activeColor1_S->color().rgb()); + config_->writeEntry("activeColor2_5", (int)dialog_->activeColor2_S->color().rgb()); + config_->writeEntry("inactiveColor1_5", (int)dialog_->inactiveColor1_S->color().rgb()); + config_->writeEntry("inactiveColor2_5", (int)dialog_->inactiveColor2_S->color().rgb()); + config_->writeEntry("ButtonStyle_5", dialog_->buttonStyle_S->currentItem()); + config_->writeEntry("TitleEffect_5", dialog_->titleeffect_S->currentItem()); + config_->writeEntry("inactiveTitleEffect_5", dialog_->i_titleeffect_S->currentItem()); + config_->writeEntry("ShapeUL_5", dialog_->shapeUL_S->isChecked()); + config_->writeEntry("ShapeUR_5", dialog_->shapeUR_S->isChecked()); + config_->writeEntry("ShapeLL_5", dialog_->shapeLL_S->isChecked()); + config_->writeEntry("ShapeLR_5", dialog_->shapeLR_S->isChecked()); + config_->writeEntry("drawIcon_5", dialog_->drawIcon_S->isChecked()); + config_->writeEntry("3DImpact_5", dialog_->_3DImpact_S->value()); + config_->writeEntry("LineImpact_5", dialog_->LineImpact_S->value()); + config_->writeEntry("BorderSize_5", dialog_->borderSize_S->value()); + + if (buttonDialog_->save){ + config_->writeEntry("InactiveButtonColor", (int)buttonDialog_->inactiveColor->Color().rgb()); + config_->writeEntry("CloseButtonColor", (int)buttonDialog_->closeColor->Color().rgb()); + config_->writeEntry("MinButtonColor", (int)buttonDialog_->minColor->Color().rgb()); + config_->writeEntry("MaxButtonColor", (int)buttonDialog_->maxColor->Color().rgb()); + config_->writeEntry("MenuButtonColor", (int)buttonDialog_->menuColor->Color().rgb()); + config_->writeEntry("HelpButtonColor", (int)buttonDialog_->helpColor->Color().rgb()); + config_->writeEntry("StickyButtonColor", (int)buttonDialog_->stickyColor->Color().rgb()); + config_->writeEntry("AboveButtonColor", (int)buttonDialog_->aboveColor->Color().rgb()); + config_->writeEntry("BehindButtonColor", (int)buttonDialog_->behindColor->Color().rgb()); + config_->writeEntry("ShadeButtonColor", (int)buttonDialog_->shadeColor->Color().rgb()); + } + config_->endGroup(); + delete config_; + +// config_->sync(); +} + +////////////////////////////////////////////////////////////////////////////// +// defaults() +// ---------- +// Set configuration defaults + +void BaghiraConfig::defaults() +{ + QRadioButton *button = (QRadioButton*)dialog_->titlealign->child("AlignHCenter"); + if (button) button->setChecked(true); + dialog_->allowEasyClosing->setChecked(false); + dialog_->minTH->setValue(22); + dialog_->ResizeGrip->setChecked(false); + dialog_->drawComicFrame->setChecked(false); + dialog_->addAutoSpacing->setChecked(true); + dialog_->maxResizable->setChecked(false); + dialog_->fullSpec->setChecked(false); + dialog_->defaultMode->setCurrentItem(1); + dialog_->noModalDeco->setChecked(false); + dialog_->delAppname->setChecked(false); + + dialog_->activeColor1_J->setColor(QColor(255,255,255)); + dialog_->inactiveColor1_J->setColor(QColor(204,214,230)); + dialog_->activeColor2_J->setColor(QColor(238,234,238)); + dialog_->inactiveColor2_J->setColor(QColor(194,196,211)); + dialog_->buttonStyle_J->setCurrentItem(1); + dialog_->titleeffect_J->setCurrentItem(1); + dialog_->i_titleeffect_J->setCurrentItem(1); + dialog_->shapeUL_J->setChecked(true); + dialog_->shapeUR_J->setChecked(true); + dialog_->shapeLL_J->setChecked(false); + dialog_->shapeLR_J->setChecked(false); + dialog_->drawIcon_J->setChecked(true); + dialog_->_3DImpact_J->setValue(20); + dialog_->LineImpact_J->setValue(40); + dialog_->borderSize_J->setValue(0); + + dialog_->activeColor1_P->setColor(QColor(238,238,238)); + dialog_->inactiveColor1_P->setColor(QColor(246,242,246)); + dialog_->activeColor2_P->setColor(QColor(205,202,205)); + dialog_->inactiveColor2_P->setColor(QColor(238,238,238)); + dialog_->buttonStyle_P->setCurrentItem(0); + dialog_->titleeffect_P->setCurrentItem(0); + dialog_->i_titleeffect_P->setCurrentItem(0); + dialog_->shapeUL_P->setChecked(true); + dialog_->shapeUR_P->setChecked(true); + dialog_->shapeLL_P->setChecked(false); + dialog_->shapeLR_P->setChecked(false); + dialog_->drawIcon_P->setChecked(true); + dialog_->_3DImpact_P->setValue(20); + dialog_->LineImpact_P->setValue(30); + dialog_->borderSize_P->setValue(0); + + dialog_->activeColor1_B->setColor(QColor(210,210,210)); + dialog_->inactiveColor1_B->setColor(QColor(200,200,200)); + dialog_->activeColor2_B->setColor(QColor(150,150,150)); + dialog_->inactiveColor2_B->setColor(QColor(140,140,140)); + dialog_->buttonStyle_B->setCurrentItem(0); + dialog_->titleeffect_B->setCurrentItem(4); + dialog_->i_titleeffect_B->setCurrentItem(4); + dialog_->shapeUL_B->setChecked(true); + dialog_->shapeUR_B->setChecked(true); + dialog_->shapeLL_B->setChecked(false); + dialog_->shapeLR_B->setChecked(false); + dialog_->drawIcon_B->setChecked(true); + dialog_->_3DImpact_B->setValue(20); + dialog_->LineImpact_B->setValue(0); + dialog_->borderSize_B->setValue(6); + + dialog_->activeColor1_T->setColor(QColor(238,238,238)); + dialog_->activeColor2_T->setColor(QColor(211,208,211)); + dialog_->buttonStyle_T->setCurrentItem(0); + dialog_->shapeUL_T->setChecked(true); + dialog_->shapeUR_T->setChecked(true); + dialog_->shapeLL_T->setChecked(false); + dialog_->shapeLR_T->setChecked(false); + dialog_->drawIcon_T->setChecked(true); + dialog_->_3DImpact_T->setValue(20); + dialog_->borderSize_T->setValue(0); + + dialog_->activeColor1_S->setColor(QColor(250,250,250)); + dialog_->inactiveColor1_S->setColor(QColor(230,230,230)); + dialog_->activeColor2_S->setColor(QColor(230,230,230)); + dialog_->inactiveColor2_S->setColor(QColor(250,250,250)); + dialog_->buttonStyle_S->setCurrentItem(0); + dialog_->titleeffect_S->setCurrentItem(0); + dialog_->i_titleeffect_S->setCurrentItem(0); + dialog_->shapeUL_S->setChecked(true); + dialog_->shapeUR_S->setChecked(true); + dialog_->shapeLL_S->setChecked(false); + dialog_->shapeLR_S->setChecked(false); + dialog_->drawIcon_S->setChecked(true); + dialog_->_3DImpact_S->setValue(20); + dialog_->LineImpact_S->setValue(30); + dialog_->borderSize_S->setValue(0); + +// buttonDialog_->defaults(); + + +} + +enum ColorPresets{Aqua = 0, Graphite, GraphiteDark, NUMBEROFCOLORS}; + +const char * presetColorName[NUMBEROFCOLORS] = {"Aqua", "Graphite", "Graphite (Dark)" }; + +typedef int ColorTable[10][3]; + +const int aquaPreset[10][3] = {{255,255,255},{200,85,70},{230,155,40},{121,180,54},{74,140,242},{0,0,0},{74,140,242},{74,140,242},{74,140,242},{74,140,242}}; +const int graphitePreset[10][3] = {{255,255,255},{130,170,190},{130,170,190},{130,170,190},{130,170,190},{0,0,0},{130,170,190},{130,170,190},{130,170,190},{130,170,190}}; +const int graphiteDarkPreset[10][3] = {{255,255,255},{103,118,134},{103,118,134},{103,118,134},{103,118,134},{0,0,0},{103,118,134},{103,118,134},{103,118,134},{103,118,134}}; +const ColorTable* presetColors[NUMBEROFCOLORS] = {&aquaPreset, &graphitePreset, &graphiteDarkPreset}; + + +ButtonColors::ButtonColors(QWidget *parent, const char * name) : QDialog(parent, name){ + save = false; + layout = new QGridLayout(this,2,2,11,6, "Grid"); + buttonLayout = new QVBoxLayout(0,0,6); + + QPixmap tmpPix = QPixmap(uic_findImage("preview")); + inactiveButton = new AquariusButton(tmpPix,this, "Inactive Button"); + buttonLayout->addWidget(inactiveButton); + closeButton = new AquariusButton(tmpPix,this, "Close Button"); + buttonLayout->addWidget(closeButton); + minButton = new AquariusButton(tmpPix,this, "Minimize Button"); + buttonLayout->addWidget(minButton); + maxButton = new AquariusButton(tmpPix,this, "Maximize Button"); + buttonLayout->addWidget(maxButton); + stickyButton = new AquariusButton(tmpPix,this, "Sticky Button"); + buttonLayout->addWidget(stickyButton); + aboveButton = new AquariusButton(tmpPix,this, "Above Button"); + buttonLayout->addWidget(aboveButton); + behindButton = new AquariusButton(tmpPix,this, "Behind Button"); + buttonLayout->addWidget(behindButton); + shadeButton = new AquariusButton(tmpPix,this, "Shade Button"); + buttonLayout->addWidget(shadeButton); + tmpPix = QPixmap(uic_findImage("preview-menu")); + menuButton = new AquariusButton(tmpPix,this, "Menu Button"); + buttonLayout->addWidget(menuButton); + tmpPix = QPixmap(uic_findImage("icon_help")); + helpButton = new AquariusButton(tmpPix,this, "Help Button"); + buttonLayout->addWidget(helpButton); + + + twoButts = new QHBoxLayout(0,0,6); + presets_ = new QComboBox(this); + for (int i = 0; i < NUMBEROFCOLORS; i++) + presets_->insertItem ( presetColorName[i], i ); + twoButts->addWidget(presets_); + cancel = new QPushButton("Cancel", this); + cancel->setDefault( true ); + twoButts->addWidget(cancel); + twoButts->addStretch(); + layout->addLayout(twoButts,1,0); + ok = new QPushButton("OK", this); + layout->addWidget(ok,1,1); + + layout->addLayout(buttonLayout,0,1); + + pickerLayout = new QVBoxLayout(0,0,6,0); + + indicator = new QLabel(inactiveButton->name(), this); + indicator->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter | Qt::ExpandTabs); + QFont tmpFont = font(); + tmpFont.setBold( true ); + tmpFont.setPointSize( 24 ); + indicator->setFont(tmpFont); + pickerLayout->addWidget(indicator); + + inactiveColor = new ColorPicker(this); + pickerLayout->addWidget(inactiveColor); + currentPicker = inactiveColor; + closeColor = new ColorPicker(this); + pickerLayout->addWidget(closeColor); + closeColor->hide(); + minColor = new ColorPicker(this); + pickerLayout->addWidget(minColor); + minColor->hide(); + maxColor = new ColorPicker(this); + pickerLayout->addWidget(maxColor); + maxColor->hide(); + menuColor = new ColorPicker(this); + pickerLayout->addWidget(menuColor); + menuColor->hide(); + helpColor = new ColorPicker(this); + pickerLayout->addWidget(helpColor); + helpColor->hide(); + stickyColor = new ColorPicker(this); + pickerLayout->addWidget(stickyColor); + stickyColor->hide(); + aboveColor = new ColorPicker(this); + pickerLayout->addWidget(aboveColor); + aboveColor->hide(); + behindColor = new ColorPicker(this); + pickerLayout->addWidget(behindColor); + behindColor->hide(); + shadeColor = new ColorPicker(this); + pickerLayout->addWidget(shadeColor); + shadeColor->hide(); + + indicator->lower(); + + layout->addLayout(pickerLayout,0,0); + + resize( QSize(485, 177).expandedTo(minimumSizeHint()) ); + clearWState( WState_Polished ); + + connect(presets_,SIGNAL(activated(int)), this, SLOT(setColorGroup(int))); + connect(ok, SIGNAL(clicked()), this, SLOT(setSave())); + connect(ok, SIGNAL(clicked()), this, SLOT(close()) ); + connect(ok, SIGNAL(clicked()), this, SLOT(init()) ); + connect(cancel, SIGNAL(clicked()), this, SLOT(close()) ); + connect(cancel, SIGNAL(clicked()), this, SLOT(reset()) ); + + connect(inactiveButton, SIGNAL(clicked()), this, SLOT(activateInactive()) ); + connect(closeButton, SIGNAL(clicked()), this, SLOT(activateClose()) ); + connect(minButton, SIGNAL(clicked()), this, SLOT(activateMin()) ); + connect(maxButton, SIGNAL(clicked()), this, SLOT(activateMax()) ); + connect(menuButton, SIGNAL(clicked()), this, SLOT(activateMenu()) ); + connect(helpButton, SIGNAL(clicked()), this, SLOT(activateHelp()) ); + connect(stickyButton, SIGNAL(clicked()), this, SLOT(activateSticky()) ); + connect(aboveButton, SIGNAL(clicked()), this, SLOT(activateAbove()) ); + connect(behindButton, SIGNAL(clicked()), this, SLOT(activateBehind()) ); + connect(shadeButton, SIGNAL(clicked()), this, SLOT(activateShade()) ); + + connect(inactiveColor, SIGNAL(colorChanged(QColor)), inactiveButton, SLOT(setColor(QColor)) ); + connect(closeColor, SIGNAL(colorChanged(QColor)), closeButton, SLOT(setColor(QColor)) ); + connect(minColor, SIGNAL(colorChanged(QColor)), minButton, SLOT(setColor(QColor)) ); + connect(maxColor, SIGNAL(colorChanged(QColor)), maxButton, SLOT(setColor(QColor)) ); + connect(menuColor, SIGNAL(colorChanged(QColor)), menuButton, SLOT(setColor(QColor)) ); + connect(helpColor, SIGNAL(colorChanged(QColor)), helpButton, SLOT(setColor(QColor)) ); + connect(stickyColor, SIGNAL(colorChanged(QColor)), stickyButton, SLOT(setColor(QColor)) ); + connect(aboveColor, SIGNAL(colorChanged(QColor)), aboveButton, SLOT(setColor(QColor)) ); + connect(behindColor, SIGNAL(colorChanged(QColor)), behindButton, SLOT(setColor(QColor)) ); + connect(shadeColor, SIGNAL(colorChanged(QColor)), shadeButton, SLOT(setColor(QColor)) ); + +} + +ButtonColors::~ButtonColors(){ +} + +void ButtonColors::setColorGroup(int i){ + inactiveColor->setColor(QColor((*presetColors[i])[0][0],(*presetColors[i])[0][1],(*presetColors[i])[0][2]).rgb()); + closeColor->setColor(QColor((*presetColors[i])[1][0],(*presetColors[i])[1][1],(*presetColors[i])[1][2]).rgb()); + minColor->setColor(QColor((*presetColors[i])[2][0],(*presetColors[i])[2][1],(*presetColors[i])[2][2]).rgb()); + maxColor->setColor(QColor((*presetColors[i])[3][0],(*presetColors[i])[3][1],(*presetColors[i])[3][2]).rgb()); + menuColor->setColor(QColor((*presetColors[i])[4][0],(*presetColors[i])[4][1],(*presetColors[i])[4][2]).rgb()); + helpColor->setColor(QColor((*presetColors[i])[5][0],(*presetColors[i])[5][1],(*presetColors[i])[5][2]).rgb()); + stickyColor->setColor(QColor((*presetColors[i])[6][0],(*presetColors[i])[6][1],(*presetColors[i])[6][2]).rgb()); + aboveColor->setColor(QColor((*presetColors[i])[7][0],(*presetColors[i])[7][1],(*presetColors[i])[7][2]).rgb()); + behindColor->setColor(QColor((*presetColors[i])[8][0],(*presetColors[i])[8][1],(*presetColors[i])[8][2]).rgb()); + shadeColor->setColor(QColor((*presetColors[i])[9][0],(*presetColors[i])[9][1],(*presetColors[i])[9][2]).rgb()); +} + +void ButtonColors::setPicker(ColorPicker *picker){ + if (currentPicker) currentPicker->hide(); + currentPicker = picker; + currentPicker->show(); +} + +void ButtonColors::activateInactive(){ + setPicker(inactiveColor); + indicator->setText( inactiveButton->name() ); +} +void ButtonColors::activateClose(){ + setPicker(closeColor); + indicator->setText( closeButton->name() ); +} +void ButtonColors::activateMin(){ + setPicker(minColor); + indicator->setText( minButton->name() ); +} +void ButtonColors::activateMax(){ + setPicker(maxColor); + indicator->setText( maxButton->name() ); +} +void ButtonColors::activateMenu(){ + setPicker(menuColor); + indicator->setText( menuButton->name() ); +} +void ButtonColors::activateHelp(){ + setPicker(helpColor); + indicator->setText( helpButton->name() ); +} +void ButtonColors::activateSticky(){ + setPicker(stickyColor); + indicator->setText( stickyButton->name() ); +} +void ButtonColors::activateAbove(){ + setPicker(aboveColor); + indicator->setText( aboveButton->name() ); +} +void ButtonColors::activateBehind(){ + setPicker(behindColor); + indicator->setText( behindButton->name() ); +} +void ButtonColors::activateShade(){ + setPicker(shadeColor); + indicator->setText( shadeButton->name() ); +} + +void ButtonColors::reset(){ + inactiveColor->reset(); + closeColor->reset(); + minColor->reset(); + maxColor->reset(); + menuColor->reset(); + helpColor->reset(); + stickyColor->reset(); + aboveColor->reset(); + behindColor->reset(); + shadeColor->reset(); +} + +void ButtonColors::init(){ + inactiveColor->init(); + closeColor->init(); + minColor->init(); + maxColor->init(); + menuColor->init(); + helpColor->init(); + stickyColor->init(); + aboveColor->init(); + behindColor->init(); + shadeColor->init(); +} + +////////////////////////////////////////////////////////////////////////////// +// Plugin Stuff // +////////////////////////////////////////////////////////////////////////////// + +extern "C" +{ + QObject* allocate_config(KConfig* config, QWidget* parent) { + return(new BaghiraConfig(config, parent)); + } +} + +#include "baghiraconfig.moc" diff --git a/deco/config/baghiraconfig.h b/deco/config/baghiraconfig.h new file mode 100644 index 0000000..07b04a5 --- /dev/null +++ b/deco/config/baghiraconfig.h @@ -0,0 +1,145 @@ +////////////////////////////////////////////////////////////////////////////// +// baghiraconfig.h +// ------------------- +// Config module for Baghira window decoration +// ------------------- +// Copyright (c) 2004 Thomas Lübking +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +////////////////////////////////////////////////////////////////////////////// + +#ifndef BAGHIRACONFIG_H +#define BAGHIRACONFIG_H + +#include <qobject.h> +#include <qdialog.h> +#include "colorpicker.h" +#include "aquariusbutton.h" + +class KConfig; +class QSettings; +class ConfigDialog; +class QLabel; +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QPushButton; +class QComboBox; + +class ButtonColors : public QDialog +{ + Q_OBJECT +public: + ButtonColors(QWidget* parent, const char * name = 0); + ~ButtonColors(); + ColorPicker *inactiveColor; + ColorPicker *closeColor; + ColorPicker *minColor; + ColorPicker *maxColor; + ColorPicker *menuColor; + ColorPicker *helpColor; + ColorPicker *stickyColor; + ColorPicker *aboveColor; + ColorPicker *behindColor; + ColorPicker *shadeColor; + ColorPicker *currentPicker; + + AquariusButton *inactiveButton; + AquariusButton *closeButton; + AquariusButton *minButton; + AquariusButton *maxButton; + AquariusButton *menuButton; + AquariusButton *helpButton; + AquariusButton *stickyButton; + AquariusButton *aboveButton; + AquariusButton *behindButton; + AquariusButton *shadeButton; + + QHBoxLayout *twoButts; + QPushButton *cancel; + QPushButton *ok; + QComboBox *presets_; + bool save; + +public slots: +// void defaults(); + void setColorGroup(int); + void init(); + + +private: + +/* + |------------|---| + | Indicator | B | + |------------|---| + | | T | + | Picker |---| + | | N | + |------------|---| +*/ + + QVBoxLayout *buttonLayout; + QVBoxLayout *pickerLayout; + QGridLayout *layout; + QLabel *indicator; + + void setPicker(ColorPicker *picker); + +private slots: + void activateInactive(); + void activateClose(); + void activateMin(); + void activateMax(); + void activateMenu(); + void activateHelp(); + void activateSticky(); + void activateAbove(); + void activateBehind(); + void activateShade(); + void setSave(){ + save = true; + } + void reset(); +}; + + +class BaghiraConfig : public QObject +{ + Q_OBJECT +public: + BaghiraConfig(KConfig* config, QWidget* parent); + ~BaghiraConfig(); + +signals: + void changed(); + +public slots: + void load(KConfig* conf); + void save(KConfig* conf); + void defaults(); + +private: +// QSettings *config_; + ConfigDialog *dialog_; + ButtonColors *buttonDialog_; +}; + + +#endif // BAGHIRACONFIG_H diff --git a/deco/config/baghiraconfig.h.new b/deco/config/baghiraconfig.h.new new file mode 100644 index 0000000..0f75139 --- /dev/null +++ b/deco/config/baghiraconfig.h.new @@ -0,0 +1,149 @@ +////////////////////////////////////////////////////////////////////////////// +// baghiraconfig.h +// ------------------- +// Config module for Baghira window decoration +// ------------------- +// Copyright (c) 2004 Thomas Lübking +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +////////////////////////////////////////////////////////////////////////////// + +#ifndef BAGHIRACONFIG_H +#define BAGHIRACONFIG_H + +#include <qobject.h> +#include <qdialog.h> +#include <qvaluelist.h> +#include "colorpicker.h" +#include "aquariusbutton.h" + +class KConfig; +class QSettings; +class ConfigDialog; +class QLabel; +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QPushButton; +class QComboBox; + +class ButtonColors : public QDialog +{ + Q_OBJECT +public: + ButtonColors(QWidget* parent, const char * name = 0); + ~ButtonColors(); + ColorPicker *inactiveColor; + ColorPicker *closeColor; + ColorPicker *minColor; + ColorPicker *maxColor; + ColorPicker *menuColor; + ColorPicker *helpColor; + ColorPicker *stickyColor; + ColorPicker *aboveColor; + ColorPicker *behindColor; + ColorPicker *shadeColor; + ColorPicker *currentPicker; + + AquariusButton *inactiveButton; + AquariusButton *closeButton; + AquariusButton *minButton; + AquariusButton *maxButton; + AquariusButton *menuButton; + AquariusButton *helpButton; + AquariusButton *stickyButton; + AquariusButton *aboveButton; + AquariusButton *behindButton; + AquariusButton *shadeButton; + + QHBoxLayout *twoButts; + QPushButton *cancel; + QPushButton *ok; + QComboBox *presets_; + bool save; + +public slots: +// void defaults(); + void setColorGroup(int); + void init(); + + +private: + +/* + |------------|---| + | Indicator | B | + |------------|---| + | | T | + | Picker |---| + | | N | + |------------|---| +*/ + + QVBoxLayout *buttonLayout; + QVBoxLayout *pickerLayout; + QGridLayout *layout; + QLabel *indicator; + + void setPicker(ColorPicker *picker); + +private slots: + void activateInactive(); + void activateClose(); + void activateMin(); + void activateMax(); + void activateMenu(); + void activateHelp(); + void activateSticky(); + void activateAbove(); + void activateBehind(); + void activateShade(); + void setSave(){ + save = true; + } + void reset(); +}; + +class CustomDecoSettings; + +class BaghiraConfig : public QObject +{ + Q_OBJECT +public: + BaghiraConfig(KConfig* config, QWidget* parent); + ~BaghiraConfig(); + +signals: + void changed(); + +public slots: + void load(KConfig* conf); + void save(KConfig* conf); + void defaults(); + +private: +// QSettings *config_; + ConfigDialog *dialog_; + ButtonColors *buttonDialog_; + typedef QValueList<CustomDecoSettings> DecoList; + DecoList decoList; +}; + + +#endif // BAGHIRACONFIG_H diff --git a/deco/config/colorpicker.cc b/deco/config/colorpicker.cc new file mode 100644 index 0000000..5e11312 --- /dev/null +++ b/deco/config/colorpicker.cc @@ -0,0 +1,124 @@ +#include "colorpicker.h" +#include <qcolor.h> +#include <qlayout.h> +#include <qslider.h> +#include <qspinbox.h> + +ColorPicker::ColorPicker(QWidget* parent, const char* name) : QGroupBox( parent, name){ +// box = new QGroupBox(parent); +// setFrameShape(QFrame::GroupBoxPanel); +// setFrameShadow(QFrame::Sunken); + setColumnLayout(0, Qt::Vertical ); + layout()->setSpacing( 6 ); + layout()->setMargin( 11 ); + + QVBoxLayout *vLayout = new QVBoxLayout(layout()); +// gridLayout->setAlignment( Qt::AlignTop ); + + QHBoxLayout *redLayout = new QHBoxLayout(); + redSlider = new QSlider(0, 255, 1, 0, Qt::Horizontal, this, "redSlider"); + redLayout->addWidget(redSlider); + + redValue = new QSpinBox(0,255,1,this); + redValue->setValue(0); + redLayout->addWidget(redValue); + + vLayout->addLayout(redLayout); + + QHBoxLayout *greenLayout = new QHBoxLayout(); + greenSlider = new QSlider(0, 255, 1, 0, Qt::Horizontal, this, "greenSlider"); + greenLayout->addWidget(greenSlider); + + greenValue = new QSpinBox(0,255,1,this); + greenValue->setValue(0); + greenLayout->addWidget(greenValue); + + vLayout->addLayout(greenLayout); + + QHBoxLayout *blueLayout = new QHBoxLayout(); + blueSlider = new QSlider(0, 255, 1, 0, Qt::Horizontal, this, "blueSlider"); + blueLayout->addWidget(blueSlider); + + blueValue = new QSpinBox(0,255,1,this); + blueValue->setValue(0); + blueLayout->addWidget(blueValue); + + vLayout->addLayout(blueLayout); + +// resize( QSize(350, 100).expandedTo(minimumSizeHint()) ); + + //connections + connect(redSlider, SIGNAL(valueChanged (int)), this, SLOT(setRed(int))); + connect(greenSlider, SIGNAL(valueChanged (int)), this, SLOT(setGreen(int))); + connect(blueSlider, SIGNAL(valueChanged (int)), this, SLOT(setBlue(int))); + connect(redValue, SIGNAL(valueChanged (int)), this, SLOT(setRed(int))); + connect(greenValue, SIGNAL(valueChanged (int)), this, SLOT(setGreen(int))); + connect(blueValue, SIGNAL(valueChanged (int)), this, SLOT(setBlue(int))); +} + +ColorPicker::~ColorPicker(){ +} + +void ColorPicker::setColor(QColor color){ + redSlider->blockSignals(true); + redSlider->setValue( color.red() ); + redSlider->blockSignals(false); + redValue->blockSignals(true); + redValue->setValue(redSlider->value()); + redValue->blockSignals(false); + greenSlider->blockSignals(true); + greenSlider->setValue( color.green() ); + greenSlider->blockSignals(false); + greenValue->blockSignals(true); + greenValue->setValue(greenSlider->value()); + greenValue->blockSignals(false); + blueSlider->blockSignals(true); + blueSlider->setValue( color.blue() ); + blueSlider->blockSignals(false); + blueValue->blockSignals(true); + blueValue->setValue(blueSlider->value()); + blueValue->blockSignals(false); + emit colorChanged(color); +} + +void ColorPicker::setRed(int red){ + redSlider->blockSignals(true); + redSlider->setValue( red ); + redSlider->blockSignals(false); + redValue->blockSignals(true); + redValue->setValue(red); + redValue->blockSignals(false); + emit colorChanged(QColor(red, greenSlider->value(), blueSlider->value())); +} + +void ColorPicker::setGreen(int green){ + greenSlider->blockSignals(true); + greenSlider->setValue( green ); + greenSlider->blockSignals(false); + greenValue->blockSignals(true); + greenValue->setValue(green); + greenValue->blockSignals(false); + emit colorChanged(QColor(redSlider->value(), green, blueSlider->value())); +} + +void ColorPicker::setBlue(int blue){ + blueSlider->blockSignals(true); + blueSlider->setValue( blue ); + blueSlider->blockSignals(false); + blueValue->blockSignals(true); + blueValue->setValue(blue); + blueValue->blockSignals(false); + emit colorChanged(QColor(redSlider->value(), greenSlider->value(), blue)); +} + +QColor ColorPicker::Color(){ + return QColor(redSlider->value(), greenSlider->value(), blueSlider->value()); +} + +void ColorPicker::reset(){ + setColor(color_); +} + +void ColorPicker::init(){ + color_ = Color(); +}
\ No newline at end of file diff --git a/deco/config/colorpicker.h b/deco/config/colorpicker.h new file mode 100644 index 0000000..3b4ec48 --- /dev/null +++ b/deco/config/colorpicker.h @@ -0,0 +1,44 @@ +#ifndef COLORPICKER_H +#define COLORPICKER_H + +//#include <qvariant.h> +#include <qgroupbox.h> + +class QSlider; +class QSpinBox; +class QColor; +//class QGroupBox; + +class ColorPicker : public QGroupBox +{ + Q_OBJECT + +public: + ColorPicker( QWidget* parent = 0, const char* name = 0); + ~ColorPicker(); + QColor Color(); + +public slots: + void setColor(QColor color); + void setRed(int red); + void setGreen(int green); + void setBlue(int blue); + void reset(); + void init(); + +protected: + QSlider *redSlider; + QSlider *greenSlider; + QSlider *blueSlider; + QSpinBox *redValue; + QSpinBox *greenValue; + QSpinBox *blueValue; + QColor color_; +// QGroupBox *box; + +signals: + void colorChanged(QColor color); + +}; + +#endif // COLORPICKER_H diff --git a/deco/config/configdialog.ui b/deco/config/configdialog.ui new file mode 100644 index 0000000..a52dadf --- /dev/null +++ b/deco/config/configdialog.ui @@ -0,0 +1,3088 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ConfigDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ConfigDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>778</width> + <height>498</height> + </rect> + </property> + <property name="caption"> + <string>Configure Baghira Window Decoration</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>generalbox</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Common Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout133</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Minimum Title Height</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>53</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>minTH</cstring> + </property> + <property name="maxValue"> + <number>30</number> + </property> + <property name="minValue"> + <number>18</number> + </property> + <property name="toolTip" stdset="0"> + <string>The Titlebar height will follow your font setting.<br>However, you can set a minmum value to extend the Titlebar if you prefer small fonts.<br>18 is the minimum due to the Buttons :)</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="1" column="0"> + <property name="name"> + <cstring>ResizeGrip</cstring> + </property> + <property name="text"> + <string>Show resize grip</string> + </property> + <property name="toolTip" stdset="0"> + <string>Starts in Brushed Metal mode instead of default, if the Style is set to Brushed Metal</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>addAutoSpacing</cstring> + </property> + <property name="text"> + <string>Add auto spacing</string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0"> + <property name="name"> + <cstring>fullSpec</cstring> + </property> + <property name="text"> + <string>Fullscreen maximized</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check this to have any window in fullscreen Mode - demaximize the window by clicking into the top right corner of your screen</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>drawComicFrame</cstring> + </property> + <property name="text"> + <string>Draw Comic Frame</string> + </property> + <property name="toolTip" stdset="0"> + <string>Draws a black frame around the window (not the Titlebar).<br>Anyway i suggest to get the kwin dropshadow patch.</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="0"> + <property name="name"> + <cstring>noModalDeco</cstring> + </property> + <property name="text"> + <string>Hide deco for fixed size modal windows</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0"> + <property name="name"> + <cstring>maxResizable</cstring> + </property> + <property name="text"> + <string>Keep maximized resizable</string> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>allowEasyClosing</cstring> + </property> + <property name="text"> + <string>Allow Easy Closing</string> + </property> + <property name="toolTip" stdset="0"> + <string>Allows Closing by clicking into the top left or right corner <br> Close Button must be most left or right element (also no spacers) <br> Closes on Mouse Button release (so you have the chance to move the mouse away and keep the Window) <br> The Window must be active and maximized <br> Unfortunately you will not be able tho resize the Window from that corner</string> + </property> + </widget> + <widget class="QComboBox" row="11" column="0"> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed Metal</string> + </property> + </item> + <item> + <property name="text"> + <string>Tiger</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <property name="name"> + <cstring>defaultMode</cstring> + </property> + </widget> + <widget class="QLabel" row="10" column="0"> + <property name="name"> + <cstring>textLabel1_7</cstring> + </property> + <property name="text"> + <string>Default Mode is</string> + </property> + </widget> + <widget class="Line" row="9" column="0"> + <property name="name"> + <cstring>line3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="8" column="0"> + <property name="name"> + <cstring>delAppname</cstring> + </property> + <property name="text"> + <string>Try to remove application name +from multipart titles</string> + </property> + </widget> + </grid> + </widget> + <widget class="QButtonGroup" row="1" column="0"> + <property name="name"> + <cstring>titlealign</cstring> + </property> + <property name="title"> + <string>Title &Alignment</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string>Use these buttons to set the alignment of the window title</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>AlignLeft</cstring> + </property> + <property name="text"> + <string>Left</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer78</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="2"> + <property name="name"> + <cstring>AlignHCenter</cstring> + </property> + <property name="text"> + <string>Center</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <spacer row="0" column="3"> + <property name="name"> + <cstring>spacer77</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="4"> + <property name="name"> + <cstring>AlignRight</cstring> + </property> + <property name="text"> + <string>Right</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="6"> + <property name="name"> + <cstring>noTitle</cstring> + </property> + <property name="text"> + <string>None</string> + </property> + </widget> + <spacer row="0" column="5"> + <property name="name"> + <cstring>spacer23_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer79</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>59</height> + </size> + </property> + </spacer> + <widget class="QPushButton" row="0" column="0"> + <property name="name"> + <cstring>ButtonColorConfig</cstring> + </property> + <property name="text"> + <string>Configure Button Colors</string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer33</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>25</height> + </size> + </property> + </spacer> + <widget class="QTabWidget" row="0" column="2" rowspan="3" colspan="1"> + <property name="name"> + <cstring>tab</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>jaguarTab</cstring> + </property> + <attribute name="title"> + <string>Jaguar</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout7_3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4_3</cstring> + </property> + <property name="text"> + <string>3D Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>_3DImpact_J</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>20</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Titleshadow Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>LineImpact_J</cstring> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>40</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout40</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout35</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2_4_3</cstring> + </property> + <property name="text"> + <string>ButtonStyle</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_3</cstring> + </property> + <property name="text"> + <string>Active Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_3_2</cstring> + </property> + <property name="text"> + <string>Inactive Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer18_2_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout39</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle_J</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>titleeffect_J</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>i_titleeffect_J</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout38</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>Colors</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout33</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor1_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor2_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout34</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor1_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor2_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox2_4</cstring> + </property> + <property name="title"> + <string>Round Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout45</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUL_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer16</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLL_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="5" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout44</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUR_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLR_J</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer24_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderSize_J</cstring> + </property> + <property name="maxValue"> + <number>16</number> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel1_6_3</cstring> + </property> + <property name="text"> + <string>Border Size</string> + </property> + </widget> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer27_2</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> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer27</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> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>drawIcon_J</cstring> + </property> + <property name="text"> + <string>Draw Icon</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>pantherTab</cstring> + </property> + <attribute name="title"> + <string>Panther</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>Titleshadow Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>LineImpact_P</cstring> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>40</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox2_3</cstring> + </property> + <property name="title"> + <string>Round Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout51</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUL_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer20</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLL_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="5" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout52</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUR_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer19</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLR_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer18</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>50</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer24_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderSize_P</cstring> + </property> + <property name="maxValue"> + <number>16</number> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel1_6_2</cstring> + </property> + <property name="text"> + <string>Border Size</string> + </property> + </widget> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer28</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> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer28_2</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> + </grid> + </widget> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout7_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4_4</cstring> + </property> + <property name="text"> + <string>3D Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>_3DImpact_P</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>20</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout50</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout31</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2_4</cstring> + </property> + <property name="text"> + <string>ButtonStyle</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8</cstring> + </property> + <property name="text"> + <string>Active Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_4</cstring> + </property> + <property name="text"> + <string>Inactive Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer18_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout30</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle_P</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>titleeffect_P</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>i_titleeffect_P</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout49</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Colors</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout47</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor1_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor2_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout48</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor1_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor2_P</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>drawIcon_P</cstring> + </property> + <property name="text"> + <string>Draw Icon</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>brushedTab</cstring> + </property> + <attribute name="title"> + <string>Brushed</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10_3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_3</cstring> + </property> + <property name="text"> + <string>Titleshadow Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>LineImpact_B</cstring> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>40</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>3D Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>_3DImpact_B</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>20</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout57</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout27</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2_4_2</cstring> + </property> + <property name="text"> + <string>ButtonStyle</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_2</cstring> + </property> + <property name="text"> + <string>Active Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_2_2</cstring> + </property> + <property name="text"> + <string>Inactive Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer18_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout26</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle_B</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>titleeffect_B</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>i_titleeffect_B</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout56</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_5</cstring> + </property> + <property name="text"> + <string>Colors</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout54</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor1_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor2_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout55</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor1_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor2_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>groupBox2_2</cstring> + </property> + <property name="title"> + <string>Round Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout58</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUL_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer21</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLL_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="5" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout59</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUR_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLR_B</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer23</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel1_6</cstring> + </property> + <property name="text"> + <string>Border Size</string> + </property> + </widget> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderSize_B</cstring> + </property> + <property name="maxValue"> + <number>16</number> + </property> + <property name="value"> + <number>6</number> + </property> + </widget> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer24</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer29</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> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer29_2</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> + </grid> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>drawIcon_B</cstring> + </property> + <property name="text"> + <string>Draw Icon</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Tiger</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout7_4</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4_2</cstring> + </property> + <property name="text"> + <string>3D Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>_3DImpact_T</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>20</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="3" column="0"> + <property name="name"> + <cstring>groupBox2_2_2</cstring> + </property> + <property name="title"> + <string>Round Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout58_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUL_T</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer21_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLL_T</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="5" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout59_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUR_T</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22_2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLR_T</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer23_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel1_6_4</cstring> + </property> + <property name="text"> + <string>Border Size</string> + </property> + </widget> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderSize_T</cstring> + </property> + <property name="maxValue"> + <number>16</number> + </property> + <property name="value"> + <number>6</number> + </property> + </widget> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer24_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer29_3</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> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer29_2_2</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> + </grid> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout42</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout27_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2_4_2_2</cstring> + </property> + <property name="text"> + <string>ButtonStyle</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_2_3</cstring> + </property> + <property name="text"> + <string>Active Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_2_2_2</cstring> + </property> + <property name="text"> + <string>Inactive Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer18_2_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout82</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle_T</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_9</cstring> + </property> + <property name="text"> + <string>(Gradient)</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_9_2</cstring> + </property> + <property name="text"> + <string>(Scanlines)</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout41</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_5_2</cstring> + </property> + <property name="text"> + <string>Colors</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout54_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor1_T</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor2_T</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_10</cstring> + </property> + <property name="text"> + <string>(Background)</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>drawIcon_T</cstring> + </property> + <property name="text"> + <string>Draw Icon</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Special</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>drawIcon_S</cstring> + </property> + <property name="text"> + <string>Draw Icon</string> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout7_5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4_5</cstring> + </property> + <property name="text"> + <string>3D Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4_5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>_3DImpact_S</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>20</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout57_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout27_3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2_4_2_3</cstring> + </property> + <property name="text"> + <string>ButtonStyle</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_2_4</cstring> + </property> + <property name="text"> + <string>Active Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_8_2_2_3</cstring> + </property> + <property name="text"> + <string>Inactive Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer18_2_2_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout26_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle_S</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>titleeffect_S</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>i_titleeffect_S</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout56_2</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_5_3</cstring> + </property> + <property name="text"> + <string>Colors</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout54_3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor1_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor2_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout55_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor1_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor2_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </hbox> + </widget> + <widget class="QGroupBox" row="4" column="0"> + <property name="name"> + <cstring>groupBox2_2_3</cstring> + </property> + <property name="title"> + <string>Round Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout58_3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUL_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer21_3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLL_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="5" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout59_3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUR_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22_3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLR_S</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer23_4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>textLabel1_6_5</cstring> + </property> + <property name="text"> + <string>Border Size</string> + </property> + </widget> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderSize_S</cstring> + </property> + <property name="maxValue"> + <number>16</number> + </property> + <property name="value"> + <number>6</number> + </property> + </widget> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer24_5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer29_4</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> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer29_2_3</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> + </grid> + </widget> + <widget class="QLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>layout10_3_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_3_2</cstring> + </property> + <property name="text"> + <string>Titleshadow Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5_3_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>LineImpact_S</cstring> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>40</number> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> +</includehints> +</UI> diff --git a/deco/config/configdialog.ui.new b/deco/config/configdialog.ui.new new file mode 100644 index 0000000..b17dbd1 --- /dev/null +++ b/deco/config/configdialog.ui.new @@ -0,0 +1,398 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ConfigDialog</class> +<widget class="QWidget"> + <property name="name"> + <cstring>ConfigDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>657</width> + <height>476</height> + </rect> + </property> + <property name="caption"> + <string>Configure Baghira Window Decoration</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>titlealign</cstring> + </property> + <property name="title"> + <string>Title &Alignment</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + <property name="whatsThis" stdset="0"> + <string>Use these buttons to set the alignment of the window title</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>AlignLeft</cstring> + </property> + <property name="text"> + <string>Left</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <spacer row="0" column="1"> + <property name="name"> + <cstring>spacer78</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="2"> + <property name="name"> + <cstring>AlignHCenter</cstring> + </property> + <property name="text"> + <string>Center</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <spacer row="0" column="3"> + <property name="name"> + <cstring>spacer77</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton" row="0" column="4"> + <property name="name"> + <cstring>AlignRight</cstring> + </property> + <property name="text"> + <string>Right</string> + </property> + <property name="toolTip" stdset="0"> + <string></string> + </property> + </widget> + <widget class="QRadioButton" row="0" column="6"> + <property name="name"> + <cstring>noTitle</cstring> + </property> + <property name="text"> + <string>None</string> + </property> + </widget> + <spacer row="0" column="5"> + <property name="name"> + <cstring>spacer23_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>51</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>generalbox</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="title"> + <string>Common Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="12" column="0"> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed Metal</string> + </property> + </item> + <item> + <property name="text"> + <string>Tiger</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <property name="name"> + <cstring>defaultMode</cstring> + </property> + </widget> + <widget class="QCheckBox" row="9" column="0"> + <property name="name"> + <cstring>delAppname</cstring> + </property> + <property name="text"> + <string>Try to remove application name +from multipart titles</string> + </property> + </widget> + <widget class="Line" row="10" column="0"> + <property name="name"> + <cstring>line3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0"> + <property name="name"> + <cstring>drawComicFrame</cstring> + </property> + <property name="text"> + <string>Draw Comic Frame</string> + </property> + <property name="toolTip" stdset="0"> + <string>Draws a black frame around the window (not the Titlebar).<br>Anyway i suggest to get the kwin dropshadow patch.</string> + </property> + </widget> + <widget class="QCheckBox" row="8" column="0"> + <property name="name"> + <cstring>noModalDeco</cstring> + </property> + <property name="text"> + <string>Hide deco for fixed size modal windows</string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0"> + <property name="name"> + <cstring>maxResizable</cstring> + </property> + <property name="text"> + <string>Keep maximized resizable</string> + </property> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>ResizeGrip</cstring> + </property> + <property name="text"> + <string>Show resize grip</string> + </property> + <property name="toolTip" stdset="0"> + <string>Starts in Brushed Metal mode instead of default, if the Style is set to Brushed Metal</string> + </property> + </widget> + <widget class="QLabel" row="11" column="0"> + <property name="name"> + <cstring>textLabel1_7</cstring> + </property> + <property name="text"> + <string>Default Mode is</string> + </property> + </widget> + <widget class="QCheckBox" row="7" column="0"> + <property name="name"> + <cstring>fullSpec</cstring> + </property> + <property name="text"> + <string>Fullscreen maximized</string> + </property> + <property name="toolTip" stdset="0"> + <string>Check this to have any window in fullscreen Mode - demaximize the window by clicking into the top right corner of your screen</string> + </property> + </widget> + <widget class="QCheckBox" row="4" column="0"> + <property name="name"> + <cstring>allowEasyClosing</cstring> + </property> + <property name="text"> + <string>Allow Easy Closing</string> + </property> + <property name="toolTip" stdset="0"> + <string>Allows Closing by clicking into the top left or right corner <br> Close Button must be most left or right element (also no spacers) <br> Closes on Mouse Button release (so you have the chance to move the mouse away and keep the Window) <br> The Window must be active and maximized <br> Unfortunately you will not be able tho resize the Window from that corner</string> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0"> + <property name="name"> + <cstring>addAutoSpacing</cstring> + </property> + <property name="text"> + <string>Add auto spacing</string> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout133</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="text"> + <string>Minimum Title Height</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>53</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>minTH</cstring> + </property> + <property name="maxValue"> + <number>30</number> + </property> + <property name="minValue"> + <number>18</number> + </property> + <property name="toolTip" stdset="0"> + <string>The Titlebar height will follow your font setting.<br>However, you can set a minmum value to extend the Titlebar if you prefer small fonts.<br>18 is the minimum due to the Buttons :)</string> + </property> + </widget> + </hbox> + </widget> + <widget class="QPushButton" row="0" column="0"> + <property name="name"> + <cstring>ButtonColorConfig</cstring> + </property> + <property name="text"> + <string>Configure Button Colors</string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidgetStack" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>decoStack</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="lineWidth"> + <number>2</number> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>WStackPage</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="geometry"> + <rect> + <x>99</x> + <y>99</y> + <width>74</width> + <height>20</height> + </rect> + </property> + <property name="text"> + <string>Blablabla</string> + </property> + </widget> + </widget> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>pushButton2</cstring> + </property> + <property name="text"> + <string>Add style</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="2"> + <property name="name"> + <cstring>pushButton3</cstring> + </property> + <property name="text"> + <string>Remove Style</string> + </property> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/deco/config/customdecosettings.ui b/deco/config/customdecosettings.ui new file mode 100644 index 0000000..2533091 --- /dev/null +++ b/deco/config/customdecosettings.ui @@ -0,0 +1,586 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>CustomDecoSettings</class> +<widget class="QWidget"> + <property name="name"> + <cstring>CustomDecoSettings</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>416</width> + <height>325</height> + </rect> + </property> + <property name="caption"> + <string>CustomDecoSettings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="5" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>boxCorner</cstring> + </property> + <property name="title"> + <string>Round Corners</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout45</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUL</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer16</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLL</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="0" column="5" rowspan="3" colspan="1"> + <property name="name"> + <cstring>layout44</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeUR</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer17</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>shapeLR</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <spacer row="1" column="4"> + <property name="name"> + <cstring>spacer24_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>60</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox" row="1" column="3"> + <property name="name"> + <cstring>borderSize</cstring> + </property> + <property name="maxValue"> + <number>16</number> + </property> + </widget> + <widget class="QLabel" row="1" column="2"> + <property name="name"> + <cstring>labelBorderSize</cstring> + </property> + <property name="text"> + <string>Border Size</string> + </property> + </widget> + <spacer row="0" column="2"> + <property name="name"> + <cstring>spacer27_2</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> + <spacer row="2" column="2"> + <property name="name"> + <cstring>spacer27</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> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelTitleshadow</cstring> + </property> + <property name="text"> + <string>Titleshadow Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>LineImpact</cstring> + </property> + <property name="buttonSymbols"> + <enum>UpDownArrows</enum> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>40</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="3" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>layout7_3</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>label3D</cstring> + </property> + <property name="text"> + <string>3D Intensity</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>200</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QSpinBox"> + <property name="name"> + <cstring>_3DImpact</cstring> + </property> + <property name="maxValue"> + <number>100</number> + </property> + <property name="value"> + <number>20</number> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout35</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelButtonstyle</cstring> + </property> + <property name="text"> + <string>ButtonStyle</string> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelTitle</cstring> + </property> + <property name="text"> + <string>Active Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>labelInTitle</cstring> + </property> + <property name="text"> + <string>Inactive Titlebar Effect</string> + </property> + <property name="buddy" stdset="0"> + <cstring>titleeffect</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="2" column="4"> + <property name="name"> + <cstring>layout38</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>labelColors</cstring> + </property> + <property name="text"> + <string>Colors</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout33</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor1</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>activeColor2</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout34</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor1</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KColorButton"> + <property name="name"> + <cstring>inactiveColor2</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="2" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout39</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Panther</string> + </property> + </item> + <item> + <property name="text"> + <string>Jaguar</string> + </property> + </item> + <item> + <property name="text"> + <string>Milk</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <property name="name"> + <cstring>buttonStyle</cstring> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>titleeffect</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>Gradient</string> + </property> + </item> + <item> + <property name="text"> + <string>Stippled</string> + </property> + </item> + <item> + <property name="text"> + <string>Nostalgia</string> + </property> + </item> + <item> + <property name="text"> + <string>Glossy</string> + </property> + </item> + <item> + <property name="text"> + <string>Brushed</string> + </property> + </item> + <item> + <property name="text"> + <string>Scanlines</string> + </property> + </item> + <property name="name"> + <cstring>i_titleeffect</cstring> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>22</height> + </size> + </property> + <property name="whatsThis" stdset="0"> + <string>Select an effect for the titlebar to change its appearance</string> + </property> + </widget> + </vbox> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>spacer18_2_3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>16</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QCheckBox" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>drawIcon</cstring> + </property> + <property name="text"> + <string>Draw Icon</string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>DecoName</cstring> + </property> + <property name="font"> + <font> + <pointsize>14</pointsize> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Name</string> + </property> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> + <includehint>kcolorbutton.h</includehint> +</includehints> +</UI> diff --git a/deco/config/generatePixmaps.sh b/deco/config/generatePixmaps.sh new file mode 100755 index 0000000..7c392a2 --- /dev/null +++ b/deco/config/generatePixmaps.sh @@ -0,0 +1,10 @@ +#!/bin/sh +top_srcdir="${1:-../..}" +imagebase="$top_srcdir/imagebase" +UIC=$(grep "UIC = " ../../Makefile | cut -f3- -d" ") +echo -e "#ifndef DCPIXMAPS_H\n#define DCPIXMAPS_H\n" > pixmaps.h +$UIC -embed baghira \ +$imagebase/icon_help \ +$imagebase/preview \ +$imagebase/preview-menu >> pixmaps.h +echo -e "#endif //DCPIXMAPS_H\n" >> pixmaps.h diff --git a/deco/generatePixmaps.sh b/deco/generatePixmaps.sh new file mode 100755 index 0000000..6fff33b --- /dev/null +++ b/deco/generatePixmaps.sh @@ -0,0 +1,28 @@ +#!/bin/sh +top_srcdir="${1:-../..}" +imagebase="$top_srcdir/imagebase" +UIC=$(grep "UIC = " ../Makefile | cut -f3- -d" ") +echo -e "#ifndef DPIXMAPS_H\n#define DPIXMAPS_H\n" > pixmaps.h +$UIC -embed baghira \ +$imagebase/brushed-gradient \ +$imagebase/brushed-tile \ +$imagebase/button_jaguar \ +$imagebase/button_jaguar_down \ +$imagebase/button_jaguar_menu \ +$imagebase/button_jaguar_menu_down \ +$imagebase/button_milk \ +$imagebase/button_milk_down \ +$imagebase/button_milk_menu \ +$imagebase/button_milk_menu_down \ +$imagebase/button_panther \ +$imagebase/button_panther_menu \ +$imagebase/deco_glossy \ +$imagebase/icon_above \ +$imagebase/icon_behind \ +$imagebase/icon_close \ +$imagebase/icon_help \ +$imagebase/icon_maximize \ +$imagebase/icon_minimize \ +$imagebase/icon_shade \ +$imagebase/icon_sticky >> pixmaps.h +echo -e "#endif //DPIXMAPS_H\n" >> pixmaps.h diff --git a/deco/masks.h b/deco/masks.h new file mode 100644 index 0000000..75c2fe2 --- /dev/null +++ b/deco/masks.h @@ -0,0 +1,81 @@ +#define help_width 14 +#define help_height 15 +static unsigned char help_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x03, 0xf0, 0x07, 0x00, 0x06, 0x00, 0x07, + 0x80, 0x03, 0xc0, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00, + 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00 }; +#define jaguar2_width 14 +#define jaguar2_height 15 +static unsigned char jaguar2_bits[] = { + 0x00, 0x00, 0xf8, 0x07, 0xfe, 0x1f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0x3f, + 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, + 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07 }; +#define jaguar_menu_down_width 20 +#define jaguar_menu_down_height 15 +static unsigned char jaguar_menu_down_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0xfc, 0xff, 0x03, + 0xfe, 0xff, 0x07, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, + 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, + 0xfa, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +#define jaguar_menu_width 20 +#define jaguar_menu_height 15 +static unsigned char jaguar_menu_bits[] = { + 0x00, 0x00, 0x00, 0x80, 0x7f, 0x00, 0xfc, 0xff, 0x03, 0xfe, 0xff, 0x07, + 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, + 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xfe, 0xff, 0x07, + 0xfc, 0xff, 0x01, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00 }; +#define jaguar_width 14 +#define jaguar_height 15 +static unsigned char jaguar_bits[] = { + 0xf8, 0x07, 0xfc, 0x0f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, + 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, + 0xff, 0x3f, 0xfe, 0x1f, 0xfc, 0x0f }; +#define milk_menu_down_width 20 +#define milk_menu_down_height 15 +static unsigned char milk_menu_down_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x01, 0xfe, 0xff, 0x03, + 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, + 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xfe, 0xff, 0x03, 0xfc, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +#define milk_menu_width 20 +#define milk_menu_height 15 +static unsigned char milk_menu_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x01, 0x0e, 0x80, 0x03, + 0x03, 0x00, 0x06, 0x03, 0x00, 0x06, 0x01, 0x00, 0x04, 0x01, 0x00, 0x04, + 0x03, 0x00, 0x06, 0x03, 0x00, 0x06, 0x0e, 0x80, 0x03, 0xfc, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +#define milk_width 14 +#define milk_height 15 +static unsigned char milk_bits[] = { + 0xf0, 0x03, 0x3c, 0x0f, 0x0e, 0x1c, 0x06, 0x18, 0x03, 0x30, 0x03, 0x30, + 0x01, 0x20, 0x01, 0x20, 0x03, 0x30, 0x03, 0x30, 0x06, 0x18, 0x0e, 0x1c, + 0x3c, 0x0f, 0xf0, 0x03, 0x00, 0x00 }; +#define panther_menu_width 20 +#define panther_menu_height 15 +static unsigned char panther_menu_bits[] = { + 0x00, 0x00, 0x00, 0xfe, 0xff, 0x07, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, + 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, + 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x07, + 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +#define panther_width 14 +#define panther_height 15 +static unsigned char panther_bits[] = { + 0xf8, 0x07, 0xfc, 0x0f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, + 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, + 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07 }; +#define milk_pressed_width 14 +#define milk_pressed_height 15 +static unsigned char milk_pressed_bits[] = { + 0xf0, 0x03, 0xfc, 0x0f, 0xfe, 0x1f, 0xfe, 0x1f, 0xff, 0x3f, 0xff, 0x3f, + 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xfe, 0x1f, 0xfe, 0x1f, + 0xfc, 0x0f, 0xf0, 0x03, 0x00, 0x00 }; + +#define arrowUp_width 8 +#define arrowUp_height 4 +static unsigned char arrowUp_bits[] = { + 0x18, 0x3c, 0x7e, 0xff }; + +#define arrowDown_width 8 +#define arrowDown_height 4 +static unsigned char arrowDown_bits[] = { + 0xff, 0x7e, 0x3c, 0x18 }; diff --git a/icons/Makefile.am b/icons/Makefile.am new file mode 100644 index 0000000..e5515a8 --- /dev/null +++ b/icons/Makefile.am @@ -0,0 +1 @@ +KDE_ICON = AUTO diff --git a/icons/cr128-app-baghira.png b/icons/cr128-app-baghira.png Binary files differnew file mode 100644 index 0000000..bf8df39 --- /dev/null +++ b/icons/cr128-app-baghira.png diff --git a/icons/cr128-app-baghira_blue.png b/icons/cr128-app-baghira_blue.png Binary files differnew file mode 100644 index 0000000..c12ea71 --- /dev/null +++ b/icons/cr128-app-baghira_blue.png diff --git a/icons/cr128-app-baghira_grey.png b/icons/cr128-app-baghira_grey.png Binary files differnew file mode 100644 index 0000000..4bef378 --- /dev/null +++ b/icons/cr128-app-baghira_grey.png diff --git a/icons/cr128-app-baghira_white.png b/icons/cr128-app-baghira_white.png Binary files differnew file mode 100644 index 0000000..3629f15 --- /dev/null +++ b/icons/cr128-app-baghira_white.png diff --git a/icons/cr128-app-baghira_yellow.png b/icons/cr128-app-baghira_yellow.png Binary files differnew file mode 100644 index 0000000..ddf2ff7 --- /dev/null +++ b/icons/cr128-app-baghira_yellow.png diff --git a/icons/cr16-app-baghira.png b/icons/cr16-app-baghira.png Binary files differnew file mode 100644 index 0000000..8f8f3af --- /dev/null +++ b/icons/cr16-app-baghira.png diff --git a/icons/cr16-app-baghira_blue.png b/icons/cr16-app-baghira_blue.png Binary files differnew file mode 100644 index 0000000..27b35ef --- /dev/null +++ b/icons/cr16-app-baghira_blue.png diff --git a/icons/cr16-app-baghira_grey.png b/icons/cr16-app-baghira_grey.png Binary files differnew file mode 100644 index 0000000..ca3e367 --- /dev/null +++ b/icons/cr16-app-baghira_grey.png diff --git a/icons/cr16-app-baghira_white.png b/icons/cr16-app-baghira_white.png Binary files differnew file mode 100644 index 0000000..6aee8c7 --- /dev/null +++ b/icons/cr16-app-baghira_white.png diff --git a/icons/cr16-app-baghira_yellow.png b/icons/cr16-app-baghira_yellow.png Binary files differnew file mode 100644 index 0000000..3523a6e --- /dev/null +++ b/icons/cr16-app-baghira_yellow.png diff --git a/icons/cr22-action-bab_itunes.png b/icons/cr22-action-bab_itunes.png Binary files differnew file mode 100644 index 0000000..762c12b --- /dev/null +++ b/icons/cr22-action-bab_itunes.png diff --git a/icons/cr22-action-bab_jaguar.png b/icons/cr22-action-bab_jaguar.png Binary files differnew file mode 100644 index 0000000..97f63f3 --- /dev/null +++ b/icons/cr22-action-bab_jaguar.png diff --git a/icons/cr22-action-bab_milk.png b/icons/cr22-action-bab_milk.png Binary files differnew file mode 100644 index 0000000..8737ca8 --- /dev/null +++ b/icons/cr22-action-bab_milk.png diff --git a/icons/cr22-action-bab_panther.png b/icons/cr22-action-bab_panther.png Binary files differnew file mode 100644 index 0000000..5c55a6a --- /dev/null +++ b/icons/cr22-action-bab_panther.png diff --git a/icons/cr22-action-bab_tiger.png b/icons/cr22-action-bab_tiger.png Binary files differnew file mode 100644 index 0000000..af6f4c7 --- /dev/null +++ b/icons/cr22-action-bab_tiger.png diff --git a/icons/cr22-app-baghira.png b/icons/cr22-app-baghira.png Binary files differnew file mode 100644 index 0000000..5c55a6a --- /dev/null +++ b/icons/cr22-app-baghira.png diff --git a/icons/cr22-app-baghira_blue.png b/icons/cr22-app-baghira_blue.png Binary files differnew file mode 100644 index 0000000..97f63f3 --- /dev/null +++ b/icons/cr22-app-baghira_blue.png diff --git a/icons/cr22-app-baghira_grey.png b/icons/cr22-app-baghira_grey.png Binary files differnew file mode 100644 index 0000000..762c12b --- /dev/null +++ b/icons/cr22-app-baghira_grey.png diff --git a/icons/cr22-app-baghira_white.png b/icons/cr22-app-baghira_white.png Binary files differnew file mode 100644 index 0000000..8737ca8 --- /dev/null +++ b/icons/cr22-app-baghira_white.png diff --git a/icons/cr22-app-baghira_yellow.png b/icons/cr22-app-baghira_yellow.png Binary files differnew file mode 100644 index 0000000..af6f4c7 --- /dev/null +++ b/icons/cr22-app-baghira_yellow.png diff --git a/icons/cr32-app-baghira.png b/icons/cr32-app-baghira.png Binary files differnew file mode 100644 index 0000000..5c386cb --- /dev/null +++ b/icons/cr32-app-baghira.png diff --git a/icons/cr32-app-baghira_blue.png b/icons/cr32-app-baghira_blue.png Binary files differnew file mode 100644 index 0000000..06352da --- /dev/null +++ b/icons/cr32-app-baghira_blue.png diff --git a/icons/cr32-app-baghira_grey.png b/icons/cr32-app-baghira_grey.png Binary files differnew file mode 100644 index 0000000..cc57c2f --- /dev/null +++ b/icons/cr32-app-baghira_grey.png diff --git a/icons/cr32-app-baghira_white.png b/icons/cr32-app-baghira_white.png Binary files differnew file mode 100644 index 0000000..229e210 --- /dev/null +++ b/icons/cr32-app-baghira_white.png diff --git a/icons/cr32-app-baghira_yellow.png b/icons/cr32-app-baghira_yellow.png Binary files differnew file mode 100644 index 0000000..03030c5 --- /dev/null +++ b/icons/cr32-app-baghira_yellow.png diff --git a/icons/cr48-app-baghira.png b/icons/cr48-app-baghira.png Binary files differnew file mode 100644 index 0000000..fd9336d --- /dev/null +++ b/icons/cr48-app-baghira.png diff --git a/icons/cr48-app-baghira_blue.png b/icons/cr48-app-baghira_blue.png Binary files differnew file mode 100644 index 0000000..14bb2e3 --- /dev/null +++ b/icons/cr48-app-baghira_blue.png diff --git a/icons/cr48-app-baghira_grey.png b/icons/cr48-app-baghira_grey.png Binary files differnew file mode 100644 index 0000000..f11f3db --- /dev/null +++ b/icons/cr48-app-baghira_grey.png diff --git a/icons/cr48-app-baghira_white.png b/icons/cr48-app-baghira_white.png Binary files differnew file mode 100644 index 0000000..1bab234 --- /dev/null +++ b/icons/cr48-app-baghira_white.png diff --git a/icons/cr48-app-baghira_yellow.png b/icons/cr48-app-baghira_yellow.png Binary files differnew file mode 100644 index 0000000..88eef1c --- /dev/null +++ b/icons/cr48-app-baghira_yellow.png diff --git a/icons/cr64-app-baghira.png b/icons/cr64-app-baghira.png Binary files differnew file mode 100644 index 0000000..8b9c54e --- /dev/null +++ b/icons/cr64-app-baghira.png diff --git a/icons/cr64-app-baghira_blue.png b/icons/cr64-app-baghira_blue.png Binary files differnew file mode 100644 index 0000000..07ea9b1 --- /dev/null +++ b/icons/cr64-app-baghira_blue.png diff --git a/icons/cr64-app-baghira_grey.png b/icons/cr64-app-baghira_grey.png Binary files differnew file mode 100644 index 0000000..f729b7d --- /dev/null +++ b/icons/cr64-app-baghira_grey.png diff --git a/icons/cr64-app-baghira_white.png b/icons/cr64-app-baghira_white.png Binary files differnew file mode 100644 index 0000000..3de608b --- /dev/null +++ b/icons/cr64-app-baghira_white.png diff --git a/icons/cr64-app-baghira_yellow.png b/icons/cr64-app-baghira_yellow.png Binary files differnew file mode 100644 index 0000000..2f9300d --- /dev/null +++ b/icons/cr64-app-baghira_yellow.png diff --git a/icons/readme b/icons/readme new file mode 100644 index 0000000..2684dcb --- /dev/null +++ b/icons/readme @@ -0,0 +1,7 @@ +Due to licensing stuff (mainly conflicts with debian free software) and as i could not reach Timur until today (onexige seems to be dead) i temporary removed his icons and replaced them with some svg stuff i created somewhen much earlier. +You can still download and include timurs icons from http://www.kde-look.org and hopefully i can reinclude them in future releases. + +Regards, +Thomas + +Timur: MAIL ME! USE A VALID MAIL ADDRESS! ;)
\ No newline at end of file diff --git a/icons/svgs.tar.bz2 b/icons/svgs.tar.bz2 Binary files differnew file mode 100644 index 0000000..9b30510 --- /dev/null +++ b/icons/svgs.tar.bz2 diff --git a/imagebase/AboutBaghira b/imagebase/AboutBaghira Binary files differnew file mode 100644 index 0000000..2f43958 --- /dev/null +++ b/imagebase/AboutBaghira diff --git a/imagebase/brush-me b/imagebase/brush-me Binary files differnew file mode 100644 index 0000000..97ffbf8 --- /dev/null +++ b/imagebase/brush-me diff --git a/imagebase/brushed-gradient b/imagebase/brushed-gradient Binary files differnew file mode 100644 index 0000000..10aab1d --- /dev/null +++ b/imagebase/brushed-gradient diff --git a/imagebase/brushed-tile b/imagebase/brushed-tile Binary files differnew file mode 100644 index 0000000..ab4fcf0 --- /dev/null +++ b/imagebase/brushed-tile diff --git a/imagebase/button-base b/imagebase/button-base Binary files differnew file mode 100644 index 0000000..a29a3e6 --- /dev/null +++ b/imagebase/button-base diff --git a/imagebase/button-glow b/imagebase/button-glow Binary files differnew file mode 100644 index 0000000..b0c3521 --- /dev/null +++ b/imagebase/button-glow diff --git a/imagebase/button-jaguar b/imagebase/button-jaguar Binary files differnew file mode 100644 index 0000000..1037901 --- /dev/null +++ b/imagebase/button-jaguar diff --git a/imagebase/button-milk b/imagebase/button-milk Binary files differnew file mode 100644 index 0000000..2752228 --- /dev/null +++ b/imagebase/button-milk diff --git a/imagebase/button-shadow b/imagebase/button-shadow Binary files differnew file mode 100644 index 0000000..630b43d --- /dev/null +++ b/imagebase/button-shadow diff --git a/imagebase/button_jaguar b/imagebase/button_jaguar Binary files differnew file mode 100644 index 0000000..609dd1a --- /dev/null +++ b/imagebase/button_jaguar diff --git a/imagebase/button_jaguar_down b/imagebase/button_jaguar_down Binary files differnew file mode 100644 index 0000000..d10d816 --- /dev/null +++ b/imagebase/button_jaguar_down diff --git a/imagebase/button_jaguar_menu b/imagebase/button_jaguar_menu Binary files differnew file mode 100644 index 0000000..5c9b2c8 --- /dev/null +++ b/imagebase/button_jaguar_menu diff --git a/imagebase/button_jaguar_menu_down b/imagebase/button_jaguar_menu_down Binary files differnew file mode 100644 index 0000000..73b3af5 --- /dev/null +++ b/imagebase/button_jaguar_menu_down diff --git a/imagebase/button_milk b/imagebase/button_milk Binary files differnew file mode 100644 index 0000000..fcb12cf --- /dev/null +++ b/imagebase/button_milk diff --git a/imagebase/button_milk_down b/imagebase/button_milk_down Binary files differnew file mode 100644 index 0000000..e234c86 --- /dev/null +++ b/imagebase/button_milk_down diff --git a/imagebase/button_milk_menu b/imagebase/button_milk_menu Binary files differnew file mode 100644 index 0000000..9a0dfc3 --- /dev/null +++ b/imagebase/button_milk_menu diff --git a/imagebase/button_milk_menu_down b/imagebase/button_milk_menu_down Binary files differnew file mode 100644 index 0000000..6f5dbde --- /dev/null +++ b/imagebase/button_milk_menu_down diff --git a/imagebase/button_panther b/imagebase/button_panther Binary files differnew file mode 100644 index 0000000..44e9d65 --- /dev/null +++ b/imagebase/button_panther diff --git a/imagebase/button_panther_menu b/imagebase/button_panther_menu Binary files differnew file mode 100644 index 0000000..cfb4885 --- /dev/null +++ b/imagebase/button_panther_menu diff --git a/imagebase/checkbox b/imagebase/checkbox Binary files differnew file mode 100644 index 0000000..5c0473f --- /dev/null +++ b/imagebase/checkbox diff --git a/imagebase/checkbox-milk b/imagebase/checkbox-milk Binary files differnew file mode 100644 index 0000000..0b26db7 --- /dev/null +++ b/imagebase/checkbox-milk diff --git a/imagebase/checkboxdown b/imagebase/checkboxdown Binary files differnew file mode 100644 index 0000000..5b5f23f --- /dev/null +++ b/imagebase/checkboxdown diff --git a/imagebase/checkboxdown-milk b/imagebase/checkboxdown-milk Binary files differnew file mode 100644 index 0000000..cb10256 --- /dev/null +++ b/imagebase/checkboxdown-milk diff --git a/imagebase/checkboxdown.bak2 b/imagebase/checkboxdown.bak2 Binary files differnew file mode 100644 index 0000000..d6f8ccc --- /dev/null +++ b/imagebase/checkboxdown.bak2 diff --git a/imagebase/combo b/imagebase/combo Binary files differnew file mode 100644 index 0000000..b28002a --- /dev/null +++ b/imagebase/combo diff --git a/imagebase/combo-jaguar b/imagebase/combo-jaguar Binary files differnew file mode 100644 index 0000000..3ba741c --- /dev/null +++ b/imagebase/combo-jaguar diff --git a/imagebase/combo-milk b/imagebase/combo-milk Binary files differnew file mode 100644 index 0000000..ad417ac --- /dev/null +++ b/imagebase/combo-milk diff --git a/imagebase/combo-shadow b/imagebase/combo-shadow Binary files differnew file mode 100644 index 0000000..b7cfedf --- /dev/null +++ b/imagebase/combo-shadow diff --git a/imagebase/deco_glossy b/imagebase/deco_glossy Binary files differnew file mode 100644 index 0000000..e27e88a --- /dev/null +++ b/imagebase/deco_glossy diff --git a/imagebase/icon_above b/imagebase/icon_above Binary files differnew file mode 100644 index 0000000..c0147d5 --- /dev/null +++ b/imagebase/icon_above diff --git a/imagebase/icon_behind b/imagebase/icon_behind Binary files differnew file mode 100644 index 0000000..5e2126f --- /dev/null +++ b/imagebase/icon_behind diff --git a/imagebase/icon_close b/imagebase/icon_close Binary files differnew file mode 100644 index 0000000..e68d91c --- /dev/null +++ b/imagebase/icon_close diff --git a/imagebase/icon_help b/imagebase/icon_help Binary files differnew file mode 100644 index 0000000..25dd801 --- /dev/null +++ b/imagebase/icon_help diff --git a/imagebase/icon_maximize b/imagebase/icon_maximize Binary files differnew file mode 100644 index 0000000..633a7cb --- /dev/null +++ b/imagebase/icon_maximize diff --git a/imagebase/icon_minimize b/imagebase/icon_minimize Binary files differnew file mode 100644 index 0000000..a3f2491 --- /dev/null +++ b/imagebase/icon_minimize diff --git a/imagebase/icon_shade b/imagebase/icon_shade Binary files differnew file mode 100644 index 0000000..721dfd3 --- /dev/null +++ b/imagebase/icon_shade diff --git a/imagebase/icon_sticky b/imagebase/icon_sticky Binary files differnew file mode 100644 index 0000000..b59d50b --- /dev/null +++ b/imagebase/icon_sticky diff --git a/imagebase/poof.png b/imagebase/poof.png Binary files differnew file mode 100644 index 0000000..990068d --- /dev/null +++ b/imagebase/poof.png diff --git a/imagebase/preview b/imagebase/preview Binary files differnew file mode 100644 index 0000000..4bb20c0 --- /dev/null +++ b/imagebase/preview diff --git a/imagebase/preview-menu b/imagebase/preview-menu Binary files differnew file mode 100644 index 0000000..a16374e --- /dev/null +++ b/imagebase/preview-menu diff --git a/imagebase/progress b/imagebase/progress Binary files differnew file mode 100644 index 0000000..ff65b87 --- /dev/null +++ b/imagebase/progress diff --git a/imagebase/progress2 b/imagebase/progress2 Binary files differnew file mode 100644 index 0000000..e289b88 --- /dev/null +++ b/imagebase/progress2 diff --git a/imagebase/radio b/imagebase/radio Binary files differnew file mode 100644 index 0000000..6847992 --- /dev/null +++ b/imagebase/radio diff --git a/imagebase/radio-milk b/imagebase/radio-milk Binary files differnew file mode 100644 index 0000000..4999d93 --- /dev/null +++ b/imagebase/radio-milk diff --git a/imagebase/radio_down b/imagebase/radio_down Binary files differnew file mode 100644 index 0000000..c4fd332 --- /dev/null +++ b/imagebase/radio_down diff --git a/imagebase/radio_down-milk b/imagebase/radio_down-milk Binary files differnew file mode 100644 index 0000000..8d634ea --- /dev/null +++ b/imagebase/radio_down-milk diff --git a/imagebase/rectbutton b/imagebase/rectbutton Binary files differnew file mode 100644 index 0000000..33aee9b --- /dev/null +++ b/imagebase/rectbutton diff --git a/imagebase/roundFrame b/imagebase/roundFrame Binary files differnew file mode 100644 index 0000000..0c03c00 --- /dev/null +++ b/imagebase/roundFrame diff --git a/imagebase/sbIslider_mid b/imagebase/sbIslider_mid Binary files differnew file mode 100644 index 0000000..5cf1ecf --- /dev/null +++ b/imagebase/sbIslider_mid diff --git a/imagebase/sb_subadd b/imagebase/sb_subadd Binary files differnew file mode 100644 index 0000000..306da73 --- /dev/null +++ b/imagebase/sb_subadd diff --git a/imagebase/sb_subadd-milk b/imagebase/sb_subadd-milk Binary files differnew file mode 100644 index 0000000..8f6a76f --- /dev/null +++ b/imagebase/sb_subadd-milk diff --git a/imagebase/sbgroove_btm b/imagebase/sbgroove_btm Binary files differnew file mode 100644 index 0000000..6c7c6ba --- /dev/null +++ b/imagebase/sbgroove_btm diff --git a/imagebase/sbgroove_btm-milk b/imagebase/sbgroove_btm-milk Binary files differnew file mode 100644 index 0000000..1629f4d --- /dev/null +++ b/imagebase/sbgroove_btm-milk diff --git a/imagebase/sbgroove_mid b/imagebase/sbgroove_mid Binary files differnew file mode 100644 index 0000000..e1dee0a --- /dev/null +++ b/imagebase/sbgroove_mid diff --git a/imagebase/sbgroove_mid-milk b/imagebase/sbgroove_mid-milk Binary files differnew file mode 100644 index 0000000..3004476 --- /dev/null +++ b/imagebase/sbgroove_mid-milk diff --git a/imagebase/sbgroove_top b/imagebase/sbgroove_top Binary files differnew file mode 100644 index 0000000..0424c8c --- /dev/null +++ b/imagebase/sbgroove_top diff --git a/imagebase/sbgroove_top-milk b/imagebase/sbgroove_top-milk Binary files differnew file mode 100644 index 0000000..2850aad --- /dev/null +++ b/imagebase/sbgroove_top-milk diff --git a/imagebase/sbslider_btm b/imagebase/sbslider_btm Binary files differnew file mode 100644 index 0000000..0e5e767 --- /dev/null +++ b/imagebase/sbslider_btm diff --git a/imagebase/sbslider_btm-milk b/imagebase/sbslider_btm-milk Binary files differnew file mode 100644 index 0000000..1073028 --- /dev/null +++ b/imagebase/sbslider_btm-milk diff --git a/imagebase/sbslider_btm_shd b/imagebase/sbslider_btm_shd Binary files differnew file mode 100644 index 0000000..066653a --- /dev/null +++ b/imagebase/sbslider_btm_shd diff --git a/imagebase/sbslider_mid b/imagebase/sbslider_mid Binary files differnew file mode 100644 index 0000000..5cd2f77 --- /dev/null +++ b/imagebase/sbslider_mid diff --git a/imagebase/sbslider_mid-milk b/imagebase/sbslider_mid-milk Binary files differnew file mode 100644 index 0000000..48f993a --- /dev/null +++ b/imagebase/sbslider_mid-milk diff --git a/imagebase/sbslider_top b/imagebase/sbslider_top Binary files differnew file mode 100644 index 0000000..1682308 --- /dev/null +++ b/imagebase/sbslider_top diff --git a/imagebase/sbslider_top-milk b/imagebase/sbslider_top-milk Binary files differnew file mode 100644 index 0000000..aa6ae7c --- /dev/null +++ b/imagebase/sbslider_top-milk diff --git a/imagebase/sbslider_top_shd b/imagebase/sbslider_top_shd Binary files differnew file mode 100644 index 0000000..ba62b8e --- /dev/null +++ b/imagebase/sbslider_top_shd diff --git a/imagebase/sliderarrow b/imagebase/sliderarrow Binary files differnew file mode 100644 index 0000000..8d49a65 --- /dev/null +++ b/imagebase/sliderarrow diff --git a/imagebase/sliderarrow-milk b/imagebase/sliderarrow-milk Binary files differnew file mode 100644 index 0000000..4c25763 --- /dev/null +++ b/imagebase/sliderarrow-milk diff --git a/imagebase/tab b/imagebase/tab Binary files differnew file mode 100644 index 0000000..817a16d --- /dev/null +++ b/imagebase/tab diff --git a/imagebase/tab-jaguar b/imagebase/tab-jaguar Binary files differnew file mode 100644 index 0000000..4510fdc --- /dev/null +++ b/imagebase/tab-jaguar diff --git a/imagebase/tab-milk b/imagebase/tab-milk Binary files differnew file mode 100644 index 0000000..3dc0d54 --- /dev/null +++ b/imagebase/tab-milk diff --git a/kickermenu-3.3/Makefile.am b/kickermenu-3.3/Makefile.am new file mode 100644 index 0000000..4d219df --- /dev/null +++ b/kickermenu-3.3/Makefile.am @@ -0,0 +1,20 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = b_menu_panelapplet.la + +b_menu_panelapplet_la_SOURCES = menuapplet.cpp menuapplet.skel + +noinst_HEADERS = menuapplet.h + +b_menu_panelapplet_la_METASOURCES = AUTO + +lnkdir = $(kde_datadir)/kicker/applets +lnk_DATA = b_menuapplet.desktop + +EXTRA_DIST = $(lnk_DATA) + +b_menu_panelapplet_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +b_menu_panelapplet_la_LIBADD = $(LIB_KDEUI) + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/kmenuapplet.pot diff --git a/kickermenu-3.3/b_menuapplet.desktop b/kickermenu-3.3/b_menuapplet.desktop new file mode 100644 index 0000000..6328532 --- /dev/null +++ b/kickermenu-3.3/b_menuapplet.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Baghira Menu +Comment=Applet embedding standalone menubars (Patched baghira version) + +Icon=menu + +X-KDE-Library=b_menu_panelapplet +X-KDE-UniqueApplet=true diff --git a/kickermenu-3.3/menuapplet.cpp b/kickermenu-3.3/menuapplet.cpp new file mode 100644 index 0000000..205ed63 --- /dev/null +++ b/kickermenu-3.3/menuapplet.cpp @@ -0,0 +1,623 @@ +/***************************************************************** + +Copyright (c) 2002 Siegfried Nijssen <snijssen@liacs.nl> +Copyright (c) 2003 Lubos Lunak <l.lunak@suse.cz> + +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 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. + +******************************************************************/ + +#define _MENUAPPLET_CPP_ + +#include <qvariant.h> // avoid X11 #define's + +#include "menuapplet.h" + +#include <assert.h> +#include <qcursor.h> +#include <kconfig.h> +#include <qtooltip.h> +#include <kglobal.h> +#include <klocale.h> +#include <qlayout.h> +#include <kdebug.h> +#include <netwm.h> +#include <kapplication.h> +#include <kwin.h> + +#include <X11/Xlib.h> + +/* + + KMenuBar from KDE3.1 and older won't work very well with this applet. + This is because QMenuBar tries really hard to keep its preffered size, + se even if the X window for the menubar has the size enforced by this + applet, Qt thinks it has the size Qt wants. This results in parts + of the menubar not being repainted. Also, old KMenuBar always forced + with to be the width of the screen, so even if the menubar has only + few entries, this applet will still indicate the menubar doesn't + fit completely in it. There's no way to fix this, besides upgrading + to KDE3.2. + +*/ + + +extern Time qt_x_time; + +extern "C" +{ + KPanelApplet* init( QWidget* parent_P, const QString& configFile_P ) + { + KGlobal::locale()->insertCatalogue("kmenuapplet"); + return new KickerMenuApplet::Applet( configFile_P, parent_P ); + } +} + +namespace KickerMenuApplet +{ + +static const int MOVE_DIFF = 100; // size increment for left/right menu moving +static const int GROW_WIDTH = 10; // width of grow buttons + +const long SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask + | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask + | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask; + +Applet::Applet( const QString& configFile_P, QWidget* parent_P ) + : KPanelApplet( configFile_P, Stretch, 0, parent_P, "menuapplet" ), + DCOPObject( "menuapplet" ), + module( NULL ), + active_menu( NULL ), + grow_indicator_left( this, LeftArrow ), + grow_indicator_right( this, RightArrow ), + selection( NULL ), + selection_watcher( NULL ), + desktop_menu( false ) + { + // for windowindicator + setBackgroundOrigin(AncestorOrigin); + QIntDict<QMenuBar>(97); //allowing 97 entries - should be enough, if not - who cares: just a label and hashtables are slightly faster than lists... + windowIndicator = new QMenuBar(this); + windowList = new KWindowListMenu(windowIndicator); + connect(windowList, SIGNAL(aboutToShow()), this, SLOT(initPopup())); + windowIndicator->insertItem( "KDE", windowList, 0); + windowIndicator->move(0,-1); + windowIndicator->show(); + windowIndicator->adjustSize(); + windowIndicator->setFixedSize(windowIndicator->size()); + //============== + dcopclient.registerAs( "menuapplet", false ); + grow_indicator_left.hide(); + grow_indicator_right.hide(); + connect( &grow_indicator_left, SIGNAL( clicked()), SLOT( growClicked())); + connect( &grow_indicator_right, SIGNAL( clicked()), SLOT( growClicked())); + // toolbarAppearanceChanged(int) is sent when changing macstyle + connect( kapp, SIGNAL( toolbarAppearanceChanged( int )), + this, SLOT( readSettings())); + claimSelection(); + readSettings(); + } + +Applet::~Applet() + { + lostSelection(); // release all menu's before really loosing the selection + /*if (windowIndicator) */delete windowIndicator; + delete selection; + delete selection_watcher; + delete module; + KGlobal::locale()->removeCatalogue("kmenuapplet"); + } + +void Applet::initPopup() + // helper to allow connecting windowlist activation to reinit - must be, as the list doesn't update itself + { + windowList->init(); + } + +void Applet::windowRemoved(WId w_P) + // another helping slot + { + windowTitleDict.setAutoDelete(TRUE); + windowTitleDict.remove(w_P); + } + +void Applet::windowAdded( WId w_P ) + { + QString* title; + NETWinInfo info( qt_xdisplay(), w_P, qt_xrootwin(), NET::WMWindowType); + XClassHint classHint; + if (!windowTitleDict[w_P] && w_P != qt_xrootwin() && XGetClassHint( qt_xdisplay(), w_P, &classHint ) ) + { + // much better way to get a nice name! + title = new QString( classHint.res_class ); + XFree( classHint.res_name ); + XFree( classHint.res_class ); + windowTitleDict.insert(w_P, title); + } + else + { //fallback + // for windowindicator + if (!windowTitleDict[w_P] && w_P != qt_xrootwin()){ + KWin::WindowInfo tmpInfo = KWin::windowInfo( w_P, NET::WMName ); + //generate title: + title = new QString(tmpInfo.name()); + if (title->contains("K3b")){ + // hack, weil herr trueg zwar ein erstklassiges brennprogramm schreiben, sich aber leider nicht an windowmanager konventionen halten kan... ;) + *title = "K3b"; + } + else if (title->contains("GIMP")){ + *title = "GIMP"; //seems as if the title is "The Gimp" in english versions?!? + } + else { + if (title->contains(" - ")) + *title = title->section(" - ", -1, -1); // get rid of application subinfo + if (title->contains(" ")) + *title = title->section(" ", 0, 0); // get rid of version numbers + } + // add title + windowTitleDict.insert(w_P, title); + } + } + // ========= + if( info.windowType() != NET::TopMenu ) + return; +// kdDebug() << "embedding:" << w_P << endl; + Window transient_for = KWin::transientFor( w_P ); + if( transient_for == None ) + return; + MenuEmbed* embed; + if( transient_for == qt_xrootwin()) + embed = new MenuEmbed( transient_for, true, this ); + else + { + KWin::WindowInfo info2 = KWin::windowInfo( transient_for, NET::WMWindowType ); + embed = new MenuEmbed( transient_for, + info2.windowType( SUPPORTED_WINDOW_TYPES ) == NET::Desktop, this ); + } + + embed->hide(); + embed->move( 0, 0 ); + embed->resize(size()); + embed->embed( w_P ); + //embed->setMinimumSize( size()); + embed->setMinimumSize( 0,0); + if( embed->embeddedWinId() == None ) + { + delete embed; + return; + } + embed->installEventFilter( this ); + menus.append( embed ); + // in case the app mapped its menu after its mainwindow, check which menu should be shown + activeWindowChanged( module->activeWindow()); + } + +// - if the active window has its topmenu -> show the menu +// - if desktop menu is enabled (i.e. explicitly in kdesktop) : +// - show it +// - otherwise show nothing +void Applet::activeWindowChanged( WId w_P ) + { +// kdDebug() << "active:" << w_P << endl; + QFont tmpFont; + for( WId window = w_P; + window != None; + window = tryTransientFor( window )) + { + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + { + if( window == (*it)->mainWindow()) + { + tmpFont = (*it)->font(); + tmpFont.setBold(true); + windowIndicator->setFont(tmpFont); + QString *newTitle = windowTitleDict[w_P]; + newTitle ? + windowIndicator->changeItem(0, *newTitle): + windowIndicator->changeItem(0, "KDE"); + windowIndicator->setMinimumSize(0, windowIndicator->height()); + windowIndicator->setMaximumSize(20000, windowIndicator->height()); + windowIndicator->adjustSize(); + windowIndicator->setFixedSize(windowIndicator->size()); + (*it)->setFixedSize(width() - windowIndicator->width()-1, height()); + activateMenu( *it ); + return; + } + } + } +// kdDebug() << "no active" << endl; + // No menu for active window found - if desktop menu + // (in kdesktoprc) is enabled, use kdesktop's menu instead of none. + bool try_desktop = desktop_menu; + if( !try_desktop && w_P != None ) + { // also use the desktop menu if the active window is desktop + KWin::WindowInfo info = KWin::windowInfo( w_P, NET::WMWindowType ); + if( info.windowType( SUPPORTED_WINDOW_TYPES ) == NET::Desktop ) + try_desktop = true; + } + if( try_desktop ) + { + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + { + if( (*it)->isDesktopMenu()) + { + tmpFont = (*it)->font(); + tmpFont.setBold(true); + windowIndicator->setFont(tmpFont); + QString *newTitle = windowTitleDict[w_P]; + newTitle ? + windowIndicator->changeItem(0, *newTitle): + windowIndicator->changeItem(0, "KDE"); + windowIndicator->setMinimumSize(0, windowIndicator->height()); + windowIndicator->setMaximumSize(20000, windowIndicator->height()); + windowIndicator->adjustSize(); + windowIndicator->setFixedSize(windowIndicator->size()); + (*it)->setFixedSize(width() - windowIndicator->width()-1, height()); + activateMenu( *it ); + return; + } + } + } + QString *newTitle = windowTitleDict[w_P]; + newTitle ? + windowIndicator->changeItem(0, *newTitle): + windowIndicator->changeItem(0, "KDE"); + windowIndicator->setMinimumSize(0, windowIndicator->height()); + windowIndicator->setMaximumSize(20000, windowIndicator->height()); + windowIndicator->adjustSize(); + windowIndicator->setFixedSize(windowIndicator->size()); + if (active_menu) active_menu->setFixedSize(width() - windowIndicator->width()-1, height()); + activateMenu( NULL ); + } + +void Applet::activateMenu( MenuEmbed* embed_P ) + { + if( embed_P != active_menu ) + { +// kdDebug() << "activate:" << embed_P << endl; + if( active_menu != NULL ){ + active_menu->hide(); + } + active_menu = embed_P; + if( active_menu != NULL ){ + active_menu->show(); + } + } + moveMenu( NULL ); + } + +bool Applet::eventFilter( QObject* obj_P, QEvent* ev_P ) + { + if( ev_P->type() == QEvent::Resize && obj_P == active_menu ) + moveMenu( NULL ); + return false; + } + +void Applet::growClicked() + { + moveMenu( static_cast< const QWidget* >( sender())); + } + +void Applet::updateGrowIndicators() + { +// kdDebug() << "ACT:" << active_menu << ":" << ( active_menu ? active_menu->x() : -1 ) << ":" << ( active_menu ? active_menu->x() + active_menu->width() : -1 ) << ":" << width() << endl; + if( active_menu != NULL && active_menu->x() < 0 ) + { + grow_indicator_left.raise(); + grow_indicator_left.setGeometry( 0, 0, GROW_WIDTH, height()); + grow_indicator_left.show(); + } + else + grow_indicator_left.hide(); + if( active_menu != NULL && active_menu->x() + active_menu->width() > width()) + { + grow_indicator_right.raise(); + grow_indicator_right.setGeometry( width() - GROW_WIDTH, 0, GROW_WIDTH, height()); + grow_indicator_right.show(); + } + else + grow_indicator_right.hide(); + } + +void Applet::moveMenu( const QWidget* indicator_P ) + { + if( active_menu == NULL ) + { + updateGrowIndicators(); + return; + } + if( indicator_P == NULL ) // no indicator -> reset pos + active_menu->move( 0 + windowIndicator->width() + 1, 0 ); + else if( indicator_P == &grow_indicator_right ) // -> move left + { // negative x + if( windowIndicator->width() + 1 + active_menu->width() + active_menu->x() > width()) + { + int newx = windowIndicator->width() + 1 + active_menu->x() - MOVE_DIFF; + if( active_menu->width() + newx < width()) + newx = windowIndicator->width() + 1 + width() - active_menu->width(); + active_menu->move( newx, 0 ); + } + } + else // indicator_P == &grow_indicator_left // -> move right + { + if( active_menu->x() < 0 ) + { + int newx = active_menu->x() + windowIndicator->width() + 1 + MOVE_DIFF; + newx = (( newx - MOVE_DIFF + 1 ) / MOVE_DIFF ) * MOVE_DIFF; + active_menu->move( newx, 0 ); + } + } + updateGrowIndicators(); + } + +// If there's no menu for the window, try finding menu for its mainwindow +// (where the window's WM_TRANSIENT_FOR property points). +// If the window is modal (_NET_WM_STATE_MODAL), stop. +WId Applet::tryTransientFor( WId w_P ) + { +/* KWin::WindowInfo info = KWin::windowInfo( w_P, NET::WMState ); + if( info.state() & NET::Modal ) + return None;*/ + WId ret = KWin::transientFor( w_P ); + if( ret == qt_xrootwin()) + ret = None; + return ret; + } + +void Applet::menuLost( MenuEmbed* embed ) + { + for( QValueList< MenuEmbed* >::Iterator it = menus.begin(); + it != menus.end(); + ++it ) + { + if( *it == embed ) + { + menus.remove( it ); + embed->deleteLater(); +// kdDebug() << "deleting:" << (*it)->mainWindow() << endl; + if( embed == active_menu ) + { + active_menu = NULL; + updateGrowIndicators(); + // trigger selecting new active menu + activeWindowChanged( module->activeWindow()); + } + return; + } + } + } + +void Applet::resizeEvent( QResizeEvent* ev ) + { + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + (*it)->setFixedSize( width() - windowIndicator->width()-1 ,height()); + KPanelApplet::resizeEvent( ev ); + moveMenu( NULL ); + } + +void Applet::paletteChange(const QPalette & /* oldPalette */) + { + if( active_menu != NULL ) + { + active_menu->hide(); + active_menu->show(); + } + } + +void Applet::claimSelection() + { + assert( selection == NULL ); + selection = new KSelectionOwner( makeSelectionAtom(), DefaultScreen( qt_xdisplay())); +// force taking the selection, but don't kill previous owner + if( selection->claim( true, false )) + { + delete selection_watcher; + selection_watcher = NULL; + connect( selection, SIGNAL( lostOwnership()), SLOT( lostSelection())); + module = new KWinModule; + connect( module, SIGNAL( windowAdded( WId )), this, SLOT( windowAdded( WId ))); + connect( module, SIGNAL( windowRemoved( WId )), this, SLOT( windowRemoved( WId ))); + connect( module, SIGNAL( activeWindowChanged( WId )), + this, SLOT( activeWindowChanged( WId ))); + QValueList< WId > windows = module->windows(); + for( QValueList< WId >::ConstIterator it = windows.begin(); + it != windows.end(); + ++it ) + windowAdded( *it ); + activeWindowChanged( module->activeWindow()); + } + else + lostSelection(); + } + +void Applet::lostSelection() + { + if( selection == NULL ) + return; +// kdDebug() << "lost selection" << endl; + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + delete (*it); // delete all MenuEmbed's = release all menus + menus.clear(); + active_menu = NULL; + if( selection_watcher == NULL ) + { + selection_watcher = new KSelectionWatcher( makeSelectionAtom(), DefaultScreen( qt_xdisplay())); + connect( selection_watcher, SIGNAL( lostOwner()), this, SLOT( claimSelection())); + } + delete module; + module = NULL; + selection->deleteLater(); + selection = NULL; + // selection_watcher stays + } + +void Applet::readSettings() + { + KConfig cfg( "kdesktoprc", true ); + cfg.setGroup( "Menubar" ); + desktop_menu = cfg.readBoolEntry( "ShowMenubar", false ); + cfg.setGroup( "KDE" ); + if( cfg.readBoolEntry( "macStyle", false ) || desktop_menu ) + QToolTip::remove( this ); + else + QToolTip::add( this, i18n( + "You do not appear to have enabled the standalone menubar; " + "enable it in the Behavior control module for desktop." )); + if( !isDisabled() && active_menu == NULL ) + activeWindowChanged( module->activeWindow()); //enforce desktop_menu + } + +void Applet::configure() + { + readSettings(); + } + +int Applet::widthForHeight( int ) const + { + return 200; // we're stretch applet + } + +int Applet::heightForWidth( int ) const + { + // *shrug* running this applet in vertical mode is a bad idea anyway + return 50; + } + +static Atom selection_atom = None; +static Atom msg_type_atom = None; + +static +void initAtoms() + { + char nm[ 100 ]; + sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( qt_xdisplay())); + char nm2[] = "_KDE_TOPMENU_MINSIZE"; + char* names[ 2 ] = { nm, nm2 }; + Atom atoms[ 2 ]; + XInternAtoms( qt_xdisplay(), names, 2, False, atoms ); + selection_atom = atoms[ 0 ]; + msg_type_atom = atoms[ 1 ]; + } + +Atom Applet::makeSelectionAtom() + { + if( selection_atom == None ) + initAtoms(); + return selection_atom; + } + +MenuEmbed::MenuEmbed( WId mainwindow_P, bool desktop_P, + QWidget* parent_P, const char* name_P ) + : QXEmbed( parent_P, name_P ), + main_window( mainwindow_P ), + desktop( desktop_P ) + { + setAutoDelete( false ); + setBackgroundOrigin(AncestorOrigin); + } + +void MenuEmbed::windowChanged( WId w_P ) + { + if( w_P == None ) + static_cast< Applet* >( parent())->menuLost( this ); + } + +bool MenuEmbed::x11Event( XEvent* ev_P ) + { + if( ev_P->type == ConfigureRequest + && ev_P->xconfigurerequest.window == embeddedWinId() + && ev_P->xconfigurerequest.value_mask & ( CWWidth | CWHeight )) + { + XConfigureRequestEvent& ev = ev_P->xconfigurerequest; + QSize new_size = size(); + if( ev.value_mask & CWWidth ) + new_size.setWidth( ev.width ); + if( ev.value_mask & CWHeight ) + new_size.setHeight( ev.height ); + // resize when the embedded window resizes (still obey min size) +// kdDebug() << "RES:" << embeddedWinId() << ":" << ev.width << ":" << ev.height << endl; + if( ev.width != width() || ev.height != height()) + resize( ev.width, ev.height ); + sendSyntheticConfigureNotifyEvent(); +// int x, y; +// unsigned int w, h, d, b; +// Window root; +// XGetGeometry( qt_xdisplay(), embeddedWinId(), &root, &x, &y, &w, &h, &b, &d ); +// kdDebug() << "RES3:" << width() << ":" << height() << ":" << w << ":" << h << endl; + return true; + } + return QXEmbed::x11Event( ev_P ); + } + +void MenuEmbed::sendSyntheticConfigureNotifyEvent() +{ + QPoint globalPos = mapToGlobal(QPoint(0,0)); + if (embeddedWinId()) { + XConfigureEvent c; + memset(&c, 0, sizeof(c)); + c.type = ConfigureNotify; + c.display = qt_xdisplay(); + c.send_event = True; + c.event = embeddedWinId(); + c.window = winId(); + c.x = globalPos.x(); + c.y = globalPos.y(); + c.width = width(); + c.height = height(); + c.border_width = 0; + c.above = None; + c.override_redirect = 0; + XSendEvent( qt_xdisplay(), c.event, TRUE, StructureNotifyMask, (XEvent*)&c ); + } +} + +void MenuEmbed::setMinimumSize( int w, int h ) +{ + QXEmbed::setMinimumSize( w, h ); + // tell the menubar also the allowed minimum size + // the applet won't allow resizing to smaller size + if( embeddedWinId() != None ) + { +// kdDebug() << "RES2:" << width() << ":" << height() << ":" << minimumWidth() << ":" << minimumHeight() << endl; + XEvent ev; + ev.xclient.display = qt_xdisplay(); + ev.xclient.type = ClientMessage; + ev.xclient.window = embeddedWinId(); + assert( msg_type_atom != None ); + ev.xclient.message_type = msg_type_atom; + ev.xclient.format = 32; + ev.xclient.data.l[0] = qt_x_time; + ev.xclient.data.l[1] = minimumWidth(); + ev.xclient.data.l[2] = minimumHeight(); + ev.xclient.data.l[3] = 0; + ev.xclient.data.l[4] = 0; + XSendEvent( qt_xdisplay(), embeddedWinId(), False, NoEventMask, &ev ); + } +} + +} // namespace + +#include "menuapplet.moc" diff --git a/kickermenu-3.3/menuapplet.h b/kickermenu-3.3/menuapplet.h new file mode 100644 index 0000000..7825bd2 --- /dev/null +++ b/kickermenu-3.3/menuapplet.h @@ -0,0 +1,135 @@ +/***************************************************************** + +Copyright (c) 2002 Siegfried Nijssen <snijssen@liacs.nl> +Copyright (c) 2003 Lubos Lunak <l.lunak@suse.cz> + +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 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef _MENUAPPLET_H_ +#define _MENUAPPLET_H_ + +#include <kpanelapplet.h> +#include <qintdict.h> +#include <qvaluelist.h> +#include <qmenubar.h> +#include <kwindowlistmenu.h> +#include <kwinmodule.h> +#include <kmanagerselection.h> +#include <dcopclient.h> +#include <dcopobject.h> +#include <qxembed.h> +#include <karrowbutton.h> +#include <assert.h> + +namespace KickerMenuApplet +{ + +class MenuEmbed; + +class Applet : public KPanelApplet, public DCOPObject + { + Q_OBJECT + K_DCOP + k_dcop: + ASYNC configure(); + public: + Applet( const QString& configFile, QWidget *parent ); + virtual ~Applet(); + virtual int widthForHeight( int height ) const; + virtual int heightForWidth( int width ) const; + virtual bool eventFilter( QObject* obj, QEvent* ev ); + void menuLost( MenuEmbed* embed ); + protected: + virtual void resizeEvent( QResizeEvent* ); + virtual void paletteChange(const QPalette& ); + private slots: + void windowAdded( WId w ); + void activeWindowChanged( WId w ); + void lostSelection(); + void readSettings(); + void claimSelection(); + void growClicked(); + // to show current active window (not necessary equal to the menubar) + void initPopup(); + void windowRemoved(WId w); + private: + bool isDisabled() const; // does it own the manager selection? + void updateGrowIndicators(); + void moveMenu( const QWidget* indicator ); + WId tryTransientFor( WId w ); + void activateMenu( MenuEmbed* embed ); + static Atom makeSelectionAtom(); + KWinModule* module; + QValueList< MenuEmbed* > menus; + MenuEmbed* active_menu; + KArrowButton grow_indicator_left, grow_indicator_right; + KSelectionOwner* selection; + KSelectionWatcher* selection_watcher; + bool desktop_menu; + DCOPClient dcopclient; + // to show current active window (not necessary equal to the menubar) + QMenuBar *windowIndicator; + QIntDict<QString>windowTitleDict; + KWindowListMenu* windowList; + }; + +class MenuEmbed + : public QXEmbed + { + Q_OBJECT + public: + MenuEmbed( WId mainwindow, bool desktop, + QWidget* parent = NULL, const char* name = NULL ); + WId mainWindow() const; + bool isDesktopMenu() const; + virtual void setMinimumSize( int w, int h ); + void setMinimumSize( const QSize& s ) { setMinimumSize( s.width(), s.height()); } + protected: + virtual void windowChanged( WId w ); + virtual bool x11Event( XEvent* ev ); + private: + void sendSyntheticConfigureNotifyEvent(); + WId main_window; + bool desktop; + }; + +inline +bool Applet::isDisabled() const + { + assert( ( selection == NULL && selection_watcher != NULL ) + || ( selection != NULL && selection_watcher == NULL )); + return selection == NULL; + } + +inline +WId MenuEmbed::mainWindow() const + { + return main_window; + } + +inline +bool MenuEmbed::isDesktopMenu() const + { + return desktop; + } + +} // namespace + +#endif diff --git a/kickermenu/Makefile.am b/kickermenu/Makefile.am new file mode 100644 index 0000000..5ab6cd5 --- /dev/null +++ b/kickermenu/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = b_menu_panelapplet.la + +b_menu_panelapplet_la_SOURCES = menuapplet.cpp menuapplet.skel + +noinst_HEADERS = menuapplet.h + +b_menu_panelapplet_la_METASOURCES = AUTO + +b_menu_panelapplet_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) +b_menu_panelapplet_la_LIBADD = $(LIB_KDEUI) + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/kmenuapplet.pot diff --git a/kickermenu/configure.in.in b/kickermenu/configure.in.in new file mode 100644 index 0000000..72f8843 --- /dev/null +++ b/kickermenu/configure.in.in @@ -0,0 +1,2 @@ +AM_CONDITIONAL( HAVE_3_4, test $(kde-config --version | grep "KDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 ) + diff --git a/kickermenu/menuapplet.cpp b/kickermenu/menuapplet.cpp new file mode 100644 index 0000000..97e35de --- /dev/null +++ b/kickermenu/menuapplet.cpp @@ -0,0 +1,704 @@ +/***************************************************************** + +Copyright (c) 2002 Siegfried Nijssen <snijssen@liacs.nl> +Copyright (c) 2003 Lubos Lunak <l.lunak@suse.cz> + +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 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. + +******************************************************************/ + +#define _MENUAPPLET_CPP_ + +#include <qdir.h> +#include <qdesktopwidget.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qtooltip.h> +#include <qtimer.h> +#include <qvariant.h> // avoid X11 #define's +#include <kapplication.h> +#include <kconfig.h> +#include <kdebug.h> +#include <kglobal.h> +#include <kglobalsettings.h> +#include <klocale.h> +#include <kwin.h> +#include <kwinmodule.h> + +#include <netwm.h> + +#include <X11/Xlib.h> + +#include "menuapplet.h" + +/* + + KMenuBar from KDE3.1 and older won't work very well with this applet. + This is because QMenuBar tries really hard to keep its preffered size, + se even if the X window for the menubar has the size enforced by this + applet, Qt thinks it has the size Qt wants. This results in parts + of the menubar not being repainted. Also, old KMenuBar always forced + with to be the width of the screen, so even if the menubar has only + few entries, this applet will still indicate the menubar doesn't + fit completely in it. There's no way to fix this, besides upgrading + to KDE3.2. + +*/ + + +extern Time qt_x_time; + +extern "C" +{ + KDE_EXPORT KPanelApplet* init( QWidget* parent_P, const QString& configFile_P ) + { + KGlobal::locale()->insertCatalogue("kmenuapplet"); + return new KickerMenuApplet::Applet( configFile_P, parent_P ); + } +} + + + +namespace KickerMenuApplet +{ + +static int _maxWidth; +static const int MOVE_DIFF = 100; // size increment for left/right menu moving +static const int GROW_WIDTH = 10; // width of grow buttons + +const long SUPPORTED_WINDOW_TYPES = NET::NormalMask | NET::DesktopMask | NET::DockMask + | NET::ToolbarMask | NET::MenuMask | NET::DialogMask | NET::OverrideMask + | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask; + +Applet::Applet( const QString& configFile_P, QWidget* parent_P ) : KPanelApplet( configFile_P, Normal, 0, parent_P, "menuapplet" ), DCOPObject( "menuapplet" ), module( NULL ), active_menu( NULL ), selection( NULL ), selection_watcher( NULL ), desktop_menu( false ), topEdgeOffset( 0 ) +{ + KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + config.setGroup("Menubar"); + _maxWidth = config.readNumEntry("Width", QDesktopWidget().availableGeometry().width()); + _menuMover = new QLabel("<<|>>", this ); + _menuMover->adjustSize(); + _menuMover->setFixedSize(_menuMover->size()); + _menuMover->move(_maxWidth - _menuMover->width(),0); + _menuMover->hide(); + _menuMover->installEventFilter(this); + windowIndicator = new QMenuBar(this); + windowIndicator->installEventFilter(this); + windowIndicator->setBackgroundOrigin(QWidget::WidgetOrigin); + windowIndicator->setLineWidth(0); + windowList = new KWindowListMenu(windowIndicator); + connect(windowList, SIGNAL(aboutToShow()), this, SLOT(initPopup())); + windowIndicator->insertItem( "KDE", windowList, 0); + QFont tmpFont = KGlobalSettings::menuFont(); + windowIndicator->setFont(tmpFont); +// windowIndicator->adjustSize(); +// int tmpHeight = windowIndicator->height(); + tmpFont.setBold(true); + windowIndicator->setFont(tmpFont); + windowIndicator->adjustSize(); +// windowIndicator->setMargin((tmpHeight-windowIndicator->height())); + windowIndicator->move(0,0); + windowIndicator->show(); + windowIndicator->setFixedWidth(windowIndicator->width() + 1); + //============== + // toolbarAppearanceChanged(int) is sent when changing macstyle + connect( kapp, SIGNAL( toolbarAppearanceChanged( int )), this, SLOT( readSettings())); + connect( kapp, SIGNAL( kdisplayFontChanged()), this, SLOT( fontChanged())); + claimSelection(); + readSettings(); + updateTopEdgeOffset(); +} + +Applet::~Applet() +{ + lostSelection(); // release all menu's before really loosing the selection + delete selection; + delete selection_watcher; + delete module; + KGlobal::locale()->removeCatalogue("kmenuapplet"); +} + +void Applet::fontChanged() +{ + if (!windowIndicator) + return; + QFont tmpFont = KGlobalSettings::menuFont(); +// windowIndicator->setFont(tmpFont); +// windowIndicator->adjustSize(); +// int tmpHeight = windowIndicator->height(); + tmpFont.setBold(true); + windowIndicator->setFont(tmpFont); + windowIndicator->adjustSize(); +// windowIndicator->setMargin((tmpHeight-windowIndicator->height())/2); +} + +void Applet::showWindowList() +{ + /* + if (windowIndicator->isItemActive(0)) + windowList->close(); + else + */ + windowIndicator->activateItemAt(0); +} + +void Applet::initPopup() +// helper to allow connecting windowlist activation to reinit - must be, as the list doesn't update itself +{ + windowList->init(); +} + +void Applet::moveMenu() +{ + if (!wannaMove) + return; + active_menu->move( active_menu->x() + menuDX, active_menu->y()); + QTimer::singleShot(100, this, SLOT(moveMenu())); +} + +bool Applet::eventFilter(QObject *o, QEvent *ev) + { + if (o == _menuMover) + { + if (ev->type() == QEvent::MouseButtonPress && active_menu) + { + if (((QMouseEvent*)ev)->x() < _menuMover->width()/2) + { + menuDX = -5; + wannaMove = true; + active_menu->move( active_menu->x() - 5, active_menu->y()); + QTimer::singleShot(200, this, SLOT(moveMenu())); + } + else + { + menuDX = 5; + wannaMove = true; + active_menu->move( active_menu->x() + 5, active_menu->y()); + QTimer::singleShot(200, this, SLOT(moveMenu())); + } + return false; + } + if (ev->type() == QEvent::MouseButtonRelease) + { + wannaMove = false; + return false; + } + return false; + } +#if 0 + // to fake menu consistency - doesn't work to good so far + if (o == windowIndicator && ev->type() == QEvent::MouseMove && + (((QMouseEvent*)ev)->x() == windowIndicator->width()-1) && + windowIndicator->isItemActive( 0 )) + // moving out to the right + { +// windowIndicator->activateItemAt ( -1 ); + windowList->close(); + return FALSE; + } + else +// #endif + if (ev->type() == QEvent::PaletteChange) + { // this is necessary as the background origin is set from somwhere outside - it's no kmenubar - so we set it back + QWidget *w = (QWidget*)o; +// #if 0 + if (w == windowIndicator) +// #endif + { + if (w->backgroundOrigin() != QWidget::WidgetOrigin) + { + w->blockSignals(TRUE); // to avoid loops + w->setBackgroundOrigin(QWidget::WidgetOrigin); + w->blockSignals(FALSE); + } + } +// #if 0 + else if (w->backgroundOrigin() != QWidget::ParentOrigin) + { + w->blockSignals(TRUE); + w->setBackgroundOrigin(QWidget::ParentOrigin); + w->blockSignals(FALSE); + } + return FALSE; + } +#endif + return FALSE; + } + +void Applet::windowAdded( WId w_P ) +{ + NETWinInfo info( qt_xdisplay(), w_P, qt_xrootwin(), NET::WMWindowType ); + Window transient_for = KWin::transientFor( w_P ); + + if( info.windowType( SUPPORTED_WINDOW_TYPES ) != NET::TopMenu ) + return; +// kdDebug() << "embedding:" << w_P << endl; + if( transient_for == None ) + return; + + MenuEmbed* embed; + if( transient_for == qt_xrootwin()) + { + embed = new MenuEmbed( transient_for, true, this ); + } + else + { + KWin::WindowInfo info2 = KWin::windowInfo( transient_for, NET::WMWindowType | NET::WMName ); + embed = new MenuEmbed( transient_for, info2.windowType( SUPPORTED_WINDOW_TYPES ) == NET::Desktop, this ); + // ========= NAMING =================== + QString title(info2.name()); + XClassHint classHint; + if (XGetClassHint( qt_xdisplay(), w_P, &classHint ) ) + { // much better way to get a nice name! + QString name( classHint.res_class ); + if (name.contains("SDL_App")) + goto titlejump; // mainly for scummvm apps - jumps to netwm caption parsing + XFree( classHint.res_name ); + XFree( classHint.res_class ); + int i = title.findRev( name, -1, FALSE ); + if (i > -1) + { + int j = title.find(' ',i); + title = title.mid(i, (j>-1)?j-i:title.length()-i); // use intersection between X and netwm and expand to netwm name, using nice formated netwm name ;) + } + else +// *title = name; // use straight x class hint - better in most cases + goto titlejump; // jumps to netwm caption parsing + if (title == "Kdesktop" || title == "kicker") title ="KDE"; //just for promotion ;) - it's the same menu anyway + } + else // netwm caption parsing, used as fallback - probably never reached + { + // exception - hopefully never necessary + if (title.contains("K3b")) //hack, working around strange k3b naming policy - shouldn't be reached ever in best case (catched upwards) + title = "K3b"; + else if (title.contains("GIMP")) //seems as if the title is "The Gimp" in english versions?!? + title = "GIMP"; + // exceptions done here + else + { + titlejump: // real parsing + if (title.contains(" - ")) + { + title = title.section(" - ", -1, -1); // get rid of application subinfo + if (title.contains(" ")) + title = title.section(" ", -1, -1); // get rid of prefixes + } + else if (title.contains(" ")) + title = title.section(" ", 0, 0); // get rid of version number etc. + } + } + embed->title = title; + } + // ========= NAMING DONE ============== +#if 0 + embed->installEventFilter(this); +#endif + embed->hide(); + embed->move( 0, -topEdgeOffset ); + embed->resize( embed->width(), height() + topEdgeOffset ); + embed->embed( w_P ); + if( embed->embeddedWinId() == None ) + { + delete embed; + return; + } + menus.append( embed ); + activeWindowChanged( module->activeWindow()); + windowIndicator->raise(); +// in case the app mapped its menu after its mainwindow, check which menu should be shown +} + +// - if the active window has its topmenu -> show the menu +// - if desktop menu is enabled (i.e. explicitly in kdesktop) : +// - show it +// - otherwise show nothing +void Applet::activeWindowChanged( WId w_P ) +{ +// kdDebug() << "active:" << w_P << endl; + for( WId window = w_P; + window != None; + window = tryTransientFor( window )) + { + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + { + if( window == (*it)->mainWindow()) + { + windowIndicator->changeItem(0, (*it)->title); + windowIndicator->setMinimumWidth(0);//, windowIndicator->height()); + windowIndicator->setMaximumWidth(20000);//, windowIndicator->height()); + windowIndicator->adjustSize(); +// windowIndicator->resize(windowIndicator->width() + 1, height()); + windowIndicator->setFixedWidth(windowIndicator->width() + 1);//, oldheight + topEdgeOffset); + activateMenu( *it ); + if (active_menu->width() + windowIndicator->width() > _maxWidth) + { +// _menuMover->move(width() - _menuMover->width(),0); + _menuMover->raise(); + _menuMover->show(); + } + else + _menuMover->hide(); + return; + } + } + } +// kdDebug() << "no active" << endl; + // No menu for active window found - if desktop menu + // (in kdesktoprc) is enabled, use kdesktop's menu instead of none. +#if 0 + bool try_desktop = desktop_menu; + if( !try_desktop && w_P != None ) + { // also use the desktop menu if the active window is desktop + KWin::WindowInfo info = KWin::windowInfo( w_P, NET::WMWindowType ); + if( info.windowType( SUPPORTED_WINDOW_TYPES ) == NET::Desktop ) + try_desktop = true; + } + if( try_desktop ) +#endif + { + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + { + if( (*it)->isDesktopMenu()) + { + windowIndicator->changeItem(0, "KDE"); + windowIndicator->setMinimumWidth(0);//, windowIndicator->height()); + windowIndicator->setMaximumWidth(20000);//, windowIndicator->height()); + windowIndicator->adjustSize(); +// windowIndicator->resize(windowIndicator->width() + 1, height()); + windowIndicator->setFixedWidth(windowIndicator->width() + 1);//, oldheight + topEdgeOffset); + activateMenu( *it ); + if (active_menu->width() + windowIndicator->width() > _maxWidth) + { +// _menuMover->move(width() - _menuMover->width(),0); + _menuMover->raise(); + _menuMover->show(); + } + else + _menuMover->hide(); + return; + } + } + } + windowIndicator->changeItem(0, "KDE"); + windowIndicator->setMinimumWidth(0);//, windowIndicator->height()); + windowIndicator->setMaximumWidth(20000);//, windowIndicator->height()); + windowIndicator->adjustSize(); +// windowIndicator->resize(windowIndicator->width() + 1, height()); + windowIndicator->setFixedWidth(windowIndicator->width() + 1);//, oldheight + topEdgeOffset); + activateMenu( NULL ); +} + +void Applet::activateMenu( MenuEmbed* embed_P ) +{ + if( embed_P != active_menu ) + { +// kdDebug() << "activate:" << embed_P << endl; + if( active_menu != NULL ) + active_menu->hide(); + active_menu = embed_P; + } + if( active_menu != NULL) + { + active_menu->setMinimumSize( width() - windowIndicator->width(), height() + topEdgeOffset ); + active_menu->move(windowIndicator->width(),-topEdgeOffset); + active_menu->show(); + if (!active_menu->isDesktopMenu()) + emit updateLayout(); + } +} + +void Applet::updateMenuGeometry( MenuEmbed* embed ) +{ + if( embed == active_menu ) + emit updateLayout(); +} + +// If there's no menu for the window, try finding menu for its mainwindow +// (where the window's WM_TRANSIENT_FOR property points). +// If the window is modal (_NET_WM_STATE_MODAL), stop. +WId Applet::tryTransientFor( WId w_P ) + { + /*KWin::WindowInfo info = KWin::windowInfo( w_P, NET::WMState ); + if( info.state() & NET::Modal ) + return None;*/ + WId ret = KWin::transientFor( w_P ); + if( ret == qt_xrootwin()) + ret = None; + return ret; + } + +void Applet::menuLost( MenuEmbed* embed ) +{ + for( QValueList< MenuEmbed* >::Iterator it = menus.begin(); it != menus.end(); ++it ) + { + if( *it == embed ) + { + menus.remove( it ); + embed->deleteLater(); + // kdDebug() << "deleting:" << (*it)->mainWindow() << endl; + if( embed == active_menu ) + { + active_menu = NULL; + // trigger selecting new active menu + activeWindowChanged( module->activeWindow()); + } + return; + } + } +} + +void Applet::positionChange( Position ) +{ + updateTopEdgeOffset(); +} + +// Detect mouse movement at the top screen edge also if the menubar +// has a popup open - in such case, Qt has a grab, and this avoids +// Kicker's FittsLawFrame. Therefore move the menubar a bit higher, +// so that it actually is positioned exactly at the screen edge +// (i.e. at a negative y coordinate within this applet, due to +// Kicker's frame). +void Applet::updateTopEdgeOffset() +{ + QPoint p = topLevelWidget()->mapToGlobal( QPoint( 0, 0 )); + if( p.y() <= 2 ) // 2 = work also when running in appletproxy + topEdgeOffset = mapToGlobal( QPoint( 0, 0 )).y() - p.y(); + else + topEdgeOffset = 0; + if( active_menu != NULL ) + active_menu->move( active_menu->x(), -topEdgeOffset ); +// if (windowIndicator) +// { +// windowIndicator->resize(windowIndicator->width(), height() + topEdgeOffset ); +// windowIndicator->move(windowIndicator->x(), -topEdgeOffset ); +// } +} + +void Applet::paletteChange(const QPalette & /* oldPalette */) +{ + if( active_menu != NULL ) + { + active_menu->hide(); + active_menu->show(); + } +} + +void Applet::claimSelection() +{ + assert( selection == NULL ); + selection = new KSelectionOwner( makeSelectionAtom(), DefaultScreen( qt_xdisplay())); +// force taking the selection, but don't kill previous owner + if( selection->claim( true, false )) + { + delete selection_watcher; + selection_watcher = NULL; + connect( selection, SIGNAL( lostOwnership()), SLOT( lostSelection())); + module = new KWinModule; + connect( module, SIGNAL( windowAdded( WId )), this, SLOT( windowAdded( WId ))); + connect( module, SIGNAL( activeWindowChanged( WId )), this, SLOT( activeWindowChanged( WId ))); + QValueList< WId > windows = module->windows(); + for( QValueList< WId >::ConstIterator it = windows.begin(); it != windows.end(); ++it ) + windowAdded( *it ); + activeWindowChanged( module->activeWindow()); + } + else + lostSelection(); +} + +void Applet::lostSelection() + { + if( selection == NULL ) + return; +// kdDebug() << "lost selection" << endl; + for( QValueList< MenuEmbed* >::ConstIterator it = menus.begin(); + it != menus.end(); + ++it ) + delete (*it); // delete all MenuEmbed's = release all menus + menus.clear(); + active_menu = NULL; + if( selection_watcher == NULL ) + { + selection_watcher = new KSelectionWatcher( makeSelectionAtom(), DefaultScreen( qt_xdisplay())); + connect( selection_watcher, SIGNAL( lostOwner()), this, SLOT( claimSelection())); + } + delete module; + module = NULL; + selection->deleteLater(); + selection = NULL; + // selection_watcher stays + } + +void Applet::readSettings() + { + KConfig cfg( "kdesktoprc", true ); + cfg.setGroup( "Menubar" ); + desktop_menu = cfg.readBoolEntry( "ShowMenubar", false ); + cfg.setGroup( "KDE" ); + if( cfg.readBoolEntry( "macStyle", false ) || desktop_menu ) + QToolTip::remove( this ); + else + QToolTip::add( this, i18n( + "You do not appear to have enabled the standalone menubar; " + "enable it in the Behavior control module for desktop." )); + if( !isDisabled() && active_menu == NULL ) + activeWindowChanged( module->activeWindow()); //enforce desktop_menu + } + +void Applet::configure() + { + readSettings(); + } + +int Applet::widthForHeight( int ) const + { + if (active_menu) + { + int w = active_menu->width() + windowIndicator->width(); + if (w > _maxWidth) w = _maxWidth; + return w; + } + return 0; // we're stretch applet + } + +int Applet::heightForWidth( int ) const + { + // *shrug* running this applet in vertical mode is a bad idea anyway + return 50; + } + +static Atom selection_atom = None; +static Atom msg_type_atom = None; + +static +void initAtoms() + { + char nm[ 100 ]; + sprintf( nm, "_KDE_TOPMENU_OWNER_S%d", DefaultScreen( qt_xdisplay())); + char nm2[] = "_KDE_TOPMENU_MINSIZE"; + char* names[ 2 ] = { nm, nm2 }; + Atom atoms[ 2 ]; + XInternAtoms( qt_xdisplay(), names, 2, False, atoms ); + selection_atom = atoms[ 0 ]; + msg_type_atom = atoms[ 1 ]; + } + +Atom Applet::makeSelectionAtom() + { + if( selection_atom == None ) + initAtoms(); + return selection_atom; + } + +MenuEmbed::MenuEmbed( WId mainwindow_P, bool desktop_P, + QWidget* parent_P, const char* name_P ) + : QXEmbed( parent_P, name_P ), + main_window( mainwindow_P ), + desktop( desktop_P ) + { + setAutoDelete( false ); + } + +void MenuEmbed::windowChanged( WId w_P ) + { + if( w_P == None ) + static_cast< Applet* >( parent())->menuLost( this ); + } + +bool MenuEmbed::x11Event( XEvent* ev_P ) +{ + if( ev_P->type == ConfigureRequest && + ev_P->xconfigurerequest.window == embeddedWinId() + && ev_P->xconfigurerequest.value_mask & ( CWWidth | CWHeight )) + { + XConfigureRequestEvent& ev = ev_P->xconfigurerequest; + QSize new_size = size(); + if( ev.value_mask & CWWidth ) + new_size.setWidth( ev.width ); + if( ev.value_mask & CWHeight ) + new_size.setHeight( ev.height ); + // resize when the embedded window resizes (still obey min size) +// kdDebug() << "RES:" << embeddedWinId() << ":" << ev.width << ":" << ev.height << endl; + if( ev.width != width() || ev.height != height()) + { + resize( ev.width > _maxWidth ? _maxWidth : ev.width, ev.height ); + static_cast< Applet* >( parent())->updateMenuGeometry( this ); +// windowIndicator->resize(windowIndicator->width(), ev.height); + } + sendSyntheticConfigureNotifyEvent(); +// int x, y; +// unsigned int w, h, d, b; +// Window root; +// XGetGeometry( qt_xdisplay(), embeddedWinId(), &root, &x, &y, &w, &h, &b, &d ); +// kdDebug() << "RES3:" << width() << ":" << height() << ":" << w << ":" << h << endl; + return true; + } + return QXEmbed::x11Event( ev_P ); +} + +void MenuEmbed::sendSyntheticConfigureNotifyEvent() +{ + QPoint globalPos = mapToGlobal(QPoint(0,0)); + if (embeddedWinId()) { + XConfigureEvent c; + memset(&c, 0, sizeof(c)); + c.type = ConfigureNotify; + c.display = qt_xdisplay(); + c.send_event = True; + c.event = embeddedWinId(); + c.window = winId(); + c.x = globalPos.x(); + c.y = globalPos.y(); + c.width = width(); + c.height = height(); + c.border_width = 0; + c.above = None; + c.override_redirect = 0; + XSendEvent( qt_xdisplay(), c.event, TRUE, StructureNotifyMask, (XEvent*)&c ); + } +} + +void MenuEmbed::setMinimumSize( int w, int h ) +{ + QXEmbed::setMinimumSize( w, h ); + // tell the menubar also the allowed minimum size + // the applet won't allow resizing to smaller size + if( embeddedWinId() != None ) + { +// kdDebug() << "RES2:" << width() << ":" << height() << ":" << minimumWidth() << ":" << minimumHeight() << endl; + XEvent ev; + ev.xclient.display = qt_xdisplay(); + ev.xclient.type = ClientMessage; + ev.xclient.window = embeddedWinId(); + assert( msg_type_atom != None ); + ev.xclient.message_type = msg_type_atom; + ev.xclient.format = 32; + ev.xclient.data.l[0] = qt_x_time; + ev.xclient.data.l[1] = minimumWidth(); + ev.xclient.data.l[2] = minimumHeight(); + ev.xclient.data.l[3] = 0; + ev.xclient.data.l[4] = 0; + XSendEvent( qt_xdisplay(), embeddedWinId(), False, NoEventMask, &ev ); + } +} + +} // namespace + +#include "menuapplet.moc" diff --git a/kickermenu/menuapplet.h b/kickermenu/menuapplet.h new file mode 100644 index 0000000..f353869 --- /dev/null +++ b/kickermenu/menuapplet.h @@ -0,0 +1,138 @@ +/***************************************************************** + +Copyright (c) 2002 Siegfried Nijssen <snijssen@liacs.nl> +Copyright (c) 2003 Lubos Lunak <l.lunak@suse.cz> + +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 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef _MENUAPPLET_H_ +#define _MENUAPPLET_H_ + +#include <kpanelapplet.h> +#include <qintdict.h> +#include <qvaluelist.h> +#include <kmenubar.h> +#include <kwindowlistmenu.h> +#include <kwinmodule.h> +#include <kmanagerselection.h> +#include <dcopclient.h> +#include <dcopobject.h> +#include <qxembed.h> +#include <karrowbutton.h> +#include <assert.h> + +class QHBoxLayout; +class QLabel; + +namespace KickerMenuApplet +{ + +class MenuEmbed; + +class Applet : public KPanelApplet, public DCOPObject +{ + Q_OBJECT + K_DCOP +k_dcop: + ASYNC configure(); + virtual void showWindowList(); +public: + friend class MenuEmbed; + Applet( const QString& configFile, QWidget *parent ); + virtual ~Applet(); + virtual int widthForHeight( int height ) const; + virtual int heightForWidth( int width ) const; + void menuLost( MenuEmbed* embed ); + void updateMenuGeometry( MenuEmbed* embed ); +protected: + virtual void paletteChange(const QPalette& ); + virtual void positionChange( Position p ); + bool eventFilter(QObject *, QEvent *ev); + QMenuBar *windowIndicator; +private slots: + void moveMenu(); + void windowAdded( WId w ); + void activeWindowChanged( WId w ); + void lostSelection(); + void readSettings(); + void claimSelection(); + // to show current active window (not necessary equal to the menubar) + void initPopup(); + void fontChanged(); +private: + bool isDisabled() const; // does it own the manager selection? + WId tryTransientFor( WId w ); + void activateMenu( MenuEmbed* embed ); + static Atom makeSelectionAtom(); + void updateTopEdgeOffset(); + KWinModule* module; + QValueList< MenuEmbed* > menus; + MenuEmbed* active_menu; + KSelectionOwner* selection; + KSelectionWatcher* selection_watcher; + bool desktop_menu; + DCOPClient dcopclient; + int topEdgeOffset; + KWindowListMenu* windowList; + QHBoxLayout *layout; + QLabel *_menuMover; + bool wannaMove; + int menuDX; +}; + +class MenuEmbed : public QXEmbed +{ + Q_OBJECT +public: + MenuEmbed( WId mainwindow, bool desktop, QWidget* parent = NULL, const char* name = NULL ); + WId mainWindow() const; + bool isDesktopMenu() const; + virtual void setMinimumSize( int w, int h ); + void setMinimumSize( const QSize& s ) { setMinimumSize( s.width(), s.height()); } + QString title; +protected: + virtual void windowChanged( WId w ); + virtual bool x11Event( XEvent* ev ); +private: + void sendSyntheticConfigureNotifyEvent(); + WId main_window; + bool desktop; +}; + +inline bool Applet::isDisabled() const +{ + assert( ( selection == NULL && selection_watcher != NULL ) + || ( selection != NULL && selection_watcher == NULL )); + return selection == NULL; +} + +inline WId MenuEmbed::mainWindow() const +{ + return main_window; +} + +inline bool MenuEmbed::isDesktopMenu() const +{ + return desktop; +} + +} // namespace + +#endif diff --git a/sessionapplet/Makefile.am b/sessionapplet/Makefile.am new file mode 100644 index 0000000..4472c36 --- /dev/null +++ b/sessionapplet/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO + +lib_LTLIBRARIES = usermanager_panelapplet.la + +usermanager_panelapplet_la_SOURCES = usermanager.cpp dmctl.cpp +usermanager_panelapplet_la_LDFLAGS = -module -avoid-version $(all_libraries) +usermanager_panelapplet_la_LIBADD = $(LIB_KDEUI) + +usermanager_DATA = usermanager.desktop +usermanagerdir = $(kde_datadir)/kicker/applets + +messages: rc.cpp + $(EXTRACTRC) `find . -name \*.ui -o -name \*.rc` > rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/usermanager.pot diff --git a/sessionapplet/dmctl.cpp b/sessionapplet/dmctl.cpp new file mode 100644 index 0000000..a6d5bf9 --- /dev/null +++ b/sessionapplet/dmctl.cpp @@ -0,0 +1,322 @@ +/* + Copyright (C) 2004 Oswald Buddenhagen <ossi@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the Lesser 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 Lesser GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "dmctl.h" + +#ifdef Q_WS_X11 + +#include <klocale.h> +#include <dcopclient.h> + +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <unistd.h> +#include <stdlib.h> +#include <fcntl.h> +#include <errno.h> + +static enum { Dunno, NoDM, NewKDM, OldKDM/*, GDM*/ } DMType = Dunno; +static const char *ctl, *dpy; + +DM::DM() : fd( -1 ) +{ + char *ptr; + struct sockaddr_un sa; + + if (DMType == Dunno) { + if (!(dpy = ::getenv( "DISPLAY" ))) + DMType = NoDM; + else if ((ctl = ::getenv( "DM_CONTROL" ))) + DMType = NewKDM; + else if ((ctl = ::getenv( "XDM_MANAGED" )) && ctl[0] == '/') + DMType = OldKDM; + else + DMType = NoDM; + } + switch (DMType) { + default: + return; + case NewKDM: + if ((fd = ::socket( PF_UNIX, SOCK_STREAM, 0 )) < 0) + return; + sa.sun_family = AF_UNIX; + if ((ptr = strchr( dpy, ':' ))) + ptr = strchr( ptr, '.' ); + snprintf( sa.sun_path, sizeof(sa.sun_path), + "%s/dmctl-%.*s/socket", ctl, ptr ? ptr - dpy : 512, dpy ); + if (::connect( fd, (struct sockaddr *)&sa, sizeof(sa) )) { + ::close( fd ); + fd = -1; + } + break; + case OldKDM: + { + QString tf( ctl ); + tf.truncate( tf.find( ',' ) ); + fd = ::open( tf.latin1(), O_WRONLY ); + } + break; + } +} + +DM::~DM() +{ + if (fd >= 0) + close( fd ); +} + +bool +DM::exec( const char *cmd ) +{ + QCString buf; + + return exec( cmd, buf ); +} + +/** + * Execute a KDM remote control command. + * @param cmd the command to execute. FIXME: undocumented yet. + * @param ret the result buffer. + * @return result: + * @li If true, the command was successfully executed. + * @p ret might contain addional results. + * @li If false and @p ret is empty, a communication error occurred + * (most probably KDM is not running). + * @li If false and @p ret is non-empty, it contains the error message + * from KDM. + */ +bool +DM::exec( const char *cmd, QCString &buf ) +{ + bool ret = false; + int tl; + unsigned len = 0; + + if (fd < 0) + goto busted; + + if (::write( fd, cmd, (tl = strlen( cmd )) ) != tl) { + bust: + ::close( fd ); + fd = -1; + busted: + buf.resize( 0 ); + return false; + } + if (DMType == OldKDM) { + buf.resize( 0 ); + return true; + } + for (;;) { + if (buf.size() < 128) + buf.resize( 128 ); + else if (buf.size() < len * 2) + buf.resize( len * 2 ); + if ((tl = ::read( fd, buf.data() + len, buf.size() - len)) <= 0) { + if (tl < 0 && errno == EINTR) + continue; + goto bust; + } + len += tl; + if (buf[len - 1] == '\n') { + buf[len - 1] = 0; + if (len > 2 && buf[0] == 'o' && buf[1] == 'k' && buf[2] < 32) + ret = true; + break; + } + } + return ret; +} + +bool +DM::canShutdown() +{ + if (DMType == OldKDM) + return strstr( ctl, ",maysd" ) != 0; + + QCString re; + + return exec( "caps\n", re ) && re.find( "\tshutdown" ) >= 0; +} + +void +DM::shutdown( KApplication::ShutdownType shutdownType, + KApplication::ShutdownMode shutdownMode, + const QString &bootOption ) +{ + if (!bootOption.isEmpty() && DMType != NewKDM) + return; + + if (shutdownType != KApplication::ShutdownTypeNone) { + QCString cmd( "shutdown\t" ); + cmd.append( shutdownType == KApplication::ShutdownTypeReboot ? + "reboot\t" : "halt\t" ); + if (!bootOption.isNull()) + cmd.append( "=" ).append( bootOption.local8Bit() ).append( "\t" ); + cmd.append( shutdownMode == KApplication::ShutdownModeInteractive ? + "ask\n" : + shutdownMode == KApplication::ShutdownModeForceNow ? + "forcenow\n" : + shutdownMode == KApplication::ShutdownModeTryNow ? + "trynow\n" : "schedule\n" ); + exec( cmd.data() ); + } +} + +bool +DM::bootOptions( QStringList &opts, int &defopt, int ¤t ) +{ + if (DMType != NewKDM) + return false; + + QCString re; + if (!exec( "listbootoptions\n", re )) + return false; + + opts = QStringList::split( '\t', QString::fromLocal8Bit( re.data() ) ); + if (opts.size() < 4) + return false; + + bool ok; + defopt = opts[2].toInt( &ok ); + if (!ok) + return false; + current = opts[3].toInt( &ok ); + if (!ok) + return false; + + opts = QStringList::split( ' ', opts[1] ); + for (QStringList::Iterator it = opts.begin(); it != opts.end(); ++it) + (*it).replace( "\\s", " " ); + + return true; +} + +void +DM::setLock( bool on ) +{ + exec( on ? "lock\n" : "unlock\n" ); +} + +bool +DM::isSwitchable() +{ + if (DMType == OldKDM) + return dpy[0] == ':'; + + QCString re; + + return exec( "caps\n", re ) && re.find( "\tlocal" ) >= 0; +} + +int +DM::numReserve() +{ + if (DMType == OldKDM) + return strstr( ctl, ",rsvd" ) ? 1 : -1; + + QCString re; + int p; + + if (!(exec( "caps\n", re ) && (p = re.find( "\treserve " )) >= 0)) + return -1; + return atoi( re.data() + p + 9 ); +} + +void +DM::startReserve() +{ + exec("reserve\n"); +} + +bool +DM::localSessions( SessList &list ) +{ + if (DMType == OldKDM) + return false; + + QCString re; + + if (!exec( "list\talllocal\n", re )) + return false; + QStringList sess = QStringList::split( QChar('\t'), re.data() + 3 ); + for (QStringList::ConstIterator it = sess.begin(); it != sess.end(); ++it) { + QStringList ts = QStringList::split( QChar(','), *it, true ); + SessEnt se; + se.display = ts[0]; + if (ts[1][0] == '@') + se.from = ts[1].mid( 1 ), se.vt = 0; + else + se.vt = ts[1].mid( 2 ).toInt(); + se.user = ts[2]; + se.session = ts[3]; + se.self = (ts[4].find( '*' ) >= 0); + se.tty = (ts[4].find( 't' ) >= 0); + list.append( se ); + } + return true; +} + +void +DM::sess2Str2( const SessEnt &se, QString &user, QString &loc ) +{ + if (se.tty) { + user = i18n("user: ...", "%1: TTY login").arg( se.user ); + loc = se.vt ? QString("vt%1").arg( se.vt ) : se.display ; + } else { + user = + se.user.isEmpty() ? + se.session.isEmpty() ? + i18n("Unused") : + se.session == "<remote>" ? + i18n("X login on remote host") : + i18n("... host", "X login on %1").arg( se.session ) : + i18n("user: session type", "%1: %2") + .arg( se.user ).arg( se.session ); + loc = + se.vt ? + QString("%1, vt%2").arg( se.display ).arg( se.vt ) : + se.display; + } +} + +QString +DM::sess2Str( const SessEnt &se ) +{ + QString user, loc; + + sess2Str2( se, user, loc ); + return i18n("session (location)", "%1 (%2)").arg( user ).arg( loc ); +} + +bool +DM::switchVT( int vt ) +{ + return exec( QString("activate\tvt%1\n").arg(vt).latin1() ); +} + +void +DM::lockSwitchVT( int vt ) +{ + if (switchVT( vt )) + kapp->dcopClient()->send( "kdesktop", "KScreensaverIface", "lock()", "" ); +} + +#endif // Q_WS_X11 diff --git a/sessionapplet/dmctl.h b/sessionapplet/dmctl.h new file mode 100644 index 0000000..bc58fcb --- /dev/null +++ b/sessionapplet/dmctl.h @@ -0,0 +1,91 @@ +/* + Copyright (C) 2004,2005 Oswald Buddenhagen <ossi@kde.org> + Copyright (C) 2005 Stephan Kulow <coolo@kde.org> + + This program is free software; you can redistribute it and/or + modify it under the terms of the Lesser 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 Lesser GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef DMCTL_H +#define DMCTL_H + +#include <kapplication.h> + +struct SessEnt { + QString display, from, user, session; + int vt; + bool self:1, tty:1; +}; + +typedef QValueList<SessEnt> SessList; + +class DM { + +#ifdef Q_WS_X11 + +public: + DM(); + ~DM(); + + bool canShutdown(); + void shutdown( KApplication::ShutdownType shutdownType, + KApplication::ShutdownMode shutdownMode, + const QString &bootOption = QString::null ); + + void setLock( bool on ); + + bool isSwitchable(); + int numReserve(); + void startReserve(); + bool localSessions( SessList &list ); + bool switchVT( int vt ); + void lockSwitchVT( int vt ); + + bool bootOptions( QStringList &opts, int &dflt, int &curr ); + + static QString sess2Str( const SessEnt &se ); + static void sess2Str2( const SessEnt &se, QString &user, QString &loc ); + +private: + int fd; + + bool exec( const char *cmd, QCString &ret ); + bool exec( const char *cmd ); + +#else // Q_WS_X11 + +public: + DM() {} + + bool canShutdown() { return false; } + void shutdown( KApplication::ShutdownType shutdownType, + KApplication::ShutdownMode shutdownMode, + const QString &bootOption = QString::null ) {} + + void setLock( bool ) {} + + bool isSwitchable() { return false; } + int numReserve() { return -1; } + void startReserve() {} + bool localSessions( SessList &list ) { return false; } + void switchVT( int vt ) {} + + bool bootOptions( QStringList &opts, int &dflt, int &curr ); + +#endif // Q_WS_X11 + +}; // class DM + +#endif // DMCTL_H diff --git a/sessionapplet/usermanager.cpp b/sessionapplet/usermanager.cpp new file mode 100644 index 0000000..faf491f --- /dev/null +++ b/sessionapplet/usermanager.cpp @@ -0,0 +1,281 @@ +/*************************************************************************** + * Copyright (C) 2005 by Thomas Lübking * + * thomas.luebking@web.de * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include <stdlib.h> +#include <kmenubar.h> +// #include <qlabel.h> +#include <qlayout.h> +#include <qpopupmenu.h> +#include <dcopclient.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kconfig.h> +#include <ksimpleconfig.h> +#include <kapplication.h> +#include <kdeversion.h> +#include <kmessagebox.h> +#include <kservice.h> +#include <kstandarddirs.h> +#include "dmctl.h" +#include "usermanager.h" + +#define _ICONSET_(i) KGlobal::iconLoader()->loadIconSet(i, KIcon::Small, 0, false) + + +UserManager::UserManager(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) + : KPanelApplet(configFile, type, actions, parent, name) +{ + + // Get the current application configuration handle + ksConfig = config(); + lockIcon = _ICONSET_("lock"); + fileSaveIcon = _ICONSET_("filesave"); + exitIcon = _ICONSET_("exit"); + setFixedWidth(600); + + menu = new KMenuBar(this); + menu->setTopLevelMenu(false); + menu->setFrameShape ( QFrame::NoFrame ); + menu->setMargin ( 0 ); + menu->setLineWidth ( 0 ); + + // sessions + sessionPopup = new QPopupMenu(this); + menu->insertItem ( getenv("USER"), sessionPopup, 0); + connect( sessionPopup, SIGNAL(aboutToShow()), SLOT(slotPopulateSessions()) ); + connect( sessionPopup, SIGNAL(activated(int)), SLOT(slotSessionActivated(int)) ); + + // languages + langPopup = new QPopupMenu(this); + + KConfigBase *config = KGlobal::config(); + config->setGroup("Locale"); + langList = config->readListEntry ("Language", ':'); +// QString flag( locate( "locale", QString::fromLatin1( "l10n/%1/flag.png" ).arg(langList[0]) ) ); +// langLabel = new QLabel(this); +// langLabel->setPixmap(_ICONSET_(flag).pixmap()); + + menu->insertItem ( '[' + langList[0].section('_',0,0) + ']', langPopup, 1 ); + menu->connectItem ( 1, this, SLOT(slotPopulateLanguages()) ); + connect( langPopup, SIGNAL(aboutToShow()), SLOT(slotPopulateLanguages()) ); + connect( langPopup, SIGNAL(activated(int)), SLOT(slotLanguageActivated(int)) ); + + menu->adjustSize(); + + setFixedWidth(menu->width()+5); + + mainView = menu; + menu->move(menu->mapToParent(QPoint(0,0)).x(),0); + menu->show(); +} + +UserManager::~UserManager() +{ +} + +int UserManager::widthForHeight(int) const +{ + return menu->width(); +} + +int UserManager::heightForWidth(int) const +{ + return menu->height(); +} + +void UserManager::about() +{ + KMessageBox::information(0, i18n("This is an about box")); +} + +void UserManager::lock() +{ + QCString appname( "kdesktop" ); +// if ( kicker_screen_number ) +// appname.sprintf("kdesktop-screen-%d", kicker_screen_number); + kapp->dcopClient()->send(appname, "KScreensaverIface", "lock()", ""); +} + +void UserManager::logout() +{ + kapp->requestShutDown(); +} + + +void UserManager::slotPopulateLanguages() +{ + langPopup->clear(); + KConfig *config = new KConfig("kdeglobals"); + config->setGroup("Locale"); + langList = config->readListEntry ("Language", ':'); + int i = 0; + for ( QStringList::ConstIterator it = langList.begin(); + it != langList.end(); ++it ) + { + KConfig entry(locate( "locale", QString::fromLatin1( "%1/entry.desktop" ).arg(*it) )); + entry.setGroup("KCM Locale"); + QString name = entry.readEntry("Name", i18n("without name")); + + QString flag( locate( "locale", QString::fromLatin1( "%1/flag.png" ).arg(*it) ) ); + langPopup->insertItem( _ICONSET_(flag), name, i ); + i++; + } +// langPopup->popup(langLabel->mapToGlobal(QPoint(0,height()))); +} + +void UserManager::slotLanguageActivated( int i ) +{ + if (i == 0) + return; // no change, no action + menu->changeItem ( 1, '[' + langList[i].section('_',0,0) + ']'/**langPopup->pixmap(i)*/ ); +// langLabel->setPixmap(*langPopup->pixmap(i)); + KConfig *config = new KConfig("kdeglobals"); + config->setGroup("Locale"); + QString tmp = langList[i]; + langList.remove(langList.at(i)); + langList.prepend(tmp); + config->writeEntry ("Language", langList, ':'); + config->sync(); +// KService::rebuildKSycoca(this); + delete config; +} + +void UserManager::slotPopulateSessions() +{ + int p = 0; + DM dm; + + sessionPopup->clear(); + // lock + if (kapp->authorize("lock_screen")) + { + sessionPopup->insertItem(lockIcon, i18n("Lock Session"), 102); + } + sessionPopup->insertSeparator(); + // switch + if (kapp->authorize("start_new_session") && (p = dm.numReserve()) >= 0) + { + if (kapp->authorize("lock_screen")) + sessionPopup->insertItem(/*_ICONSET_("lockfork"),*/ i18n("Lock&&Load Session..."), 100 ); + sessionPopup->insertItem(_ICONSET_("fork"), i18n("New Session..."), 101 ); + if (!p) { + sessionPopup->setItemEnabled( 100, false ); + sessionPopup->setItemEnabled( 101, false ); + } + sessionPopup->insertSeparator(); + } + SessList sess; + if (dm.localSessions( sess )) + for (SessList::ConstIterator it = sess.begin(); it != sess.end(); ++it) { + int id = sessionPopup->insertItem( DM::sess2Str( *it ), (*it).vt ); + if (!(*it).vt) + sessionPopup->setItemEnabled( id, false ); + if ((*it).self) + sessionPopup->setItemChecked( id, true ); + } + // save + sessionPopup->insertSeparator(); + KConfig ksmserver("ksmserverrc", false, false); + ksmserver.setGroup("General"); + if (ksmserver.readEntry( "loginMode" ) == "restoreSavedSession") + { + sessionPopup->insertItem(fileSaveIcon, i18n("Save Session"), 103); + } + // logout + if (kapp->authorize("logout")) + { + sessionPopup->insertItem(exitIcon, i18n("Log Out..."), 104); + } +} + +void UserManager::slotSessionActivated( int ent ) +{ + switch (ent) + { + case 100: + doNewSession( true ); + break; + case 101: + doNewSession( false ); + break; + case 102: + lock(); + break; + case 103: + saveSession(); + break; + case 104: + logout(); + break; + default: + if (!sessionPopup->isItemChecked( ent )) + DM().lockSwitchVT( ent ); + } +} + +void UserManager::doNewSession( bool lock_ ) +{ + int result = KMessageBox::warningContinueCancel( + kapp->desktop()->screen(kapp->desktop()->screenNumber(this)), + i18n("<p>You have chosen to open another desktop session.<br>" + "The current session will be hidden " + "and a new login screen will be displayed.<br>" + "An F-key is assigned to each session; " + "F%1 is usually assigned to the first session, " + "F%2 to the second session and so on. " + "You can switch between sessions by pressing " + "Ctrl, Alt and the appropriate F-key at the same time. " + "Additionally, the KDE Panel and Desktop menus have " + "actions for switching between sessions.</p>") + .arg(7).arg(8), + i18n("Warning - New Session"), + KGuiItem(i18n("&Start New Session"), "fork"), + ":confirmNewSession", +#if KDE_IS_VERSION(3,4,0) //3.4 + KMessageBox::PlainCaption | +#endif + KMessageBox::Notify); + + if (result==KMessageBox::Cancel) + return; + + if (lock_) + lock(); + + DM().startReserve(); +} + +void UserManager::saveSession() +{ + QByteArray data; + kapp->dcopClient()->send( "ksmserver", "default", + "saveCurrentSession()", data ); +} + + +extern "C" +{ + KPanelApplet* init( QWidget *parent, const QString& configFile) + { + KGlobal::locale()->insertCatalogue("usermanager"); + return new UserManager(configFile, KPanelApplet::Normal, KPanelApplet::About, parent, "usermanager"); + } +} diff --git a/sessionapplet/usermanager.desktop b/sessionapplet/usermanager.desktop new file mode 100644 index 0000000..31c61cf --- /dev/null +++ b/sessionapplet/usermanager.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Encoding=UTF-8 +Comment=Session Control, Lock, Logout, Change +Name=SessionManager +Name[xx]=xxSessionManagerxx +Icon=fork +X-KDE-Library=usermanager_panelapplet +X-KDE-UniqueApplet = true diff --git a/sessionapplet/usermanager.h b/sessionapplet/usermanager.h new file mode 100644 index 0000000..87f8864 --- /dev/null +++ b/sessionapplet/usermanager.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * Copyright (C) 2005 by Thomas Lübking * + * thomas.luebking@web.de * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + + +#ifndef USERMANAGER_H +#define USERMANAGER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kpanelapplet.h> +#include <qstring.h> +#include <qiconset.h> +#include <qstringlist.h> +#include <kconfig.h> + +class KMenuBar; +class QPopunMenu; +// class QLabel; + +class UserManager : public KPanelApplet +{ + Q_OBJECT + +public: + UserManager(const QString& configFile, Type t = Normal, int actions = 0, + QWidget *parent = 0, const char *name = 0); + /** destructor */ + ~UserManager(); + + virtual void about(); + int heightForWidth(int) const; + int widthForHeight(int) const; + +protected slots: + void slotPopulateSessions(); + void slotSessionActivated( int ); + void slotPopulateLanguages(); + void slotLanguageActivated( int ); + +protected: + void lock(); + void logout(); + void saveSession(); + void doNewSession(bool lock_); + +private: + KConfig *ksConfig; + QWidget *mainView; + KMenuBar *menu; + QPopupMenu *sessionPopup; + QPopupMenu *langPopup; + QStringList langList; + QIconSet exitIcon; + QIconSet lockIcon; + QIconSet fileSaveIcon; +// QLabel *langLabel; +}; + +#endif diff --git a/sessionapplet/usermanager.lsm b/sessionapplet/usermanager.lsm new file mode 100644 index 0000000..cb6f2cd --- /dev/null +++ b/sessionapplet/usermanager.lsm @@ -0,0 +1,16 @@ +Begin3 +Title: UserManager -- Some description +Version: 0.1 +Entered-date: +Description: +Keywords: KDE Qt +Author: Thomas Lübking <thomas.luebking@web.de> +Maintained-by: Thomas Lübking <thomas.luebking@web.de> +Home-page: +Alternate-site: +Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils + xxxxxx usermanager-0.1.tar.gz + xxx usermanager-0.1.lsm +Platform: Linux. Needs KDE +Copying-policy: GPL +End diff --git a/sidebar/Makefile.am b/sidebar/Makefile.am new file mode 100644 index 0000000..779e77d --- /dev/null +++ b/sidebar/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO + +kde_module_LTLIBRARIES=konqsidebar_baghirasidebar.la +include_HEADERS = baghirasidebar.h linkview.h listboxlink.h dndlistbox.h baghirasidebariface.h +noinst_HEADERS = baghiralinkdrag.h baghirasidebar.h linkview.h listboxlink.h dndlistbox.h baghirasidebariface.h + +konqsidebar_baghirasidebar_la_SOURCES = baghiralinkdrag.cpp baghirasidebar.cpp linkview.cpp listboxlink.cpp dndlistbox.cpp linkconfig.ui baghirasidebariface.skel +konqsidebar_baghirasidebar_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) -lkonqsidebarplugin +konqsidebar_baghirasidebar_la_LIBADD = $(LIB_KPARTS) $(LIB_KFILE) + +baghirasidebar_entry_DATA = baghirasidebar.desktop +baghirasidebar_entrydir = $(kde_datadir)/konqsidebartng/entries +baghirasidebar_add_DATA = baghirasidebar_add.desktop +baghirasidebar_adddir = $(kde_datadir)/konqsidebartng/add +poof_DATA = ../imagebase/poof.png +poofdir = $(kde_datadir)/baghira diff --git a/sidebar/baghiralinkdrag.cpp b/sidebar/baghiralinkdrag.cpp new file mode 120000 index 0000000..4997e26 --- /dev/null +++ b/sidebar/baghiralinkdrag.cpp @@ -0,0 +1 @@ +../starter/baghiralinkdrag.cpp
\ No newline at end of file diff --git a/sidebar/baghiralinkdrag.h b/sidebar/baghiralinkdrag.h new file mode 120000 index 0000000..20f50f7 --- /dev/null +++ b/sidebar/baghiralinkdrag.h @@ -0,0 +1 @@ +../starter/baghiralinkdrag.h
\ No newline at end of file diff --git a/sidebar/baghirasidebar.cpp b/sidebar/baghirasidebar.cpp new file mode 100644 index 0000000..0969bad --- /dev/null +++ b/sidebar/baghirasidebar.cpp @@ -0,0 +1,68 @@ + +#include <kinstance.h> +#include <qsplitter.h> +#include <kiconloader.h> +#include <stdlib.h> +#include "dndlistbox.h" +#include "listboxlink.h" +#include "linkview.h" +#include "baghirasidebar.h" +#include "baghirasidebar.moc" + +baghiraSidebar::baghiraSidebar(KInstance *inst,QObject *parent,QWidget *widgetParent, QString &desktopName, const char* name): + KonqSidebarPlugin(inst,parent,widgetParent,desktopName,name) +{ + scrollView = new LinkView(widgetParent); + scrollView->setHScrollBarMode(QScrollView::AlwaysOff); + connect (scrollView->Hardware(), SIGNAL(clicked(QListBoxItem *)), this, SLOT(callURL(QListBoxItem *))); + connect (scrollView->Locations(), SIGNAL(clicked(QListBoxItem *)), this, SLOT(callURL(QListBoxItem *))); +} + +baghiraSidebar::~baghiraSidebar() +{ +} + +void baghiraSidebar::callURL(QListBoxItem *item) +{ + emit openURLRequest(KURL(((ListBoxLink*)(item))->URL()), KParts::URLArgs(true,0,0)); +} + +void baghiraSidebar::handleURL(const KURL &url) +{ + int item = scrollView->Hardware()->currentItem(); + if ( scrollView->Hardware()->isSelected(item) && + KURL(((ListBoxLink*)(scrollView->Hardware()->item(item)))->URL()).url() != url.url() ) + { + scrollView->Hardware()->setSelected(item, FALSE); + return; + } + item = scrollView->Locations()->KListBox::currentItem(); + if (scrollView->Locations()->isSelected(item) && + KURL(((ListBoxLink*)(scrollView->Locations()->item(item)))->URL()).url() != url.url() ) + { + scrollView->Locations()->setSelected(item, FALSE); + return; + } +} + +extern "C" { + KDE_EXPORT bool add_konqsidebar_baghirasidebar(QString* fn, QString* param, QMap<QString,QString> *map) { + Q_UNUSED(param); + + map->insert("Type", "Link"); + map->insert("Icon", "bab_brushed"); + map->insert("Name", "Baghira Sidebar"); + map->insert("Open", "true"); + map->insert("X-KDE-KonqSidebarModule","konqsidebar_baghirasidebar"); + fn->setLatin1("baghirasidebar%1.desktop"); + return true; + } +} + +extern "C" +{ + void* create_konqsidebar_baghirasidebar(KInstance *instance,QObject *par,QWidget *widp,QString &desktopname,const char *name) + { + return new baghiraSidebar(instance,par,widp,desktopname,name); + } +}; diff --git a/sidebar/baghirasidebar.desktop b/sidebar/baghirasidebar.desktop new file mode 100644 index 0000000..ba6b560 --- /dev/null +++ b/sidebar/baghirasidebar.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Link +URL= +Icon=bab_brushed +Comment=Baghira Sidebar +Name=baghirasidebar +Name[xx]=xxbaghirasidebarxx + +Open=false +X-KDE-KonqSidebarModule=konqsidebar_baghirasidebar + diff --git a/sidebar/baghirasidebar.h b/sidebar/baghirasidebar.h new file mode 100644 index 0000000..dae8fc5 --- /dev/null +++ b/sidebar/baghirasidebar.h @@ -0,0 +1,50 @@ + +#ifndef BAGHIRASIDEBAR_H +#define BAGHIRASIDEBAR_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <konqsidebarplugin.h> +#include <kconfig.h> + +class LinkView; +class KListBox; +class QListBoxItem; + +class baghiraSidebar : public KonqSidebarPlugin +{ + Q_OBJECT + +public: + /** + * Construct a @ref KonqSidebarPlugin. + * + * @param inst The sidebar's kinstance class. + * @param parent The sidebar internal button info class responsible for this plugin. + * @param widgetParent The container which will contain the plugins widget. + * @param desktopName The filename of the configuration file. + * @param name A Qt object name for your plugin. + **/ + baghiraSidebar(KInstance *inst,QObject *parent, QWidget *widgetParent, QString &desktopName, const char* name=0); + + /** destructor */ + ~baghiraSidebar(); + + virtual QWidget *getWidget(){return scrollView;} + virtual void *provides(const QString &) {return 0;} + +protected: + LinkView *scrollView; + virtual void handleURL(const KURL &url); + +private slots: + void callURL(QListBoxItem *); + +signals: + void openURLRequest(const KURL &url, const KParts::URLArgs &args); + +}; + +#endif diff --git a/sidebar/baghirasidebar_add.desktop b/sidebar/baghirasidebar_add.desktop new file mode 100644 index 0000000..634b658 --- /dev/null +++ b/sidebar/baghirasidebar_add.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Comment=Baghira Sidebar +Encoding=UTF-8 +Icon=filetypes +Name=Add Baghira Sidebar +Name[de]=Baghira Sideabr hinzufügen +Open=false +Type=Link +URL= +X-KDE-KonqSidebarAddModule=konqsidebar_baghirasidebar diff --git a/sidebar/baghirasidebariface.h b/sidebar/baghirasidebariface.h new file mode 100644 index 0000000..c5e160d --- /dev/null +++ b/sidebar/baghirasidebariface.h @@ -0,0 +1,35 @@ +/*************************************************************************** + * Copyright (C) 2005 by Thomas Lübking * + * thomas.luebking@web.de * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _BAGHIRASIDEBARIFACE_H_ +#define _BAGHIRASIDEBARIFACE_H_ + +#include <dcopobject.h> + +class BaghiraSidebarIface : virtual public DCOPObject +{ + K_DCOP + k_dcop: + virtual void mediumAdded(const QString &name) = 0; + virtual void mediumRemoved(const QString &name) = 0; + virtual void mediumChanged(const QString &name) = 0; +}; + +#endif diff --git a/sidebar/configure.in.in b/sidebar/configure.in.in new file mode 100644 index 0000000..72f8843 --- /dev/null +++ b/sidebar/configure.in.in @@ -0,0 +1,2 @@ +AM_CONDITIONAL( HAVE_3_4, test $(kde-config --version | grep "KDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 ) + diff --git a/sidebar/dndlistbox.cpp b/sidebar/dndlistbox.cpp new file mode 100644 index 0000000..8fe78cf --- /dev/null +++ b/sidebar/dndlistbox.cpp @@ -0,0 +1,685 @@ + +#include <dcopclient.h> +#include <qdragobject.h> +#include <kurl.h> +#include <qstrlist.h> +#include <qtimer.h> +#include <kapplication.h> +#include <klocale.h> +#include <kfileitem.h> +#include <kpopupmenu.h> +#include <kicondialog.h> +#include <kiconloader.h> +#include <klineedit.h> +#include <kprocess.h> +#include <kurlrequester.h> +#include <kstandarddirs.h> +#include <kwin.h> +#include <qclipboard.h> +#include "listboxlink.h" +#include "linkconfig.h" +#include "dndlistbox.h" +#include "baghiralinkdrag.h" +#include "dndlistbox.moc" + +#define ID 0 +#define NAME 1 +#define LABEL 2 +#define USER_LABEL 3 +#define MOUNTABLE 4 +#define DEVICE_NODE 5 +#define MOUNT_POINT 6 +#define FS_TYPE 7 +#define MOUNTED 8 +#define BASE_URL 9 +#define MIME_TYPE 10 +#define ICON_NAME 11 +#define MEDIA_PROPS 12 +#define MEDIALIST_PROPS 13 + +ResizingLinkBox::ResizingLinkBox( QWidget * parent, const char * name, WFlags f ) : KListBox( parent, name, f) +{ + KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + config.setGroup("Sidebar"); + size_ = config.readNumEntry (QString(name) + "_IconSize", 48); + popupMenu = new KPopupMenu; + popupMenu->insertTitle (i18n("Icon Size"),122,122); + popupMenu->insertItem("16x16", this, SLOT(setIconSize(int)),0,16,123); + popupMenu->insertItem("22x22", this, SLOT(setIconSize(int)),0,22,124); + popupMenu->insertItem("32x32", this, SLOT(setIconSize(int)),0,32,125); + popupMenu->insertItem("48x48", this, SLOT(setIconSize(int)),0,48,126); + popupMenu->insertItem("64x64", this, SLOT(setIconSize(int)),0,64,127); + popupMenu->insertItem("128x128", this, SLOT(setIconSize(int)),0,128,128); +} + +void ResizingLinkBox::insertItem( const QListBoxItem *lbi, int index ) +{ + KListBox::insertItem( lbi, index ); + if (height() <= numRows()*itemHeight()) + emit itemNumberChanged(TRUE); +} + +void ResizingLinkBox::insertItem( const QListBoxItem *lbi, const QListBoxItem *after ) +{ + KListBox::insertItem( lbi, after ); + if (height() <= numRows()*itemHeight()) + emit itemNumberChanged(TRUE); +} + + +void ResizingLinkBox::insertItem( const QString & icon, const QString & title, const QString & url ) +{ + insertItem( new ListBoxLink(icon, size_, title, url ) ); +} + +void ResizingLinkBox::removeItem( int index ) +{ + blockSignals ( true ); + KListBox::removeItem(index); + blockSignals ( false ); + emit itemNumberChanged(FALSE); +} + +void ResizingLinkBox::setIconSize(int size) +{ + size_ = size; + KConfig *config = new KConfig(QDir::homeDirPath() + "/.qt/baghirarc"); + config->setGroup("Sidebar"); + config->writeEntry (QString(name()) + "_IconSize", size); + config->sync(); + ListBoxLink *runner; + ListBoxDevice *current; + blockSignals ( true ); + for (uint i = 0; i < count(); i++) + { + runner = (ListBoxLink*)item(i); + if (dynamic_cast<ListBoxDevice*>(runner)) + { + current = (ListBoxDevice*)runner; + insertItem( new ListBoxDevice(current->icon(), size, current->text(), current->URL(), current->name(), current->mountPoint(), current->mounted(), current->ejectable(), current->removable(), current->id()), i ); + } + else + { + insertItem( new ListBoxLink(runner->icon(), size, runner->text(), runner->URL()), i ); + } + KListBox::removeItem(i+1); + } + blockSignals ( false ); +} + +void ResizingLinkBox::mousePressEvent ( QMouseEvent *mpe ) +{ + KListBox::mousePressEvent( mpe ); +} + +void ResizingLinkBox::mouseReleaseEvent ( QMouseEvent *mpe ) +{ + if (mpe->button() == Qt::LeftButton) + { + ListBoxLink *link = (ListBoxLink*)itemAt(mpe->pos()); + if (isSelected(link)) emit clicked(link); + KListBox::mousePressEvent( mpe ); + return; + } + KListBox::mouseReleaseEvent( mpe ); +} + +void ResizingLinkBox::contentsWheelEvent ( QWheelEvent * we ) +{ + if (we->state() == Qt::ControlButton) + KListBox::contentsWheelEvent ( we ); + else + emit scrolled(0, -we->delta()); +} + +MediaListBox::MediaListBox( QWidget * parent, const char * name, WFlags f ) : ResizingLinkBox(parent, name, f), DCOPObject("BaghiraSidebarIface") +{ + KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + config.setGroup("Sidebar"); + hiddenDevices = config.readListEntry("HiddenDevices"); + currentFloppy = 0L; + devicePopup = new KPopupMenu(this); + devicePopup->setCheckable ( true ); + popupMenu->insertItem(i18n("Device List"), devicePopup, 1, 0); + popupMenu->insertSeparator( 0 ); + +#if KDE_IS_VERSION(3,4,90) + insertItem(new ListBoxDevice("system", size_, i18n("My Computer"), "system:/", "", "", TRUE, FALSE, FALSE)); + insertItem(new ListBoxDevice("network", size_, i18n("Network"), "remote:/", "", "", TRUE, FALSE, FALSE)); +#else + insertItem(new ListBoxDevice("system", size_, i18n("My Computer"), "media:/", "", "", TRUE, FALSE, FALSE)); + insertItem(new ListBoxDevice("network", size_, i18n("Network"), "lan:/localhost", "", "", TRUE, FALSE, FALSE)); +#endif + insertItem(new ListBoxDevice("hdd_mount", size_, i18n("Startvolume"), QDir::rootDirPath(), "", "", TRUE, FALSE, FALSE)); + client = KApplication::dcopClient(); + client->connectDCOPSignal("kded", "mediamanager", "mediumAdded(QString)", "BaghiraSidebarIface", "mediumAdded(QString)", FALSE); + client->connectDCOPSignal("kded", "mediamanager", "mediumRemoved(QString)", "BaghiraSidebarIface", "mediumRemoved(const QString)", FALSE); + client->connectDCOPSignal("kded", "mediamanager", "mediumChanged(QString)", "BaghiraSidebarIface", "mediumChanged(QString)", FALSE); + /* Get the media info - huhhh ;) */ + QByteArray data, replyData; + QCString replyType; + QDataStream arg(data, IO_WriteOnly); + arg << ""; // ask for the full list + if (!client->call("kded", "mediamanager", "fullList()", data, replyType, replyData)) + qDebug("there was some error using DCOP."); + else + { + QDataStream reply(replyData, IO_ReadOnly); + if (replyType == "QStringList") + { + QStringList result; + reply >> result; + blockSignals ( true ); + for (uint i = 0; i < result.size()/MEDIALIST_PROPS; i++) + { + if (result[MEDIALIST_PROPS*i+MIME_TYPE] != "media/hdd_mounted" && + result[MEDIALIST_PROPS*i+MIME_TYPE] != "media/hdd_unmounted" && + result[MEDIALIST_PROPS*i+MIME_TYPE] != "media/nfs_mounted" && + result[MEDIALIST_PROPS*i+MIME_TYPE] != "media/nfs_unmounted" && + result[MEDIALIST_PROPS*i+MIME_TYPE] != "media/smb_mounted" && + result[MEDIALIST_PROPS*i+MIME_TYPE] != "media/smb_unmounted") + { + ListBoxDevice *dev = createListBoxDevice(result, i); + if (hiddenDevices.contains(dev->name())) + { + deviceList.append(dev); + devicePopup->setItemChecked(dev->id(),false); + } + else + { + insertItem(dev); + devicePopup->setItemChecked(dev->id(),true); + } + } + } + blockSignals ( false ); + } + else + qWarning("fullList() returned an unexpected type of reply!"); + } +// setCurrentItem( 0 ); +} + +MediaListBox::~MediaListBox() +{ + hiddenDevices.clear(); + ListBoxDevice *runner; + for ( runner = deviceList.first(); runner; runner = deviceList.next() ) + hiddenDevices.append(runner->name()); + KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + config.setGroup("Sidebar"); + config.writeEntry("HiddenDevices", hiddenDevices); +} + +void MediaListBox::removeItem( int index ) +{ + devicePopup->removeItem(((ListBoxDevice*)item( index ))->id()); + ResizingLinkBox::removeItem(index); +} + +void MediaListBox::kfloppy() +{ + if (currentFloppy) + { + KProcess proc; + proc << "kfloppy" << currentFloppy->mountPoint(); + proc.start(KProcess::DontCare); + proc.detach(); + currentFloppy = 0L; + } + return; +} + +void MediaListBox::toggleDevice(int id) +{ + ListBoxDevice *runner; + if (devicePopup->isItemChecked(id)) // remove the device! + { + devicePopup->setItemChecked(id, false); + for (uint i = 0; i < count(); i++) + { + runner = (ListBoxDevice*)item(i); + if (runner->id() == id) + { + deviceList.append(runner); + blockSignals ( true ); + takeItem(runner); + blockSignals ( false ); + break; + } + } + } + else // add the device! + { + devicePopup->setItemChecked(id, true); + for ( runner = deviceList.first(); runner; runner = deviceList.next() ) + if (runner->id() == id) + { + insertItem(deviceList.take()); + break; + } + } +} + +ListBoxDevice *MediaListBox::createListBoxDevice(QStringList & deviceProperties, uint n) +{ + QString icon; + icon = deviceProperties[MEDIALIST_PROPS*n+ICON_NAME]; + if (icon.isNull()) + { + icon = deviceProperties[MEDIALIST_PROPS*n+MIME_TYPE]; + icon = icon.section( '/', -1 ); + icon.truncate( icon.length()-2 ); + if (icon.contains("floppy")) icon.prepend("3"); + } + QString label; + label = deviceProperties[MEDIALIST_PROPS*n+USER_LABEL]; + if (label.isNull()) + { + label = deviceProperties[MEDIALIST_PROPS*n+LABEL]; + label = i18n(label.section( " (", 0, 0 ).utf8()); + } +#if KDE_IS_VERSION(3,4,90) + return new ListBoxDevice( icon, size_, label, "system:/media/"+deviceProperties[MEDIALIST_PROPS*n+NAME], deviceProperties[MEDIALIST_PROPS*n+NAME], deviceProperties[MEDIALIST_PROPS*n+DEVICE_NODE], deviceProperties[MEDIALIST_PROPS*n+MOUNTED] == "true", icon.contains("dvd") || icon.contains("cdrom") || icon.contains("cdwriter"),icon.contains("floppy"), devicePopup->insertItem(deviceProperties[MEDIALIST_PROPS*n+NAME], this, SLOT(toggleDevice(int)))); +#else + return new ListBoxDevice( icon, size_, label, "media:/"+deviceProperties[MEDIALIST_PROPS*n+NAME], deviceProperties[MEDIALIST_PROPS*n+NAME], deviceProperties[MEDIALIST_PROPS*n+DEVICE_NODE], deviceProperties[MEDIALIST_PROPS*n+MOUNTED] == "true", icon.contains("dvd") || icon.contains("cdrom") || icon.contains("cdwriter"),icon.contains("floppy"),devicePopup->insertItem(deviceProperties[MEDIALIST_PROPS*n+NAME], this, SLOT(toggleDevice(int)))); +#endif +} + +int MediaListBox::index (const QString & name ) +{ + ListBoxDevice *device; + for (uint i = 0; i < count(); i++) + { + device = (ListBoxDevice*)item(i); + if (device && device->name() == name) return i; + } + return -1; +} + +void MediaListBox::mediumAdded(const QString &name) +{ + QByteArray data, replyData; + QCString replyType; + QDataStream arg(data, IO_WriteOnly); + arg << name; // ask for this item only + if (!client->call("kded", "mediamanager", "properties(QString)", data, replyType, replyData)) + qDebug("there was some error using DCOP."); + else + { + QDataStream reply(replyData, IO_ReadOnly); + if (replyType == "QStringList") + { + QStringList result; + reply >> result; + ListBoxDevice *dev = createListBoxDevice(result); + if (hiddenDevices.contains(dev->name())) + { + deviceList.append(dev); + devicePopup->setItemChecked(dev->id(),false); + } + else + { + insertItem(dev); + devicePopup->setItemChecked(dev->id(),true); + } + } + else + qWarning("properties() returned an unexpected type of reply!"); + } +} + +void MediaListBox::mediumRemoved(const QString &name) +{ + QByteArray data, replyData; + QCString replyType; + QDataStream arg(data, IO_WriteOnly); + arg << name; // ask for this item only + if (!client->call("kded", "mediamanager", "properties(QString)", data, replyType, replyData)) + qDebug("there was some error using DCOP."); + else + { + QDataStream reply(replyData, IO_ReadOnly); + if (replyType == "QStringList") + { + QStringList result; + reply >> result; + int i = index(name); + if (i<0) + return; + if (i == currentItem()) setCurrentItem(0); + removeItem(i); + } + else + qWarning("properties() returned an unexpected type of reply!"); + } +} + +void MediaListBox::mediumChanged(const QString &name) +{ + QByteArray data, replyData; + QCString replyType; + QDataStream arg(data, IO_WriteOnly); + arg << name; // ask for this item only + if (!client->call("kded", "mediamanager", "properties(QString)", data, replyType, replyData)) + qDebug("there was some error using DCOP."); + else + { + QDataStream reply(replyData, IO_ReadOnly); + if (replyType == "QStringList") + { + QStringList result; + reply >> result; + int i = index(name); + if (i<0) + return; + + ListBoxDevice *device = createListBoxDevice(result); + if (hiddenDevices.contains(device->name())) + { + deviceList.append(device); + devicePopup->setItemChecked(device->id(),false); + return; + } + devicePopup->setItemChecked(device->id(),true); + blockSignals(true); + if (i == currentItem()) // changing current item - take some care of updating stuff + { + if (((ListBoxDevice*)item(i))->mounted() && !device->mounted()) // unmounted the device - we certainly do not wanna select it anymore + { + setCurrentItem(0); + removeItem(i); + insertItem(device, i); + } + else // we're selected and wanna keep selection + { + removeItem(i); + insertItem(device, i); + setSelected( i, true ); + } + } + else // ordinary change + { + removeItem(i); + insertItem(device, i); + } + blockSignals(false); + } + else + qWarning("properties() returned an unexpected type of reply!"); + } +} + +#define _FLOPPYID_ 0 +#define _FLOPPYINDEX_ 0 + +void MediaListBox::mousePressEvent ( QMouseEvent *mpe ) +{ + if (mpe->button() == Qt::RightButton) + { + popupMenu->removeItem(_FLOPPYID_); + ListBoxDevice *device = (ListBoxDevice*)itemAt(mpe->pos()); + if (device && device->name().contains("fd")) + { + currentFloppy = device; + popupMenu->insertItem(i18n("Format disk..."), this, SLOT(kfloppy()),0,_FLOPPYID_,_FLOPPYINDEX_); + } + popupMenu->popup(mpe->globalPos()); + return; + } + if (mpe->button() == Qt::LeftButton && mpe->x() > width()-22) + { + ListBoxDevice *device = (ListBoxDevice*)itemAt(mpe->pos()); + int dy = itemRect(device).y(); + if ((device->removable() || device->ejectable()) && device->mounted() && mpe->y() > dy+11 && mpe->y() < dy+33) + { + KProcess proc; + device->ejectable()? + proc << "kdeeject" /*<< "-q"*/ << device->mountPoint(): + proc << "umount" << device->mountPoint(); // umount? + proc.start(KProcess::DontCare); + proc.detach(); + return; + } + } + ResizingLinkBox::mousePressEvent( mpe ); +} + +void MediaListBox::resizeEvent ( QResizeEvent * re) +{ + if (width() != re->oldSize().width()) + { + for (uint i = 0; i < count(); i++) + if (((ListBoxDevice*)item(i))->ejectable() && ((ListBoxDevice*)item(i))->mounted() && !isSelected(i)) updateItem(i); + } + ResizingLinkBox::resizeEvent(re); +} + +DnDListBox::DnDListBox( QWidget * parent, const char * name, WFlags f ): +ResizingLinkBox( parent, name, f), _poof(0), _poofIndex(0), _poofAnimPix(0), _poofPix(0) +{ + setAcceptDrops(true); + dialog = new LinkConfig(); + connect(dialog->buttonOk, SIGNAL(clicked()), this, SLOT(updateLink())); + setCursor(Qt::PointingHandCursor); +} + +DnDListBox::~DnDListBox() +{ +} + +void DnDListBox::poof(ListBoxLink *link) +{ + _poofIndex = 0; + _poofPix = new QPixmap(locateLocal("data", "baghira/poof.png"), "png"); + _poofAnimPix = new QPixmap(_poofPix->width(), _poofPix->width()); + if (!_poof) + _poof = new QWidget(0,0, Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM); + KWin::setShadowSize(_poof->winId(), 0); + _poof->setFixedSize(_poofPix->width(), _poofPix->width()); + int x = QCursor::pos().x() - _poof->width()/2; + int y = QCursor::pos().y() - _poof->height()/2; + QPixmap bgPix = QPixmap::grabWindow( qt_xrootwin(), x, y, _poofPix->width(), _poofPix->width()); + _poof->move(x,y); + _poof->show(); + _poof->setBackgroundOrigin(QWidget::WidgetOrigin); + _poof->setPaletteBackgroundPixmap( bgPix ); + runPoof(); + removeItem ( index(link) ); +} + +void DnDListBox::runPoof() +{ + if (_poofIndex > 4) + { + _poof->hide(); + delete _poofPix; + _poofPix = 0L; +// delete _poof; +// _poof = 0L; + delete _poofAnimPix; + _poofAnimPix = 0L; + _poofIndex = 0; + return; + } + _poof->erase(); + bitBlt(_poof, 0 ,0, _poofPix, 0, _poofIndex * _poofPix->width(), _poofPix->width(), _poofPix->width(), Qt::AndROP); + ++_poofIndex; + QTimer::singleShot ( 70, this, SLOT(runPoof()) ); // around 15 fps +} + +void DnDListBox::dragEnterEvent ( QDragEnterEvent *dee ) +{ +// dragging_ = true; + if (QUriDrag::canDecode(dee) || BaghiraLinkDrag::canDecode(dee) || QTextDrag::canDecode(dee)) + dee->accept(true); +} + +void DnDListBox::dropEvent ( QDropEvent *de ) +{ + QStrList list; + QString title; + QString command; + QString icon; + int oldIndex; + QCString subtype; + if (BaghiraLinkDrag::decode(de, &title, &command, &icon, &oldIndex)) // internal move + { + BaghiraLinkDrag::setAccepted(); + QListBoxItem *after = itemAt(de->pos()); + int newIndex = index(after); + if (!dragging_ || oldIndex < 0 || oldIndex > count()-2) + insertItem (new ListBoxLink(icon, size_, title, command), after?newIndex:count()); + else if (oldIndex != newIndex) + { + insertItem (new ListBoxLink(*((ListBoxLink*)item(oldIndex))), after?newIndex:count()); + removeItem ( (newIndex < 0 || oldIndex < newIndex) ? oldIndex : oldIndex + 1 ); + } + } + else if ( QUriDrag::decode(de, list) ) + { + char *uri; + KURL url; + QListBoxItem *after = itemAt(de->pos()); + for ( uri = list.first(); uri; uri = list.next() ) + { + url = KURL(uri); + if (url.protocol() == "http") + insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?QString(""):url.path()), uri), after?index(after):count()); + else + { + KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); + insertItem(new ListBoxLink(item.iconName(), size_, url.fileName().isEmpty()?url.prettyURL():url.fileName(), uri), after?index(after):count()); + } + } + } + else if (QTextDrag::decode(de, command, subtype)) + { + KURL url(command); + if (url.isValid()) + { + QListBoxItem *after = itemAt(de->pos()); + if (url.protocol() == "http") + insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?QString(""):url.path()), command), after?index(after):count()); + else + { + KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); + insertItem(new ListBoxLink(item.iconName(), size_, url.fileName().isEmpty()?url.prettyURL():url.fileName(), command), after?index(after):count()); + } + } + else if (command.contains('@')) + { + QListBoxItem *after = itemAt(de->pos()); + command.replace(" ",""); + insertItem(new ListBoxLink("kmail", size_, command, "mailto:"+command), after?index(after):count()); + } + else if (command.contains("'at'")) //last chance for anti-spam addy + { + QListBoxItem *after = itemAt(de->pos()); + command.replace(" ",""); + command.replace("'at'","@"); + insertItem(new ListBoxLink("kmail", size_, command, "mailto:"+command), after?index(after):count()); + } + } +} + +void DnDListBox::mousePressEvent ( QMouseEvent *mpe ) +{ + if (mpe->button() == Qt::RightButton) + { + currentItem = 0; + popupMenu->removeItem(0); + ListBoxDevice *device = (ListBoxDevice*)itemAt(mpe->pos()); + if (device) + { + currentItem = device; + popupMenu->insertItem("Edit link...", this, SLOT(configureLink()),0,0,0); + } + popupMenu->popup(mpe->globalPos()); + return; + } + if (mpe->button() == Qt::MidButton) + { + pasteURL(QClipboard::Selection, itemAt(mpe->pos())); + return; + } + ResizingLinkBox::mousePressEvent( mpe ); +} + +void DnDListBox::mouseReleaseEvent ( QMouseEvent *mre ) +{ + if (!dragging_) ResizingLinkBox::mouseReleaseEvent( mre ); +} + +void DnDListBox::mouseMoveEvent ( QMouseEvent * mme ) +{ + if (mme->state() & Qt::LeftButton) + { + if (!dragging_) + { + ListBoxLink *link = (ListBoxLink*)itemAt(mme->pos()); + if (link) + { + dragging_ = true; + BaghiraLinkDrag *d = new BaghiraLinkDrag( link->text(), link->URL(), link->icon(), index(link), this ); + d->setPixmap(*link->pixmap(),QPoint(22,22)); + d->drag(); + if (mme->state() & Qt::ControlButton || BaghiraLinkDrag::accepted()) + return; + poof(link); + // do NOT delete d. + } + } + } + else // ensure to release from drag + dragging_ = false; +} + +void DnDListBox::pasteURL(int mode, QListBoxItem *after) +{ + QString string = qApp->clipboard()->text( (QClipboard::Mode)mode ); + KURL url(string); + if (url.isValid()) + { + if (url.protocol() == "http") + insertItem(new ListBoxLink("html", size_, url.host()+(url.path()=="/"?QString(""):url.path()), string), after?index(after):count()); + else + { + KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); + insertItem(new ListBoxLink(item.iconName(),size_, url.fileName().isEmpty()?url.prettyURL():url.fileName(), string), after?index(after):count()); + } + } + else if (string.contains('@')) + { + string.replace(" ",""); + insertItem(new ListBoxLink("kmail", size_, string, "mailto:"+string), after?index(after):count()); + } + else if (string.contains("'at'")) //last chance for anti-spam addy + { + string.replace(" ",""); + string.replace("'at'","@"); + insertItem(new ListBoxLink("kmail", size_, string, "mailto:"+string), after?index(after):count()); + } +} + +void DnDListBox::configureLink() +{ + if (currentItem == 0L) + return; + dialog->title->setText(currentItem->text()); + dialog->url->setURL(currentItem->URL()); + dialog->icon->setIcon(currentItem->icon()); + dialog->show(); +} + +void DnDListBox::updateLink() +{ + if (currentItem) + { + int index_ = index(currentItem); + bool wasSelected = isSelected(index_); + insertItem( new ListBoxLink(dialog->icon->icon(), size_, dialog->title->text(),dialog->url->url()), index_ +1); + removeItem( index_ ); + setSelected(index_, wasSelected); + } +} diff --git a/sidebar/dndlistbox.h b/sidebar/dndlistbox.h new file mode 100644 index 0000000..b84dbcc --- /dev/null +++ b/sidebar/dndlistbox.h @@ -0,0 +1,126 @@ + +#ifndef DNDLISTBOX_H +#define DNDLISTBOX_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <klistbox.h> +#include <qptrlist.h> +#include <qstringlist.h> +#include "baghirasidebariface.h" + +class DCOPClient; +class QDragEnterEvent; +class QDragMoveEvent; +class QDragLeaveEvent; +class QDropEvent; +class QKeyEvent; +class QPoint; +class KPopupMenu; +class LinkConfig; +class ListBoxLink; +class ListBoxDevice; +class QResizeEvent; + +class ResizingLinkBox : public KListBox +{ + Q_OBJECT + +public: + ResizingLinkBox( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ); + ~ResizingLinkBox(){}; + void insertItem( const QListBoxItem *, int index=-1 ); + void insertItem( const QListBoxItem *lbi, const QListBoxItem *after ); + void insertItem( const QString & icon, const QString & title, const QString & url ); + void insertItem( const QString &text, int index=-1 ) + { + insertItem( new QListBoxText(text), index ); + } + void insertItem( const QPixmap &pixmap, int index=-1 ) + { + insertItem( new QListBoxPixmap(pixmap), index ); + } + void insertItem( const QPixmap &pixmap, const QString &text, int index=-1 ){ + insertItem( new QListBoxPixmap(pixmap, text), index ); + } + + void removeItem( int index ); +protected: + void mousePressEvent ( QMouseEvent * ); + void mouseReleaseEvent ( QMouseEvent * ); + void contentsWheelEvent ( QWheelEvent * ); + KPopupMenu *popupMenu; + uint size_; +private slots: + void setIconSize(int); +signals: + void itemNumberChanged(bool); + void scrolled(int,int); +}; + +class MediaListBox : public ResizingLinkBox, virtual public BaghiraSidebarIface +{ + Q_OBJECT +public: + MediaListBox( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ); + ~MediaListBox(); + ListBoxDevice *createListBoxDevice(QStringList & deviceProperties, uint n = 0); + void mediumAdded(const QString &name); + void mediumRemoved(const QString &name); + void mediumChanged(const QString &name); + int index (const QString & name ); + void removeItem( int index ); +protected: + void mousePressEvent ( QMouseEvent * ); + void resizeEvent ( QResizeEvent * ); +private: + KPopupMenu *devicePopup; + DCOPClient *client; + ListBoxDevice *currentFloppy; + typedef QPtrList<ListBoxDevice> DeviceList; + DeviceList deviceList; + QStringList hiddenDevices; +private slots: + void kfloppy(); + void toggleDevice(int id); +}; + +class DnDListBox : public ResizingLinkBox +{ + Q_OBJECT + +public: + DnDListBox( QWidget * parent = 0, const char * name = 0, WFlags f = 0 ); + + /** destructor */ + ~DnDListBox(); + void poof(ListBoxLink *link); + +protected: + void mousePressEvent ( QMouseEvent * ); + void mouseReleaseEvent ( QMouseEvent * ); + void mouseMoveEvent ( QMouseEvent * e ); + void dragEnterEvent ( QDragEnterEvent * ); +// void dragMoveEvent ( QDragMoveEvent * ); +// void dragLeaveEvent ( QDragLeaveEvent * ); + void dropEvent ( QDropEvent * ); + void startDrag(); +private: + ListBoxLink *currentItem; //TODO: unshadow int KListBox::currentItem() + LinkConfig *dialog; + bool dragging_; + void pasteURL(int mode, QListBoxItem *after = 0); + bool _draggedMe; + int _poofIndex; + QPixmap *_poofPix; + QPixmap *_poofAnimPix; + QWidget *_poof; +private slots: + void configureLink(); + void updateLink(); + void runPoof(); +}; + +#endif diff --git a/sidebar/eject.xbm b/sidebar/eject.xbm new file mode 100644 index 0000000..3230a26 --- /dev/null +++ b/sidebar/eject.xbm @@ -0,0 +1,9 @@ +#define eject_width 22 +#define eject_height 22 +static unsigned char eject_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x07, 0x00, + 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00, 0xe0, 0x3f, 0x00, 0xf0, 0x7f, 0x00, + 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01, 0xfe, 0xff, 0x03, 0xff, 0xff, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, + 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/sidebar/linkconfig.ui b/sidebar/linkconfig.ui new file mode 100644 index 0000000..14ccf55 --- /dev/null +++ b/sidebar/linkconfig.ui @@ -0,0 +1,187 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>LinkConfig</class> +<widget class="QDialog"> + <property name="name"> + <cstring>LinkConfig</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>403</width> + <height>164</height> + </rect> + </property> + <property name="caption"> + <string>Configure Link</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><b>Title</b></string> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>title</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><b>URL</b></string> + </property> + </widget> + <widget class="KURLRequester"> + <property name="name"> + <cstring>url</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>206</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="KIconButton" row="0" column="1"> + <property name="name"> + <cstring>icon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>64</width> + <height>64</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>64</width> + <height>64</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSize"> + <number>48</number> + </property> + <property name="strictIconSize"> + <bool>false</bool> + </property> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>LinkConfig</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>LinkConfig</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kicondialog.h</includehint> +</includehints> +</UI> diff --git a/sidebar/linkview.cpp b/sidebar/linkview.cpp new file mode 100644 index 0000000..8becf29 --- /dev/null +++ b/sidebar/linkview.cpp @@ -0,0 +1,199 @@ + +#include <stdlib.h> +#include <qcursor.h> +#include <qsplitter.h> +#include <klocale.h> +#include <qdir.h> +#include <kconfig.h> +#include <qtimer.h> +#include "dndlistbox.h" +#include "listboxlink.h" +#include "linkview.h" +#include "linkview.moc" + +// internal class to eat invalid leave envents (i.e. leave that does not leave the rect but just enters the splitter, as styles (like baghira ;) may post install eventfilters that'd cause useless repaints and therefore flicker if the scroller appereance changes ;) +class EventKiller : public QObject +{ +protected: + virtual bool eventFilter( QObject *o, QEvent *e) + { + if (e->type() == QEvent::Leave) + return ((QScrollView*)o)->rect().contains(((QScrollView*)o)->mapFromGlobal (QCursor::pos())); + return false; + } +}; + +LinkView::LinkView(QWidget * parent, const char * name, WFlags f): + QScrollView(parent, name, f) +{ + setFrameShape( QFrame::StyledPanel ); + setFrameShadow( QFrame::Sunken ); + setBackgroundMode(Qt::PaletteBase); + _blocked = FALSE; + splitter = new QSplitter( Qt::Vertical, viewport() ); + addChild(splitter); + splitter->setMargin(5); + splitter->setBackgroundMode(Qt::PaletteBase); + splitter->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum); + splitter->setFrameShape( QFrame::NoFrame ); + splitter->setChildrenCollapsible(TRUE); + splitter->setHandleWidth( 3 ); + splitter->setOpaqueResize(); + hardware = new MediaListBox(splitter, "hardware"); + splitter->setResizeMode( hardware, QSplitter::KeepSize ); + hardware->setFrameShape( QFrame::NoFrame ); + hardware->setHScrollBarMode(QScrollView::AlwaysOff); + hardware->setVScrollBarMode(QScrollView::AlwaysOff); + locations = new DnDListBox(splitter, "locations"); +// splitter->setResizeMode( locations, QSplitter::KeepSize ); + locations->setFrameShape( QFrame::NoFrame ); + locations->setHScrollBarMode(QScrollView::AlwaysOff); + locations->setVScrollBarMode(QScrollView::AlwaysOff); + // custom area, locations + loadLinks(); + locations->setCurrentItem(0); + locations->setSelected( locations->selectedItem(), false ); + hardware->installEventFilter(this); + connect (hardware, SIGNAL(highlighted( int )), this, SLOT(unselectLocations())); + connect (locations, SIGNAL(highlighted( int )), this, SLOT(unselectHardware())); + connect (hardware, SIGNAL(scrolled(int,int)), this, SLOT(scrollBy(int,int))); + connect (locations, SIGNAL(scrolled(int,int)), this, SLOT(scrollBy(int,int))); + connect (hardware, SIGNAL(itemNumberChanged(bool)), this, SLOT(adjustSplitter2Hardware(bool))); + connect (locations, SIGNAL(itemNumberChanged(bool)), this, SLOT(adjustSplitter2Locations())); + QTimer::singleShot(50, this, SLOT(adjustSplitter2Locations())); + QTimer::singleShot(60, this, SLOT(postInstallEventFilter())); +} + +static EventKiller *eventKiller = 0L; + +LinkView::~LinkView() +{ + + saveLinks(); + delete eventKiller; eventKiller = 0L; +} + +void LinkView::postInstallEventFilter() +{ + eventKiller = new EventKiller; + installEventFilter(eventKiller); +} + +bool LinkView::eventFilter(QObject *o, QEvent *e) +{ + if (o != hardware) + return QScrollView::eventFilter(o, e); + if (_blocked || e->type() != QEvent::Resize) + return FALSE; // not a resize - non of our business + QResizeEvent *rev = (QResizeEvent*)e; + if (rev->size().height() == rev->oldSize().height()) + return FALSE; // height didn't change + int tmpH = rev->size().height() + locations->numRows()*locations->itemHeight()+20; + if (tmpH < viewport()->height()) + tmpH = viewport()->height(); + if (tmpH != splitter->height()) + { + _blocked = TRUE; + splitter->resize ( splitter->width(), tmpH ); + _blocked = FALSE; + } + + return FALSE; +} + +void LinkView::adjustSplitter2Locations() +{ + int tmpH = hardware->height() + locations->numRows()*locations->itemHeight()+20; + if (tmpH < viewport()->height()) + tmpH = viewport()->height(); + if (tmpH != splitter->height()) + splitter->resize ( viewport()->width(), tmpH ); +} + +void LinkView::adjustSplitter2Hardware(bool added) +{ + if (added) + { + if (hardware->height() < hardware->numRows()*hardware->itemHeight()) + hardware->resize ( hardware->width(), hardware->numRows()*hardware->itemHeight() ); + } + else + if (hardware->height() > hardware->numRows()*hardware->itemHeight()) + hardware->resize ( hardware->width(), hardware->numRows()*hardware->itemHeight() ); +} + +void LinkView::viewportResizeEvent( QResizeEvent *rev ) +{ + int tmpH = hardware->height() + locations->numRows()*locations->itemHeight()+20; + if (tmpH < rev->size().height()) + tmpH = rev->size().height(); + splitter->resize(rev->size().width(), tmpH); +} + +void LinkView::unselectLocations() +{ + if (locations) locations->setSelected( locations->selectedItem(), FALSE ); +} + +void LinkView::unselectHardware() +{ + if (hardware) hardware->setSelected( hardware->selectedItem(), FALSE ); +} + +void LinkView::loadLinks() +{ + if (!locations) + return; + KConfig config(QDir::homeDirPath() + "/.qt/baghirarc"); + config.setGroup("Sidebar"); + splitter->setSizes(config.readIntListEntry ("Sizes")); + loadedLinks = (uint)config.readNumEntry("NumLinks", 0); + locations->blockSignals ( true ); + if (loadedLinks == 0) // no settings stored - load defaults + { + locations->insertItem("desktop", i18n("Desktop"), QDir::homeDirPath()+"/Desktop"); + locations->insertItem("folder_home", getenv("USER"), QDir::homeDirPath()); + locations->insertItem("kmenu", i18n("Programs"), "programs:/"); + } + QString num; + for (uint i = 0; i < loadedLinks; i++) + { + QString title; + QString icon; + QString url; + num.setNum(i); + title = config.readEntry("Link_"+num+"_Title", "???"); + icon = config.readEntry("Link_"+num+"_Icon", "empty"); + url = config.readEntry("Link_"+num+"_URL", QDir::homeDirPath()); + locations->insertItem(icon, title, url); + } + locations->blockSignals ( false ); +} + +void LinkView::saveLinks() +{ + if (!locations) + return; + KConfig *config = new KConfig(QDir::homeDirPath() + "/.qt/baghirarc"); + config->setGroup("Sidebar"); + config->writeEntry("Sizes", splitter->sizes()); + config->writeEntry("NumLinks", (int)locations->count()); + QString num; + for (uint i = 0; i < locations->count(); i++) + { + num.setNum(i); + ListBoxLink *current = (ListBoxLink*)locations->item(i); + config->writeEntry("Link_"+num+"_Title", current->text()); + config->writeEntry("Link_"+num+"_Icon", current->icon()); + config->writeEntry("Link_"+num+"_URL", current->URL()); + } + // reduced links, remove them from settings + for (uint i = locations->count(); i < loadedLinks; i++) + { + num.setNum(i); + config->deleteEntry("Link_"+num+"_Title"); + config->deleteEntry("Link_"+num+"_Icon"); + config->deleteEntry("Link_"+num+"_URL"); + } + delete config; +} diff --git a/sidebar/linkview.h b/sidebar/linkview.h new file mode 100644 index 0000000..ebe54ef --- /dev/null +++ b/sidebar/linkview.h @@ -0,0 +1,46 @@ + +#ifndef LINKVIEW_H +#define LINKVIEW_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qscrollview.h> + +class ListBoxLink; +class DnDListBox; +class MediaListBox; + +class LinkView : public QScrollView +{ + Q_OBJECT + +public: + LinkView(QWidget * parent = 0, const char * name = 0, WFlags f = 0); + + /** destructor */ + ~LinkView(); + MediaListBox *Hardware(){return hardware;} + DnDListBox *Locations(){return locations;} + void loadLinks(); + void saveLinks(); + +protected: + void viewportResizeEvent( QResizeEvent * ); + bool eventFilter(QObject *, QEvent *); +private: + MediaListBox *hardware; + DnDListBox *locations; + QSplitter *splitter; + bool _blocked; + uint loadedLinks; +private slots: + void postInstallEventFilter(); + void unselectLocations(); + void unselectHardware(); + void adjustSplitter2Locations(); + void adjustSplitter2Hardware(bool added); +}; + +#endif diff --git a/sidebar/listboxlink.cpp b/sidebar/listboxlink.cpp new file mode 100644 index 0000000..47adb88 --- /dev/null +++ b/sidebar/listboxlink.cpp @@ -0,0 +1,78 @@ + +#include <kiconloader.h> +#include "listboxlink.h" +#include <qpainter.h> +#include <qbitmap.h> +#include "eject.xbm" +#include "lock.xbm" + +static QBitmap eject = QBitmap( eject_width, eject_height, eject_bits, true ); +static QBitmap locked = QBitmap( lock_width, lock_height, lock_bits, true ); + +ListBoxLink::ListBoxLink( const QString & icon, uint size, const QString & title, const QString & url): QListBoxPixmap(KGlobal::iconLoader()->loadIcon(icon, KIcon::Desktop, size), title),url_(url),icon_(icon) +{ +} + +ListBoxLink::ListBoxLink( const QPixmap & pixmap, const QString & title, const QString & url) : QListBoxPixmap(pixmap, title), url_(url), icon_(0) +{ +} + +ListBoxLink::ListBoxLink(ListBoxLink & link) : QListBoxPixmap(*link.pixmap(), link.text()), url_(link.URL()), icon_(link.icon()) +{ +} + +ListBoxLink::~ListBoxLink() +{ +} + +void ListBoxLink::setURL(const QString & url) +{ + url_ = url; +} + +void ListBoxLink::setIcon(const QString & icon) +{ + icon_ = icon; +} + +int ListBoxLink::height ( const QListBox * lb ) const +{ + return (QListBoxPixmap::height ( lb ) + 4); +} + +ListBoxDevice::ListBoxDevice(const QString & icon, uint size, const QString & title, const QString & url, const QString & name, const QString & mountPoint, bool mounted, bool ejectable, bool removable, int id) : ListBoxLink(icon, size, title, url), name_(name), mountPoint_(mountPoint), mounted_(mounted), ejectable_(ejectable), removable_(removable),id_(id) +{ + if (!eject.mask()) + eject.setMask(eject); + if (!locked.mask()) + locked.setMask(locked); +} + +ListBoxDevice::ListBoxDevice(const QPixmap & pixmap, const QString & title, const QString & url, const QString & name, const QString & mountPoint, bool mounted, bool ejectable, bool removable, int id) : ListBoxLink(pixmap, title, url), name_(name), mountPoint_(mountPoint), mounted_(mounted), ejectable_(ejectable), removable_(removable),id_(id) +{ + if (!eject.mask()) + eject.setMask(eject); + if (!locked.mask()) + locked.setMask(locked); +} + +int ListBoxDevice::width ( const QListBox * lb ) const +{ + if (ejectable_ && mounted_ && lb) + return lb->width(); + return ListBoxLink::width(lb); +} + +void ListBoxDevice::paint( QPainter * p ) +{ + if ((ejectable_ || removable_) && mounted_) + { + p->save(); + ListBoxLink::paint(p); + p->setBrush(isSelected()?listBox()->colorGroup().highlightedText():listBox()->colorGroup().text()); + p->drawPixmap(listBox()->width()-22, 11, ejectable_?eject:locked); + p->restore(); + } + else + ListBoxLink::paint(p); +} diff --git a/sidebar/listboxlink.h b/sidebar/listboxlink.h new file mode 100644 index 0000000..6614920 --- /dev/null +++ b/sidebar/listboxlink.h @@ -0,0 +1,64 @@ + +#ifndef LISTBOXLINK_H +#define LISTBOXLINK_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qlistbox.h> + +class KListBox; +class QPainter; +class QPixmap; +class QStringList; +class KURL; + +class ListBoxLink : public QListBoxPixmap +{ +friend class DnDListBox; + +public: + ListBoxLink(const QString & icon, uint size, const QString & title, const QString & url); + ListBoxLink(const QPixmap & pixmap, const QString & title, const QString & url); + ListBoxLink(ListBoxLink & link); + ~ListBoxLink(); + QString & URL(){return url_;} + void setURL(const QString & url); + QString & icon(){return icon_;} + void setIcon(const QString & icon); + int height ( const QListBox * lb ) const; + +private: + QString url_; //TODO: make this KURL?! + QString icon_; +}; + +class ListBoxDevice : public ListBoxLink +{ + friend class MediaListBox; +public: + ListBoxDevice(const QString & icon, uint size, const QString & title, const QString & url, const QString & name, const QString & mountPoint, bool mounted, bool ejectable = FALSE, bool removable = FALSE, int id = 0); + ListBoxDevice(const QPixmap & pixmap, const QString & title, const QString & url, const QString & name, const QString & mountPoint, bool mounted, bool ejectable = FALSE, bool removable = FALSE, int id = 0); + ~ListBoxDevice(){}; + QString & name(){return name_;} + bool mounted(){return mounted_;} + bool ejectable(){return ejectable_;} + bool removable(){return removable_;} + QString & mountPoint(){return mountPoint_;} + int id(){return id_;} + int width ( const QListBox * lb ) const; + +protected: + void paint( QPainter * p ); + +private: + QString name_; + QString mountPoint_; + bool mounted_; + bool ejectable_; + bool removable_; + int id_; +}; + +#endif diff --git a/sidebar/lock.xbm b/sidebar/lock.xbm new file mode 100644 index 0000000..6f7caaf --- /dev/null +++ b/sidebar/lock.xbm @@ -0,0 +1,9 @@ +#define lock_width 22 +#define lock_height 22 +static unsigned char lock_bits[] = { + 0x00, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0xf8, 0x7f, 0x00, 0x3c, 0xf0, 0x00, + 0x0e, 0xc0, 0x01, 0x06, 0x80, 0x01, 0x06, 0x80, 0x01, 0x06, 0x80, 0x01, + 0x06, 0x80, 0x01, 0x06, 0x80, 0x01, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, + 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0x03, 0x00, 0x03, 0xff, 0xff, 0x03, + 0x03, 0x00, 0x03, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, 0xff, 0xff, 0x03, + 0xff, 0xff, 0x03, 0x00, 0x00, 0x00 }; diff --git a/starter/Makefile.am b/starter/Makefile.am new file mode 100644 index 0000000..6fee0e8 --- /dev/null +++ b/starter/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES= $(all_includes) +METASOURCES = AUTO +KDE_ICON = AUTO + +lib_LTLIBRARIES = libbaghirastarter.la + +libbaghirastarter_la_SOURCES = baghiralinkdrag.cpp menu.cpp starter.cpp starterconfig.ui starterhelp.ui config.ui help.ui linkconfig.ui starteriface.skel +libbaghirastarter_la_LDFLAGS = -module -avoid-version $(all_libraries) +libbaghirastarter_la_LIBADD = -lXtst $(LIB_KDEUI) + +starter_DATA = starter.desktop +starterdir = $(kde_datadir)/kicker/applets +poof_DATA = ../imagebase/poof.png +poofdir = $(kde_datadir)/baghira + +messages: rc.cpp + $(EXTRACTRC) *.ui >> rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/starter.pot diff --git a/starter/Themes/Apple Aqua/bStarter.png b/starter/Themes/Apple Aqua/bStarter.png Binary files differnew file mode 100644 index 0000000..6cb6924 --- /dev/null +++ b/starter/Themes/Apple Aqua/bStarter.png diff --git a/starter/Themes/Apple Aqua/bStarter_down.png b/starter/Themes/Apple Aqua/bStarter_down.png Binary files differnew file mode 100644 index 0000000..fdfae84 --- /dev/null +++ b/starter/Themes/Apple Aqua/bStarter_down.png diff --git a/starter/Themes/Apple Aqua/bStarter_hover.png b/starter/Themes/Apple Aqua/bStarter_hover.png Binary files differnew file mode 100644 index 0000000..1feeab9 --- /dev/null +++ b/starter/Themes/Apple Aqua/bStarter_hover.png diff --git a/starter/Themes/Apple Graphite/bStarter.png b/starter/Themes/Apple Graphite/bStarter.png Binary files differnew file mode 100644 index 0000000..6fcac0e --- /dev/null +++ b/starter/Themes/Apple Graphite/bStarter.png diff --git a/starter/Themes/Apple Graphite/bStarter_down.png b/starter/Themes/Apple Graphite/bStarter_down.png Binary files differnew file mode 100644 index 0000000..d691c93 --- /dev/null +++ b/starter/Themes/Apple Graphite/bStarter_down.png diff --git a/starter/Themes/Apple Graphite/bStarter_hover.png b/starter/Themes/Apple Graphite/bStarter_hover.png Binary files differnew file mode 100644 index 0000000..914c5b8 --- /dev/null +++ b/starter/Themes/Apple Graphite/bStarter_hover.png diff --git a/starter/Themes/Apple Panther/README b/starter/Themes/Apple Panther/README new file mode 100644 index 0000000..8ff4799 --- /dev/null +++ b/starter/Themes/Apple Panther/README @@ -0,0 +1 @@ +Contributed by Arnaud diff --git a/starter/Themes/Apple Panther/base.png b/starter/Themes/Apple Panther/base.png Binary files differnew file mode 100644 index 0000000..d50edc6 --- /dev/null +++ b/starter/Themes/Apple Panther/base.png diff --git a/starter/Themes/Apple Panther/down.png b/starter/Themes/Apple Panther/down.png Binary files differnew file mode 100644 index 0000000..69e2884 --- /dev/null +++ b/starter/Themes/Apple Panther/down.png diff --git a/starter/Themes/Apple Panther/hover.png b/starter/Themes/Apple Panther/hover.png Binary files differnew file mode 100644 index 0000000..7bc9841 --- /dev/null +++ b/starter/Themes/Apple Panther/hover.png diff --git a/starter/Themes/kickerbg-b.png b/starter/Themes/kickerbg-b.png Binary files differnew file mode 100644 index 0000000..3ac9fa5 --- /dev/null +++ b/starter/Themes/kickerbg-b.png diff --git a/starter/Themes/kickerbg-g.png b/starter/Themes/kickerbg-g.png Binary files differnew file mode 100644 index 0000000..a59138f --- /dev/null +++ b/starter/Themes/kickerbg-g.png diff --git a/starter/baghiralinkdrag.cpp b/starter/baghiralinkdrag.cpp new file mode 100644 index 0000000..9c54011 --- /dev/null +++ b/starter/baghiralinkdrag.cpp @@ -0,0 +1,125 @@ +#include <qbuffer.h> +#include "baghiralinkdrag.h" + +static bool _accepted; + +#define _TLO_ 0 +#define _TO_ 4*sizeof(int) +#define _CLO_ 1*sizeof(int) +#define _CO_ 4*sizeof(int) + title.length()*sizeof(QChar) +#define _CO2_ 4*sizeof(int) + title->length()*sizeof(QChar) +#define _ILO_ 2*sizeof(int) +#define _IO_ 4*sizeof(int) + (title.length()+command.length())*sizeof(QChar) +#define _IO2_ 4*sizeof(int) + (title->length()+command->length())*sizeof(QChar) +#define _IxO_ 3*sizeof(int) + +BaghiraLinkDrag::BaghiraLinkDrag(QString title, QString command, QString icon, int index, QWidget* dragSource) : QDragObject(dragSource, 0) + +{ + _accepted = false; + a.resize((title.length()+command.length()+icon.length())*sizeof(QChar)+4*sizeof(int)); + + QChar* tmpChar; + int tmpLength; + + tmpChar = const_cast<QChar*>(title.unicode()); + tmpLength = title.length(); + memcpy(a.data(), &tmpLength, sizeof(int)); + memcpy(a.data() + _TO_ , tmpChar, tmpLength*sizeof(QChar)); + + tmpChar = const_cast<QChar*>(command.unicode()); + tmpLength = command.length(); + memcpy(a.data() + _CLO_ , &tmpLength, sizeof(int)); + memcpy(a.data() + _CO_, tmpChar, tmpLength*sizeof(QChar)); + + tmpChar = const_cast<QChar*>(icon.unicode()); + tmpLength = icon.length(); + memcpy(a.data() + _ILO_, &tmpLength, sizeof(int)); + memcpy(a.data() + _IO_, tmpChar, tmpLength*sizeof(QChar)); + + memcpy(a.data() + _IxO_, &index, sizeof(int)); +} + +BaghiraLinkDrag::~BaghiraLinkDrag() +{ +} + +bool BaghiraLinkDrag::decode( const QMimeSource * e, QString * title, QString * command, QString * icon, int * index) +{ + QByteArray a = e->encodedData("application/baghiralink"); + + if (a.size() < 4*sizeof(int)) // some empty stuff + { + return false; + } + + QChar* tmpChar; + int tmpLength; + + memcpy(&tmpLength, a.data(), sizeof(int)); + tmpChar = new QChar[tmpLength]; + memcpy(tmpChar, a.data() + _TO_, tmpLength*sizeof(QChar)); + title->setUnicode(tmpChar, tmpLength); + delete tmpChar; + + memcpy(&tmpLength, a.data() + _CLO_, sizeof(int)); + tmpChar = new QChar[tmpLength]; + memcpy(tmpChar, a.data() + _CO2_, tmpLength*sizeof(QChar)); + command->setUnicode(tmpChar, tmpLength); + delete tmpChar; + + memcpy(&tmpLength, a.data() + _ILO_, sizeof(int)); + tmpChar = new QChar[tmpLength]; + memcpy(tmpChar, a.data() + _IO2_, tmpLength*sizeof(QChar)); + icon->setUnicode(tmpChar, tmpLength); + delete tmpChar; tmpChar = 0L; + + memcpy(index, a.data() + _IxO_, sizeof(int)); + + return true; +} + +bool BaghiraLinkDrag::accepted() +{ + return _accepted; +} + +bool BaghiraLinkDrag::canDecode( const QMimeSource * e ) +{ + return e->provides("application/baghiralink"); +#if 0 + if (!e->provides("application/baghiralink")) + { + return false; + } + QByteArray a = e->encodedData("application/baghiralink"); + if (a.size() != BAGHIRALINK_BUFSIZE) + { + return false; + } + return true; +#endif +} + +void BaghiraLinkDrag::setAccepted() +{ + _accepted = true; +} + +const char * BaghiraLinkDrag::format ( int i ) const +{ + if (i == 0) + { + return "application/baghiralink"; + } + return 0; +} + +QByteArray BaghiraLinkDrag::encodedData ( const char * mimeType) const +{ + if (QString("application/baghiralink") == mimeType) + { + return a; + } + return QByteArray(); +} diff --git a/starter/baghiralinkdrag.h b/starter/baghiralinkdrag.h new file mode 100644 index 0000000..3aca9ec --- /dev/null +++ b/starter/baghiralinkdrag.h @@ -0,0 +1,24 @@ +#ifndef _BAGHIRALINKDRAG_H_ +#define _BAGHIRALINKDRAG_H_ + +#include <qdragobject.h> +#include <qstring.h> + +class BaghiraLinkDrag : public QDragObject +{ +// Q_OBJECT + +public: + BaghiraLinkDrag(QString title, QString command, QString icon, int index = -1, QWidget* dragSource = 0); + ~BaghiraLinkDrag(); + static bool decode( const QMimeSource * e, QString * title, QString * command, QString * icon, int * index); + static bool canDecode( const QMimeSource * e); + static void setAccepted( ); + virtual const char * format ( int i = 0 ) const; + virtual QByteArray encodedData ( const char * ) const; + static bool accepted( ); +private: + QByteArray a; +}; + +#endif diff --git a/starter/config.ui b/starter/config.ui new file mode 100644 index 0000000..ebc7956 --- /dev/null +++ b/starter/config.ui @@ -0,0 +1,575 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>ConfigDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>ConfigDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>658</width> + <height>629</height> + </rect> + </property> + <property name="caption"> + <string>New Entry</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QPushButton" row="1" column="0"> + <property name="name"> + <cstring>buttonDetail</cstring> + </property> + <property name="text"> + <string>Extended Mode</string> + </property> + <property name="toggleButton"> + <bool>true</bool> + </property> + </widget> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>baseGroup</cstring> + </property> + <property name="frameShape"> + <enum>GroupBoxPanel</enum> + </property> + <property name="title"> + <string>Basic Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KComboBox" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>category</cstring> + </property> + <property name="editable"> + <bool>true</bool> + </property> + <property name="insertionPolicy"> + <enum>AfterCurrent</enum> + </property> + <property name="autoCompletion"> + <bool>true</bool> + </property> + <property name="duplicatesEnabled"> + <bool>false</bool> + </property> + <property name="contextMenuEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>Is a</string> + </property> + </widget> + <widget class="KLineEdit" row="0" column="1"> + <property name="name"> + <cstring>appName</cstring> + </property> + </widget> + <widget class="KURLRequester" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>command</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="KLineEdit" row="1" column="1"> + <property name="name"> + <cstring>genericName</cstring> + </property> + </widget> + <widget class="KIconButton" row="0" column="2" rowspan="2" colspan="1"> + <property name="name"> + <cstring>iconButton</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>60</width> + <height>60</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>60</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <property name="iconSize"> + <number>48</number> + </property> + </widget> + <widget class="QLabel" row="3" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string><b>Command</b></string> + </property> + </widget> + <widget class="QLabel" row="4" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><i>Keywords</i></string> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><i><b>Name</b></i></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string><i><b>Category</b></i></string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>keywords</cstring> + </property> + </widget> + <widget class="QCheckBox" row="5" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>startupFeedback</cstring> + </property> + <property name="text"> + <string>Activate startup feedback</string> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>showInSystray</cstring> + </property> + <property name="text"> + <string>Show in system tray</string> + </property> + </widget> + <widget class="KTextEdit" row="1" column="4" rowspan="4" colspan="1"> + <property name="name"> + <cstring>description</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> + <widget class="QLabel" row="0" column="4"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string>Description</string> + </property> + </widget> + <widget class="Line" row="0" column="3" rowspan="5" colspan="1"> + <property name="name"> + <cstring>line4</cstring> + </property> + <property name="frameShape"> + <enum>VLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="2" column="0"> + <property name="name"> + <cstring>extendedGroup</cstring> + </property> + <property name="title"> + <string>Extended Settings</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0" rowspan="2" colspan="5"> + <property name="name"> + <cstring>textLabel7</cstring> + </property> + <property name="text"> + <string>Working directory</string> + </property> + </widget> + <widget class="Line" row="2" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="3" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>startInTerminal</cstring> + </property> + <property name="text"> + <string>Start in terminal</string> + </property> + </widget> + <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel9</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Terminal settings</string> + </property> + </widget> + <widget class="KLineEdit" row="4" column="2" rowspan="1" colspan="4"> + <property name="name"> + <cstring>terminalSettings</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="Line" row="5" column="0" rowspan="1" colspan="6"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="6" column="0" rowspan="1" colspan="5"> + <property name="name"> + <cstring>startAsUser</cstring> + </property> + <property name="text"> + <string>Start as different user</string> + </property> + </widget> + <widget class="QLabel" row="7" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Username</string> + </property> + </widget> + <widget class="KLineEdit" row="7" column="2" rowspan="1" colspan="4"> + <property name="name"> + <cstring>username</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="Line" row="8" column="0" rowspan="2" colspan="6"> + <property name="name"> + <cstring>line3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel" row="10" column="0" rowspan="2" colspan="1"> + <property name="name"> + <cstring>textLabel8</cstring> + </property> + <property name="text"> + <string>Shortcut</string> + </property> + </widget> + <widget class="KURLRequester" row="1" column="4" rowspan="1" colspan="2"> + <property name="name"> + <cstring>workingDir</cstring> + </property> + </widget> + <spacer row="11" column="5"> + <property name="name"> + <cstring>spacer2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>250</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KKeyButton" row="9" column="3" rowspan="3" colspan="2"> + <property name="name"> + <cstring>shortcut</cstring> + </property> + <property name="text"> + <string>None</string> + </property> + </widget> + <spacer row="11" column="1"> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>31</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>ConfigDialog</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>ConfigDialog</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>startInTerminal</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel9</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>startInTerminal</sender> + <signal>toggled(bool)</signal> + <receiver>terminalSettings</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>startAsUser</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel6</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>startAsUser</sender> + <signal>toggled(bool)</signal> + <receiver>username</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>buttonDetail</sender> + <signal>toggled(bool)</signal> + <receiver>extendedGroup</receiver> + <slot>setShown(bool)</slot> + </connection> + <connection> + <sender>buttonDetail</sender> + <signal>released()</signal> + <receiver>ConfigDialog</receiver> + <slot>adjustSize()</slot> + </connection> +</connections> +<tabstops> + <tabstop>appName</tabstop> + <tabstop>genericName</tabstop> + <tabstop>category</tabstop> + <tabstop>command</tabstop> + <tabstop>keywords</tabstop> + <tabstop>startupFeedback</tabstop> + <tabstop>showInSystray</tabstop> + <tabstop>iconButton</tabstop> + <tabstop>description</tabstop> + <tabstop>buttonDetail</tabstop> + <tabstop>workingDir</tabstop> + <tabstop>startInTerminal</tabstop> + <tabstop>terminalSettings</tabstop> + <tabstop>startAsUser</tabstop> + <tabstop>username</tabstop> + <tabstop>shortcut</tabstop> + <tabstop>buttonHelp</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kcombobox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kicondialog.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>ktextedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kkeybutton.h</includehint> +</includehints> +</UI> diff --git a/starter/cr22-action-bStarter.png b/starter/cr22-action-bStarter.png Binary files differnew file mode 100644 index 0000000..51c829f --- /dev/null +++ b/starter/cr22-action-bStarter.png diff --git a/starter/cr22-action-bStarter_down.png b/starter/cr22-action-bStarter_down.png Binary files differnew file mode 100644 index 0000000..069f417 --- /dev/null +++ b/starter/cr22-action-bStarter_down.png diff --git a/starter/cr22-action-bStarter_hover.png b/starter/cr22-action-bStarter_hover.png Binary files differnew file mode 100644 index 0000000..bb6932d --- /dev/null +++ b/starter/cr22-action-bStarter_hover.png diff --git a/starter/help.ui b/starter/help.ui new file mode 100644 index 0000000..dbb5416 --- /dev/null +++ b/starter/help.ui @@ -0,0 +1,123 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>HelpDialog</class> +<widget class="QDialog"> + <property name="name"> + <cstring>HelpDialog</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>600</width> + <height>480</height> + </rect> + </property> + <property name="caption"> + <string>Help</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KTextEdit" row="0" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>kTextEdit2</cstring> + </property> + <property name="frameShape"> + <enum>LineEditPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="text"> + <string><p align="center"><font size="+3"><b>Menu entry editor</b></font></p> +<p align="center">----------------------------------------------------------------------------------</p> +<h3>Introduction</h3> + +By default, you will only see the basic settings for the new entry. Clicking "Show More" will give you access to some extended settings that can be interesting but mostly useless for you.<br><br> +<b>Bold options must be entered</b> for a usefull entry, i<i>talic ones are respected by the search feature</i>. +<br><br> +<h3>Basic settings</h3> + +<b>Name:</b><br> +This is the visible name of your new entry and can be any string, e.g. "The Gimp".<br> +(Necessary, searchkey) +<br><br> +<b>Is a:</b><br> +Describes the applications genre (generic name), e.g. "Image manipulation"<br> +(Optional, yet not searched - maybe later) +<br><br> +<b>Category:</b><br> +Choose an existing group or add a new one. The hierarchy is represented by seperating slashes ("/"), if you want to enter a slash, you must escape it ("\/")<br> +(Necessary, searchkey) +<br><br> +<b>Command:</b><br> +The command to start the application, e.g. "gimp-remote". On *nix systems, is usually not necessary to pass the full path to the executably, but you can do so, if you want to start an executable that is shadowed by the executable in the path dir, e.g. "/usr/local/gimp-1.3/gimp-remote"<br> +(Necessary, not searched) +<br><br> +<b>Keywords:</b><br> +Comma separated list of keywords that refer to this application during search, e.g. "image manipulation,pixel,photoshop".<br> +Please note:<br> +1. search is <i>not</i> case sensitive<br> +2. search finds partial matches, so it's <i>not</i> necessary to add e.g. "image,image manipulation"<br> +3. different from the applications name, the keyword list will be translated (if) so if you think like "'KImage' allready contains 'image', so i don't need it as keyword" <b>you're wrong!</b><br> +4. Finding good keywords is not simple, but in general use striking ones! "editor" is not a very good keyword, as allmost everything is an editor. (Gimp is a pixel-editor, KHexedit is a hex-editor, KEdit is a text-editor, a config dialog is a config-editor, ...)<br> +(Optional, searchkey) +<br><br> +<b>Description:</b><br> +This is the longtext description of your application (not a helptext, though ;), e.g. "A powerfull image manipulator with a UI similar to photoshop. Supports Layers, filters, scripting, blahblahblah..." +You can use Qt richtext tags and there's no limit on the size, but keep it usefull ;) let's say something about 200 chars at max.<br> +(Optional, not searched)</string> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="undoRedoEnabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>buttonClose</cstring> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>231</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonClose</sender> + <signal>released()</signal> + <receiver>HelpDialog</receiver> + <slot>close()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>ktextedit.h</includehint> +</includehints> +</UI> diff --git a/starter/linkconfig.ui b/starter/linkconfig.ui new file mode 100644 index 0000000..b156900 --- /dev/null +++ b/starter/linkconfig.ui @@ -0,0 +1,184 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>LinkConfig</class> +<widget class="QDialog"> + <property name="name"> + <cstring>LinkConfig</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>438</width> + <height>173</height> + </rect> + </property> + <property name="caption"> + <string>Configure Link</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="1" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>206</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="KIconButton" row="0" column="1"> + <property name="name"> + <cstring>icon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>64</width> + <height>64</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>64</width> + <height>64</height> + </size> + </property> + <property name="text"> + <string></string> + </property> + <property name="iconSize"> + <number>48</number> + </property> + <property name="strictIconSize"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout3</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><b>Title</b></string> + </property> + </widget> + <widget class="KLineEdit"> + <property name="name"> + <cstring>title</cstring> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><b>Command</b></string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>command</cstring> + </property> + </widget> + </vbox> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>LinkConfig</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>LinkConfig</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kicondialog.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/starter/menu.cpp b/starter/menu.cpp new file mode 100644 index 0000000..81611d0 --- /dev/null +++ b/starter/menu.cpp @@ -0,0 +1,2249 @@ +#include <qcheckbox.h> +#include <qcursor.h> +#include <qdatetime.h> +#include <qdir.h> +#include <kpopupmenu.h> +#include <qobjectlist.h> +#include <qpainter.h> +#include <qptrlist.h> +#include <qstrlist.h> +#include <qstringlist.h> +#include <qvbox.h> +#include <dcopclient.h> +#include <kapplication.h> +#include <kconfig.h> +#include <kcombobox.h> +#include <kdeversion.h> +#include <kurl.h> +#include <kfileitem.h> +#include <kicondialog.h> +#include <kiconloader.h> +#include <kkeybutton.h> +#include <klistbox.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kpixmapeffect.h> +#include <kprocess.h> +#include <kurifilter.h> +#include <kurl.h> +#include <krun.h> +#include <kservice.h> +#include <kshortcut.h> +#include <ksqueezedtextlabel.h> +#include <kstandarddirs.h> +#include <ksycocaentry.h> +#include <ktextedit.h> +#include <kurlrequester.h> +#include <kwin.h> +//WARNING: THIS IS NOT PORTABLE! +// #include <X11/Xlib.h> +// #include <X11/Xatom.h> +#include <X11/keysym.h> +#include <X11/extensions/XTest.h> +#include <fixx11h.h> +#include <stdlib.h> +// TO HERE -------- +//#include "kdrawer.h" +#include "baghiralinkdrag.h" +#include "menu.h" +#include "config.h" +#include "help.h" +#include "linkconfig.h" +#define OPAQUE 0xffffffff +#define OPACITY "_KDE_WM_WINDOW_OPACITY" + +#define _BIGSIZE_(_s_) ((_s_ == 16) ? 22 :\ +(_s_ == 22) ? 32 :\ +(_s_ == 32) ? 48 :\ +(_s_ == 48) ? 64 :\ +(_s_ == 64) ? 128 :\ +(int)(_s_*1.4)) + +//TODO: sort functions alphabetically, split files by classes... refactoring sucks ;) + +static QColor commentColor; +static QColor infoColor; +static KConfig *config; +static bool useKTTS; + + +QString spell(const QString text) +{ + QString result; + for (uint i = 0; i < text.length(); i++) + { + result += " "; result += text[i]; + } + return result; +} + +/* + Internal class to get access to protected QBoxLayout-members +*/ +class MyVBoxLayout : public QVBoxLayout +{ + friend class AppList; +public: + MyVBoxLayout( QLayout * parentLayout, int spacing = -1, const char * name = 0 ) + : QVBoxLayout( parentLayout, spacing, name ) {} +}; + +StartMenuButton::StartMenuButton( int size, QString icon, QString title, QString command, Orientation orientation, QWidget* parent, const char * name) : QWidget(parent, name), m_title(title), m_command(command), m_icon(icon), m_orientation(orientation), _moving(false) +{ + setBackgroundOrigin(QWidget::ParentOrigin); + int bigSize = _BIGSIZE_(size); + m_pix = KGlobal::iconLoader()->loadIcon(icon, KIcon::Desktop, size); + m_hoverPix = KGlobal::iconLoader()->loadIcon(icon, KIcon::Desktop, bigSize); + m_pixmapLabel = new QLabel(this, name); + m_pixmapLabel->setPixmap(m_pix); + m_pixmapLabel->setBackgroundOrigin(QWidget::AncestorOrigin); + QBoxLayout* layout; + if (orientation == Horizontal) + { + m_titleLabel = new QLabel("<qt><b>" + title + "</b></qt>", this, name); + m_titleLabel->setBackgroundOrigin(QWidget::AncestorOrigin); + m_titleLabel->setTextFormat( Qt::RichText ); + m_titleLabel->setAlignment ( Qt::AlignLeft | Qt::AlignVCenter ); + m_pixmapLabel->setFixedSize(bigSize+2,bigSize+2); + m_pixmapLabel->setAlignment ( Qt::AlignCenter ); + layout = new QHBoxLayout ( this ); + layout->addSpacing ( 5 ); + layout->addWidget(m_pixmapLabel,0,Qt::AlignCenter); + layout->addSpacing ( 2 ); + layout->addWidget(m_titleLabel,1); + layout->addSpacing ( 5 ); + } + else if (orientation == Vertical) + { + m_titleLabel = new QLabel("<qt><b>" + title + "</b></qt>", this, name); + m_titleLabel->setBackgroundOrigin(QWidget::AncestorOrigin); + m_titleLabel->setTextFormat( Qt::RichText ); + m_titleLabel->setAlignment ( Qt::AlignHCenter | Qt::AlignTop ); + m_pixmapLabel->setFixedSize(bigSize+2,bigSize+2); + m_pixmapLabel->setAlignment ( Qt::AlignCenter ); + layout = new QVBoxLayout ( this ); + layout->addSpacing ( 5 ); + layout->addWidget(m_pixmapLabel,0,Qt::AlignCenter); + layout->addSpacing ( 2 ); + layout->addWidget(m_titleLabel,1); + layout->addSpacing ( 5 ); + } + else + { + setFixedSize(bigSize+2,bigSize+2); + m_pixmapLabel->setAlignment ( Qt::AlignCenter ); + m_pixmapLabel->setFixedSize(bigSize+2,bigSize+2); + } + setCursor(Qt::PointingHandCursor); +} + +void StartMenuButton::reloadIcon(int size) +{ + int bigSize = _BIGSIZE_(size); + if (m_orientation == Status) + setFixedSize(bigSize+2,bigSize+2); + m_pixmapLabel->setFixedSize(bigSize+2,bigSize+2); + m_pix = KGlobal::iconLoader()->loadIcon(m_icon, KIcon::Desktop, size); + m_hoverPix = KGlobal::iconLoader()->loadIcon(m_icon, KIcon::Desktop, bigSize); + m_pixmapLabel->setPixmap(m_pix); +} + +void StartMenuButton::smartMove(QPoint &pt) +{ +} + +void StartMenuButton::smartMove(int x, int y) +{ + if (!dynamic_cast<Panel*>(parentWidget())) + return; + StartMenuButton *bt = 0L; + QObjectList *kids = const_cast<QObjectList*>(parentWidget()->children()); + QRect dRect(QPoint(x,y), size()); + QRect bRect; + if (kids && !kids->isEmpty()) + { + QObject *o; + for ( o = kids->first(); o; o = kids->next() ) + if ((o != this) && (bt = (dynamic_cast<StartMenuButton*>(o)))) + { + bRect = QRect(bt->pos(), bt->size()); + if (dRect.intersects(bRect)) + break; + bt = 0L; + } + } + if (!bt) + { + move(dRect.topLeft()); + int dst; + if (((Panel*)parentWidget())->orientation() == Qt::Horizontal) + { + dst = pos().x() + width() - parentWidget()->width(); + if (dst > 0) + emit updateSize(1); + else if (pos().x() < 0) + emit updateSize(-1); + } + else + { + dst = pos().y() + height() - parentWidget()->height(); + if (dst > 0) + emit updateSize(1); + else if (pos().y() < 0) + emit updateSize(-1); + } + ((Panel*)parentWidget())->ensureVisible(dRect); + } + else if ( + // left of center of left + (dRect.right() > bRect.right() && dRect.x() < bRect.right() - bRect.width() / 2) || + // right of center of right + (dRect.x() < bRect.x() && dRect.right() > bRect.x() + bRect.width() / 2) || + // up of center of upper + (dRect.bottom() > bRect.bottom() && dRect.y() < bRect.bottom() - bRect.height() / 2) || + // below center of lower + (dRect.y() < bRect.y() && dRect.bottom() > bRect.y() + bRect.height() / 2) + ) + { + QPoint bPt = bt->pos(); + bt->move(pos()); + move(bPt); + } +} + +void StartMenuButton::mouseReleaseEvent ( QMouseEvent * mre) +{ + if (mre->state() & Qt::LeftButton) + { + if (_moving) { _moving = false; return; } + emit pressed(m_command); + return; + } + if (mre->state() & Qt::RightButton) + { + if (!dynamic_cast<Panel*>(parentWidget())) + return; + ((Panel*)parentWidget())->linkConfigDialog->setCaption ( i18n("Configure Link") ); + ((Panel*)parentWidget())->linkConfigDialog->title->setText(m_title); + ((Panel*)parentWidget())->linkConfigDialog->command->setText(m_command); + ((Panel*)parentWidget())->linkConfigDialog->icon->setIcon(m_icon); + disconnect(((Panel*)parentWidget())->linkConfigDialog->buttonOk, SIGNAL(clicked()), 0, 0); + connect(((Panel*)parentWidget())->linkConfigDialog->buttonOk, SIGNAL(clicked()), ((Panel*)parentWidget())->linkConfigDialog, SLOT(accept())); + connect(((Panel*)parentWidget())->linkConfigDialog->buttonOk, SIGNAL(clicked()), this, SLOT(edit())); + ((Panel*)parentWidget())->linkConfigDialog->exec(); + } +} + +void StartMenuButton::edit() +{ + if (!dynamic_cast<Panel*>(parentWidget())) + return; + m_command = ((Panel*)parentWidget())->linkConfigDialog->command->text(); + if (m_command.isEmpty()) + { + deleteLater(); + return; + } + m_icon = ((Panel*)parentWidget())->linkConfigDialog->icon->icon(); + m_title = ((Panel*)parentWidget())->linkConfigDialog->title->text(); + int bigSize = _BIGSIZE_(((Panel*)parentWidget())->_size); + m_pix = KGlobal::iconLoader()->loadIcon(m_icon, KIcon::Desktop, ((Panel*)parentWidget())->_size); + m_hoverPix = KGlobal::iconLoader()->loadIcon(m_icon, KIcon::Desktop, bigSize); + m_pixmapLabel->setPixmap(m_pix); + if (m_orientation == Horizontal || m_orientation == Vertical) + m_titleLabel->setText("<qt><b>" + m_title + "</b></qt>"); + ((Panel*)parentWidget())->linkConfigDialog->close(); +} + +void Panel::addIcon() +{ + if (!linkConfigDialog->command->text().isEmpty()) + addIcon ( linkConfigDialog->icon->icon(), linkConfigDialog->title->text(), linkConfigDialog->command->text(), iconAddPosition ); +} + +void StartMenuButton::mouseMoveEvent ( QMouseEvent * mme ) +{ + if (!dynamic_cast<Panel*>(parentWidget())) + return; + if (mme->state() & Qt::LeftButton) + { + _moving = true; + QPoint pt = mapToParent(mme->pos()); + if (!(mme->state() & Qt::ShiftButton)) + { + if (pt.y() < -5 || pt.y() > parentWidget()->height() + 5 || pt.x() < -5 || pt.x() > parentWidget()->width() + 5) + { + BaghiraLinkDrag *d = new BaghiraLinkDrag( m_title, m_command, m_icon, -1, parentWidget() ); + d->setPixmap(m_hoverPix, QPoint(m_hoverPix.width()/2, m_hoverPix.height()/2)); + d->drag(); + if ((mme->state() & Qt::ControlButton) || BaghiraLinkDrag::accepted()) + return; + ((Panel*)parentWidget())->poof(); + // do NOT delete d. + return; + } + } + if (((Panel*)parentWidget())->orientation() == Qt::Horizontal) + smartMove(pt.x() - width()/2, pos().y()); + else + smartMove(pos().x(), pt.y() - height()/2); + } + else + _moving = false; +} + + +void StartMenuButton::enterEvent( QEvent * ) +{ + if (m_orientation == Status) emit hovered(m_title); + m_pixmapLabel->setPixmap(m_hoverPix); +} + +void StartMenuButton::leaveEvent( QEvent * ) +{ + if (m_orientation == Status) emit unhovered(); + m_pixmapLabel->setPixmap(m_pix); +} + + +StartMenuEntry::StartMenuEntry(KService * service, QString relPath, int size, bool newbie, QWidget * parent) : QWidget(parent) +{ + groupPath = relPath; + forNewbie = newbie; + if (config) // might be first use ever... + { + QString tmpString = config->readEntry(service->desktopEntryName()); + if (tmpString != QString::null) + { + usage = tmpString.section ( ' ', 0, 0 ).toUInt(); + lastUse = QDate::fromString(tmpString.section ( ' ', 1, 1 ), Qt::ISODate); + // ranking is naiv but hopefully usefull for the beginning: often usage increases rank, time to the last usage decreases. "8" is just a "random" offset - the idea is that apps that have been used within the last week should have a higher rank than apps that don't appear in the list - setting these to - infinity isn't a good idea as well, as they might be brand new + rank = 8 + usage - lastUse.daysTo(QDate::currentDate()); + } + else + { + usage = 0; + rank = 0; // neutral rank + } + } + else + { + qWarning("no valid config!"); + usage = 0; + rank = 0; // neutral rank + } + int bigSize = _BIGSIZE_(size); + isCurrent = false; + m_service = service; + exec = m_service->exec(); + display = false; + m_pix = m_service->pixmap( KIcon::Desktop, size ); + m_hoverPix = m_service->pixmap( KIcon::Desktop, bigSize ); + m_titleLabel = new QLabel("<qt><h3>" + m_service->name() + "</h3></qt>", this); + m_titleLabel->setTextFormat( Qt::RichText ); + m_commentLabel = new QLabel(m_service->comment(), this); + m_commentLabel->setPaletteForegroundColor(commentColor); + m_commentLabel->setTextFormat( Qt::RichText ); + m_pixmapLabel = new QLabel(this); + m_pixmapLabel->setFixedSize ( bigSize+2, bigSize+2 ); + m_pixmapLabel->setAlignment(Qt::AlignCenter); + m_pixmapLabel->setPixmap(m_pix); + QVBoxLayout* spacer = new QVBoxLayout ( this ); + spacer->addSpacing ( 1 ); + QHBoxLayout* layout = new QHBoxLayout ( spacer ); + layout->addWidget(m_pixmapLabel); + layout->addSpacing ( 2 ); + QVBoxLayout* textLayout = new QVBoxLayout ( layout ); + layout->setStretchFactor ( textLayout, 1 ); + textLayout->addWidget(m_titleLabel); + textLayout->addWidget(m_commentLabel); + layout->addStretch(); + spacer->addSpacing ( 1 ); + setCursor(Qt::PointingHandCursor); +} + +void StartMenuEntry::reloadIcon(int size) +{ + int bigSize = _BIGSIZE_(size); + m_pixmapLabel->setFixedSize(bigSize+2,bigSize+2); + m_pix = m_service->pixmap( KIcon::Desktop, size ); + m_hoverPix = m_service->pixmap( KIcon::Desktop, bigSize ); + m_pixmapLabel->setPixmap(m_pix); +} + +StartMenuEntry::~StartMenuEntry() +{ +// if (m_service) delete m_service; m_service = 0L; +} + +void StartMenuEntry::saveStats() +{ + if (usage > 0) + config->writeEntry(m_service->desktopEntryName(), QString::number(usage) + " " + lastUse.toString(Qt::ISODate)); +} + +bool StartMenuEntry::operator==( const StartMenuEntry& se ) const +{ + return rank == se.rank; +} +bool StartMenuEntry::operator!=( const StartMenuEntry& se ) const +{ + return rank != se.rank; +} +bool StartMenuEntry::operator<( const StartMenuEntry& se ) const +{ + /* + if (rank == se.rank) + return m_titleLabel->text() < se.title(); + else + */ + return rank > se.rank; // to have descending sort order (we could also use a negative ranking...) +} +bool StartMenuEntry::operator>( const StartMenuEntry& se ) const +{ + /* + if (rank == se.rank) + return m_titleLabel->text() > se.title(); + else + */ + return rank < se.rank; // to have descending sort order (we could also use a negative ranking...) +} +bool StartMenuEntry::operator==( const double& d ) const +{ + return rank == d; +} +bool StartMenuEntry::operator!=( const double& d ) const +{ + return rank != d; +} +bool StartMenuEntry::operator<( const double& d ) const +{ + return rank > d; // to have descending sort order (we could also use a negative ranking...) +} +bool StartMenuEntry::operator>( const double& d ) const +{ + return rank < d; // to have descending sort order (we could also use a negative ranking...) +} + +void StartMenuEntry::mouseReleaseEvent ( QMouseEvent * e ) +//TODO: do funny stuff with other buttons (e.g. provide edit dialog) +{ + if (e->button() == Qt::LeftButton) + { + m_pixmapLabel->setPixmap(m_pix); + execute(); + if (!(e->state() & Qt::ControlButton)) + emit pressed(); + } + if (e->button() == Qt::RightButton) + { + emit popup(this); + } +} + +void StartMenuEntry::mouseMoveEvent ( QMouseEvent * mme ) +{ + if (mme->state() & Qt::LeftButton && (mme->pos().y() < 0 || mme->pos().y() > height() || mme->pos().x() < 0 || mme->pos().x() > width())) + { + BaghiraLinkDrag *d = new BaghiraLinkDrag( m_service->name(), m_service->exec(), m_service->icon(), -1, parentWidget() ); + d->setPixmap(m_hoverPix, QPoint(m_hoverPix.width()/2, m_hoverPix.height()/2)); + d->dragCopy(); + // do NOT delete d. + } +} + +void StartMenuEntry::keyPressEvent ( QKeyEvent * e ) +{ + switch (e->key()) + { + case Qt::Key_Escape: + emit closeMenu(); + break; + case Qt::Key_Return: + case Qt::Key_Enter: + execute(); + if (!(e->state() & Qt::ControlButton)) + emit pressed(); + break; + case Qt::Key_Down: + emit appDown(); + break; + case Qt::Key_Up: + emit appUp(); + break; + case Qt::Key_Home: // ->searchline + select + case Qt::Key_Left: + emit appLeft(); + break; + default: + break; + } +} + +QString StartMenuEntry::title() +{ + return m_titleLabel->text(); +} + +void StartMenuEntry::focusInEvent ( QFocusEvent * ) +{ + isCurrent = true; + emit hovered("[ " + groupPath + " ] " + exec); + if (useKTTS) + { + QString text = i18n("for TTS output, telling which item is focussed (keyboard) and than reads the comment", "%1 focussed. %2").arg(m_titleLabel->text()).arg(m_commentLabel->text()); + emit sayText(text); + } + setPaletteBackgroundColor(KGlobalSettings::highlightColor()); + m_commentLabel->setPaletteBackgroundColor(KGlobalSettings::highlightColor()); + setPaletteForegroundColor(KGlobalSettings::highlightedTextColor()); + m_commentLabel->setPaletteForegroundColor(KGlobalSettings::highlightedTextColor()); +} + +void StartMenuEntry::focusOutEvent ( QFocusEvent * ) +{ + emit unhovered(); + isCurrent = false; + setPaletteBackgroundColor(KGlobalSettings::baseColor()); + m_commentLabel->setPaletteBackgroundColor(KGlobalSettings::baseColor()); + if (hasMouse()) + { + setPaletteForegroundColor(KGlobalSettings::highlightColor()); + m_commentLabel->setPaletteForegroundColor(KGlobalSettings::highlightColor()); + } + else + { + setPaletteForegroundColor(KGlobalSettings::textColor()); + m_commentLabel->setPaletteForegroundColor(commentColor); + } +} + +void StartMenuEntry::enterEvent( QEvent * ) +{ + emit hovered("[ " + groupPath + " ] " + exec); + if (useKTTS) + { + QString text = i18n("for TTS output, telling which item is hovered (mouse) and than reads the comment", "%1 hovered. %2").arg(m_titleLabel->text()).arg(m_commentLabel->text()); + emit sayText(text); + } + if (!isCurrent) + { + setPaletteForegroundColor(KGlobalSettings::highlightColor()); + m_commentLabel->setPaletteForegroundColor(KGlobalSettings::highlightColor()); + } + m_pixmapLabel->setPixmap(m_hoverPix); +} + +void StartMenuEntry::leaveEvent( QEvent * ) +{ + emit unhovered(); + if (!isCurrent) + { + setPaletteForegroundColor(KGlobalSettings::textColor()); + m_commentLabel->setPaletteForegroundColor(commentColor); + } + m_pixmapLabel->setPixmap(m_pix); +} + +void StartMenuEntry::execute() +{ + usage++; + lastUse = QDate::currentDate(); + rank = 8 + usage; + KApplication::startServiceByDesktopPath(m_service->desktopEntryPath(), QStringList(), 0, 0, 0, "", true); + emit executed(); +} + +Panel::Panel(int size, QWidget * parent, const char * name) : QWidget(parent, name), _size(size), _draggedMe(false), _count(0), _orientation(Qt::Horizontal), _poof(0), _poofIndex(0), _poofAnimPix(0), _poofPix(0) +{ + linkConfigDialog = new LinkConfig(); + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); +// setPaletteBackgroundColor(KGlobalSettings::highlightColor()); + setAcceptDrops(true); + config->setGroup("Panel"); + QStringList commands = config->readListEntry("Commands", '§'); + QStringList icons = config->readListEntry("Icons", '§'); + QStringList offsets = config->readListEntry("Offsets", '§'); + QStringList titles = config->readListEntry("Titles", '§'); + QStringList::Iterator it1 = commands.begin(); + QStringList::Iterator it2 = icons.begin(); + QStringList::Iterator it3 = offsets.begin(); + QStringList::Iterator it4 = titles.begin(); + while (it1 != commands.end() && + it2 != icons.end() && + it3 != offsets.end() && + it4 != titles.end()) + { + addIcon(*it2, *it4, *it1, QPoint((*it3).toInt(),0)); + ++it1; + ++it2; + ++it3; + ++it4; + } +} + +void Panel::save(KConfig *config) +{ + config->setGroup("Panel"); + QObjectList *kids = const_cast<QObjectList*>(children()); + StartMenuButton *bt = 0; + if (kids && !kids->isEmpty()) + { + QStringList icons; + QStringList titles; + QStringList commands; + QStringList offsets; + QObject *o; + for ( o = kids->first(); o; o = kids->next() ) + if (bt = (dynamic_cast<StartMenuButton*>(o))) + { + icons.append(bt->icon()); + titles.append(bt->title()); + commands.append(bt->command()); + _orientation == Qt::Horizontal ? + offsets.append(QString::number(bt->x())) : + offsets.append(QString::number(bt->y())); + } + config->writeEntry("Commands", commands, '§'); + config->writeEntry("Icons", icons, '§'); + config->writeEntry("Offsets", offsets, '§'); + config->writeEntry("Titles", titles, '§'); + } +} + +void Panel::reloadIcons( int size) +{ + _size = size; + if (_orientation == Qt::Horizontal) + { + setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + setFixedHeight(_BIGSIZE_(_size)+4); + setMaximumWidth(32767); + } + else + { + setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + setFixedWidth(_BIGSIZE_(_size)+4); + setMaximumHeight(32767); + } + QObjectList *kids = const_cast<QObjectList*>(children()); + StartMenuButton *bt = 0; + if (kids && !kids->isEmpty()) + { + QObject *o; + for ( o = kids->first(); o; o = kids->next() ) + if (bt = (dynamic_cast<StartMenuButton*>(o))) + { + bt->reloadIcon(size); + } + } +} + +void Panel::ensureVisible(QRect & rect) +{ + int dx = 0; int dy = 0; + if (rect.width() > clipRegion().boundingRect().width()) + dx = (rect.width() - clipRegion().boundingRect().width())/2 - rect.x(); + else if (rect.right() > clipRegion().boundingRect().right()) + dx = clipRegion().boundingRect().right() - rect.right(); + else if (rect.x() < clipRegion().boundingRect().x()) + dx = clipRegion().boundingRect().x() - rect.x(); + if (rect.height() > clipRegion().boundingRect().height()) + dy = (rect.height() - clipRegion().boundingRect().height())/2 - rect.y(); + else if (rect.bottom() > clipRegion().boundingRect().bottom()) + dy = clipRegion().boundingRect().bottom() - rect.bottom(); + else if (rect.y() < clipRegion().boundingRect().y()) + dy = clipRegion().boundingRect().y() - rect.y(); + scroll(dx, dy); +} + +void Panel::updateSize(int dst) +{ + if (dst > 0) + { + if (_orientation == Qt::Horizontal) + { + resize(width()+dst, height()); + } + else + { + resize(width(), height()+dst); + } + } + else // more complex: resize and reposition all children, so first one is on (0,0) + { + QObjectList *kids = const_cast<QObjectList*>(children()); + if (kids && !kids->isEmpty()) + { + QObject *o; + StartMenuButton *bt; + if (_orientation == Qt::Horizontal) + { + resize(width()-dst, height()); + for ( o = kids->first(); o; o = kids->next() ) + if (bt = (dynamic_cast<StartMenuButton*>(o))) + bt->move(QPoint(bt->x()-dst, bt->y())); + } + else + { + resize(width(), height()-dst); + for ( o = kids->first(); o; o = kids->next() ) + if (bt = (dynamic_cast<StartMenuButton*>(o))) + bt->move(QPoint(bt->x(), bt->y()-dst)); + } + } + } +} + +void Panel::wheelEvent ( QWheelEvent * we ) +{ + if (_orientation == Qt::Vertical) + { + if (we->delta() > 0) + { + if (childrenRect().y() < clipRegion().boundingRect().y()) + { + if (childrenRect().y() + we->delta() < clipRegion().boundingRect().y()) + scroll ( 0, we->delta() ); + else + scroll ( 0, clipRegion().boundingRect().y() - childrenRect().y() ); + } + } + else + { + if (childrenRect().bottom() > clipRegion().boundingRect().bottom()) + { + if (childrenRect().bottom() + we->delta() > clipRegion().boundingRect().bottom()) + scroll ( 0, we->delta() ); + else + scroll ( 0, clipRegion().boundingRect().bottom() - childrenRect().bottom() ); + } + } + } + else + { + if (we->delta() > 0) + { + if (childrenRect().x() < clipRegion().boundingRect().x()) + { + if (childrenRect().x() + we->delta() < clipRegion().boundingRect().x()) + scroll ( we->delta(), 0 ); + else + scroll ( clipRegion().boundingRect().x() - childrenRect().x(), 0 ); + } + } + else + { + if (childrenRect().right() > clipRegion().boundingRect().right()) + { + if (childrenRect().right() + we->delta() > clipRegion().boundingRect().right()) + scroll ( we->delta(), 0 ); + else + scroll ( clipRegion().boundingRect().right() - childrenRect().right(), 0 ); + } + } + } +} + +void Panel::resizeEvent ( QResizeEvent * e) +{ + if (_orientation == Qt::Horizontal) + { + if (e->size().height() != e->oldSize().height()) + { + int h = e->size().height(); + KPixmap bgPix = QPixmap(32, h); + KPixmap bgPix1 = QPixmap(32, h/2); + KPixmap bgPix2 = QPixmap(32, h - bgPix1.height()); + QColor color = palette().color(QPalette::Active, QColorGroup::Background); + KPixmapEffect::gradient( bgPix1, color.light(130), color.dark(105), KPixmapEffect::VerticalGradient, 0); + KPixmapEffect::gradient( bgPix2, color.dark(120), color.light(110), KPixmapEffect::VerticalGradient, 0); + QPainter p(&bgPix); + p.drawPixmap(0,0,bgPix1); + p.drawPixmap(0,bgPix1.height(),bgPix2); + p.end(); + setPaletteBackgroundPixmap( bgPix ); + } + } + else if (_orientation == Qt::Vertical) + { + if (e->size().width() != e->oldSize().width()) + { + int w = e->size().width(); + KPixmap bgPix = QPixmap(w, 32); + KPixmap bgPix1 = QPixmap(w/2, 32); + KPixmap bgPix2 = QPixmap(w - bgPix1.width(), 32); + QColor color = palette().color(QPalette::Active, QColorGroup::Background); + KPixmapEffect::gradient( bgPix1, color.light(110), color.dark(120), KPixmapEffect::HorizontalGradient, 0); + KPixmapEffect::gradient( bgPix2, color.dark(105), color.light(130), KPixmapEffect::HorizontalGradient, 0); + QPainter p(&bgPix); + p.drawPixmap(0,0,bgPix1); + p.drawPixmap(bgPix1.width(),0,bgPix2); + p.end(); + setPaletteBackgroundPixmap( bgPix ); + } + } + QWidget::resizeEvent( e ); +} + +void Panel::poof() +{ + /*if (_draggedMe) + { + _draggedMe = false; + return; + }*/ + QObjectList *kids = const_cast<QObjectList*>(children()); + if (kids && !kids->isEmpty()) + { + QObject *o; + StartMenuButton *bt = 0L; + for ( o = kids->first(); o; o = kids->next() ) + { + bt = 0L; + if ((bt = (dynamic_cast<StartMenuButton*>(o))) && bt->isMoving()) + { + bt->hide(); bt->deleteLater(); bt = 0L; + --_count; + } + } + _poofIndex = 0; + _poofPix = new QPixmap(locateLocal("data", "baghira/poof.png"), "png"); + _poofAnimPix = new QPixmap(_poofPix->width(), _poofPix->width()); + if (!_poof) + _poof = new QWidget(0,0, Qt::WType_TopLevel | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WX11BypassWM); +#if KDE_IS_VERSION(3,3,91) //3.4 beta + KWin::setShadowSize(_poof->winId(), 0); +#endif + _poof->setFixedSize(_poofPix->width(), _poofPix->width()); + int x = QCursor::pos().x() - _poof->width()/2; + int y = QCursor::pos().y() - _poof->height()/2; + QPixmap bgPix = QPixmap::grabWindow( qt_xrootwin(), x, y, _poofPix->width(), _poofPix->width()); + _poof->move(x,y); + _poof->show(); + _poof->setBackgroundOrigin(QWidget::WidgetOrigin); + _poof->setPaletteBackgroundPixmap( bgPix ); + runPoof(); + } +} + +void Panel::runPoof() +{ + if (_poofIndex > 4) + { + _poof->hide(); + delete _poofPix; + _poofPix = 0L; +// delete _poof; +// _poof = 0L; + delete _poofAnimPix; + _poofAnimPix = 0L; + _poofIndex = 0; + return; + } + _poof->erase(); + bitBlt(_poof, 0 ,0, _poofPix, 0, _poofIndex * _poofPix->width(), _poofPix->width(), _poofPix->width(), Qt::AndROP); + ++_poofIndex; + QTimer::singleShot ( 70, this, SLOT(runPoof()) ); // around 15 fps +} + +void Panel::mouseReleaseEvent ( QMouseEvent * mre ) +{ + if (mre->state() & Qt::RightButton) + { + iconAddPosition = mre->pos(); + linkConfigDialog->setCaption ( i18n("New Link") ); + linkConfigDialog->title->clear(); + linkConfigDialog->command->clear(); + linkConfigDialog->icon->resetIcon(); + disconnect(linkConfigDialog->buttonOk, SIGNAL(clicked()), 0, 0); + connect(linkConfigDialog->buttonOk, SIGNAL(clicked()), linkConfigDialog, SLOT(accept())); + connect(linkConfigDialog->buttonOk, SIGNAL(clicked()), this, SLOT(addIcon())); + linkConfigDialog->exec(); + } +} + +void Panel::dragEnterEvent ( QDragEnterEvent *dee ) +{ + if (BaghiraLinkDrag::canDecode(dee)) + { + QObjectList *kids = const_cast<QObjectList*>(children()); + if (kids && !kids->isEmpty()) + { + QObject *o; + StartMenuButton *bt = 0L; + for ( o = kids->first(); o; o = kids->next() ) + if ((bt = (dynamic_cast<StartMenuButton*>(o))) && bt->isMoving()) + // this is just some icon the user drags around ad that accidently left the panel + { + BaghiraLinkDrag::setAccepted(); + // as we cannot access Qts dragmanager and qdragobject doesn't provide a function to cancel the drag, we just emit a virtual escape key... + _draggedMe = true; // ensure to please not poof ;P + XTestFakeKeyEvent(qt_xdisplay(),XKeysymToKeycode(qt_xdisplay(), XK_Escape), true, 0); + XTestFakeKeyEvent(qt_xdisplay(),XKeysymToKeycode(qt_xdisplay(), XK_Escape), false, 0); + XFlush(qt_xdisplay()); + repositionIcon(bt, mapFromGlobal(dee->pos())); + return; + } + } + dee->accept(TRUE); + } + else if (QUriDrag::canDecode(dee) || QTextDrag::canDecode(dee)) + dee->accept(TRUE); +} + +void Panel::dropEvent ( QDropEvent *de ) +{ + QStrList list; + QString title; + QString command; + QString icon; + int index; + if ( BaghiraLinkDrag::decode(de, &title, &command, &icon, &index) ) + { + addIcon ( icon, title, command, QPoint(de->pos().x() - (_BIGSIZE_(_size)/2), de->pos().y() - (_BIGSIZE_(_size)/2))); + BaghiraLinkDrag::setAccepted(); + } + else if ( QUriDrag::decode(de, list) ) + { + char *uri; + KURL url; + for ( uri = list.first(); uri; uri = list.next() ) + { + url = KURL(uri); + if (url.protocol() == "http") + addIcon ( "html", url.host()+(url.path()=="/"?QString(""):url.path()), uri, de->pos() ); + else + { + KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); + addIcon ( item.iconName(), url.fileName().isEmpty()?url.prettyURL():url.fileName(), uri, de->pos() ); + } + } + } + else if (QTextDrag::decode(de, command)) + { + KURL url(command); + if (url.isValid()) + { + if (url.protocol() == "http") + addIcon ( "html", url.host()+(url.path()=="/"?QString(""):url.path()), command, de->pos() ); + else + { + KFileItem item = KFileItem(KFileItem::Unknown, KFileItem::Unknown, url, true); + addIcon ( item.iconName(), url.fileName().isEmpty()?url.prettyURL():url.fileName(), command, de->pos() ); + } + } + else if (command.contains('@')) + { + command.replace(" ",""); + addIcon ( "kmail", command, "mailto:"+command, de->pos() ); + } + else if (command.contains("'at'")) //last chance for anti-spam addy + { + command.replace(" ",""); + command.replace("'at'","@"); + addIcon ( "kmail", command, "mailto:"+command, de->pos() ); + } + else // ok, just take this as siple unknown command and hope the user knows, what she's ;) doing... + { + StartMenuButton *bt = addIcon ( command, command, command, de->pos() ); + } + } +} + +void Panel::repositionIcon(StartMenuButton *button, QPoint pt) +{ + QObjectList *kids = const_cast<QObjectList*>(children()); + if (!kids || kids->isEmpty()) // the easy one ;) + return; + if (kids->count() == 1) // button's for certain the only child ;) + { + if (_orientation == Qt::Horizontal) + button->move(pt.x(),0); + else + button->move(0,pt.y()); + return; + } + QObject *o; + StartMenuButton *bt = 0L; + int xy = 0; + if (_orientation == Qt::Horizontal) + { + if (pt.x() < 0) // append horizontally + { + for ( o = kids->first(); o; o = kids->next() ) + if ((bt = dynamic_cast<StartMenuButton*>(o)) && bt != button && bt->x() + bt->width() > xy ) + xy = bt->x() + bt->width(); + button->move(xy,0); + } + else // inject horizontally + { + // first find possible icon under the position + for ( o = kids->first(); o; o = kids->next() ) + { + if ((bt = dynamic_cast<StartMenuButton*>(o)) && QRect(bt->pos(), bt->size()).contains(pt)) + break; + else + bt = 0l; + } + if (bt) // found? - decide whether to insert left or right + { + if (bt->x() + bt->width()/2 > pt.x()) // move to old icon place + { + button->move(bt->x(), 0); + } + else // move to right + { + button->move(bt->x() + bt->width(), 0); + } + // adjust right icons + for ( o = kids->first(); o; o = kids->next() ) + if ((bt = dynamic_cast<StartMenuButton*>(o)) && bt->x() >= button->x() && bt != button ) + { + bt->move(bt->x() + button->width(), 0); + } + } + else // no collision, just move there + button->move(pt.x(), 0); + } + } + else + { + if (pt.y() < 0) // append vertically + { + for ( o = kids->first(); o; o = kids->next() ) + if ((bt = dynamic_cast<StartMenuButton*>(o)) && bt != button && bt->y() + bt->height() > xy ) + xy = bt->y() + bt->height(); + button->move(0, xy); + } + else // inject vertically + { + // first find possible icon under the position + for ( o = kids->first(); o; o = kids->next() ) + { + if ((bt = dynamic_cast<StartMenuButton*>(o)) && QRect(bt->pos(), bt->size()).contains(pt)) + break; + else + bt = 0l; + } + if (bt) // found? - decide whether to insert up or down + { + if (bt->y() + bt->height()/2 > pt.y()) // move to old icon place + button->move(0, bt->y()); + else // move to right + button->move(0, bt->y() + bt->height()); + // adjust lower icons + for ( o = kids->first(); o; o = kids->next() ) + if ((bt = dynamic_cast<StartMenuButton*>(o)) && bt->y() >= button->y() && bt != button ) + bt->move(0, bt->y() + button->height()); + } + else // no collision, just move there + button->move(0, pt.y()); + } + } +} + +StartMenuButton* Panel::addIcon ( QString icon, QString title, QString command, QPoint pt ) +{ + StartMenuButton *tmpButton = new StartMenuButton(_size, icon, title, command, StartMenuButton::Status, this); + // reposition icon + repositionIcon(tmpButton, pt); + // connections + connect (tmpButton, SIGNAL(hovered(const QString &)), this, SIGNAL(message(const QString &))); + connect (tmpButton, SIGNAL(unhovered()), this, SIGNAL(clearStatus())); + connect (tmpButton, SIGNAL(updateSize(int)), this, SLOT(updateSize(int))); + connect (tmpButton, SIGNAL(pressed(const QString &)), parent(), SLOT(execute(const QString &))); + connect (tmpButton, SIGNAL(pressed(const QString &)), parent(), SLOT(close())); + // done + // inc counter + _count++; + tmpButton->show(); + return tmpButton; +} + +void Panel::setOrientation ( Orientation ori ) +{ + if (_orientation == ori) + return; + _orientation = ori; + QObjectList *kids = const_cast<QObjectList*>(children()); + if (!kids || kids->isEmpty()) + return; + QObject *o; + StartMenuButton *bt = 0L; + for ( o = kids->first(); o; o = kids->next() ) + if (bt = (dynamic_cast<StartMenuButton*>(o))) + bt->move(QPoint(bt->pos().y(), bt->pos().x())); +} + +AppList::AppList(int size, QWidget * parent) : QScrollView(parent), _size(size) +{ + popupBlocked_ = false; + enableClipper( true ); + setFrameStyle(QFrame::LineEditPanel | QFrame::Sunken ); + configDialog_ = new ConfigDialog; + helpDialog_ = new HelpDialog; + connect (((QObject*)configDialog_->buttonHelp), SIGNAL(clicked()), ((QObject*)helpDialog_), SLOT(exec())); + connect (((QObject*)configDialog_->buttonCancel), SIGNAL(clicked()), this, SLOT(unblockPopup())); + m_widget = new QFrame(viewport()); + m_widget->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); + m_widget->setPaletteBackgroundColor(KGlobalSettings::baseColor()); + addChild(m_widget,0,0); + setResizePolicy(QScrollView::AutoOneFit); + m_widget->show(); + infoLayout = new QVBoxLayout(m_widget); + infoLabel = new QLabel(m_widget); + infoLabel->setPaletteBackgroundColor(infoColor); + infoLabel->setTextFormat( Qt::RichText ); + infoLayout->addWidget(infoLabel); + m_VLayout = new QVBoxLayout(infoLayout); + m_iconLoader = KGlobal::iconLoader(); + m_popup = new KPopupMenu(this); + m_popup->insertItem(i18n("Edit Entry"), this, SLOT(editDialog())); + m_popup->insertItem(i18n("Remove Entry"), this, SLOT(removeEntry())); + m_popup->insertSeparator(); + m_popup->insertItem(i18n("Add Entry"), this, SLOT(addDialog())); + init(); +} + +void AppList::mouseReleaseEvent ( QMouseEvent * e ) +{ + if (e->button() == Qt::RightButton) + addDialog(); +} + +void AppList::windowActivationChange ( bool oldActive ) +{ + if (isActiveWindow() && entryList.current()) + entryList.current()->setFocus(); + QScrollView::windowActivationChange ( oldActive ); +} + +void AppList::reloadIcons( int size) +{ + _size = size; + QPtrListIterator<StartMenuEntry> it(entryList); + StartMenuEntry *runner; + while( (runner = it.current()) != 0 ) + { + ++it; + runner->reloadIcon(size); + } +} + +void AppList::addDialog() +{ + disconnect (((QObject*)configDialog_->buttonOk), SIGNAL(clicked()), this, 0); + connect (((QObject*)configDialog_->buttonOk), SIGNAL(clicked()), this, SLOT(addEntry())); + configDialog_->appName->clear(); + configDialog_->category->clearEdit(); + configDialog_->command->clear(); + configDialog_->genericName->clear(); + configDialog_->iconButton->resetIcon(); + configDialog_->keywords->clear(); + configDialog_->startupFeedback->setChecked( true ); + configDialog_->showInSystray->setChecked( false ); + configDialog_->description->clear(); + configDialog_->startInTerminal->setChecked( false ); + configDialog_->terminalSettings->clear(); + configDialog_->startAsUser->setChecked( false ); + configDialog_->username->clear(); + configDialog_->workingDir->clear(); + configDialog_->shortcut->setShortcut(KShortcut::null(), false); + + configDialog_->setCaption ( i18n("New Entry") ); + ((QWidget*)(configDialog_->extendedGroup))->hide(); + configDialog_->buttonDetail->setDown ( false ); + configDialog_->adjustSize(); + configDialog_->show(); +} + +void AppList::addEntry() +{ + QString fullpath = configDialog_->category->currentText(); + while (fullpath[0] == '/') // remove leading "/"'s + { + fullpath.remove(0,1); + } + fullpath = KService::newServicePath(true, fullpath + configDialog_->appName->text()); +//qWarning("%s",fullpath.ascii()); + writeEntry(fullpath); + KService *s = new KService(fullpath); + QStringList list(KServiceGroup::group(configDialog_->category->currentText())->caption()); + StartMenuEntry *sme = addApp(s, list, configDialog_->category->currentText()); + sme->rank = 0xFFFFFF; // hype rank to max, i.e. keep this entry on top of everything - for this session or until first use + sme->show(); + sort(); +} + +void AppList::removeEntry() +{ + popupBlocked_ = true; + if (KMessageBox::questionYesNo (this, i18n("<qt>Are you sure you want to remove<br> %1</qt>").arg(handledEntry->title()), i18n("Remove ALI entry")) == KMessageBox::Yes) + { + qWarning("gonna delete!"); + writeEntry(handledEntry->m_service->locateLocal(), true); + handledEntry->hide(); + entryList.removeRef(handledEntry); + delete handledEntry; + handledEntry = 0L; + } + popupBlocked_ = false; +} + +void AppList::editDialog() +{ + if (!handledEntry) + return; + popupBlocked_ = true; + disconnect (((QObject*)configDialog_->buttonOk), SIGNAL(clicked()), this, 0); + connect (((QObject*)configDialog_->buttonOk), SIGNAL(clicked()), this, SLOT(editEntry())); + configDialog_->appName->setText(handledEntry->m_service->name()); + configDialog_->category->setCurrentItem (handledEntry->groupPath, false); + configDialog_->showInSystray->setChecked( handledEntry->m_service->exec().contains("ksystraycmd ") ); + if (!configDialog_->showInSystray->isChecked()) + configDialog_->command->setURL(handledEntry->m_service->exec()); + else + configDialog_->command->setURL(handledEntry->m_service->exec().right(handledEntry->m_service->exec().length() - (handledEntry->m_service->exec().findRev("ksystraycmd ") + 12))); + configDialog_->genericName->setText(handledEntry->m_service->genericName()); + configDialog_->iconButton->setIcon(handledEntry->m_service->icon ()); + configDialog_->keywords->setText(handledEntry->m_service->keywords().join(",")); + configDialog_->startupFeedback->setChecked( handledEntry->m_service->property ( "StartupNotify" ).toBool()); + configDialog_->description->setText(handledEntry->m_service->comment()); + configDialog_->startInTerminal->setChecked( handledEntry->m_service->terminal() ); + configDialog_->terminalSettings->setText(handledEntry->m_service->terminalOptions()); + configDialog_->startAsUser->setChecked( handledEntry->m_service->substituteUid() ); + configDialog_->username->setText(handledEntry->m_service->username()); + configDialog_->workingDir->setURL(handledEntry->m_service->path()); +// KKeyButton* shortcut; + + configDialog_->setCaption ( i18n("Edit Entry") ); + ((QWidget*)(configDialog_->extendedGroup))->hide(); + configDialog_->buttonDetail->setDown ( false ); + configDialog_->adjustSize(); + configDialog_->show(); +} + +void AppList::editEntry() +{ + QString fullpath; + if (handledEntry->groupPath == configDialog_->category->currentText()) // group not changed + fullpath = handledEntry->m_service->locateLocal(); // find a local replacement path + else // more complex: remove (del/shadow) entry from old group and create one in the new group + { + writeEntry(handledEntry->m_service->locateLocal(), true); //hide from old group + fullpath = configDialog_->category->currentText(); + while (fullpath[0] == '/') // remove leading "/"'s + fullpath.remove(0,1); + fullpath = KService::newServicePath(true, fullpath + configDialog_->appName->text()); // find new path + } + writeEntry(fullpath); + handledEntry->hide(); + QDate lu = handledEntry->lastUse; + uint u = handledEntry->usage; + entryList.removeRef(handledEntry); + delete handledEntry; + handledEntry = 0L; + KService *s = new KService(fullpath); + QStringList list(KServiceGroup::group(configDialog_->category->currentText())->caption()); + StartMenuEntry *sme = addApp(s, list, configDialog_->category->currentText()); + sme->lastUse = lu; + sme->usage = u; + sme->rank = 8 + u - lu.daysTo(QDate::currentDate()); + if (!config) config = new KConfig("bStarter", false, false); + config->setGroup("Statistics"); + sme->saveStats(); + delete config; + config = 0L; + sme->show(); + sort(); + popupBlocked_ = false; +} + +void AppList::writeEntry(QString path, bool hidden ) +{ + KConfig *config = new KConfig(path); + config->setDesktopGroup(); + + if (!configDialog_->description->text().isEmpty()) + config->writeEntry("Comment", configDialog_->description->text()); + if (!configDialog_->command->url().isEmpty()) + if (configDialog_->showInSystray->isChecked()) + config->writeEntry("Exec", "ksystraycmd " + configDialog_->command->url()); + else + config->writeEntry("Exec", configDialog_->command->url()); + if (!configDialog_->genericName->text().isEmpty()) + config->writeEntry("GenericName", configDialog_->genericName->text()); + if (hidden) + config->writeEntry("Hidden", true); + else if (config->readBoolEntry("Hidden", false)) + config->writeEntry("Hidden", false); + if (!configDialog_->iconButton->icon().isNull()) + config->writeEntry("Icon", configDialog_->iconButton->icon()); + if (!configDialog_->keywords->text().isEmpty()) + config->writeEntry("Keywords", QStringList::split(',', configDialog_->keywords->text())); + if (!configDialog_->appName->text().isEmpty()) + config->writeEntry("Name", configDialog_->appName->text()); + if (!configDialog_->workingDir->url().isEmpty()) + config->writeEntry("Path", configDialog_->workingDir->url()); + if (configDialog_->startupFeedback->isChecked()) + config->writeEntry("StartupNotify", true); + if (configDialog_->startInTerminal->isChecked()) + { + config->writeEntry("Terminal", 1); + if (!configDialog_->terminalSettings->text().isEmpty()) + config->writeEntry("TerminalOptions", configDialog_->terminalSettings->text()); + } + config->writeEntry("Type", "Application"); + if (configDialog_->startAsUser->isChecked()) + { + config->writeEntry("X-KDE-SubstituteUID", true); + if (!configDialog_->username->text().isEmpty()) + config->writeEntry("X-KDE-Username", configDialog_->username->text()); + } + + delete config; + +// configDialog_->category->setCurrentItem (handledEntry->m_service->categories().join("/"), true); +} + +void AppList::popup(StartMenuEntry* entry) +{ + if (popupBlocked_ && configDialog_->isShown()) + return; + handledEntry = entry; + m_popup->popup(QCursor::pos()); +} + +void AppList::sort() +{ + // first clean the layout (i assume that QLayout::remove() will search from beginning so removing over the current order will be quite fast) + QPtrListIterator<StartMenuEntry> it(entryList); + StartMenuEntry *runner; + while( (runner = it.current()) != 0 ) + { + ++it; + m_VLayout->remove ( runner ); + } + ((MyVBoxLayout*)m_VLayout)->deleteAllItems(); // get rid of the stretch + // then sort the list + entryList.sort(); + it.toFirst(); + // now rebuild the layout from new list + while( (runner = it.current()) != 0 ) + { + ++it; + m_VLayout->addWidget ( runner ); + } + m_VLayout->addStretch(1); // add final stretch +} + +void AppList::init() +{ + m_root = KServiceGroup::group(QString::null); + + if (!m_root || !m_root->isValid()) + { + qWarning("ROOT NOT FOUND"); + return; + } + favItemAmount = config->readNumEntry("FavItemAmount", 10); + neewbieApps << "konqueror" << "kmail" << "kppp"; + if (newbie = config->readBoolEntry("firstUse", true)) // '/' is certainly not unescaped part of a filename ;) + { + infoLabel->setText ( i18n("<qt><b>First Session Applications</b></qt>") ); +// delete config; +// config = 0L; + } + else + { + infoLabel->setText ( i18n("<qt><b>Favorite Applications</b><br></qt>") ); + } + config->setGroup("Statistics"); + QStringList captions, paths; + insertGroup(m_root, captions, paths); + paths.sort(); + configDialog_->category->insertStringList(paths); + configDialog_->category->completionObject()->setCompletionMode( KGlobalSettings::CompletionPopupAuto ); + configDialog_->category->completionObject()->insertItems(paths); +// if (config) { delete config; config = 0L; } + sort(); + reset(); +} + +void AppList::save(KConfig *config) +{ + config->setGroup("Statistics"); + QPtrListIterator<StartMenuEntry> it(entryList); + StartMenuEntry *runner; + while( (runner = it.current()) != 0 ) + { + ++it; + runner->saveStats(); + } +} + +void AppList::insertGroup(KServiceGroup *g, QStringList & captions, QStringList & paths) +{ + KServiceGroup::List list = g->entries(true, true, false, false); + + if (list.isEmpty()) + { + return; + } + else + { + captions.append(g->caption()); + if (!categories.contains(g->caption())) + categories.append(g->caption()); + if (!paths.contains(g->relPath())) + paths.append(g->relPath()); + for( KServiceGroup::List::ConstIterator it = list.begin(); it != list.end(); it++) + { + KSycocaEntry *p = (*it); + if (p->isType(KST_KService)) + { + KService *s = static_cast<KService *>(p); + if ((s->name().at(0) == '.')) + continue; + if (s->type() == "Application") + { + addApp(s, captions, g->relPath()); + } + } + else if (p->isType(KST_KServiceGroup)) + { + KServiceGroup *g2 = static_cast<KServiceGroup *>(p); + if ((g2->name().at(0) == '.')) + continue; + insertGroup(g2,captions, paths); + } + } + captions.remove(g->caption()); + } +} + +StartMenuEntry* AppList::addApp(KService * s, QStringList & captions, QString relPath) +{ + StartMenuEntry * tmp = new StartMenuEntry(s, relPath, _size, neewbieApps.find(s->desktopEntryName()) != neewbieApps.end(), m_widget); + connect (tmp, SIGNAL(appUp()), this, SLOT(appUp())); + connect (tmp, SIGNAL(appDown()), this, SLOT(appDown())); + connect (tmp, SIGNAL(appLeft()), this, SLOT(appLeft())); + connect (tmp, SIGNAL(hovered(const QString&)), this, SIGNAL(message(const QString&))); + if (useKTTS) connect (tmp, SIGNAL(sayText(const QString&)), this, SIGNAL(sayText(const QString&))); + connect (tmp, SIGNAL(unhovered()), this, SIGNAL(clearStatus())); + connect (tmp, SIGNAL(pressed()), parent(), SLOT(close())); + connect (tmp, SIGNAL(popup(StartMenuEntry*)), this, SLOT(popup(StartMenuEntry*))); + connect (tmp, SIGNAL(closeMenu()), parent(), SLOT(close())); + connect (tmp, SIGNAL(executed()), this, SLOT(sort())); + m_VLayout->addWidget(tmp); + tmp->hide(); + entryList.append(tmp); + KeyWordList::Iterator it; + if (!(s->name().isNull() || s->name().isEmpty())) + { + it = m_keywordList.insert(s->name(), StartMenuEntryList(), false); + it.data().append( tmp ); + } + QStringList kw; +#if 0 + kw = s->categories(); // THIS IS ****IMPORTANT***** kicker will crash on init if you try to grep through the pointers! + if (!kw.isEmpty()) + { + QStringList::Iterator key; + for ( key = kw.begin(); key != kw.end(); ++key ) + { + if (!((*key).isNull() || (*key).isEmpty())) + { + it = m_keywordList.insJediKnightert(*key, StartMenuEntryList(), false); + it.data().append( tmp ); + } + } + } +#endif + kw = s->keywords(); // THIS IS ****IMPORTANT***** kicker will crash on init if you try to grep through the pointers! + if (!kw.isEmpty()) + { + for ( QStringList::Iterator key = kw.begin(); key != kw.end(); ++key ) + { + if (!((*key).isNull() || (*key).isEmpty())) + { + it = m_keywordList.insert(*key, StartMenuEntryList(), false); + it.data().append( tmp ); + } + } + } + // group captions (so Games/IDSoftware/Quake3 will appear in Games and IDSoftware) + if (!captions.isEmpty()) + { + for ( QStringList::Iterator key = captions.begin(); key != captions.end(); ++key ) + { + if (!((*key).isNull() || (*key).isEmpty())) + { + it = m_groupList.insert(*key, StartMenuEntryList(), false); + it.data().append( tmp ); + } + } + } + return tmp; +} + +void AppList::finish() +{ + entryList.last(); entryList.next(); + m_VLayout->addStretch(1); + categories.sort(); +} + +void AppList::appDown() +{ + StartMenuEntry *save; + if (entryList.current() == 0L/*entryList.getLast()*/) + { + entryList.first(); + save = 0L; + } + else + { + save = entryList.current(); + entryList.next(); + } + for ( StartMenuEntry *runner = entryList.current(); runner; runner = entryList.next() ) + if (runner->isShown()) + { + if (save) save->clearFocus(); + runner->setFocus(); + QPoint pt(0,runner->height()); + pt = runner->mapToParent(pt); + ensureVisible ( pt.x(), pt.y()); + return; + } +// if (currentEntry == entryList.end()) +// currentEntry = entryList.begin(); // keep this somewhere valid +} + +void AppList::appUp() +{ + if (entryList.current() == entryList.getFirst()) + { + entryList.current()->clearFocus(); + entryList.last(); entryList.next(); // we jump out + emit looseKey(); + return; + } + StartMenuEntry *save = entryList.current(); + StartMenuEntry *runner; + if (entryList.current()) + runner = entryList.prev(); + else + runner = entryList.last(); + for ( ; runner != entryList.getFirst(); runner = entryList.prev()) + if (runner->isShown()) + { + if (save) save->clearFocus(); + runner->setFocus(); + QPoint pt(0,0); + pt = runner->mapToParent(pt); + ensureVisible ( pt.x(), pt.y()); + return; + } + if (runner == entryList.getFirst()) + { + if (save) save->clearFocus(); + if (runner->isShown()) + { + runner->setFocus(); + QPoint pt(0,0); + pt = runner->mapToParent(pt); + ensureVisible ( pt.x(), pt.y()); + } + else + { + entryList.last(); entryList.next();// we jump out + emit looseKey(); + } + } +} +void AppList::appLeft() +{ + if (entryList.current()) + { + entryList.current()->clearFocus(); + entryList.last(); entryList.next(); // we jump out + } + emit looseKey(); +} + +void AppList::showCategory(const QString & string) +{ + infoLabel->setText(string); + infoLabel->show(); + StartMenuEntry *it2; + KeyWordList::Iterator it; + for ( it = m_groupList.begin(); it != m_groupList.end(); ++it ) + { + if (it.key() == string) + { + for ( it2 = it.data().first(); it2; it2 = it.data().next()) + it2->display = true; + } + else + { + for ( it2 = it.data().first(); it2; it2 = it.data().next()) + it2->display = it2->display || false; + } + } + uint visibleItems = 0; + for ( it2 = entryList.first(); it2; it2 = entryList.next()) + { + if (it2->display) + { + visibleItems++; + it2->show(); + } + else + it2->hide(); + it2->display = false; + } + if (useKTTS && visibleItems == 0) + { + QString text = i18n("for TTS output, informs the user that no entries are in the currently selected group", "Warning! No Applications in group %1").arg(string); + emit sayText(text); + } +} + +void AppList::search(const QString & string) +{ + StartMenuEntry *it2; + if (string == QString::null || string == "") // empty line - remove all and exit + { + infoLabel->setText ( i18n("<qt><b>Favorite Applications</b><br></qt>") ); + infoLabel->show(); + int i = 0; + for ( it2 = entryList.first(); it2; it2 = entryList.next() ) + { + i < favItemAmount ? it2->show() : it2->hide(); + i++; + } + return; + } + infoLabel->hide(); + // ok, we need a 2pass search: 1st to figure out which to show, 2nd to show or hide things + // the implementation also prevents us from spending time on showing/hiding things and some onscreen flicker, O(k*n(k)*n) + KeyWordList::Iterator it; + //keywords + for ( it = m_keywordList.begin(); it != m_keywordList.end(); ++it ) + { + if (it.key().contains(string, false) > 0) + { + for ( it2 = it.data().first(); it2; it2 = it.data().next()) + it2->display = true; + } + else + { + for ( it2 = it.data().first(); it2; it2 = it.data().next()) + it2->display = it2->display || false; + } + } + //groups + for ( it = m_groupList.begin(); it != m_groupList.end(); ++it ) + { + if (it.key().contains(string, false) > 0) + { + for ( it2 = it.data().first(); it2; it2 = it.data().next()) + it2->display = true; + } + else + { + for ( it2 = it.data().first(); it2; it2 = it.data().next()) + it2->display = it2->display || false; + } + } + //items + uint visibleItems = 0; + for ( it2 = entryList.first(); it2; it2 = entryList.next()) + { + if (it2->display && visibleItems < 50) //limit this to a healthy size + { + visibleItems++; + it2->show(); + } + else + it2->hide(); + it2->display = false; + } + if (useKTTS && visibleItems == 0) + { + QString text = i18n("for TTS output, no entries match the current search text", "Warning! No more Applications left. The entered Text is %1").arg(spell(string)); + emit sayText(text); + } +} + +void AppList::clear() +{ + for ( StartMenuEntry *it = entryList.first(); it; it = entryList.next()) + it->hide(); +} + +void AppList::reset() +{ + newbie ? + infoLabel->setText ( i18n("<qt><b>First Session Applications</b></qt>") ) : + infoLabel->setText ( i18n("<qt><b>Favorite Applications</b><br></qt>") ); + infoLabel->show(); + if (newbie) + { + for ( StartMenuEntry *it = entryList.first(); it; it = entryList.next()) + { + it->forNewbie ? it->show() : it->hide(); + } + } + else + { + uint i = 0; + for ( StartMenuEntry *it = entryList.first(); it; it = entryList.next()) + { + i < favItemAmount ? it->show() : it->hide(); + i++; + } + } + setContentsPos(0, 0); +} + +StartMenu::StartMenu( int size, QWidget * parent, WFlags f ) : QWidget(parent, "StartMenu", f), _size(size), inMove(false) +{ + m_panelPos = StartMenu::Nowhere; + panelLayout = new QGridLayout ( this, 3, 3 ); + config = new KConfig("bStarter", true, false); + config->setGroup("Shell"); + history = config->readListEntry("History"); + config->setGroup("Settings"); + if (useKTTS = config->readBoolEntry("useKTTS", false)) + m_spokenText = 0; + _filterData = new KURIFilterData(); + int r,g,b,r2,g2,b2; + KGlobalSettings::baseColor().getRgb(&r,&g,&b); + KGlobalSettings::textColor().getRgb(&r2,&g2,&b2); + commentColor.setRgb((r+r2)/2,(g+g2)/2,(b+b2)/2); + infoColor.setRgb((3*r+r2)/4,(3*g+g2)/4,(3*b+b2)/4); + currentHistoryItem = history.end(); + header = new QWidget(this, "_B_ALI_HEADER"); + header->installEventFilter(this); + QHBoxLayout *headerLayout = new QHBoxLayout(header, 5, 3); + userButton = new StartMenuButton(_size, "folder_home", QString(getenv("USER")), "~", StartMenuButton::Status, header, "_B_ALI_HEADER"); + headerLayout->addWidget(userButton); + header->setPaletteBackgroundColor(KGlobalSettings::highlightColor()); + connect (userButton, SIGNAL(pressed(const QString &)), this, SLOT(execute(const QString &))); + connect (userButton, SIGNAL(pressed(const QString &)), this, SLOT(close())); + QBoxLayout *mainLayout = new QVBoxLayout(); + panelLayout->addLayout(mainLayout, 1, 1); + mainLayout->addWidget(header); + mainLayout->addSpacing ( 3 ); + QBoxLayout *centerLayout = new QHBoxLayout( mainLayout ); + centerLayout->addSpacing ( 3 ); + + appList = new AppList(_size, this); + appList->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + appList->finish(); + + searchLine = new SearchLine(header); + categoryCombo = new QComboBox(header, "_B_ALI_HEADER"); + headerLayout->addWidget(categoryCombo); + categoryCombo->setLineEdit ( searchLine ); + categoryCombo->insertStringList(appList->categories); + categoryCombo->setEditable ( true ); + categoryCombo->setInsertionPolicy(QComboBox::NoInsertion); + searchLine->installEventFilter(this); + searchLine->setCompletionMode(KGlobalSettings::CompletionAuto); + config->setGroup("Shortcuts"); + // read shortcuts... + QStringList cuts = config->readListEntry ("Shortcuts", ','); + QStringList cats = config->readListEntry ("Categories", ','); + QStringList::Iterator it; + QStringList::Iterator it2 = cats.begin(); + for ( it = cuts.begin(); it != cuts.end(); ++it ) + { + if (it2 == cats.end()) break; + shortcutList.insert(MyKey((*it)),(*it2)); + it2++; + } + //--- + QString PATH(getenv("PATH")); + int n = PATH.contains(':', false); + QStringList list; + for (int i = 0; i < n; i++) + { + QDir execDir(PATH.section(':', i, i)); + list = execDir.entryList(QDir::Files | QDir::Executable, QDir::Name | QDir::IgnoreCase ); + searchLine->completionObject()->insertItems(list); + } + + connect (categoryCombo, SIGNAL(activated( const QString &)), appList, SLOT(showCategory(const QString &))); + connect (searchLine, SIGNAL(typedTextChanged(const QString &)), appList, SLOT(search(const QString &))); + connect (searchLine, SIGNAL(textChanged(const QString &)), this, SLOT(endHistory())); + connect (appList, SIGNAL(looseKey()), searchLine, SLOT(setFocus())); + connect (appList, SIGNAL(looseKey()), searchLine, SLOT(selectAll() )); + connect (kapp, SIGNAL(shutDown()), this, SLOT(save() )); + if (useKTTS) connect (appList, SIGNAL(sayText(const QString&)), this, SLOT(sayText(const QString&) )); + + centerLayout->addWidget(appList,10); + centerLayout->addSpacing ( 3 ); + + m_panel = new Panel(_size, this, "_B_ALI_HEADER"); +// m_panel->installEventFilter(this); + m_panel->setFixedHeight(_BIGSIZE_(_size)+4); + + statusBar = new KSqueezedTextLabel(this); + QFont tmpFnt = statusBar->font(); + tmpFnt.setBold(true); + statusBar->setFont(tmpFnt); + connect (appList, SIGNAL(message(const QString&)), this, SLOT(message(const QString&) )); + connect (appList, SIGNAL(clearStatus()), this, SLOT(clearStatus() )); + connect (m_panel, SIGNAL(message(const QString&)), this, SLOT(centerMessage(const QString&) )); + connect (m_panel, SIGNAL(clearStatus()), this, SLOT(clearStatus() )); + + mainLayout->addSpacing ( 3 ); + mainLayout->addWidget ( statusBar ); + panelLayout->addWidget ( m_panel, 2, 1 ); + m_panel->hide(); + + if (config) { delete config; config = 0L; } +// KDrawer *drawer = new KDrawer(this, KDrawer::Bottom); +} + +void StartMenu::save() +{ + config = new KConfig("bStarter", false, false); + config->setGroup("Shell"); + QStringList lst; + for ( QStringList::Iterator it = history.begin(); it != history.end(); ++it ) + lst.prepend(*it); + config->writeEntry("History", lst); + config->setGroup("Settings"); + config->writeEntry("firstUse", false); + appList->save(config); + m_panel->save(config); + delete config; config = 0L; +} +#if 0 +extern int kicker_screen_number; + +void StartMenu::slotLock() +{ + QCString appname( "kdesktop" ); +// if ( kicker_screen_number ) +// appname.sprintf("kdesktop-screen-%d", kicker_screen_number); + kapp->dcopClient()->send(appname, "KScreensaverIface", "lock()", ""); +} +#endif + +void StartMenu::reloadIcons( int size) +{ + _size = size; + m_panel->reloadIcons(size); + appList->reloadIcons(size); +} + +void StartMenu::setCategory(const QString & category) +{ + categoryCombo->setCurrentItem ( categoryCombo->listBox()->index(categoryCombo->listBox()->findItem(category, Qt::ExactMatch))); + //emit categoryCombo->activated ( category ); // dunno if i'll need that once, needs protected access + appList->showCategory(category); +} + +void StartMenu::updateShortcuts(ShortcutList & list) +{ + shortcutList = list; +} + +void StartMenu::toggleKTTS(bool on) +{ + useKTTS = on; + if (useKTTS) + { + m_spokenText = 0; + QPtrListIterator<StartMenuEntry> it(appList->entryList); + StartMenuEntry *runner; + while( (runner = it.current()) != 0 ) + { + ++it; + connect (runner, SIGNAL(sayText(const QString&)), this, SIGNAL(sayText(const QString&))); + } + connect (appList, SIGNAL(sayText(const QString&)), this, SLOT(sayText(const QString&) )); + } + else + { + QPtrListIterator<StartMenuEntry> it(appList->entryList); + StartMenuEntry *runner; + while( (runner = it.current()) != 0 ) + { + ++it; + disconnect (runner, SIGNAL(sayText(const QString&)), this, SIGNAL(sayText(const QString&))); + } + disconnect (appList, SIGNAL(sayText(const QString&)), this, SLOT(sayText(const QString&) )); + } +} + +SearchLine::SearchLine( QWidget * parent ) : KLineEdit(parent){blocked = false;}; + +void SearchLine::makeCompletion (const QString & string) +{ + if (blocked) {blocked = false; return;} + emit typedTextChanged(string); + KLineEdit::makeCompletion (string); +} + +StartMenu::~StartMenu() +{ +// appList->save(); +} + +void StartMenu::sayText(const QString &text) +{ + // strip tags + QString cleanText; + bool copy = true; + for (uint i = 0; i < text.length(); i++) + { + if (!copy && text[i] == '>') // end tag, set copy true and move on + { + copy = true; + continue; + } + if (copy && text[i] == '<') // tag start, set copy false and move on + { + copy = false; + continue; + } + if (copy) //copy char ;) + cleanText += text[i]; + } + // done + QByteArray data1; + QDataStream arg1(data1, IO_WriteOnly); + arg1 << m_spokenText; // stop what we messaged before (if) + if (!kapp->dcopClient()->send("kttsd", "kspeech", "stopText(uint)", data1)) + qDebug("there was some error using DCOP."); + + QByteArray data, replyData; + QCString replyType; + QDataStream arg(data, IO_WriteOnly); + arg << cleanText << ""; // ask for the full list + if (!kapp->dcopClient()->call("kttsd", "kspeech", "sayText(QString, QString)", data, replyType, replyData)) + qDebug("there was some error using DCOP."); + else + { + QDataStream reply(replyData, IO_ReadOnly); + if (replyType == "uint") + reply >> m_spokenText; + else + qWarning("properties() returned an unexpected type of reply (%s)!",QString(replyType).ascii()); + } +} + +void StartMenu::show() +{ + m_panel->setBackgroundOrigin(QWidget::WidgetOrigin); + statusBar->setBackgroundOrigin(QWidget::ParentOrigin); + searchLine->setText(i18n("Type to search or enter a command")); + searchLine->selectAll(); + searchLine->setFocus(); +// KWin::setOpacity(winId(), 80); + QWidget::show(); +} + +void StartMenu::hide() +{ + emit aboutToHide(); + searchLine->clear(); + appList->reset(); + QWidget::hide(); +} + +void StartMenu::message(const QString &text) +{ + statusBar->setAlignment ( Qt::AlignAuto | Qt::AlignVCenter ); + statusBar->setText(text); +} + +void StartMenu::centerMessage(const QString &text) +{ + statusBar->setAlignment ( Qt::AlignCenter ); + statusBar->setText(text); +} + +void StartMenu::clearStatus() +{ + statusBar->clear(); +} + +void StartMenu::setPanelPosition(PanelPosition p) +{ + if (p == m_panelPos) + return; + panelLayout->remove(m_panel); + switch (p) + { + case StartMenu::South: + m_panel->show(); + if (m_panelPos == StartMenu::Nowhere || m_panelPos == StartMenu::West || m_panelPos == StartMenu::East ) + { +// m_panel->set2SizePolicies(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + m_panel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + m_panel->setOrientation ( Qt::Horizontal ); + m_panel->setFixedHeight(_BIGSIZE_(_size)+4); + m_panel->setMaximumWidth(32767); + } + panelLayout->addWidget(m_panel, 2, 1); + break; + case StartMenu::West: + m_panel->show(); + if (m_panelPos == StartMenu::Nowhere || m_panelPos == StartMenu::South || m_panelPos == StartMenu::North ) + { +// m_panel->set2SizePolicies(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); + m_panel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + m_panel->setOrientation ( Qt::Vertical ); + m_panel->setFixedWidth(_BIGSIZE_(_size)+4); + m_panel->setMaximumHeight(32767); + } + panelLayout->addWidget(m_panel, 1, 0); + break; + case StartMenu::East: + m_panel->show(); + if (m_panelPos == StartMenu::Nowhere || m_panelPos == StartMenu::South || m_panelPos == StartMenu::North ) + { +// m_panel->set2SizePolicies(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding); + m_panel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); + m_panel->setOrientation ( Qt::Vertical ); + m_panel->setFixedWidth(_BIGSIZE_(_size)+4); + m_panel->setMaximumHeight(32767); + } + panelLayout->addWidget(m_panel, 1, 2); + break; + case StartMenu::North: + m_panel->show(); + if (m_panelPos == StartMenu::Nowhere || m_panelPos == StartMenu::West || m_panelPos == StartMenu::East ) + { +// m_panel->set2SizePolicies(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + m_panel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); + m_panel->setOrientation ( Qt::Horizontal ); + m_panel->setFixedHeight(_BIGSIZE_(_size)+4); + m_panel->setMaximumWidth(32767); + } + panelLayout->addWidget(m_panel, 0, 1); + break; + default: + m_panel->hide(); +// break; + } + m_panelPos = p; +} + +void StartMenu::execute(const QString& command) +// adapted from kicker run applet - far more convenient ;) +{ + history.remove(command); + history.append(command); // all - the list is not stored and the user may want to easily correct mistypes of LOOOOOOOOOOOOOOOOOOOONG commands with a lot of "\ "... ;P + QString exec; + + kapp->propagateSessionManager(); + + _filterData->setData( command.stripWhiteSpace() ); + QStringList filters; + filters << "kurisearchfilter" << "kshorturifilter"; + KURIFilter::self()->filterURI( *(_filterData), filters ); + + QString cmd = (_filterData->uri().isLocalFile() ? _filterData->uri().path():_filterData->uri().url()); + + // Nothing interesting. Quit! + if ( cmd.isEmpty() ) + { + return; + } + else if (cmd == "logout") + { + close(); + kapp->requestShutDown(); + } + else + { + switch( _filterData->uriType() ) + { + case KURIFilterData::LOCAL_FILE: + case KURIFilterData::LOCAL_DIR: + case KURIFilterData::NET_PROTOCOL: + case KURIFilterData::HELP: + { + (void) new KRun( _filterData->uri() ); + return; + } + case KURIFilterData::EXECUTABLE: + case KURIFilterData::SHELL: + { + exec = cmd; + if( _filterData->hasArgsAndOptions() ) + cmd += _filterData->argsAndOptions(); + break; + } + case KURIFilterData::UNKNOWN: + case KURIFilterData::ERROR: + default: + return; + } + } + KRun::runCommand( cmd, exec, "" ); + return; +} + + +void StartMenu::endHistory() +{ + currentHistoryItem = history.end(); +} + +void StartMenu::search(const QString & string) +{ + disconnect (searchLine, SIGNAL(textChanged ( const QString & )), this, SLOT(search(const QString &))); + appList->search(string); +} + +bool StartMenu::eventFilter ( QObject * o, QEvent * e ) +{ + if (o == header) + { + if (e->type() == QEvent::MouseButtonPress && ((QMouseEvent*)e)->button() == Qt::LeftButton) + { + inMove = true; + movePoint = ((QMouseEvent*)e)->pos(); + header->grabMouse(Qt::SizeAllCursor); + return true; + } + else if (e->type() == QEvent::MouseButtonRelease && ((QMouseEvent*)e)->button() == Qt::LeftButton) + { + inMove = false; + header->releaseMouse(); + return true; + } + else if (e->type() == QEvent::MouseMove && inMove) + { + move(((QMouseEvent*)e)->globalPos() - movePoint); + return true; + } + else if (e->type() == QEvent::Resize && ((QResizeEvent*)e)->size().height() != ((QResizeEvent*)e)->oldSize().height()) + { + int height = ((QResizeEvent*)e)->size().height(); + KPixmap bgPix = QPixmap(32, height); + KPixmap bgPix1 = QPixmap(32, height/2); + KPixmap bgPix2 = QPixmap(32, height - bgPix1.height()); + QColor buttonColor = ((QWidget*)o)->palette().color(QPalette::Active, QColorGroup::Button); + KPixmapEffect::gradient( bgPix1, buttonColor.light(130), buttonColor, KPixmapEffect::VerticalGradient, 0); + KPixmapEffect::gradient( bgPix2, buttonColor.dark(120), buttonColor.light(110), KPixmapEffect::VerticalGradient, 0); + QPainter p(&bgPix); + p.drawPixmap(0,0,bgPix1); + p.drawPixmap(0,bgPix1.height(),bgPix2); + p.end(); + ((QWidget*)o)->setPaletteBackgroundPixmap( bgPix ); + } + return false; + } + if (o != searchLine) + return false; + QLineEdit *le = (QLineEdit *)o; + if (e->type() == QEvent::KeyPress) + { + QKeyEvent *ke = (QKeyEvent*)e; + if (ke->state() & Qt::ControlButton || ke->state() & Qt::AltButton) + // might be shortcut, set category + { + if (ke->state() == Qt::ControlButton) + { + if (ke->key() == Qt::Key_Up) + { + if (categoryCombo->currentItem() > 0) + { + categoryCombo->setCurrentItem ( categoryCombo->currentItem() - 1 ); + appList->showCategory(categoryCombo->currentText()); + } + return true; + } + if (ke->key() == Qt::Key_Down) + { + if (categoryCombo->currentItem() < categoryCombo->count()) + { + categoryCombo->setCurrentItem ( categoryCombo->currentItem() + 1 ); + appList->showCategory(categoryCombo->currentText()); + } + return true; + } + } + if (ke->key() == Qt::Key_Shift || ke->key() == Qt::Key_Control || ke->key() == Qt::Key_Alt) + return false; + ShortcutList::Iterator it; + for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) + { + if (it.key().modFlags() == ke->state() && it.key().key() == ke->key()) + setCategory( it.data() ); + } + return true; //fire event to prevent lienedit action like ctrl+d -> del etc. + } + switch(ke->key()) + { + case Qt::Key_Return: + case Qt::Key_Enter: + { + execute(le->text()); + if (!(ke->state() & Qt::ControlButton)) + close(); //bye + return true; //don't do anything else + } + case Qt::Key_Backspace: + case Qt::Key_Delete: + { + connect (le, SIGNAL(textChanged ( const QString & )), this, SLOT(search(const QString &))); + break; + } + case Qt::Key_Down: + { + if (history.isEmpty() || currentHistoryItem == history.end()) + { + appList->appDown(); + } + else // navigate history + { + le->blockSignals(true); + le->setText(*currentHistoryItem); + le->blockSignals(false); + currentHistoryItem++; + if (currentHistoryItem == history.end()) + le->selectAll(); + } + return true; //don't scroll the categories + } + case Qt::Key_Up: + { + if (!(history.isEmpty() || currentHistoryItem == history.begin())) + { + currentHistoryItem--; + le->blockSignals(true); + le->setText(*currentHistoryItem); + le->blockSignals(false); + } + return true; //don't scroll the categories + } + case Qt::Key_Escape: + { + close(); //bye + break; + } + default: + break; + } + return false; + } + else if (isVisible() && useKTTS && e->type() == QEvent::FocusIn) + { + QString text = i18n("TTS output", "The searchline has now the focus."); + sayText(text); + } + return false; +} diff --git a/starter/menu.h b/starter/menu.h new file mode 100644 index 0000000..d11a651 --- /dev/null +++ b/starter/menu.h @@ -0,0 +1,320 @@ + +#ifndef STARTMENU_H +#define STARTMENU_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <qpoint.h> +#include <qwidget.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qscrollview.h> +#include <qmap.h> +#include <qpixmap.h> +#include <qsortedlist.h> +#include <qptrlist.h> +#include <klineedit.h> +#include <kservicegroup.h> +#include "mykey.h" + +class KIconLoader; +class QPaintEvent; +class QMouseEvent; +class QEvent; +class QPixmap; +class QVBoxLayout; +class QComboBox; +class StartMenuButton; +class KConfig; +class LinkConfig; + +class Panel : public QWidget//QScrollView +{ + friend class StartMenu; + friend class StartMenuButton; +Q_OBJECT + +public: + Panel(int size = 32, QWidget * parent = 0, const char * name = 0); + Orientation orientation(){ return _orientation; } + void setOrientation ( Orientation o ); +// void addItem ( QWidget *w ); + StartMenuButton* addIcon ( QString icon, QString title, QString command, QPoint pt = QPoint(-1,-1) ); + void save(KConfig* config); + void repositionIcon ( StartMenuButton* bt, QPoint pt ); + void ensureVisible(QRect & rect); + void reloadIcons(int size); + void poof(); +public slots: + void updateSize(int); +protected: + void wheelEvent ( QWheelEvent * ); + void dragEnterEvent ( QDragEnterEvent * ); + void dropEvent ( QDropEvent * ); + void mouseReleaseEvent ( QMouseEvent * e ); + void resizeEvent ( QResizeEvent * ); + LinkConfig *linkConfigDialog; + int _size; +private: + int _count; + Orientation _orientation; + bool _draggedMe; + int _poofIndex; + QPoint iconAddPosition; + QPixmap *_poofPix; + QPixmap *_poofAnimPix; + QWidget *_poof; +private slots: + void addIcon(); + void runPoof(); +signals: + void message(const QString&); + void clearStatus(); +}; + +class QTextDrag; + +class StartMenuButton : public QWidget +{ + friend class Panel; + Q_OBJECT + +public: + enum Orientation { Horizontal = 0, Vertical, Status }; + StartMenuButton ( int size, QString icon, QString title, QString command, Orientation orientation, QWidget* parent = 0, const char * name = 0); + void smartMove(QPoint & pt); // prevents collisions with other childs of parentWidget() + void smartMove(int x, int y); + void reloadIcon(int size); +public slots: + void edit(); +protected: + QString & command(){return m_command;} + QString & title(){return m_title;} + QString & icon(){return m_icon;} + void mouseReleaseEvent ( QMouseEvent * e ); + void mouseMoveEvent ( QMouseEvent * e ); + void enterEvent( QEvent * ); + void leaveEvent( QEvent * ); + bool isMoving() {return _moving;} +private: + Orientation m_orientation; + bool _moving; + QTextDrag *myDrag; + QString m_command; + QString m_title; + QString m_icon; + QLabel* m_titleLabel; + QLabel* m_pixmapLabel; + QPixmap m_pix; + QPixmap m_hoverPix; +signals: + void pressed(const QString &); + void hovered(const QString &); + void unhovered(); + void updateSize(int); +}; + +class KService; +class QDate; +class AppList; + +class StartMenuEntry : public QWidget +{ + friend class AppList; + Q_OBJECT +public: + StartMenuEntry(KService * service, QString relPath, int size = 32, bool neewbie = false, QWidget * parent = 0); + ~StartMenuEntry(); + void reloadIcon(int size); + bool display; + QString title(); + void saveStats(); + int rank; + bool forNewbie; + //--- operators to allow use of qHeapSort() + bool operator==( const StartMenuEntry& se ) const; + bool operator!=( const StartMenuEntry& se ) const; + bool operator<( const StartMenuEntry& se ) const; + bool operator>( const StartMenuEntry& se ) const; + bool operator==( const double& d ) const; + bool operator!=( const double& d ) const; + bool operator<( const double& d ) const; + bool operator>( const double& d ) const; +protected: + void focusInEvent ( QFocusEvent * ); + void focusOutEvent ( QFocusEvent * ); + void mouseReleaseEvent ( QMouseEvent * e ); + void mouseMoveEvent ( QMouseEvent * mme ); + void keyPressEvent ( QKeyEvent * e ); + void enterEvent( QEvent * ); + void leaveEvent( QEvent * ); + KService* m_service; + QString groupPath; + QDate lastUse; + uint usage; +private: + void execute(); + QString exec; + bool isCurrent; + QLabel* m_titleLabel; + QLabel* m_commentLabel; + QLabel* m_pixmapLabel; + QPixmap m_pix; + QPixmap m_hoverPix; +signals: + void closeMenu(); + void pressed(); + void appDown(); + void appUp(); + void appLeft(); + void hovered(const QString &); + void sayText(const QString&); + void unhovered(); + void popup(StartMenuEntry*); + void executed(); +}; + +class KPopupMenu; +class ConfigDialog; +class HelpDialog; + +class AppList : public QScrollView +{ + friend class StartMenu; +Q_OBJECT + +public: + AppList(int size = 32, QWidget * parent = 0); + StartMenuEntry* addApp(KService * service, QStringList & captions, QString relPath); + void finish(); + StartMenuEntry* handledEntry; // for rightclick menu action + void writeEntry(QString path, bool hidden = false); // for add/edit + void reloadIcons(int size); +public slots: + void addEntry(); + void addDialog(); + void removeEntry(); + void editEntry(); + void editDialog(); + void clear(); + void reset(); + void search(const QString & string); + void appDown(); + void appUp(); + void appLeft(); + void sort(); + void showCategory(const QString & string); + void unblockPopup(){popupBlocked_ = false;} +protected: + QStringList categories; + int favItemAmount; + void save(KConfig* config); + void mouseReleaseEvent ( QMouseEvent * e ); + void windowActivationChange ( bool oldActive ); +private: + void init(); + void insertGroup(KServiceGroup *g, QStringList & captions, QStringList & paths); + KServiceGroup::Ptr m_root; + KIconLoader *m_iconLoader; + QLabel *infoLabel; + QVBoxLayout * infoLayout; + QVBoxLayout * m_VLayout; + QFrame * m_widget; + bool newbie; + QStringList neewbieApps; + KPopupMenu *m_popup; + bool popupBlocked_; + int _size; + typedef QSortedList<StartMenuEntry> StartMenuEntryList; + typedef QMap<QString,StartMenuEntryList> KeyWordList; + StartMenuEntryList entryList; + KeyWordList m_keywordList; + KeyWordList m_groupList; + ConfigDialog* configDialog_; + HelpDialog* helpDialog_; +private slots: + void popup(StartMenuEntry*); +signals: + void looseKey(); + void message(const QString&); + void sayText(const QString&); + void clearStatus(); +}; + +class QStringList; + +class SearchLine : public KLineEdit +{ + Q_OBJECT +public: + SearchLine( QWidget * parent ); + bool blocked; +protected slots: + void makeCompletion (const QString &); + void block(){blocked = true;} +signals: + void typedTextChanged(const QString & string); +}; + +class KURIFilterData; +class StarterConfig; +class QSignalMapper; +class KSqueezedTextLabel; + +class StartMenu : public QWidget +{ + friend class starter; // to allow setting the shortcutlis directly + Q_OBJECT +public: + enum PanelPosition { North = 0, South, West, East, Nowhere }; + StartMenu ( int size = 32, QWidget * parent = 0, WFlags f = 0 ); + ~StartMenu(); + void show(); + void hide(); + void reloadIcons(int size); + QStringList & categories(){return appList->categories;}; + typedef QMap<MyKey,QString> ShortcutList; + void updateShortcuts(ShortcutList &); + void setFavItemAmount(int i) {if (appList) appList->favItemAmount = i;} + void setPanelPosition(PanelPosition p); +public slots: + void sayText(const QString &text); + void toggleKTTS(bool); + void setCategory(const QString & category); + void save(); +protected: + bool eventFilter ( QObject * o, QEvent * e ); + ShortcutList shortcutList; +private slots: + void message(const QString &text); + void centerMessage(const QString &text); + void clearStatus(); + void execute(const QString & command); + void search(const QString & string); + void endHistory(); +// void slotLock(); +private: + bool inMove; + uint m_spokenText; + int _size; + QWidget *header; + QPoint movePoint; + KURIFilterData *_filterData; + AppList *appList; + QComboBox *categoryCombo; + SearchLine *searchLine; + KSqueezedTextLabel *statusBar; + Panel *m_panel; + QStringList history; + QStringList::Iterator currentHistoryItem; + PanelPosition m_panelPos; + StartMenuButton *userButton; + QGridLayout *panelLayout; + +signals: + void aboutToHide(); +}; + +#endif diff --git a/starter/mykey.h b/starter/mykey.h new file mode 100644 index 0000000..36a32d2 --- /dev/null +++ b/starter/mykey.h @@ -0,0 +1,73 @@ + +#ifndef MYKEY_H +#define MYKEY_H +#include <qstring.h> + +class MyKey +{ +public: + MyKey(short key, short modFlags){modFlags_ = modFlags; key_ = key;} + MyKey(){modFlags_ = 0; key_ = 0;} + MyKey(QString & string) + { + QString tmpString = string.left(string.findRev('+')); + modFlags_ = 0; + if (tmpString.contains("256")) // QString.setNum(Qt::ShiftButton) + modFlags_ |= Qt::ShiftButton; + if (tmpString.contains("512")) // QString.setNum(Qt::ControlButton) + modFlags_ |= Qt::ControlButton; + if (tmpString.contains("1024")) // QString.setNum(Qt::AltButton) + modFlags_ |= Qt::AltButton; + tmpString = string.right(string.length() - string.findRev('+') - 1); + key_ = tmpString.toShort(); + } + short modFlags() const {return modFlags_;} + short key()const {return key_;} + bool operator==( const MyKey& myKey ) const + { + return (modFlags_ == myKey.modFlags() && key_ == myKey.key()); + } + bool operator!=( const MyKey& myKey ) const + { + return (modFlags_ != myKey.modFlags() || key_ != myKey.key()); + } + bool operator<( const MyKey& myKey ) const + { + return (!(modFlags_ < myKey.modFlags()) || key_ < myKey.key()); + } + bool operator>( const MyKey& myKey ) const + { + return (!(modFlags_ > myKey.modFlags()) && key_ > myKey.key()); + } + QString toString() const + { + QString string; + QString numString; + if (modFlags_ & Qt::ShiftButton) + { + numString.setNum(Qt::ShiftButton); + string += numString; + string += '+'; + } + if (modFlags_ & Qt::ControlButton) + { + numString.setNum(Qt::ControlButton); + string += numString; + string += '+'; + } + if (modFlags_ & Qt::AltButton) + { + numString.setNum(Qt::AltButton); + string += numString; + string += '+'; + } + numString.setNum(key_); + string += numString; + return string; + } +private: + short modFlags_; + short key_; +}; + +#endif diff --git a/starter/po/Makefile.am b/starter/po/Makefile.am new file mode 100644 index 0000000..0fa209c --- /dev/null +++ b/starter/po/Makefile.am @@ -0,0 +1 @@ +POFILES = AUTO diff --git a/starter/po/de.po b/starter/po/de.po new file mode 100644 index 0000000..1e9061d --- /dev/null +++ b/starter/po/de.po @@ -0,0 +1,351 @@ +# translation of de.po to German +# translation of starter.po to German +# This file is put in the public domain. +# Thomas Lübking <thomas.luebking@web.de>, 2005. +# +msgid "" +msgstr "" +"Project-Id-Version: de\n" +"POT-Creation-Date: 2005-07-19 21:15+0200\n" +"PO-Revision-Date: 2005-07-19 22:15+0200\n" +"Last-Translator: Thomas Lübking <thomas.luebking@web.de>\n" +"Language-Team: German <de@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.10\n" + +#. i18n: file buttons.ui line 16 +#: buttons.cpp:98 rc.cpp:3 rc.cpp:141 +#, no-c-format +msgid "Select Button Images" +msgstr "Skins auswählen" + +#. i18n: file buttons.ui line 103 +#: buttons.cpp:103 rc.cpp:14 rc.cpp:152 +#, no-c-format +msgid "<b>Down</b>" +msgstr "Gedrückt" + +#. i18n: file buttons.ui line 111 +#: buttons.cpp:104 rc.cpp:17 rc.cpp:155 +#, no-c-format +msgid "<b>Hover</b>" +msgstr "Unter Maus" + +#. i18n: file buttons.ui line 119 +#: buttons.cpp:105 rc.cpp:20 rc.cpp:158 +#, no-c-format +msgid "<b>Base</b>" +msgstr "Normal" + +#. i18n: file config.ui line 16 +#: config.cpp:285 menu.cpp:419 rc.cpp:23 rc.cpp:161 +#, no-c-format +msgid "New Entry" +msgstr "Neue Verknüpfung" + +#. i18n: file config.ui line 47 +#: config.cpp:287 rc.cpp:29 rc.cpp:167 +#, no-c-format +msgid "F1" +msgstr "" + +#. i18n: file config.ui line 108 +#: config.cpp:292 rc.cpp:40 rc.cpp:178 +#, no-c-format +msgid "Extended Mode" +msgstr "Erweiterte Einstellungen" + +#. i18n: file config.ui line 122 +#: config.cpp:293 rc.cpp:43 rc.cpp:181 +#, no-c-format +msgid "Basic Settings" +msgstr "Basiseinstellungen" + +#. i18n: file config.ui line 153 +#: config.cpp:294 rc.cpp:46 rc.cpp:184 +#, no-c-format +msgid "Is a" +msgstr "Ist ein" + +#. i18n: file config.ui line 218 +#: config.cpp:296 rc.cpp:50 rc.cpp:188 +#, no-c-format +msgid "<b>Command</b>" +msgstr "<b>Kommando</b>" + +#. i18n: file config.ui line 226 +#: config.cpp:297 rc.cpp:53 rc.cpp:191 +#, no-c-format +msgid "<i>Keywords</i>" +msgstr "<i>Schlüsselworte</i>" + +#. i18n: file config.ui line 234 +#: config.cpp:298 rc.cpp:56 rc.cpp:194 +#, no-c-format +msgid "<i><b>Name</b></i>" +msgstr "<i><b>Name</b></i>" + +#. i18n: file config.ui line 242 +#: config.cpp:299 rc.cpp:59 rc.cpp:197 +#, no-c-format +msgid "<i><b>Category</b></i>" +msgstr "<i><b>Kategorie</b></i>" + +#. i18n: file config.ui line 255 +#: config.cpp:300 rc.cpp:62 rc.cpp:200 +#, no-c-format +msgid "Activate startup feedback" +msgstr "Startrückmeldung aktivieren" + +#. i18n: file config.ui line 263 +#: config.cpp:301 rc.cpp:65 rc.cpp:203 +#, no-c-format +msgid "Show in system tray" +msgstr "Im Systray anzeigen" + +#. i18n: file config.ui line 290 +#: config.cpp:302 rc.cpp:68 rc.cpp:206 +#, no-c-format +msgid "Description" +msgstr "Beschreibung" + +#. i18n: file config.ui line 314 +#: config.cpp:303 rc.cpp:71 rc.cpp:209 +#, no-c-format +msgid "Extended Settings" +msgstr "Erweiterte Einstellungen" + +#. i18n: file config.ui line 325 +#: config.cpp:304 rc.cpp:74 rc.cpp:212 +#, no-c-format +msgid "Working directory" +msgstr "Arbeitsverzeichnis" + +#. i18n: file config.ui line 347 +#: config.cpp:305 rc.cpp:77 rc.cpp:215 +#, no-c-format +msgid "Start in terminal" +msgstr "Im Terminal ausführen" + +#. i18n: file config.ui line 358 +#: config.cpp:306 rc.cpp:80 rc.cpp:218 +#, no-c-format +msgid "Terminal settings" +msgstr "Terminal Einstellungen" + +#. i18n: file config.ui line 388 +#: config.cpp:307 rc.cpp:83 rc.cpp:221 +#, no-c-format +msgid "Start as different user" +msgstr "Als anderer Benutzer starten" + +#. i18n: file config.ui line 399 +#: config.cpp:308 rc.cpp:86 rc.cpp:224 +#, no-c-format +msgid "Username" +msgstr "Benutzername" + +#. i18n: file config.ui line 429 +#: config.cpp:309 rc.cpp:89 rc.cpp:227 +#, no-c-format +msgid "Shortcut" +msgstr "Tastenkürzel" + +#. i18n: file config.ui line 459 +#: config.cpp:310 rc.cpp:92 rc.cpp:230 +#, no-c-format +msgid "None" +msgstr "" + +#. i18n: file help.ui line 73 +#: help.cpp:72 rc.cpp:98 rc.cpp:236 +#, no-c-format +msgid "" +"<p align=\"center\"><font size=\"+3\"><b>Menu entry editor</b></font></p>\n" +"<p align=\"center" +"\">----------------------------------------------------------------------------------" +"</p>\n" +"<h3>Introduction</h3>\n" +"\n" +"By default, you will only see the basic settings for the new entry. Clicking " +"\"Show More\" will give you access to some extended settings that can be " +"interesting but mostly useless for you.<br><br>\n" +"<b>Bold options must be entered</b> for a usefull entry, i<i>talic ones are " +"respected by the search feature</i>.\n" +"<br><br>\n" +"<h3>Basic settings</h3>\n" +"\n" +"<b>Name:</b><br>\n" +"This is the visible name of your new entry and can be any string, e.g. \"The " +"Gimp\".<br>\n" +"(Necessary, searchkey)\n" +"<br><br>\n" +"<b>Is a:</b><br>\n" +"Describes the applications genre (generic name), e.g. \"Image manipulation" +"\"<br>\n" +"(Optional, yet not searched - maybe later)\n" +"<br><br>\n" +"<b>Category:</b><br>\n" +"Choose an existing group or add a new one. The hierarchy is represented by " +"seperating slashes (\"/\"), if you want to enter a slash, you must escape it " +"(\"\\/\")<br>\n" +"(Necessary, searchkey)\n" +"<br><br>\n" +"<b>Command:</b><br>\n" +"The command to start the application, e.g. \"gimp-remote\". On *nix systems, " +"is usually not necessary to pass the full path to the executably, but you " +"can do so, if you want to start an executable that is shadowed by the " +"executable in the path dir, e.g. \"/usr/local/gimp-1.3/gimp-remote\"<br>\n" +"(Necessary, not searched)\n" +"<br><br>\n" +"<b>Keywords:</b><br>\n" +"Comma separated list of keywords that refer to this application during " +"search, e.g. \"image manipulation,pixel,photoshop\".<br>\n" +"Please note:<br>\n" +"1. search is <i>not</i> case sensitive<br>\n" +"2. search finds partial matches, so it's <i>not</i> necessary to add e.g. " +"\"image,image manipulation\"<br>\n" +"3. different from the applications name, the keyword list will be translated " +"(if) so if you think like \"'KImage' allready contains 'image', so i don't " +"need it as keyword\" <b>you're wrong!</b><br>\n" +"4. Finding good keywords is not simple, but in general use striking ones! " +"\"editor\" is not a very good keyword, as allmost everything is an editor. " +"(Gimp is a pixel-editor, KHexedit is a hex-editor, KEdit is a text-editor, a " +"config dialog is a config-editor, ...)<br>\n" +"(Optional, searchkey)\n" +"<br><br>\n" +"<b>Description:</b><br>\n" +"This is the longtext description of your application (not a helptext, " +"though ;), e.g. \"A powerfull image manipulator with a UI similar to " +"photoshop. Supports Layers, filters, scripting, blahblahblah...\"\n" +"You can use Qt richtext tags and there's no limit on the size, but keep it " +"usefull ;) let's say something about 200 chars at max.<br>\n" +"(Optional, not searched)" +msgstr "" +"<p align=\"center\"><font size=\"+3\"><b>Verknüpfungseditor</b></font></p>\n" +"<p align=\"center" +"\">----------------------------------------------------------------------------------" +"</p>\n" +"<h3>Einführung</h3>\n" +"\n" +"Standardmäßig werden nur die Basiseinstellungen für die neue Verknüpfung angezeigt. Indem man auf \"Erweiterte Einstellungen\" clickt, erhält man Zugriff auf einige weniger gebräuchliche Optionen.<br><br>\n" +"<b>Fettgedruckte Felder müssen</b> für eine brauchbare Verknüpfung ausgefüllt werden, <i>kursive werden von der Suchfunktion berücksichtigt</i>.\n" +"<br><br>\n" +"<h3>Basiseinstellungen</h3>\n" +"\n" +"<b>Name:</b><br>\n" +"Der sichtbare Name der Verknüpfung. Jede Zeichenkette ist erlaubt, z.B.\"The " +"Gimp\".<br>\n" +"(Notwendig, Suchschlüssel)\n" +"<br><br>\n" +"<b>Ist ein:</b><br>\n" +"Das Genre der Anwendung (genericName), z.B. \"Bildbearbeitung" +"\"<br>\n" +"(Optional, derzeit nicht bei der Suche berücksichtigt)\n" +"<br><br>\n" +"<b>Kategorie:</b><br>\n" +"Wählen Sie eine existierende Gruppe oder fügen sie eine neue hinzu. Die Hierarchie wird durch den \"/\" als Trennzeichen gekennzeichnet,wenn \"/\" Teil des Namens sein soll, muß ein \"\\\" vorangestellt werden (\"\\/\")<br>\n" +"(Notwendig, Suchschlüssel (Der übersetzte Begriff))\n" +"<br><br>\n" +"<b>Kommando:</b><br>\n" +"Das Kommando zum starten der Anwendung, z.B. \"gimp-remote\". Auf *nix Systemen ist es normalerweise nicht notwendig den vollen Pfad anzugeben, aber Sie können das tun, um eine Anwendung zu starten die durch eine andere überlagert wird, z.B. \"/usr/local/gimp-1.3/gimp-remote\"<br>\n" +"(Notewndig, nicht durchsucht)\n" +"<br><br>\n" +"<b>Schlüsselworte:</b><br>\n" +"Kommagetrennte Liste von Schlüsselworten für diese Anwendung, z.B. \"bildbearbeitung,pixel,photoshop\".<br>\n" +"Anmerkungen:<br>\n" +"1. Die Suche unterscheidet nicht zwischen GROSS und kleinschreibung<br>\n" +"2. Die Suche findet auch Teilbegriffe, es ist also <i>nicht</i> notwendig z.B.\"Bild,Bildbearbeitung\" einzutragen<br>\n" +"3. Anders als der Name der Anwendung, werden die Schlüssel übersetzt (wenn).- KImage hätte zwar \"image\" als schlüsselwort, aber nicht \"bild\"<br>\n" +"4. Die Suche nach guten Schlüsselworten ist nicht immer leicht, aber sie sollten vor allem aussagekräftig sein!" +"\"editor\" ist kein besonders gutes Schlüsselwort, denn fast alles ist irgendwie ein Editor." +"(Gimp ist ein Pixel-Editor, KHexedit ist ein Hex-Editor, KEdit ist ein Text-Editor, ein Konfigurationsdialog ist ein Config-Editor, ...)<br>\n" +"(Optional, Suchschlüssel)\n" +"<br><br>\n" +"<b>Beschreibung:</b><br>\n" +"Die (längere) Beschreibung der Anwendung (aber kein Hilfetext ;), z.B. \"Eine mächtige Bildbearbeitung mit einer Photoshop ähnlichen Oberfläche. Unterstützt Ebenen, Filter, Scripte, blahblahblah...\"\n" +"Sie können Qt RichText tags verwenden und die Zeichenlänge ist nicht limitiert, sollte aber im vernünftigen Rahmen gehelten werden - maximal 200 Zeichen.<br>\n" +"(Optional, nicht durchsucht)" + +#: menu.cpp:307 +msgid "" +"for TTS output, telling which item is focussed (keyboard) and than reads the " +"comment" +msgstr "" + +#: menu.cpp:338 +msgid "" +"for TTS output, telling which item is hovered (mouse) and than reads the " +"comment" +msgstr "" + +#: menu.cpp:392 menu.cpp:483 +msgid "Edit Entry" +msgstr "Verknüpfung modifizieren..." + +#: menu.cpp:393 +msgid "Remove Entry" +msgstr "Verknüpfung entfernen..." + +#: menu.cpp:395 +msgid "Add Entry" +msgstr "Neue Verknüpfung..." + +#: menu.cpp:446 +msgid "<qt>Are you sure you want to remove<br> %1</qt>" +msgstr "<qt>Sind Sie sicher, daß sie <br> %1 <br> eintfernen möchten?</qt>" + +#: menu.cpp:446 +msgid "Remove ALI entry" +msgstr "ALI Verknüpung entfernen" + +#: menu.cpp:614 +msgid "<qt><b>First Session Applications</b></qt>" +msgstr "<qt><b>Erstbenutzer Anwendungen</b></qt>" + +#: menu.cpp:620 menu.cpp:882 menu.cpp:954 +msgid "<qt><b>Favorite Applications</b><br></qt>" +msgstr "<qt><b>Beliebte Anwendungen</b><br></qt>" + +#: menu.cpp:872 +msgid "" +"for TTS output, informs the user that no entries are in the currently " +"selected group" +msgstr "" + +#: menu.cpp:939 +msgid "for TTS output, no entries match the current search text" +msgstr "" + +#: menu.cpp:953 +msgid "" +"<qt><b>First Session Applications</b><br>This is a list of Applications you " +"might want to try out</qt>" +msgstr "" + +#: menu.cpp:1049 +msgid "Lock Session" +msgstr "" + +#: menu.cpp:1056 +msgid "Switch User" +msgstr "" + +#: menu.cpp:1062 +msgid "Logout" +msgstr "" + +#: menu.cpp:1160 +msgid "Type to search or enter a command" +msgstr "Tippen sie, um zu suchen oder ein Kommando direkt einzugeben" + +#: menu.cpp:1326 +msgid "TTS output" +msgstr "" + +#: starter.cpp:43 +msgid "Select Button Images ..." +msgstr "Skins auswählen..." + diff --git a/starter/po/starter.pot b/starter/po/starter.pot new file mode 100644 index 0000000..c2ecc2c --- /dev/null +++ b/starter/po/starter.pot @@ -0,0 +1,299 @@ +# SOME DESCRIPTIVE TITLE. +# This file is put in the public domain. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"POT-Creation-Date: 2005-07-19 22:15+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. i18n: file buttons.ui line 16 +#: buttons.cpp:98 rc.cpp:3 rc.cpp:141 +#, no-c-format +msgid "Select Button Images" +msgstr "" + +#. i18n: file buttons.ui line 103 +#: buttons.cpp:103 rc.cpp:14 rc.cpp:152 +#, no-c-format +msgid "<b>Down</b>" +msgstr "" + +#. i18n: file buttons.ui line 111 +#: buttons.cpp:104 rc.cpp:17 rc.cpp:155 +#, no-c-format +msgid "<b>Hover</b>" +msgstr "" + +#. i18n: file buttons.ui line 119 +#: buttons.cpp:105 rc.cpp:20 rc.cpp:158 +#, no-c-format +msgid "<b>Base</b>" +msgstr "" + +#. i18n: file config.ui line 16 +#: config.cpp:285 menu.cpp:419 rc.cpp:23 rc.cpp:161 +#, no-c-format +msgid "New Entry" +msgstr "" + +#. i18n: file config.ui line 47 +#: config.cpp:287 rc.cpp:29 rc.cpp:167 +#, no-c-format +msgid "F1" +msgstr "" + +#. i18n: file config.ui line 108 +#: config.cpp:292 rc.cpp:40 rc.cpp:178 +#, no-c-format +msgid "Extended Mode" +msgstr "" + +#. i18n: file config.ui line 122 +#: config.cpp:293 rc.cpp:43 rc.cpp:181 +#, no-c-format +msgid "Basic Settings" +msgstr "" + +#. i18n: file config.ui line 153 +#: config.cpp:294 rc.cpp:46 rc.cpp:184 +#, no-c-format +msgid "Is a" +msgstr "" + +#. i18n: file config.ui line 218 +#: config.cpp:296 rc.cpp:50 rc.cpp:188 +#, no-c-format +msgid "<b>Command</b>" +msgstr "" + +#. i18n: file config.ui line 226 +#: config.cpp:297 rc.cpp:53 rc.cpp:191 +#, no-c-format +msgid "<i>Keywords</i>" +msgstr "" + +#. i18n: file config.ui line 234 +#: config.cpp:298 rc.cpp:56 rc.cpp:194 +#, no-c-format +msgid "<i><b>Name</b></i>" +msgstr "" + +#. i18n: file config.ui line 242 +#: config.cpp:299 rc.cpp:59 rc.cpp:197 +#, no-c-format +msgid "<i><b>Category</b></i>" +msgstr "" + +#. i18n: file config.ui line 255 +#: config.cpp:300 rc.cpp:62 rc.cpp:200 +#, no-c-format +msgid "Activate startup feedback" +msgstr "" + +#. i18n: file config.ui line 263 +#: config.cpp:301 rc.cpp:65 rc.cpp:203 +#, no-c-format +msgid "Show in system tray" +msgstr "" + +#. i18n: file config.ui line 290 +#: config.cpp:302 rc.cpp:68 rc.cpp:206 +#, no-c-format +msgid "Description" +msgstr "" + +#. i18n: file config.ui line 314 +#: config.cpp:303 rc.cpp:71 rc.cpp:209 +#, no-c-format +msgid "Extended Settings" +msgstr "" + +#. i18n: file config.ui line 325 +#: config.cpp:304 rc.cpp:74 rc.cpp:212 +#, no-c-format +msgid "Working directory" +msgstr "" + +#. i18n: file config.ui line 347 +#: config.cpp:305 rc.cpp:77 rc.cpp:215 +#, no-c-format +msgid "Start in terminal" +msgstr "" + +#. i18n: file config.ui line 358 +#: config.cpp:306 rc.cpp:80 rc.cpp:218 +#, no-c-format +msgid "Terminal settings" +msgstr "" + +#. i18n: file config.ui line 388 +#: config.cpp:307 rc.cpp:83 rc.cpp:221 +#, no-c-format +msgid "Start as different user" +msgstr "" + +#. i18n: file config.ui line 399 +#: config.cpp:308 rc.cpp:86 rc.cpp:224 +#, no-c-format +msgid "Username" +msgstr "" + +#. i18n: file config.ui line 429 +#: config.cpp:309 rc.cpp:89 rc.cpp:227 +#, no-c-format +msgid "Shortcut" +msgstr "" + +#. i18n: file config.ui line 459 +#: config.cpp:310 rc.cpp:92 rc.cpp:230 +#, no-c-format +msgid "None" +msgstr "" + +#. i18n: file help.ui line 73 +#: help.cpp:72 rc.cpp:98 rc.cpp:236 +#, no-c-format +msgid "" +"<p align=\"center\"><font size=\"+3\"><b>Menu entry editor</b></font></p>\n" +"<p align=\"center" +"\">----------------------------------------------------------------------------------" +"</p>\n" +"<h3>Introduction</h3>\n" +"\n" +"By default, you will only see the basic settings for the new entry. Clicking " +"\"Show More\" will give you access to some extended settings that can be " +"interesting but mostly useless for you.<br><br>\n" +"<b>Bold options must be entered</b> for a usefull entry, i<i>talic ones are " +"respected by the search feature</i>.\n" +"<br><br>\n" +"<h3>Basic settings</h3>\n" +"\n" +"<b>Name:</b><br>\n" +"This is the visible name of your new entry and can be any string, e.g. \"The " +"Gimp\".<br>\n" +"(Necessary, searchkey)\n" +"<br><br>\n" +"<b>Is a:</b><br>\n" +"Describes the applications genre (generic name), e.g. \"Image manipulation" +"\"<br>\n" +"(Optional, yet not searched - maybe later)\n" +"<br><br>\n" +"<b>Category:</b><br>\n" +"Choose an existing group or add a new one. The hierarchy is represented by " +"seperating slashes (\"/\"), if you want to enter a slash, you must escape it " +"(\"\\/\")<br>\n" +"(Necessary, searchkey)\n" +"<br><br>\n" +"<b>Command:</b><br>\n" +"The command to start the application, e.g. \"gimp-remote\". On *nix systems, " +"is usually not necessary to pass the full path to the executably, but you " +"can do so, if you want to start an executable that is shadowed by the " +"executable in the path dir, e.g. \"/usr/local/gimp-1.3/gimp-remote\"<br>\n" +"(Necessary, not searched)\n" +"<br><br>\n" +"<b>Keywords:</b><br>\n" +"Comma separated list of keywords that refer to this application during " +"search, e.g. \"image manipulation,pixel,photoshop\".<br>\n" +"Please note:<br>\n" +"1. search is <i>not</i> case sensitive<br>\n" +"2. search finds partial matches, so it's <i>not</i> necessary to add e.g. " +"\"image,image manipulation\"<br>\n" +"3. different from the applications name, the keyword list will be translated " +"(if) so if you think like \"'KImage' allready contains 'image', so i don't " +"need it as keyword\" <b>you're wrong!</b><br>\n" +"4. Finding good keywords is not simple, but in general use striking ones! " +"\"editor\" is not a very good keyword, as allmost everything is an editor. " +"(Gimp is a pixel-editor, KHexedit is a hex-editor, KEdit is a text-editor, a " +"config dialog is a config-editor, ...)<br>\n" +"(Optional, searchkey)\n" +"<br><br>\n" +"<b>Description:</b><br>\n" +"This is the longtext description of your application (not a helptext, " +"though ;), e.g. \"A powerfull image manipulator with a UI similar to " +"photoshop. Supports Layers, filters, scripting, blahblahblah...\"\n" +"You can use Qt richtext tags and there's no limit on the size, but keep it " +"usefull ;) let's say something about 200 chars at max.<br>\n" +"(Optional, not searched)" +msgstr "" + +#: menu.cpp:307 +msgid "" +"for TTS output, telling which item is focussed (keyboard) and than reads the " +"comment" +msgstr "" + +#: menu.cpp:338 +msgid "" +"for TTS output, telling which item is hovered (mouse) and than reads the " +"comment" +msgstr "" + +#: menu.cpp:392 menu.cpp:483 +msgid "Edit Entry" +msgstr "" + +#: menu.cpp:393 +msgid "Remove Entry" +msgstr "" + +#: menu.cpp:395 +msgid "Add Entry" +msgstr "" + +#: menu.cpp:446 +msgid "<qt>Are you sure you want to remove<br> %1</qt>" +msgstr "" + +#: menu.cpp:446 +msgid "Remove ALI entry" +msgstr "" + +#: menu.cpp:614 menu.cpp:953 +msgid "<qt><b>First Session Applications</b></qt>" +msgstr "" + +#: menu.cpp:620 menu.cpp:882 menu.cpp:954 +msgid "<qt><b>Favorite Applications</b><br></qt>" +msgstr "" + +#: menu.cpp:872 +msgid "" +"for TTS output, informs the user that no entries are in the currently " +"selected group" +msgstr "" + +#: menu.cpp:939 +msgid "for TTS output, no entries match the current search text" +msgstr "" + +#: menu.cpp:1049 +msgid "Lock Session" +msgstr "" + +#: menu.cpp:1056 +msgid "Switch User" +msgstr "" + +#: menu.cpp:1062 +msgid "Logout" +msgstr "" + +#: menu.cpp:1160 +msgid "Type to search or enter a command" +msgstr "" + +#: menu.cpp:1326 +msgid "TTS output" +msgstr "" + +#: starter.cpp:43 +msgid "Select Button Images ..." +msgstr "" diff --git a/starter/starter.cpp b/starter/starter.cpp new file mode 100644 index 0000000..9740888 --- /dev/null +++ b/starter/starter.cpp @@ -0,0 +1,483 @@ + +#include <qcombobox.h> +#include <qcursor.h> +#include <qdesktopwidget.h> +#include <kglobal.h> +#include <klocale.h> +#include <kconfig.h> +#include <kmessagebox.h> +#include <kapplication.h> +# include <kpopupmenu.h> +#include <qimage.h> +#include <qfile.h> +#include <qlabel.h> +#include <qradiobutton.h> +#include <qspinbox.h> +#include <qcheckbox.h> +#include <qtimer.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kdebug.h> +#include <kkeybutton.h> +#include <kurlrequester.h> +#include "starter.h" +#include "starterconfig.h" +#include "starterhelp.h" +#include "menu.h" + +#define _SIZE2VALUE_(_s_) (_s_ == 16) ? 0 :\ +(_s_ == 22) ? 1 :\ +(_s_ == 32) ? 2 :\ +(_s_ == 48) ? 3 : 4 + +#define _VALUE2SIZE_(_v_) (_v_ == 0) ? 16 :\ +(_v_ == 1) ? 22 :\ +(_v_ == 2) ? 32 :\ +(_v_ == 3) ? 48 : 64 + +starter::starter(const QString& configFile, Type type, int actions, QWidget *parent, const char *name) +: DCOPObject("StarterIface"), KPanelApplet(configFile, type, actions, parent, name) +{ + configPopup = new KPopupMenu(this); + popupBlocked = false; + mainView = new QLabel(this); + + configDialog = new StarterConfig(this); + QRect desktop = QDesktopWidget().availableGeometry( configDialog ); + configDialog->move((desktop.width() - configDialog->width())/2, (desktop.height() - configDialog->height())/2); + KConfig config("bStarter", false, false); + config.setGroup("Settings"); + configDialog->buttonShortcut->setEnabled(false); + configDialog->BaseURL->setURL(config.readEntry("BaseImage", "" )); + configDialog->HoverURL->setURL(config.readEntry("HoverImage", "" )); + configDialog->DownURL->setURL(config.readEntry("DownImage", "" )); + configDialog->useKTTS->setChecked(config.readBoolEntry("useKTTS", false )); + + configDialog->customPopupSize->setChecked(config.readBoolEntry("CustomPopupSize", false )); + configDialog->customDialogSize->setChecked(config.readBoolEntry("CustomDialogSize", false )); + configDialog->customDialogPos->setChecked(config.readBoolEntry("CustomDialogPos", false )); + configDialog->fixedDialogPos->setChecked(config.readBoolEntry("FixedDialogPos", false )); + configDialog->dialogFollowMouse->setChecked(config.readBoolEntry("DialogFollowMouse", false )); + configDialog->showDialogTitlebar->setChecked(config.readBoolEntry("ShowDialogTitlebar", false )); + configDialog->popupW->setValue(config.readNumEntry("PopupW", 0 )); + configDialog->popupH->setValue(config.readNumEntry("PopupH", 0 )); + configDialog->dialogW->setValue(config.readNumEntry("DialogW", 0 )); + configDialog->dialogH->setValue(config.readNumEntry("DialogH", 0 )); + configDialog->dialogX->setValue(config.readNumEntry("DialogX", 0 )); + configDialog->dialogY->setValue(config.readNumEntry("DialogY", 0 )); + configDialog->favItemAmount->setValue(config.readNumEntry("FavItemAmount", 10 )); + configDialog->dialogPanelPos->setCurrentItem(config.readNumEntry("DialogPanelPos", 1 )); + configDialog->popupPanelPos->setCurrentItem(config.readNumEntry("PopupPanelPos", 2 )); + _iconSize = config.readNumEntry("IconSize", 32 ); + configDialog->iconSize->setCurrentItem(_SIZE2VALUE_(_iconSize)); + + startMenu = new StartMenu(_iconSize, this, Qt::WType_Popup); + shortcutList = startMenu->shortcutList; + configDialog->categoryList->insertStringList(startMenu->categories()); + connect (startMenu, SIGNAL(aboutToHide()), this, SLOT(unblockPopupDelayed())); + connect(configDialog->useKTTS, SIGNAL(toggled( bool )), startMenu, SLOT(toggleKTTS(bool))); + + //--- + connect(configDialog->categoryList, SIGNAL(highlighted(int)), this, SLOT(activateShortcutButton(int))); + connect(configDialog->buttonShortcut, SIGNAL(capturedShortcut (const KShortcut &)), this, SLOT(addShortcut(const KShortcut &))); + connect(configDialog->categoryList, SIGNAL(highlighted ( const QString & )), this, SLOT(updateShortcutButton(const QString &))); + connect(configDialog->buttonOk, SIGNAL(clicked()), this, SLOT(updateSettings())); + StarterHelp *helpDialog = new StarterHelp(configDialog); + connect(configDialog->buttonHelp, SIGNAL(clicked()), helpDialog, SLOT(show())); + //----- + configPopup->insertItem(i18n("Configure the Startmenu"), configDialog, SLOT(show())); + configDialog->BaseURL->setFilter( "*.png" ); + configDialog->HoverURL->setFilter( "*.png" ); + configDialog->DownURL->setFilter( "*.png" ); + mainView->move(0,0); + if (parent) move(parent->x(),parent->y()); + mainView->installEventFilter(this); + reloadImages(); + mainView->setPixmap(pixmap); + mainView->show(); +} + +void starter::activateShortcutButton(int i) +{ + configDialog->buttonShortcut->setEnabled(bool(i)); +} + +void starter::addShortcut(const KShortcut &cut) +{ + // in case of empty shortcut, remove the entry from the list and return + if (!short(cut.keyCodeQt())) + { + ShortcutList::Iterator it; + for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) + if (it.data() == configDialog->categoryList->currentText()) + { + shortcutList.remove(it); + break; + } + configDialog->buttonShortcut->setShortcut(KShortcut::null(), false); + return; + } + // generate MyKey + short state = 0; + if (cut.seq(0).key(0).modFlags() & KKey::CTRL) + state |= Qt::ControlButton; + if (cut.seq(0).key(0).modFlags() & KKey::ALT) + state |= Qt::AltButton; + if (cut.seq(0).key(0).modFlags() & KKey::SHIFT) + state |= Qt::ShiftButton; + MyKey key(cut.seq(0).keyCodeQt(), state); + // Test if this is a valid shotrcut, i.e. contains 'ctrl' or 'alt', returns iff not + if (!(state & Qt::ControlButton || state & Qt::AltButton)) + { + KMessageBox::sorry(this, i18n("<qt>To ensure usefull behaviour of the searchline, the shortcut <b>must contain</b> a metabutton, i.e. <b>'ctrl' and/or 'alt'</b></qt>"), i18n("Sorry, invalid Shortcut")); + return; + } + // test if the cut was allready bound to another category and ask the user whta to do (return iff not rebind) + ShortcutList::Iterator it = shortcutList.find(key); + if ((it != shortcutList.end() && KMessageBox::questionYesNo(this, i18n("<qt>The selected shortcut is allready bound to the category \"%1\".<br>Do you want to <b>rebind</b> it?</qt>").arg(it.data()), i18n("Rebind Shortcut?")) == KMessageBox::No)) + return; + // if rebind (it is not end and we did not return ;) remove the old shortcut + if (it != shortcutList.end()) + { + shortcutList.remove(it); + } + // test if another shortcut is bound to this category and remove it in case + for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) + if (it.data() == configDialog->categoryList->currentText()) + { + shortcutList.remove(it); + break; + } + // add new shortcut/category map entry + shortcutList[key] = configDialog->categoryList->currentText(); + // update UI + configDialog->buttonShortcut->setShortcut(cut, false); +} + +void starter::updateShortcutButton(const QString & category) +{ + ShortcutList::Iterator it; + for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) + if (it.data() == category) + { + QKeyEvent qke( QEvent::KeyPress, it.key().key(), 0, it.key().modFlags()); + KKey kkey(&qke); + KShortcut ksc(kkey); + configDialog->buttonShortcut->setShortcut(ksc, false); + return; + } + configDialog->buttonShortcut->setShortcut(KShortcut::null(), false); +} + +starter::~starter() +{ +} + +void starter::updateSettings() +{ + startMenu->updateShortcuts(shortcutList); + KConfig *config = new KConfig("bStarter", false, false); + config->setGroup("Settings"); + config->writeEntry("BaseImage", configDialog->BaseURL->url()); + config->writeEntry("HoverImage", configDialog->HoverURL->url()); + config->writeEntry("DownImage", configDialog->DownURL->url()); + config->writeEntry("useKTTS", configDialog->useKTTS->isChecked()); + config->writeEntry("CustomPopupSize", configDialog->customPopupSize->isChecked()); + config->writeEntry("CustomDialogSize", configDialog->customDialogSize->isChecked()); + config->writeEntry("CustomDialogPos", configDialog->customDialogPos->isChecked()); + config->writeEntry("FixedDialogPos", configDialog->fixedDialogPos->isChecked()); + config->writeEntry("DialogFollowMouse", configDialog->dialogFollowMouse->isChecked()); + config->writeEntry("ShowDialogTitlebar", configDialog->showDialogTitlebar->isChecked()); + config->writeEntry("PopupW", configDialog->popupW->value()); + config->writeEntry("PopupH", configDialog->popupH->value()); + config->writeEntry("DialogW", configDialog->dialogW->value()); + config->writeEntry("DialogH", configDialog->dialogH->value()); + config->writeEntry("DialogX", configDialog->dialogX->value()); + config->writeEntry("DialogY", configDialog->dialogY->value()); + config->writeEntry("FavItemAmount", configDialog->favItemAmount->value()); + config->writeEntry("DialogPanelPos", configDialog->dialogPanelPos->currentItem()); + config->writeEntry("PopupPanelPos", configDialog->popupPanelPos->currentItem()); + if (_iconSize != (_VALUE2SIZE_(configDialog->iconSize->currentItem()))) + { + _iconSize = _VALUE2SIZE_(configDialog->iconSize->currentItem()); + config->writeEntry("IconSize", _iconSize); + startMenu->reloadIcons(_iconSize); + } + startMenu->setFavItemAmount(configDialog->favItemAmount->value()); + config->setGroup("Shortcuts"); + QStringList cuts; QStringList cats; + ShortcutList::Iterator it; + for ( it = shortcutList.begin(); it != shortcutList.end(); ++it ) + { + cuts.append(it.key().toString()); + cats.append(it.data()); + } + config->writeEntry("Shortcuts", cuts, ','); + config->writeEntry("Categories", cats, ','); + reloadImages(); + delete config; +} + +#define _VALID_(_url_) configDialog && !configDialog->_url_->url().isEmpty() && QFile::exists(configDialog->_url_->url()) + +void starter::reloadImages() +{ + KIconLoader* iLoader = KGlobal::iconLoader(); + QString pth; + if (_VALID_(BaseURL)) + pth = configDialog->BaseURL->url(); + else + pth = iLoader->iconPath("bStarter", KIcon::Small, true); + if (pth) + pixmap = QImage(pth); + if (!pth || pixmap.isNull()) + { + pixmap = QPixmap(22,22); + pixmap.fill(Qt::black); + } + pth = QString(); + if (_VALID_(HoverURL)) + pth = configDialog->HoverURL->url(); + else + pth = iLoader->iconPath("bStarter_hover", KIcon::Small, true); + if (pth) + hoverPixmap = QImage(pth); + if (!pth || hoverPixmap.isNull()) + { + hoverPixmap = QPixmap(22,22); + hoverPixmap.fill(Qt::black); + } + pth = QString(); + if (_VALID_(DownURL)) + pth = configDialog->DownURL->url(); + else + pth = iLoader->iconPath("bStarter_down", KIcon::Small, true); + if (pth) + downPixmap = QImage(pth); + if (!pth || downPixmap.isNull()) + { + downPixmap = QPixmap(22,22); + downPixmap.fill(Qt::white); + } + int wd = pixmap.width(); + int ht = pixmap.height(); + if (wd < hoverPixmap.width()) wd = hoverPixmap.width(); + if (wd < downPixmap.width()) wd = downPixmap.width(); + if (ht < hoverPixmap.height()) ht = hoverPixmap.height(); + if (ht < downPixmap.height()) ht = downPixmap.height(); + mainView->setFixedSize(wd,ht); + repaint(); +} + +void starter::resizeEvent ( QResizeEvent *rev ) +{ + pixmap = pixmap.convertToImage().smoothScale(rev->size().height()*pixmap.width()/pixmap.height(),rev->size().height()); + downPixmap = downPixmap.convertToImage().smoothScale(rev->size().height()*downPixmap.width()/downPixmap.height(),rev->size().height()); + hoverPixmap = hoverPixmap.convertToImage().smoothScale(rev->size().height()*hoverPixmap.width()/hoverPixmap.height(),rev->size().height()); + mainView->setFixedSize(rev->size().height()*mainView->width()/mainView->height(),rev->size().height()); + mainView->setPixmap(pixmap); + KPanelApplet::resizeEvent(rev); +} + +void starter::configureMenu() +{ + KApplication::startServiceByDesktopName("kmenuedit", QStringList(), 0, 0, 0, "", true); +} + +void starter::preferences() +{ + KApplication::startServiceByDesktopName("kmenuedit", QStringList(), 0, 0, 0, "", true); +} + +int starter::widthForHeight(int height) const +{ + return mainView->width(); +} + +int starter::heightForWidth(int width) const +{ + return mainView->height(); +} + +void starter::unblockPopupDelayed() +{ + popupBlocked = true; + QTimer::singleShot ( 50, this, SLOT(unblockPopup()) ); +} + +void starter::unblockPopup() +{ + popupBlocked = false; + if (mainView->hasMouse()) + mainView->setPixmap(hoverPixmap); + else + mainView->setPixmap(startMenu->isShown() ? downPixmap : pixmap); + mainView->repaint(); +} + +#define _MAX_(a,b) (a > b ? a : b) +void starter::popupMenu() +{ + if (popupBlocked) + return; + { +// if (!isDialog_) +// return; + startMenu->setMinimumSize ( 0, 0 ); + startMenu->setMaximumSize ( 32767, 32767 ); + setActiveWindow(); + startMenu->setPanelPosition((StartMenu::PanelPosition)configDialog->popupPanelPos->currentItem()); + if (configDialog->customPopupSize->isChecked()) + { + startMenu->resize(configDialog->popupW->value(),configDialog->popupH->value()); + startMenu->setFixedSize(startMenu->size()); +// startMenu->setFixedSize(_MAX_(configDialog->popupW->value(), startMenu->minimumWidth()), _MAX_(configDialog->popupH->value(), startMenu->minimumHeight())); + } + else + { + QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + startMenu->resize(desktop.width()/5, 2*desktop.height()/3); + startMenu->setFixedSize(startMenu->size()); +// startMenu->setFixedSize(_MAX_(startMenu->minimumWidth(), desktop.width()/5) ,_MAX_(startMenu->minimumHeight(), 2*desktop.height()/3)); // 1/5 screen width, 2/3 screen height + } + + QPoint pt = mapToGlobal(pos()); + QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + int x = pt.x(); + int y = pt.y(); + + switch(position()) + { + case pTop: + y += height() + 1; + if (x + startMenu->width() > desktop.right()) + x = desktop.right() - startMenu->width(); + if (x < 0) x = 0; + break; + case pLeft: + x += width() + 1; + if (y + startMenu->height() > desktop.bottom()) + y = desktop.bottom() - startMenu->height(); + if (y < 0) y = 0; + break; + case pBottom: + y -= startMenu->height() - 1; + if (x + startMenu->width() > desktop.right()) + x = desktop.right() - startMenu->width(); + if (x < 0) x = 0; + break; + case pRight: + x -= startMenu->width() - 1; + if (y + startMenu->height() > desktop.bottom()) + y = desktop.bottom() - startMenu->height(); + if (y < 0) y = 0; + } + pt = QPoint(x, y); + + startMenu->reparent(this, Qt::WType_Popup, pt, true); + } +} + +void starter::showMenu() +{ + startMenu->setMinimumSize ( 0, 0 ); + startMenu->setMaximumSize ( 32767, 32767 ); + startMenu->setPanelPosition((StartMenu::PanelPosition)configDialog->dialogPanelPos->currentItem()); + if (configDialog->customDialogSize->isChecked()) + { + startMenu->resize(configDialog->dialogW->value(), configDialog->dialogH->value()); + startMenu->setFixedSize(startMenu->size()); +// startMenu->setFixedSize(_MAX_(configDialog->dialogW->value(), startMenu->minimumWidth()), _MAX_(startMenu->minimumHeight(), configDialog->dialogH->value())); + } + else + { + QRect desktop = QDesktopWidget().availableGeometry( startMenu ); +// setActiveWindow(); + startMenu->resize(desktop.width()/2, desktop.width()*9/32); + startMenu->setFixedSize(startMenu->size()); +// startMenu->setFixedSize(_MAX_(startMenu->minimumWidth(), desktop.width()/2) , _MAX_(startMenu->minimumHeight(), desktop.width()*9/32)); // 16:9 window, width == 1/2 screen + } + QPoint pt; + if (configDialog->customDialogPos->isChecked()) + { + if (configDialog->dialogFollowMouse->isChecked()) + { + QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + int x,y; + x = QCursor::pos().x() + startMenu->width()/2 < desktop.width() ? QCursor::pos().x() - startMenu->width()/2 : desktop.width() - startMenu->width(); + if (x < 0) x = 0; + y = QCursor::pos().y() + startMenu->height()/2 < desktop.height() ? QCursor::pos().y() - startMenu->height()/2 : desktop.height() - startMenu->height(); + if (y < 0) y = 0; + pt = QPoint(x, y); + } + else + pt = QPoint(configDialog->dialogX->value(), configDialog->dialogY->value()); + } + else + { + QRect desktop = QDesktopWidget().availableGeometry( startMenu ); + pt = QPoint((desktop.right() - startMenu->width())/2, (desktop.bottom() - startMenu->height())/2); + } + if (configDialog->showDialogTitlebar->isChecked()) + startMenu->reparent(this, Qt::WType_TopLevel, pt, true); + else + startMenu->reparent(this, Qt::WType_TopLevel | Qt::WStyle_Customize | Qt::WStyle_NoBorder, pt, true); +} + +bool starter::eventFilter( QObject*, QEvent *e ) +{ + switch (e->type()) + { + case QEvent::Enter: + { + mainView->setPixmap(hoverPixmap); + mainView->repaint(); + return TRUE; + } + case QEvent::Leave: + { + mainView->setPixmap(startMenu->isShown() ? downPixmap : pixmap); + mainView->repaint(); + return TRUE; + } + case QEvent::MouseButtonPress: + { + if (((QMouseEvent*)e)->button() == Qt::RightButton) + { + configPopup->popup(((QMouseEvent*)e)->globalPos()); + return TRUE; + } + if (((QMouseEvent*)e)->button() == Qt::LeftButton) + { + mainView->setPixmap(downPixmap); + mainView->repaint(); + popupMenu(); + } + return TRUE; + } + case QEvent::MouseButtonRelease: + { + if (((QMouseEvent*)e)->button() != Qt::LeftButton) + return FALSE; + if (mainView->hasMouse()) + mainView->setPixmap(hoverPixmap); + else + mainView->setPixmap(startMenu->isShown() ? downPixmap : pixmap); + mainView->repaint(); + return TRUE; + } + default: + return FALSE; + } +} + +extern "C" +{ + KPanelApplet* init( QWidget *parent, const QString& configFile) + { + KGlobal::locale()->insertCatalogue("starter"); + return new starter(configFile, KPanelApplet::Normal, + KPanelApplet::Preferences, + parent, "baghirastarter"); + } +} diff --git a/starter/starter.desktop b/starter/starter.desktop new file mode 100644 index 0000000..cfc27dc --- /dev/null +++ b/starter/starter.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Baghira Starter +Icon=bStarter +X-KDE-Library=libbaghirastarter +X-KDE-UniqueApplet=true + diff --git a/starter/starter.h b/starter/starter.h new file mode 100644 index 0000000..39c72b9 --- /dev/null +++ b/starter/starter.h @@ -0,0 +1,72 @@ + +#ifndef STARTER_H +#define STARTER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <kpanelapplet.h> +#include <qmap.h> +#include <qstring.h> +#include <qpixmap.h> +// #include <qpainter.h> +#include <kconfig.h> +#include <kshortcut.h> +#include "starteriface.h" +#include "mykey.h" + +class DCOPClient; +class QLabel; +class KPopupMenu; +class StartMenu; +class StarterConfig; + +class starter : public KPanelApplet, virtual public StarterIface +{ + Q_OBJECT + +public: + starter(const QString& configFile, Type t = Normal, int actions = 0, + QWidget *parent = 0, const char *name = 0); + ~starter(); + + virtual int widthForHeight(int height) const; + virtual int heightForWidth(int width) const; + virtual void preferences(); + void popupMenu(); + void showMenu(); +protected: + virtual void resizeEvent ( QResizeEvent * ); + +private: + enum State {Default, Hover, Down}; + State state; + int _iconSize; + bool eventFilter( QObject *o, QEvent *e ); + bool popupBlocked; +// bool isDialog_; + QLabel *mainView; +// QPainter m_painter; + DCOPClient *client; + KPopupMenu *configPopup; + StartMenu *startMenu; + QPixmap pixmap; + QPixmap hoverPixmap; + QPixmap downPixmap; + StarterConfig *configDialog; + typedef QMap<MyKey,QString> ShortcutList; + ShortcutList shortcutList; +private slots: + void addShortcut(const KShortcut&); + void updateShortcutButton(const QString&); + void configureMenu(); + void reloadImages(); + void updateSettings(); +// void blockMenu(); + void unblockPopupDelayed(); + void unblockPopup(); + void activateShortcutButton(int); +}; + +#endif diff --git a/starter/starterconfig.ui b/starter/starterconfig.ui new file mode 100644 index 0000000..a703e45 --- /dev/null +++ b/starter/starterconfig.ui @@ -0,0 +1,872 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>StarterConfig</class> +<widget class="QDialog"> + <property name="name"> + <cstring>StarterConfig</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>492</width> + <height>674</height> + </rect> + </property> + <property name="caption"> + <string>Baghira Starter Config</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QGroupBox" row="0" column="0"> + <property name="name"> + <cstring>groupBox5</cstring> + </property> + <property name="title"> + <string>Startbutton images</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KURLRequester" row="0" column="1"> + <property name="name"> + <cstring>BaseURL</cstring> + </property> + </widget> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel2_3</cstring> + </property> + <property name="text"> + <string><b>Hover</b></string> + </property> + </widget> + <widget class="KURLRequester" row="1" column="1"> + <property name="name"> + <cstring>HoverURL</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><b>Base</b></string> + </property> + </widget> + <widget class="QLabel" row="2" column="0"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string><b>Down</b></string> + </property> + </widget> + <widget class="KURLRequester" row="2" column="1"> + <property name="name"> + <cstring>DownURL</cstring> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="accel"> + <string></string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QButtonGroup" row="3" column="0"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="title"> + <string>Dialog options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout10</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>customDialogSize</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Custom dialog size</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>dialogW</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maxValue"> + <number>3000</number> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string>x</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>dialogH</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maxValue"> + <number>2000</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>111</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QRadioButton" row="4" column="0"> + <property name="name"> + <cstring>dialogFollowMouse</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Show dialog under mouse</string> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>fixedDialogPos</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Fixed</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>dialogX</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_2</cstring> + </property> + <property name="text"> + <string>:</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>dialogY</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QCheckBox" row="2" column="0"> + <property name="name"> + <cstring>customDialogPos</cstring> + </property> + <property name="text"> + <string>Custom dialog position</string> + </property> + </widget> + <widget class="Line" row="1" column="0"> + <property name="name"> + <cstring>line1</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="8" column="0"> + <property name="name"> + <cstring>showDialogTitlebar</cstring> + </property> + <property name="text"> + <string>Show titlebar for dialog</string> + </property> + </widget> + <widget class="Line" row="7" column="0"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="Line" row="5" column="0"> + <property name="name"> + <cstring>line2_3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="6" column="0"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Panel Position</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>North</string> + </property> + </item> + <item> + <property name="text"> + <string>South</string> + </property> + </item> + <item> + <property name="text"> + <string>West</string> + </property> + </item> + <item> + <property name="text"> + <string>East</string> + </property> + </item> + <item> + <property name="text"> + <string>Nowhere</string> + </property> + </item> + <property name="name"> + <cstring>dialogPanelPos</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="currentItem"> + <number>1</number> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="2" column="0"> + <property name="name"> + <cstring>groupBox6</cstring> + </property> + <property name="title"> + <string>Popup options</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="0" column="0"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>customPopupSize</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Custom popup size</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>popupW</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maxValue"> + <number>3000</number> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string>x</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>popupH</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="maxValue"> + <number>2000</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>141</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="Line" row="1" column="0"> + <property name="name"> + <cstring>line2_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout6_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_3_2</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Panel Position</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>North</string> + </property> + </item> + <item> + <property name="text"> + <string>South</string> + </property> + </item> + <item> + <property name="text"> + <string>West</string> + </property> + </item> + <item> + <property name="text"> + <string>East</string> + </property> + </item> + <item> + <property name="text"> + <string>Nowhere</string> + </property> + </item> + <property name="name"> + <cstring>popupPanelPos</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="currentItem"> + <number>2</number> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="1" column="0"> + <property name="name"> + <cstring>groupBox4</cstring> + </property> + <property name="title"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget" row="2" column="0"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2_4</cstring> + </property> + <property name="text"> + <string>Items in favorite list</string> + </property> + </widget> + <widget class="QSpinBox"> + <property name="name"> + <cstring>favItemAmount</cstring> + </property> + <property name="value"> + <number>10</number> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="Line" row="1" column="0"> + <property name="name"> + <cstring>line1_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox" row="0" column="0"> + <property name="name"> + <cstring>useKTTS</cstring> + </property> + <property name="text"> + <string>Talk to me (via KTTS)</string> + </property> + </widget> + <widget class="QLayoutWidget" row="3" column="0"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_4</cstring> + </property> + <property name="text"> + <string>Icon SIze</string> + </property> + </widget> + <widget class="QComboBox"> + <item> + <property name="text"> + <string>16/22</string> + </property> + </item> + <item> + <property name="text"> + <string>22/32</string> + </property> + </item> + <item> + <property name="text"> + <string>32/48</string> + </property> + </item> + <item> + <property name="text"> + <string>48/64</string> + </property> + </item> + <item> + <property name="text"> + <string>64/128</string> + </property> + </item> + <property name="name"> + <cstring>iconSize</cstring> + </property> + </widget> + </hbox> + </widget> + </grid> + </widget> + <widget class="QGroupBox" row="0" column="1" rowspan="4" colspan="1"> + <property name="name"> + <cstring>groupBox7</cstring> + </property> + <property name="title"> + <string>Shortcuts</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QListBox" row="0" column="0"> + <property name="name"> + <cstring>categoryList</cstring> + </property> + <property name="hScrollBarMode"> + <enum>AlwaysOff</enum> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="0"> + <property name="name"> + <cstring>layout18</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KKeyButton"> + <property name="name"> + <cstring>buttonShortcut</cstring> + </property> + <property name="text"> + <string>None</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </grid> + </widget> + </grid> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>StarterConfig</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>StarterConfig</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>customPopupSize</sender> + <signal>toggled(bool)</signal> + <receiver>popupW</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>customPopupSize</sender> + <signal>toggled(bool)</signal> + <receiver>popupH</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>toggled(bool)</signal> + <receiver>dialogX</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>customDialogSize</sender> + <signal>toggled(bool)</signal> + <receiver>dialogW</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>customDialogSize</sender> + <signal>toggled(bool)</signal> + <receiver>dialogH</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>customDialogPos</sender> + <signal>toggled(bool)</signal> + <receiver>fixedDialogPos</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>customDialogPos</sender> + <signal>toggled(bool)</signal> + <receiver>dialogFollowMouse</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>fixedDialogPos</sender> + <signal>toggled(bool)</signal> + <receiver>dialogX</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>fixedDialogPos</sender> + <signal>toggled(bool)</signal> + <receiver>dialogY</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>customDialogPos</sender> + <signal>toggled(bool)</signal> + <receiver>fixedDialogPos</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>customDialogPos</sender> + <signal>toggled(bool)</signal> + <receiver>dialogFollowMouse</receiver> + <slot>setChecked(bool)</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kurlrequester.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kkeybutton.h</includehint> +</includehints> +</UI> diff --git a/starter/starterhelp.ui b/starter/starterhelp.ui new file mode 100644 index 0000000..a0bf868 --- /dev/null +++ b/starter/starterhelp.ui @@ -0,0 +1,121 @@ +<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> +<class>StarterHelp</class> +<widget class="QDialog"> + <property name="name"> + <cstring>StarterHelp</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>510</width> + <height>582</height> + </rect> + </property> + <property name="caption"> + <string>Baghira Starter Config Help</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Filterline</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string><qt>The filterline provides several functions +<ul> +<li>It filters the below entry list</li> +<li>It autocompletes to executable entries in $PATH</li> +<li>The applied listbox lets you select the available categories</li> +<li>You can navigate through the categories either by using the mousewheel or by holding <b>ctrl+up/down</b></li> +<li>The category is also selected when calling the applied shortcut</li> +<li>It supports all protocols you know from Konqueror, e.g. "gg:Baghira" will google for "Baghira" etc.</li> +</ul> +Pressing <b>Enter</b> will execute the (autocompleted) binary in $PATH or the entered kfm protocol call<br> +Pressing <b>down</b> will move the keyboard focus to the below entry list +</qt></string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Entry Field</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel6</cstring> + </property> + <property name="text"> + <string><qt>The entry field shows up all your menu entries (filtered)<br><br> +You can start an application by clicking the <b>left mouse button</b> above the item (highlighted text) or by pressing <b>Enter</b> if the entry has the keyboard focus (highlighted background).<br><br> +You may navigate by either scrolling the <b>mousewheel</b> or using the <b>up/down</b> keys (this will also shift the keyboard focus)<br><br> +Pressing the <b>left</b> key will put focus on the filterline and select the whole text (i.e. start typing will change a complete new filter action)<br><br> +Pressing the <b>up</b> key on the topmost item will act as above.</qt></string> + </property> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>TabPage</cstring> + </property> + <attribute name="title"> + <string>Panel</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><qt>The panel allow you to store often used links, independent from the application links in the entry list<br><br> +To <b>add a link</b>, either:<br> +- rightclick the panel<br> +- drag and drop a link out of the entry list<br> +- drag and drop any url or text or command (uris and mails are handled, the rest is interpreted as simple command, any command that works on the filterline works here as well)<br> +<br> +To <b>remove a link</b>, simply drag it out and drop it outside. (The panel interacts with the linklist from the baghira sidebar, links won't be removed, but copied if dragged from one to the other)<br> +<br> +To <b>configure a link</b>, simply rightclick it<br><br> +To <b>move a link</b>, just drag it and move i around.<br><br> + +Te panel is <b>scrollable (mousewheel)</b> and you can configure <b>individual positions</b> for the popup and the dialog<br><br> +More poofs can be found e.g. here: <a href="http://www.resexcellence.com/user_poofs.shtml">www.resexcellence.com/user_poofs.shtml</a> +</qt></string> + </property> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<layoutdefaults spacing="6" margin="11"/> +</UI> diff --git a/starter/starteriface.h b/starter/starteriface.h new file mode 100644 index 0000000..be1469f --- /dev/null +++ b/starter/starteriface.h @@ -0,0 +1,34 @@ +/*************************************************************************** + * Copyright (C) 2005 by Thomas Lübking * + * thomas.luebking@web.de * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef _STARTERIFACE_H_ +#define _STARTERIFACE_H_ + +#include <dcopobject.h> + +class StarterIface : virtual public DCOPObject +{ + K_DCOP + k_dcop: + virtual void popupMenu() = 0; + virtual void showMenu() = 0; +}; + +#endif diff --git a/starter/subdirs b/starter/subdirs new file mode 100644 index 0000000..6cddb31 --- /dev/null +++ b/starter/subdirs @@ -0,0 +1 @@ +po diff --git a/style/Makefile.am b/style/Makefile.am new file mode 100644 index 0000000..2094915 --- /dev/null +++ b/style/Makefile.am @@ -0,0 +1,16 @@ +AM_CPPFLAGS = -DQT_PLUGIN + +INCLUDES = -I$(top_srcdir)/kdefx $(all_includes) +noinst_HEADERS = baghira.h pixmaps.h bitmaps.h +METASOURCES = AUTO +kde_style_LTLIBRARIES = baghira.la +baghira_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +baghira_la_LIBADD = -lkdefx -lXtst $(LIB_KDEUI) +baghira_la_SOURCES = baghira.cpp optionHandler.cpp polish.cpp utils.cpp +lnkdir = $(kde_datadir)/kstyle/themes +lnk_DATA = baghira.themerc +EXTRA_DIST = $(lnk_DATA) +pixmaps.h: $(srcdir)/generatePixmaps.sh + $(SHELL) $(srcdir)/generatePixmaps.sh $(top_srcdir) +CLEANFILES = pixmaps.h +baghira.lo: pixmaps.h diff --git a/style/baghira.cpp b/style/baghira.cpp new file mode 100644 index 0000000..bae1611 --- /dev/null +++ b/style/baghira.cpp @@ -0,0 +1,3384 @@ +#include "baghira.h" +#include "bitmaps.h" +#include "pixmaps.h" +//#include "../deco/baghiradecobuttons.h" + +#include <qapplication.h> +#include <qbitmap.h> +#include <qbrush.h> +#include <qbutton.h> +#include <qcleanuphandler.h> +#include <qcolor.h> +#include <qcombobox.h> +//#include <qevent.h> +#include <qfont.h> +#include <qframe.h> +#include <qgroupbox.h> +#include <qheader.h> +#include <qiconset.h> +#include <qimage.h> +#include <qlayout.h> +#include <qlistbox.h> +#include <qlistview.h> +#include <qmenubar.h> +#include <qobject.h> +#include <qobjectlist.h> +#include <qpaintdevice.h> +#include <qpainter.h> +#include <qpalette.h> +#include <qpen.h> +#include <qpoint.h> +#include <qpopupmenu.h> +#include <qpushbutton.h> +//#include <qrangecontrol.h> +#include <qrect.h> +#include <qscrollbar.h> +#include <qscrollview.h> +#include <qsize.h> +#include <qslider.h> +#include <qstring.h> +#include <qstyleplugin.h> +#include <qtabbar.h> +#include <qtabwidget.h> +#include <qvariant.h> +#include <ktoolbar.h> +#include <ktoolbarbutton.h> +#include <kwordwrap.h> +#include "config.h" + +#define PRINTDEVICE(p) qWarning("device is %s", (p->device()->devType() == QInternal::Widget) ?\ +"Widget": (p->device()->devType() == QInternal::Pixmap) ?\ +"Pixmap": (p->device()->devType() == QInternal::Printer) ?\ +"Printer": (p->device()->devType() == QInternal::Picture) ?\ +"Picture": (p->device()->devType() == QInternal::UndefinedDevice) ?\ +"UndefinedDevice": "fuckdevice!" ); + +#define GCC_VERSION (__GNUC__ * 10000 \ ++ __GNUC_MINOR__ * 100 \ ++ __GNUC_PATCHLEVEL__) + +static const int windowsItemFrame = 1; // menu item frame width +static const int windowsSepHeight = 2; // separator item height +static const int windowsItemHMargin = 3; // menu item hor text margin +static const int windowsItemVMargin = 1; // menu item ver text margin +static const int windowsArrowHMargin = 6; // arrow horizontal margin +static const int windowsTabSpacing = 12; // space between text and tab +static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark +static const int windowsRightBorder = 12; // right border on windows +static const int windowsCheckMarkWidth = 12; // checkmarks width on windows + +// options +int OptionHandler::menuBackground; +int OptionHandler::menuOpacity; +bool OptionHandler::menuColorButton; +bool OptionHandler::shadowText; +//color +QColor OptionHandler::customButtonColor, OptionHandler::menuStripeColor_; +//widgets +bool OptionHandler::customWidgetColor; +QColor OptionHandler::customColors[ 10 ]; +//menu +bool OptionHandler::useCustomMenuColor; +QColor OptionHandler::color, OptionHandler::color2, OptionHandler::colorHigh, OptionHandler::fgColor, OptionHandler::fgColorHigh; +//Panel +// bool OptionHandler::panelCustom; +// QColor OptionHandler::customPanelColor; +//incativeButton +int OptionHandler::inactiveButtonColor; +QColor OptionHandler::customInactiveButtonColor; + +//Design +//stipples +bool OptionHandler::bgStipple, /*OptionHandler::panelStipple,*/ OptionHandler::bevelHighlights_, OptionHandler::drawMenuStripe_, OptionHandler::glossyMenus_; +Style OptionHandler::style_; +int OptionHandler::contrast; +//shadows +bool OptionHandler::groupboxshadow; +int OptionHandler::shadowDarkness; +//istviews; +bool OptionHandler::drawDotlines, OptionHandler::useCustomExpanderColor; +int OptionHandler::expanderStyle; +QColor OptionHandler::expanderColor, OptionHandler::dotlineColor; +int OptionHandler::dotlineStyle; +//slider +bool OptionHandler::squeezesbslider; +bool OptionHandler::shadowsbslider; +bool OptionHandler::animateSlider; +bool OptionHandler::animateProgress; +//toolbar +bool OptionHandler::reverseBtnColor, OptionHandler::tbFrame; +//tweaks +bool OptionHandler::centerTabs; +bool OptionHandler::smoothListViewHeaders; +bool OptionHandler::smootherLVH; +bool OptionHandler::icyButtons; +Style OptionHandler::_buttonStyle; +int OptionHandler::progressBar; +bool OptionHandler::removeKickerBevel; +Style OptionHandler::_toolbuttonStyle; +bool OptionHandler::drawProgressLabel; +QColor OptionHandler::brushTint; +QColor OptionHandler::aDecoColor1_; +QColor OptionHandler::aDecoColor2_; +QColor OptionHandler::titleColor_[2]; +QColor OptionHandler::titleButtonColor_[3]; +bool OptionHandler::tintBrush; +tabStyle OptionHandler::tabStyle_; +unsigned long OptionHandler::wmDesign; +bool OptionHandler::animateButton; +int OptionHandler::custCols[8]; + +QPixmap LiquidStyle::popupBack; + +//============ + +class KAccessToolBarButton : public KToolBarButton +{ +// to get me access to the toolbbar + friend class LiquidStyle; +public: + KAccessToolBarButton( QWidget* parent=0, const char* name=0 ) + : KToolBarButton( parent, name ) {} +}; + + +class LiquidStylePlugin : public QStylePlugin { + public: + LiquidStylePlugin() { + ; + } + ~LiquidStylePlugin() { + ; + } + + QStringList keys() const { + return ( QStringList() << "Baghira" ); + } + QStyle *create( const QString & ); + }; + +QStyle *LiquidStylePlugin::create( const QString &s ) { + if ( s.lower() == "baghira" ) + return ( new LiquidStyle() ); + return ( 0 ); + } + +Q_EXPORT_PLUGIN( LiquidStylePlugin ) + +static const int itemFrame = 1; +static const int itemHMargin = 3; +static const int itemVMargin = 1; +static const int arrowHMargin = 6; +static const int rightBorder = 12; + + +LiquidStyle::LiquidStyle() : KStyle( AllowMenuTransparency | FilledFrameWorkaround, ThreeButtonScrollBar ) +{ + QIntDict<ButtonFadeInfo>bfi(31);// assuming 31 btns will be enough - a pointer list would be more accurate, but we need to lookup this every 50ms... + QIntDict<ButtonTile>btnShadowedDict(223);// we need around 10/color, 3 colors/button assuming 10 different colors (e.g. kcalc) + QIntDict<ButtonTile>buttonGlowDict(109); + QIntDict<ButtonTile>buttonDict(331); + headerHoverID = -1; + headerSortID = -1; + hoveredTabIndex = -1; + currentTabBar = 0L; + paintWidget = 0L; + highlightWidget = 0L; + currentTaskContainer = 0L; + taskContainerHover = false; + isTaskContainer = false; + isHTMLButton = false; + inExitPolish = false; + inactiveRoundFrame = 0L; + activeRoundFrame = 0L; + eventKiller = new EventKiller; + bmShower = 0L; // only if b/m + + btnDict.setAutoDelete( true ); + btnShadowedDict.setAutoDelete( true ); + bfi.setAutoDelete( true ); +// inverseTabDict.setAutoDelete( true ); +// tabDict.setAutoDelete( true ); + initialPaletteLoaded = false; + qtrcModificationTime = 0; + + // animations kram! + progAnimShift = 0; + prog2AnimShift = 0; + sliderAnimShift = 0; + QTimer* timer = new QTimer( this ); + timer->start(50, false); +// if (optionHandler->AnimateProgress()) + connect(timer, SIGNAL(timeout()), this, SLOT(updateProgressPos())); + activeScroller = NULL; + //-------------------------------------- + + tooltipPalette = qApp->palette(); + tooltipPalette.setBrush( QColorGroup::Background, QColor( 255, 255, 220 ) ); + tooltipPalette.setBrush( QColorGroup::Foreground, Qt::black ); + + rMatrix.rotate( 90.0 ); + lMatrix.rotate( 270.0 ); + iMatrix.rotate( 180.0 ); + mMatrix.setMatrix ( -1, 0, 0, 1, 0, 0); + m2Matrix.setMatrix ( 1, 0, 0, -1, 0, 0); + + optionHandler = new OptionHandler( this ); + if (optionHandler->style() != Milk && optionHandler->AnimateSlider()) + connect(timer, SIGNAL(timeout()), this, SLOT(updateSliderPos())); + if (optionHandler->style() == Brushed) + bmShower = new BMShower(this); + + switch (optionHandler->buttonStyle()) + { + case Jaguar: + btnBorderImg = new QImage( uic_findImage("button-jaguar") ); + btnShadowImg = new QImage( uic_findImage( "button-shadow" ) ); + buttonGlow = new QImage( uic_findImage( "button-glow" ) ); + combo = new QImage( uic_findImage("combo-jaguar") ); + comboShadow = new QImage( uic_findImage( "combo-shadow" ) ); + if (optionHandler->toolbuttonStyle() == Brushed || !optionHandler->SmoothListViewHeaders()) + rectbutton = new QImage( uic_findImage( "rectbutton" ) ); + else rectbutton = 0L; + break; + case Panther: + case Tiger: + btnBorderImg = new QImage( uic_findImage("button-base") ); + btnShadowImg = new QImage( uic_findImage( "button-shadow" ) ); + buttonGlow = new QImage( uic_findImage( "button-glow" ) ); + combo = new QImage( uic_findImage("combo") ); + comboShadow = new QImage( uic_findImage( "combo-shadow" ) ); + if (optionHandler->toolbuttonStyle() == Brushed || !optionHandler->SmoothListViewHeaders()) + rectbutton = new QImage( uic_findImage( "rectbutton" ) ); + else rectbutton = 0L; + break; + case Brushed: + btnBorderImg = 0L; + btnShadowImg = 0L; + buttonGlow = 0L; + rectbutton = new QImage( uic_findImage( "rectbutton" ) ); + switch (optionHandler->toolbuttonStyle()) + { + case Jaguar: + combo = new QImage( uic_findImage("combo-jaguar") ); + comboShadow = new QImage( uic_findImage( "combo-shadow" ) ); + break; + case Panther: + case Tiger: + case Brushed: + combo = new QImage( uic_findImage("combo") ); + comboShadow = new QImage( uic_findImage( "combo-shadow" ) ); + break; + case Milk: + combo = new QImage( uic_findImage("combo-milk") ); + comboShadow = new QImage( uic_findImage( "combo-shadow" ) ); + default: + break; + } + break; + case Milk: + btnBorderImg = new QImage( uic_findImage("button-milk") ); + btnShadowImg = 0L; + buttonGlow = 0L; + combo = new QImage( uic_findImage("combo-milk") ); + comboShadow = new QImage( uic_findImage( "combo-shadow" ) ); + if (optionHandler->toolbuttonStyle() == Brushed || !optionHandler->SmoothListViewHeaders()) + rectbutton = new QImage( uic_findImage( "rectbutton" ) ); + else rectbutton = 0L; + default: + break; + } + + if ( btnBorderImg && btnBorderImg->depth() < 32 ) + * btnBorderImg = btnBorderImg->convertDepth( 32 ); + + if ( btnShadowImg && btnShadowImg->depth() < 32 ) + * btnShadowImg = btnShadowImg->convertDepth( 32 ); + + if ( buttonGlow && buttonGlow->depth() < 32 ) + * buttonGlow = buttonGlow->convertDepth( 32 ); + + if ( combo && combo->depth() < 32 ) + * combo = combo->convertDepth( 32 ); + + if ( comboShadow && comboShadow->depth() < 32 ) + * comboShadow = comboShadow->convertDepth( 32 ); + + if ( rectbutton && rectbutton->depth() < 32 ) + * rectbutton = rectbutton->convertDepth( 32 ); + + if (optionHandler->style() == Milk) + { + slider_top = new QImage( uic_findImage( "sbslider_top-milk" ) ); + slider_btm = new QImage( uic_findImage( "sbslider_btm-milk" ) ); + } + else + { + slider_top = new QImage( uic_findImage( "sbslider_top" ) ); + slider_btm = new QImage( uic_findImage( "sbslider_btm" ) ); + } + + if ( slider_top->depth() < 32 ) + * slider_top = slider_top->convertDepth( 32 ); + + if ( slider_btm->depth() < 32 ) + * slider_btm = slider_btm->convertDepth( 32 ); + + if (optionHandler->shadowSbSlider()) + { + slider_top_shd = new QImage( uic_findImage( "sbslider_top_shd" ) ); + if ( slider_top_shd->depth() < 32 ) + * slider_top_shd = slider_top_shd->convertDepth( 32 ); + + slider_btm_shd = new QImage( uic_findImage( "sbslider_btm_shd" ) ); + if ( slider_btm_shd->depth() < 32 ) + * slider_btm_shd = slider_btm_shd->convertDepth( 32 ); + } + else + { + slider_top_shd = 0L; + slider_btm_shd = 0L; + } + + roundFrame = new QImage( uic_findImage( "roundFrame" ) ); + if ( roundFrame->depth() < 32 ) + * roundFrame = roundFrame->convertDepth( 32 ); + + menuPix = NULL; + tmpBtnPix = NULL; + + int i; + for ( i = 0; i < BITMAP_ITEMS; ++i ) { + pixmaps[ i ] = NULL; + } + + sbLeft = new QBitmap( 6, 7, sbarrow_left_bits, true ); + sbLeft->setMask( *sbLeft ); + sbRight = new QBitmap( 6, 7, sbarrow_right_bits, true ); + sbRight->setMask( *sbRight ); + sbUp = new QBitmap( 7, 6, sbarrow_up_bits, true ); + sbUp->setMask( *sbUp ); + sbDown = new QBitmap( 7, 6, sbarrow_down_bits, true ); + sbDown->setMask( *sbDown ); + checkmark = new QBitmap( 6, 7, checkmark_bits, true ); + checkmark->setMask( *checkmark ); + + isKicker = ( qstrcmp( qApp->argv() [ 0 ], "kicker" ) == 0 ) || + ( qstrcmp( qApp->argv() [ 0 ], "appletproxy" ) == 0 ); + isOOO = !qstrcmp( qApp->argv() [ 0 ], "soffice.bin" ); + + groupShadow = new QPixmap( 64, 64 ); + QColor c; + optionHandler->custCols[0] != -1 ? c = QColor(optionHandler->custCols[0]) : c= QColor(qApp->palette().color(QPalette::Active, isKicker?QColorGroup::Button:QColorGroup::Background)); + + groupShadow->fill( ( c.dark( 100 + optionHandler->ShadowDarkness() ) ).rgb() ); + if ( (optionHandler->style() != Brushed) && optionHandler->useBgStipple() ) { + QPainter p; + p.begin( groupShadow ); + p.setPen( c.dark( 100 + optionHandler->ShadowDarkness() + (int)(optionHandler->stippleContrast()/2) ) ); + for ( int i = 1; i < 64; i += 4 ) { + p.drawLine( 0, i, 63, i ); + p.drawLine( 0, i+2, 63, i+2 ); + } + p.setPen( c.dark( 100 + optionHandler->ShadowDarkness() + optionHandler->stippleContrast()) ); + for ( int i = 2; i < 63; i += 4 ) { + p.drawLine( 0, i, 63, i ); + } + } + + if (optionHandler->style() == Brushed) + { + plainBrush = optionHandler->TintBrush() ? + *tintBrush(uic_findImage( "brushed-tile" ), optionHandler->BrushTint()) : + uic_findImage( "brushed-tile" ); + gradBrush = optionHandler->TintBrush() ? + *tintBrush(uic_findImage( "brushed-gradient" ), optionHandler->BrushTint()) : + uic_findImage( "brushed-gradient" ); + } +} + +LiquidStyle::~LiquidStyle() { +// btnDict.setAutoDelete(true); + btnDict.clear(); +// btnShadowedDict.setAutoDelete(true); + btnShadowedDict.clear(); +// buttonGlowDict.setAutoDelete(true); + buttonGlowDict.clear(); +// comboDict.setAutoDelete(true); + comboDict.clear(); +// comboShadowedDict.setAutoDelete(true); + comboShadowedDict.clear(); +// if (! tabDict.isEmpty()) tabDict.clear(); +// if (! inverseTabDict.isEmpty()) inverseTabDict.clear(); +// rectBtnDict.setAutoDelete(true); + rectBtnDict.clear(); +// progress2Dict.setAutoDelete(true); + progress2Dict.clear(); +// bfi.setAutoDelete(true); + bfi.clear(); +// fadeColorMap.setAutoDelete(true); + fadeColorMap.clear(); + + delete optionHandler; + + delete sbUp; + delete sbDown; + delete sbLeft; + delete sbRight; + delete checkmark; + + + if ( btnBorderImg ) + delete btnBorderImg; + if ( btnShadowImg ) + delete btnShadowImg; + if (combo) + delete combo; + if (comboShadow) + delete comboShadow; + if (buttonGlow) + delete buttonGlow; + delete slider_top; + delete slider_btm; + if (slider_top_shd) + delete slider_top_shd; + if (slider_btm_shd) + delete slider_btm_shd; + if (rectbutton) + delete rectbutton; + delete roundFrame; + + if ( tmpBtnPix ) + delete tmpBtnPix; + if ( menuPix ) + delete menuPix; + + int i; + for ( i = 0; i < BITMAP_ITEMS; ++i ) { + if ( pixmaps[ i ] ) + delete pixmaps[ i ]; + } + if ( groupShadow ) + delete groupShadow; + + } + +inline void LiquidStyle::updateProgressPos() +{ + progAnimShift = (progAnimShift + 1) % 20; + prog2AnimShift = (prog2AnimShift + 1) % 38; + //Update the registered progressbars. + QMap<QWidget*, int>::iterator iter; + for (iter = progAnimWidgets.begin(); iter != progAnimWidgets.end(); iter++) + { + if ( !::qt_cast<QProgressBar*>(iter.key()) ) + continue; + (iter.key())->repaint(false); + } +} + +inline void LiquidStyle::updateSliderPos(){ + sliderAnimShift = (sliderAnimShift + 1) % 32; + if (activeScroller) + activeScroller->repaint(false); +} + +void LiquidStyle::progressBarDestroyed(QObject* obj){ + progAnimWidgets.remove(static_cast<QWidget*>(obj)); +} + +bool LiquidStyle::isPlain() const { + return ( !optionHandler->useBgStipple() ); + } + + +void LiquidStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, + const QRect &r, const QColorGroup &cg, + SFlags flags, const QStyleOption &opt ) const +{ + bool down = flags & Style_Down; + bool on = flags & Style_On; + + switch ( pe ) + { + case PE_TabBarBase: + { + bool isDialog = false; + if (p->device() && p->device()->devType() == QInternal::Widget) + { + QWidget *w = (QWidget*)p->device(); + if (w && ::qt_cast<QTabWidget*>(w) && w->children()) + { + QObjectListIt it( *w->children() ); // iterate over the buttons + QObject *obj; + QTabBar *tabBar = 0L; + while ( (obj = it.current()) != 0 ) + { + ++it; + if (::qt_cast<QTabBar*>(obj)) + { + tabBar = (QTabBar*)obj; + break; + } + } + if (!tabBar || !tabBar->isVisible()) + break; + } + isDialog = optionHandler->TabStyle() == Clever && w->topLevelWidget()->inherits("QDialog"); + } + if (isDialog || optionHandler->TabStyle() == Chooser) + { + int x = r.x(); int right = r.right(); int bottom = r.bottom(); int y2 = r.y() + 1; + QColor bright( cg.background().dark( 110 ) ); + QColor mid( cg.background().dark( 130 ) ); + QColor dark( cg.background().dark( 150 ) ); + p->setPen( dark ); + p->drawLine( x + 6, y2, right - 6, y2 ); + p->drawPoint(x+3,y2+1);p->drawPoint(x+4,y2+1); + p->drawPoint(x+2,y2+2); + p->drawPoint(x+1,y2+3); + p->drawPoint(right-3,y2+1);p->drawPoint(right-4,y2+1); + p->drawPoint(right-2,y2+2); + p->drawPoint(right-1,y2+3); + p->drawLine(x,y2+5,x,bottom); + p->drawLine(right,y2+5,right,bottom); + + p->setPen( mid ); + p->drawPoint(x+4, y2);p->drawPoint(x+5,y2); + p->drawPoint(right-4, y2);p->drawPoint(right-5,y2); + p->drawPoint(x+2, y2+1); + p->drawPoint(right-2, y2+1); + p->drawLine(x+5,y2 + 1, right - 5, y2 + 1); + p->drawPoint(x+1,y2+2); + p->drawPoint(right-1,y2+2); + p->drawPoint(x+2,y2+3); + p->drawPoint(right-2,y2+3); + p->drawPoint(x,y2+4);p->drawPoint(x+1,y2+4); + p->drawPoint(right,y2+4);p->drawPoint(right+1,y2+4); + + p->setPen(bright); + p->drawPoint(x+3,y2);p->drawPoint(right-3,y2); + p->drawLine(x+4,y2+2,right-4,y2+2); + p->drawPoint(x,y2+3);p->drawPoint(x+3,y2+3); + p->drawPoint(right,y2+3);p->drawPoint(right-3,y2+3); + p->drawPoint(x+2,y2+4);p->drawPoint(right-2,y2+4); + p->drawLine(x+1,y2+5,x+1,bottom); + p->drawLine(right-1,y2+5,right-1,bottom); + break; + } + else + { + drawCombo( p, cg, cg.button(), r.x()+1, r.y()+1, r.width()-2, r.height()+1, false, false, false, center); + QPen oldPen = p->pen(); +// p->setClipping ( false ); + p->setPen( cg.button().dark( 158 ) ); + p->drawRect(r); +// p->fillRect(r, Qt::red); +// p->flush(); + p->setPen(oldPen); + } + break; + } + case PE_ButtonCommand: + case PE_ButtonDefault: + { + bool sunken = on || down; + bool hover = flags & Style_MouseOver; + bool focused = flags & Style_HasFocus; + QColor newColor = sunken ? cg.button().dark( 110 ) : hover || focused ? cg.button() : optionHandler->InactiveButtonColor(); + if (optionHandler->AnimateButton() && (sunken || hover || focused)) + { + ButtonFadeInfo *bfi_ = /*(::qt_cast<QWidget*>(*/opt.widget()/*))*/ ? bfi[opt.widget()->winId()] : 0L; + if (bfi_) + { + int index = bfi_->index; + newColor = mapFadeColor(newColor, index); + } + } + + if (optionHandler->buttonStyle() == Brushed) + { + drawRectangularButton( p, cg, newColor, r.x(), r.y(), r.width(), r.height(), sunken, hover, false, full); + } + else if ( ( r.width() < 21 || r.height() < 25 )) + { + drawCombo( p, cg, newColor, r.x(), r.y(), r.width(), r.height()+2, sunken, hover, false, center, isHTMLButton ); + QPen oldpen(p->pen()); + p->setPen( newColor.dark(150)); + p->drawRect(r.x(), r.y(), r.width(), r.height()); + if (sunken) + { + p->setPen(newColor.dark(180)); + p->drawRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2); + } + p->setPen(oldpen); + break; + } + else if (optionHandler->buttonStyle() == Milk) + drawCombo( p, cg, newColor, r.x(), r.y(), r.width(), r.height(), sunken, hover, false, full, isHTMLButton ); + else + { + drawRoundButton( p, cg, newColor, r.x(), r.y(), r.width(), r.height(), sunken, hover, btnOffset.x(), btnOffset.y() ); + } + break; + } + case PE_ButtonBevel: + case PE_ButtonDropDown: + { + bool sunken = on || down; + bool hover = flags & Style_MouseOver; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, sunken ? cg.button().dark( 110 ) : hover ? cg.button() : optionHandler->InactiveButtonColor(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, full); + else + drawCombo( p, cg, sunken ? cg.button().dark( 110 ) : hover ? cg.button() : optionHandler->InactiveButtonColor(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, full ); + break; + } + case PE_ButtonTool: + { + bool sunken = on || down; + bool hover = flags & Style_MouseOver; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, sunken ? cg.button().dark( 110 ) : hover ? cg.button() : optionHandler->InactiveButtonColor(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, full); + else + drawCombo( p, cg, sunken ? cg.button().dark( 110 ) : hover ? cg.button() : optionHandler->InactiveButtonColor(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, full ); + break; + } + case PE_HeaderSection: + { + bool sunken = on || down; + bool hover = flags & Style_MouseOver; + QPen oldpen(p->pen()); + if ( isTaskContainer ) // is kicker? + { + if (optionHandler->SmoothListViewHeaders()) + { + drawCombo( p, cg, sunken ? cg.button() : taskContainerHover ? cg.button().light( 110 ) : cg.background(), r.x(), r.y(), r.width(), isKicker ? r.height() + 2 : r.height(), sunken, hover, false, optionHandler->SmootherLVH() ? full : center ); + if (isKicker && !optionHandler->SmootherLVH()) + { + p->setPen(cg.background().dark(150)); + p->drawRect(r.x(), r.y(), r.width(), r.height()); + if (sunken) + { + p->setPen(cg.background().dark(200)); + p->drawRect(r.x()+1, r.y()+1, r.width()-2, r.height()-2); + } + } + } + else + { + drawRectangularButton( p, cg, sunken ? cg.button() : taskContainerHover ? cg.button().light( 110 ) : cg.background(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, center); + p->setPen(cg.background().dark(150)); + p->drawLine(r.x(),r.y()+1,r.x(),r.height()-2); + } + const_cast<LiquidStyle*>( this ) ->isTaskContainer = false; + const_cast<LiquidStyle*>( this ) ->taskContainerHover = false; + } + else + { + if ( (p->device() && p->device()->devType() == QInternal::Widget) && ::qt_cast<QHeader*>((QWidget*)p->device()) ) + { + QHeader *header = (QHeader*)p->device(); + int id = header->orientation() == Qt::Horizontal ? header->sectionAt( r.x() + 2 + header->offset() ) : header->sectionAt( r.y() + 2 + header->offset() ); + hover = ((id != -1) && ((currentHeader == header && id == headerHoverID ) || id == headerSortID)); + if (header->mapToIndex(id) == header->count()-1 && (r.bottom() < header->rect().bottom() || r.right() < header->rect().right())) + { + bool hadClip = p->hasClipping(); + p->setClipping( false ); + if (header->orientation() == Qt::Horizontal) + p->fillRect(r.right()+1, r.y(), header->width()-r.right(), r.height(), cg.base()); + else + p->fillRect(r.x(), r.bottom()+1, r.width(), header->height()-r.bottom(), cg.base()); + p->setClipping( hadClip ); + } + } + if (optionHandler->SmoothListViewHeaders()) + { + drawCombo( p, cg, sunken ? cg.button().dark( 110 ) : hover ? cg.button() : optionHandler->InactiveButtonColor(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, center); + } + else + drawRectangularButton( p, cg, sunken ? cg.button().dark( 110 ) : hover ? cg.button() : optionHandler->InactiveButtonColor(), r.x(), r.y(), r.width(), r.height(), sunken, hover, false, center); + } + p->setPen(oldpen); + break; + } + case PE_FocusRect: + { + p->drawWinFocusRect( r ); + break; + } + case PE_ScrollBarSlider: + case PE_ScrollBarAddPage: + case PE_ScrollBarSubPage: + { + QColor sbBgColor = optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBGroove ) : + qApp->palette().active().background(); + + bool isActive = optionHandler->ScrollerActive(); + bool isHover = currentScrollBar->hasMouse(); + bool isPressed = currentScrollBar->draggingSlider(); + bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); + + // horizontal slider + if ( flags & Style_Horizontal ) + { + int extent = currentScrollBar->height(); + QRect bgR( extent, 0, currentScrollBar->width() - extent * 3 + 1, extent ); + if ( sbBuffer.size() != currentScrollBar->size() ) + const_cast<LiquidStyle*>( this )->sbBuffer.resize( currentScrollBar->size() ); + QPainter painter; + painter.begin( &sbBuffer ); + // pixmaps + if (drawSlider) + { + painter.drawPixmap( bgR.x(), bgR.y() + 1, *getPixmap( HSBSliderBtmBg ) ); + painter.drawTiledPixmap( bgR.x() + 7, bgR.y() + 1, bgR.width() - 15, 13, *getPixmap( HSBSliderMidBg ) ); + painter.drawPixmap( bgR.right() - 8, bgR.y() + 1, *getPixmap( HSBSliderTopBg ) ); + } + else + painter.drawTiledPixmap( bgR.x(), bgR.y() + 1, bgR.width(), 13, *getPixmap( HSBSliderMidBg ) ); + + // lines + painter.setPen( sbBgColor.dark( 110 ) ); + painter.drawLine( bgR.x(), bgR.y(), bgR.right(), bgR.y()); + painter.drawLine( bgR.x(), bgR.bottom(), bgR.right(), bgR.bottom()); + + if ( pe == PE_ScrollBarSlider && drawSlider) + { + int offset = isPressed * ( optionHandler->squeezeSbSlider() + optionHandler->shadowSbSlider()*2); + int offset2 = optionHandler->shadowSbSlider()*2 + (isPressed && optionHandler->squeezeSbSlider()); + + painter.drawPixmap( r.x() + offset, r.y() + 1, + isPressed ? *getPixmap( HSBSliderBtmPressed ) : + (isHover || isActive || isOOO) ? *getPixmap( HSBSliderBtmActive ) : + *getPixmap( HSBSliderBtm)); + + painter.drawPixmap( r.right() - 6 - offset2, r.y() + 1, + isPressed ? *getPixmap( HSBSliderTopPressed ) : + (isHover || isActive || isOOO) ? *getPixmap( HSBSliderTopActive ) : + *getPixmap( HSBSliderTop ) ); + // mid part last, as i have to redefine clip section + painter.setClipRect(r.x() + 7 + offset2, r.y() + 1, r.width() - 14 - 2*offset2, 13, QPainter::CoordPainter); + painter.drawTiledPixmap( r.x() + 7 + offset2 + ((isHover && !isPressed) ? (sliderAnimShift - 32) : 0), r.y() + 1, r.width() - 14 - 2*offset2 - ((isHover && !isPressed) ? + (sliderAnimShift - 32) : 0), 13, isPressed ? *getPixmap( HSBSliderMidPressed ) : + (isHover || isActive || isOOO) ? *getPixmap( HSBSliderMidActive ) : + *getPixmap( HSBSliderMid ), isPressed?r.x() : 0, 0); + } + + painter.end(); + } + + // vertical slider + else + { + int extent = currentScrollBar->width(); + QRect bgR( 0, extent, extent, currentScrollBar->height() - extent * 3 + 1 ); + + if ( sbBuffer.size() != currentScrollBar->size() ) + const_cast<LiquidStyle*>( this ) -> sbBuffer.resize( currentScrollBar->size() ); + QPainter painter; + painter.begin( &sbBuffer ); // set painter to pixelbuffer + if (drawSlider) + { + // top slidergroove rounder + painter.drawPixmap( bgR.x() + 1, bgR.y(), *getPixmap( VSBSliderTopBg ) ); + // the groove + painter.drawTiledPixmap( bgR.x() + 1, bgR.y() + 8, 13, bgR.height() - 15, *getPixmap( VSBSliderMidBg ) ); + // bottom slidergroove rounder + painter.drawPixmap( bgR.x() + 1, bgR.bottom() - 7, *getPixmap( VSBSliderBtmBg ) ); + } + else + painter.drawTiledPixmap( bgR.x() + 1, bgR.y(), 13, bgR.height(), *getPixmap( VSBSliderMidBg ) ); + + painter.setPen( sbBgColor.dark( 110 ) ); + painter.drawLine( bgR.x(), bgR.y(), bgR.x(), bgR.bottom() ); + painter.drawLine( bgR.right(), bgR.y(), bgR.right(), bgR.bottom() ); + + // here we are, now the slider + if ( pe == PE_ScrollBarSlider && drawSlider ) + { + int offset = isPressed * ( optionHandler->squeezeSbSlider() + optionHandler->shadowSbSlider()*2); + int offset2 = (isPressed * optionHandler->squeezeSbSlider()) + optionHandler->shadowSbSlider()*2; + + painter.drawPixmap( r.x() + 1, r.y() + offset, isPressed ? + *getPixmap( VSBSliderTopPressed ) : + (isHover || isActive || isOOO) ? *getPixmap( VSBSliderTopActive ) : + *getPixmap( VSBSliderTop)); + painter.drawPixmap( r.x() + 1, r.bottom() - 6 - offset2, isPressed ? + *getPixmap( VSBSliderBtmPressed ) : + (isHover || isActive || isOOO) ? *getPixmap( VSBSliderBtmActive ) : + *getPixmap( VSBSliderBtm ) ); + // mid part last, as i have to redefine clipping section + painter.setClipRect(r.x() + 1, r.y() + 7+offset2, 13, r.height() - 14 - 2*offset2, QPainter::CoordPainter); + painter.drawTiledPixmap( r.x() + 1, r.y() + 7 + offset2 - ((isHover && !isPressed) ? sliderAnimShift : 0), + 13, r.height() - 14 - 2*offset2 + ((isHover && !isPressed) ? + sliderAnimShift : 0), isPressed ? *getPixmap( VSBSliderMidPressed ) : + (isHover || isActive || isOOO) ? *getPixmap( VSBSliderMidActive ) : + *getPixmap( VSBSliderMid ),0,isPressed?r.y():0 ); + } + painter.end(); + } + p->drawPixmap( r.x(), r.y(), sbBuffer, r.x(), r.y(), r.width(), r.height() ); + break; + } + case PE_ScrollBarAddLine: + { + QColor c( optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBGroove ) : + qApp->palette().active().background() ); + QColor pixColor = flags & Style_Down ? qApp->palette().active().button() : c; + + bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); + + if ( flags & Style_Horizontal ) + { + p->drawTiledPixmap( r.x(), r.y() + 1, r.width(), 13, *getPixmap(drawSlider ? HSBSliderMidBgI : HSBSliderMidBg)); + p->setPen( c.dark( 110 ) ); + p->drawLine( r.x(), r.y(), r.right(), r.y()); + p->drawLine( r.x(), r.bottom(), r.right(), r.bottom()); + } + else + { + p->drawTiledPixmap( r.x() + 1, r.y(), 13, r.height(), *getPixmap(drawSlider ? VSBSliderMidBgI : VSBSliderMidBg)); + p->setPen( c.dark( 110 ) ); + p->drawLine( r.x(), r.y(), r.x(), r.bottom()); + p->drawLine( r.right(), r.y(), r.right(), r.bottom()); + } + if (drawSlider) + { + p->setPen( flags & Style_Down ? cg.button() : QColor(85,85,85) ); + p->setBrush( flags & Style_Down ? cg.button() : QColor(85,85,85) ); + p->drawPixmap( r.x() + 4, r.y() + 4, flags & Style_Horizontal ? *sbRight : *sbDown ); + } + break; + } + case PE_ScrollBarSubLine: + { + QColor c( optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBGroove ) : + qApp->palette().active().background() ); + QColor pixColor = flags & Style_Down ? qApp->palette().active().button() : c; + bool top = flags & Style_Horizontal ? r.x() == 0 : r.y() == 0; + + bool drawSlider = currentScrollBar->minValue() < currentScrollBar->maxValue(); + + if ( flags & Style_Horizontal ) + { + if ( top ) + { + p->drawTiledPixmap( r.x(), r.y() + 1, r.width(), 13, *getPixmap(drawSlider ? HSBSliderMidBgI : HSBSliderMidBg)); + } + else + { + p->drawTiledPixmap( r.x(), r.y() + 1, r.width(), 13, *getPixmap(drawSlider ? HSBSliderMidBgI : HSBSliderMidBg)); + } + p->setPen( c.dark( 110 ) ); + p->drawLine( r.x(), r.y(), r.right(), r.y()); + p->drawLine( r.x(), r.bottom(), r.right(), r.bottom()); + } + else + { + if ( top ) + { + p->drawTiledPixmap( r.x() + 1, r.y(), 13, r.height(), *getPixmap(drawSlider ? VSBSliderMidBgI : VSBSliderMidBg)); + } + else + { + p->drawTiledPixmap( r.x() + 1, r.y(), 13, r.height(), *getPixmap(drawSlider ? VSBSliderMidBgI : VSBSliderMidBg)); + } + p->setPen( c.dark( 110 ) ); + p->drawLine( r.x(), r.y(), r.x(), r.bottom()); + p->drawLine( r.right(), r.y(), r.right(), r.bottom()); + } + if (drawSlider) + { + p->setPen( flags & Style_Down ? cg.button() : QColor(85,85,85) ); + p->setBrush( flags & Style_Down ? cg.button() : QColor(85,85,85) ); + if (currentScrollBar->minValue() < currentScrollBar->maxValue()) p->drawPixmap( r.x() + 4, r.y() + 4, flags & Style_Horizontal ? *sbLeft : *sbUp ); + } + break; + } + case PE_Indicator: + { + bool hover = flags & Style_MouseOver; + bool pressed = flags & Style_Down; +// bool isMasked = p->device() && p->device() ->devType() == QInternal::Widget && ( ( QWidget * ) p->device() ) ->autoMask(); +#if 0 + if ( isMasked ) + { + if ( !( flags & Style_Off ) ) + p->drawPixmap( r.x(), r.y(), + hover ? *getPixmap( HTMLCBDownHover ) : + *getPixmap( HTMLCBDown ) ); + else + p->drawPixmap( r.x(), r.y(), hover ? + *getPixmap( HTMLCBHover ) : *getPixmap( HTMLCB ) ); + } + else +#endif + { + if ( flags & Style_On ) + p->drawPixmap( r.x(), r.y(), + pressed ? *getPixmap( CBDownPressed ) : + hover ? *getPixmap( CBDownHover ) : + *getPixmap( CBDown ) ); + else if ( flags & Style_Off ) + p->drawPixmap( r.x(), r.y(), + pressed ? *getPixmap( CBPressed ) : + hover ? *getPixmap( CBHover ) : + *getPixmap( CB ) ); + else //tristate + p->drawPixmap( r.x(), r.y(), + pressed ? *getPixmap( CBTriPressed ) : + hover ? *getPixmap( CBTriHover ) : + *getPixmap( CBTri ) ); + } + break; + } + case PE_IndicatorMask: + { + p->fillRect( r, Qt::color1 ); + break; + } + case PE_ExclusiveIndicator: + { + bool hover = flags & Style_MouseOver; + bool pressed = flags & Style_Down; + + if ( on || down ) + p->drawPixmap( r.x(), r.y(), + pressed ? *getPixmap( RadioOnPressed ) : + hover ? *getPixmap( RadioOnHover ) : + *getPixmap( RadioOn ) ); + else + p->drawPixmap( r.x(), r.y(), + pressed ? *getPixmap( RadioOffPressed ) : + hover ? *getPixmap( RadioOffHover ) : + *getPixmap( RadioOff ) ); + break; + } + case PE_ExclusiveIndicatorMask: + { + break; + } + case PE_Splitter: + case PE_DockWindowResizeHandle: + { + QPen oldpen(p->pen()); + QBrush oldbrush(p->brush()); + if (highlightWidget == p->device()) + { + if (flags & Style_Horizontal) + { //vertical? + p->setPen(cg.mid()); + p->drawLine(r.x(), r.y(), r.x(), r.bottom()); + p->drawLine(r.right(), r.y(), r.right(), r.bottom()); + p->setPen(cg.button().dark(140)); + p->setBrush(cg.button().dark(140)); + p->drawEllipse(r.x()+1,r.y() + (int)(r.height() / 2.5), 4, 4); + } + else + { + p->setPen(cg.mid()); + p->drawLine(r.x(), r.y(), r.right(), r.y()); + p->drawLine(r.x(), r.bottom(), r.right(), r.bottom()); + p->setPen(cg.button().dark(140)); + p->setBrush(cg.button().dark(140)); + p->drawEllipse(r.x()+r.width()/2,r.y() + 1, 4, 4); + } + + } + else + { + if (flags & Style_Horizontal) + { + p->setPen(cg.mid()); + p->drawLine(r.x(), r.y(), r.x(), r.bottom()); + p->drawLine(r.right(), r.y(), r.right(), r.bottom()); + p->setPen(cg.background().dark(130)); + p->setBrush(cg.background().dark(150)); + p->drawEllipse(r.x()+1,r.y() + (int)(r.height() / 2.5), 4, 4); + } + else + { + p->setPen(cg.mid()); + p->drawLine(r.x(), r.y(), r.right(), r.y()); + p->drawLine(r.x(), r.bottom(), r.right(), r.bottom()); + p->setPen(cg.background().dark(130)); + p->setBrush(cg.background().dark(150)); + p->drawEllipse(r.x()+r.width()/2,r.y() + 1, 4, 4); + } + } + p->setPen(oldpen); + p->setBrush(oldbrush); + break; + } +// case PE_BoxFrame: + case PE_PanelGroupBox: + case PE_GroupBoxFrame: + { + QColor bgColor; + QWidget* w = (p->device() && p->device()->devType() == QInternal::Widget) ? + (QWidget*)(p->device()) : 0; + QGroupBox* gb = ::qt_cast<QGroupBox*>(w); + + optionHandler->drawGroupBoxShadow() ? + bgColor = QColor(cg.background().dark( 100 + optionHandler->ShadowDarkness() )) : + bgColor = QColor(cg.background()); + QColor bright( bgColor.dark( 110 ) ); + QColor mid( bgColor.dark( 130 ) ); + QColor dark( bgColor.dark( 150 ) ); + + int titleHeight = (gb && !gb->title().isEmpty() && pe == PE_PanelGroupBox) ? + p->fontMetrics().height()+(gb->isCheckable()?4:1) : 0; + + int x = r.x(); int right = r.right(); int bottom = r.bottom(); + int y2 = r.y(); + + /*** + ok, to get the sunken look somwhat efficient and less glitchy + we reset the groupbox brush and only repaint the title + (saves us from several is item in groupbox checks as well) + only problem left: draw the parents brush on the title window aligned... + ***/ + + if (gb && titleHeight) + { + bool hadClip = p->hasClipping(); + QRegion oldClip = p->clipRegion(); + if (gb->parentWidget()) + { + const QPixmap *pix = gb->parentWidget()->paletteBackgroundPixmap(); + + if (optionHandler->drawGroupBoxShadow()) + { + QPointArray pa1(3); + pa1.setPoint(0, x,y2); + pa1.setPoint(1, x+5,y2); + pa1.setPoint(2, x,y2+5); + QPointArray pa2(3); + pa2.setPoint(0, right-5,y2); + pa2.setPoint(1, right,y2); + pa2.setPoint(2, right,y2+5); + QPointArray pa3(3); + pa3.setPoint(0, right,bottom-5); + pa3.setPoint(1, right,bottom); + pa3.setPoint(2, right-5,bottom); + QPointArray pa4(3); + pa4.setPoint(0, x+5,bottom); + pa4.setPoint(1, x,bottom); + pa4.setPoint(2, x,bottom-5); + + QRegion reg2(0,0, r.right(), titleHeight); + p->setClipRegion(QRegion(pa1)+QRegion(pa2)+QRegion(pa3)+QRegion(pa4)+reg2); + } + else + p->setClipRect(0,0,r.right(),titleHeight); + pix ? p->drawTiledPixmap( QRect( 0, 0, w->width(), w->height()), *pix, w->backgroundOffset()) : p->fillRect(QRect(0, 0, w->width(), w->height()),w->parentWidget()->backgroundBrush()); + } + if (gb && !gb->isCheckable()) + { + QString title = gb->title(); + QFont font( p->font() ); + font.setBold( true ); + p->setFont( font ); + drawItem( p, QRect(10,0,r.width(),titleHeight), ShowPrefix, cg, flags & Style_Enabled, 0, title, -1, &cg.text() ); + } + p->setClipRegion(oldClip); + p->setClipping(hadClip); + } + + //outer rect + // top + p->setPen( dark ); + if (pe == PE_PanelGroupBox) + { + p->drawLine( x + 6, y2, right - 6, y2 ); + // left points + p->drawPoint(x+3,y2+1);p->drawPoint(x+4,y2+1); + p->drawPoint(x+2,y2+2); + p->drawPoint(x+1,y2+3); + // right points + p->drawPoint(right-3,y2+1);p->drawPoint(right-4,y2+1); + p->drawPoint(right-2,y2+2); + p->drawPoint(right-1,y2+3); + // vertcal outer lines + p->drawLine(x,y2+5,x,bottom-5); + p->drawLine(right,y2+5,right,bottom-5); + } + else + { + // vertcal outer lines + p->drawLine(x,y2,x,bottom-5); + p->drawLine(right,y2,right,bottom-5); + } + + p->setPen( mid ); + if (pe == PE_PanelGroupBox) + { + // top stuff + p->drawPoint(x+4, y2);p->drawPoint(x+5,y2); + p->drawPoint(right-4, y2);p->drawPoint(right-5,y2); + p->drawPoint(x+2, y2+1); + p->drawPoint(right-2, y2+1); + p->drawLine(x+5,y2 + 1, right - 5, y2 + 1); + p->drawPoint(x+1,y2+2); + p->drawPoint(right-1,y2+2); + p->drawPoint(x+2,y2+3); + p->drawPoint(right-2,y2+3); + p->drawPoint(x,y2+4);p->drawPoint(x+1,y2+4); + p->drawPoint(right,y2+4);p->drawPoint(right+1,y2+4); + } + // bottom stuff + p->drawPoint(x,bottom - 4); p->drawPoint(x+1,bottom - 4); + p->drawPoint(right,bottom - 4); p->drawPoint(right-1,bottom - 4); + p->drawPoint(x+1,bottom - 3); + p->drawPoint(right-1,bottom - 3); + p->drawPoint(x+1,bottom - 2); p->drawPoint(x+2,bottom - 2); + p->drawPoint(right-1,bottom - 2); p->drawPoint(right-2,bottom - 2); + p->drawPoint(x+2, bottom - 1); p->drawPoint(x+3, bottom - 1); + p->drawPoint(right-2, bottom - 1); p->drawPoint(right-3, bottom - 1); + p->drawLine(x + 4, bottom,right - 4, bottom); + + p->setPen(bright); + // top stuff + if (pe == PE_PanelGroupBox) + { + p->drawPoint(x+3,y2);p->drawPoint(right-3,y2); + p->drawLine(x+4,y2+2,right-4,y2+2); + p->drawPoint(x,y2+3);p->drawPoint(x+3,y2+3); + p->drawPoint(right,y2+3);p->drawPoint(right-3,y2+3); + p->drawPoint(x+2,y2+4);p->drawPoint(right-2,y2+4); + // vertical lines + p->drawLine(x+1,y2+5,x+1,bottom-5); + p->drawLine(right-1,y2+5,right-1,bottom-5); + } + else + { + // vertical lines + p->drawLine(x+1,y2,x+1,bottom-5); + p->drawLine(right-1,y2,right-1,bottom-5); + } + // bottom stuff + p->drawPoint(x, bottom-3);p->drawPoint(right, bottom-3); + p->drawPoint(x+3, bottom);p->drawPoint(right-3, bottom); + + break; + } + case PE_StatusBarSection: + { + break; + } + case PE_WindowFrame: + { + drawEditFrame( p, r, cg, false, false, true ); + break; + } + case PE_Panel: + { + bool sunken = flags & Style_Sunken; + if (!(isKicker && optionHandler->RemoveKickerBevel())) + sunken ? drawEditFrame( p, r, cg ) : drawEditFrame( p, r, cg, false, false, true ); + break; + } + case PE_PanelTabWidget: + { + // don't ask + bool isDialog = optionHandler->TabStyle() == Clever && + (p->device() && p->device()->devType() == QInternal::Widget)&& + ((QWidget*)p->device())->topLevelWidget()->inherits("QDialog"); + + QColor bright( cg.background().dark( 110 ) ); + QColor mid( cg.background().dark( 130 ) ); + QColor dark( cg.background().dark( 150 ) ); + int x = r.x(); int right = r.right(); int bottom = r.bottom(); int y2 = r.y(); + if (isDialog || optionHandler->TabStyle() == Chooser) + { + //outer rect + // top + p->setPen( dark ); + // vertcal outer lines + p->drawLine(x,y2,x,bottom-5); + p->drawLine(right,y2,right,bottom-5); + + p->setPen( mid ); + // bottom stuff + p->drawPoint(x,bottom - 4); p->drawPoint(x+1,bottom - 4); + p->drawPoint(right,bottom - 4); p->drawPoint(right-1,bottom - 4); + p->drawPoint(x+1,bottom - 3); + p->drawPoint(right-1,bottom - 3); + p->drawPoint(x+1,bottom - 2); p->drawPoint(x+2,bottom - 2); + p->drawPoint(right-1,bottom - 2); p->drawPoint(right-2,bottom - 2); + p->drawPoint(x+2, bottom - 1); p->drawPoint(x+3, bottom - 1); + p->drawPoint(right-2, bottom - 1); p->drawPoint(right-3, bottom - 1); + p->drawLine(x + 4, bottom,right - 4, bottom); + + p->setPen(bright); + // top stuff + // vertical lines + p->drawLine(x+1,y2,x+1,bottom-5); + p->drawLine(right-1,y2,right-1,bottom-5); + + // bottom stuff + p->drawPoint(x, bottom-3);p->drawPoint(right, bottom-3); + p->drawPoint(x+3, bottom);p->drawPoint(right-3, bottom); + break; + } + else + { + p->setPen( mid ); + p->drawLine( x, y2, x, bottom-2 ); + p->drawLine( right, y2, right, bottom-2 ); + p->setPen( dark ); + p->drawLine( x, bottom-1, right, bottom-1 ); + p->drawLine( x, bottom, right, bottom ); + break; + } + } + case PE_PanelLineEdit: + { + bool focused = flags & Style_HasFocus; + bool isHTML = p->device() && p->device()->devType() == QInternal::Widget && isHTMLWidget((QWidget*)p->device()); + drawEditFrame( p, r, cg, isHTML, focused, false); + break; + } + case PE_PanelPopup: + { + int x, y, w , h; + r.rect( &x, &y, &w, &h ); + QColor c( optionHandler->UseCustomMenuColor()? + optionHandler->Color(): + optionHandler->MenuColorButton()? + optionHandler->buttonColor(): + optionHandler->bgColor() ); + p->setPen( c.dark( 140 ) ); + p->drawRect( x, y, w, h ); + p->setPen( c.light( 120 ) ); + p->drawRect( x + 1, y + 1, w - 2, h - 2 ); + break; + } + case PE_PanelMenuBar: + { + break; + } + case PE_PanelDockWindow: + { + break; + } + case PE_Separator: + case PE_DockWindowSeparator: + { + break; //don't draw anything + if (!(p->device() && p->device()->devType() == QInternal::Widget && ::qt_cast<QToolBar*>((QWidget*)p->device()))) + { + if ( !( flags & Style_Horizontal ) ) + { + p->setPen( cg.mid() ); + p->drawLine( 4, r.height() / 2, r.width() - 5, r.height() / 2 ); + p->setPen( cg.light() ); + p->drawLine( 4, r.height() / 2 + 1, r.width() - 5, r.height() / 2 + 1 ); + } + else + { + p->setPen( cg.mid() ); + p->drawLine( r.width() / 2, 4, r.width() / 2, r.height() - 5 ); + p->setPen( cg.light() ); + p->drawLine( r.width() / 2 + 1, 4, r.width() / 2 + 1, r.height() - 5 ); + } + } + break; + } + case PE_SpinWidgetUp: + case PE_SpinWidgetDown: + { + bool sunken = on || down; + bool hover = flags & Style_MouseOver; + int x = r.x() + ( r.width() - 7 ) / 2; + int y = pe == PE_SpinWidgetDown ? r.y() + 1 : r.bottom() - 7; + QPen oldPen( p->pen() ); + QBrush oldBrush( p->brush() ); + p->setPen( sunken ? cg.button() : hover ? cg.mid() : cg.text() ); + p->setBrush( sunken ? cg.button() : hover ? cg.mid() : cg.text() ); + p->drawPixmap( x, y, pe == PE_SpinWidgetUp ? *sbUp : *sbDown ); + p->setBrush( oldBrush ); + p->setPen( oldPen ); + break; + } + case PE_CheckMark: + { + QPen oldPen( p->pen() ); + p->setPen( flags & Style_On ? cg.highlightedText() : optionHandler->textColor() ); + p->drawPixmap(r.x() + r.width()/2 - 4,r.y() + r.height()/2 - 4,*checkmark); + p->setPen( oldPen ); + break; + } + default: + { + if ( (pe >= PE_ArrowUp && pe <= PE_ArrowLeft ) || pe == PE_HeaderArrow) + { + QBrush oldBrush(p->brush()); + QColor tmpC = flags & Style_Enabled ? (flags & Style_Down || flags & Style_Sunken) && pe != PE_HeaderArrow ? cg.light() : cg.buttonText() : cg.mid(); + if (tmpC == Qt::black) tmpC = QColor(85,85,85); + p->setBrush(tmpC); + int x = r.width() > 7 ? r.x() + r.width()/2 - 4 : r.right() - 7; + int y = r.height() > 7 ? r.y() + r.height()/2 - 4 : r.bottom() - 7; + + switch ( pe ) + { + case PE_ArrowRight: + { + p->drawPixmap(x,y,*sbRight); + break; + } + case PE_ArrowUp: + { + p->drawPixmap(x,y,*sbUp); + break; + } + case PE_ArrowDown: + { + p->drawPixmap(x,y,*sbDown); + break; + } + case PE_HeaderArrow: + { + if (flags & Style_Up) + p->drawPixmap(x,y,*sbUp); + else + p->drawPixmap(x,y,*sbDown); + break; + } + default: + { + p->drawPixmap(x,y,*sbLeft); + break; + } + } + p->setBrush( oldBrush ); + } + else + KStyle::drawPrimitive( pe, p, r, cg, flags, opt ); + } + } // general switch +} + +void LiquidStyle::drawKStylePrimitive( KStylePrimitive kpe, QPainter* p, + const QWidget* widget, const QRect &r, + const QColorGroup &cg, SFlags flags, + const QStyleOption &opt ) const +{ + switch ( kpe ) + { + case KPE_ToolBarHandle: + { + if (widget && widget->parentWidget() && widget->parentWidget()->hasMouse()) + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + w = (int)((w-3)/2); + QColor c( (optionHandler->style() == Brushed) ? cg.background() : cg.background().dark(120) ); + p->setPen(c); + p->setBrush(c); + for (int i = 0; i < h-3; i += 5 ) + p->drawEllipse(x+w,y+i,3,3); + } + break; + } + case KPE_GeneralHandle: + { + if (!widget) + break; + if ( widget->inherits( "AppletHandleDrag" ) ) + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + w = (int)((w-3)/2); + QColor c( widget->hasMouse() ? cg.button() : cg.background().dark(110) ); + p->setPen(c); + p->setBrush(c); + for (int i = 0; i < h-3; i += 5 ) + p->drawEllipse(x+w,y+i,3,3); + break; + } + else if (widget->hasMouse()) + { + if (optionHandler->style() == Brushed) + { + drawCombo( p, cg, cg.button(), r.x(), r.y(), r.width(), r.height()+2, false, false, false, center); + } + else + { + p->fillRect(r,cg.button()); + p->setPen(cg.button().dark( 100 + optionHandler->stippleContrast() )); + int x=r.x(); + int y=r.y(); + int w=r.width(); + int h=r.height(); + for (int i = y;i < y+h; i += 4 ) + { + p->drawLine( x, i, x+w, i ); + p->drawLine( x, i + 1, x+w, i + 1 ); + } + } + } + else if (optionHandler->style() == Brushed && widget->parentWidget()) // needs alignment + { + p->drawTiledPixmap(r, *widget->paletteBackgroundPixmap(), widget->parentWidget()->backgroundOffset()); + } + break; + } + case KPE_SliderGroove: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + if (qstrcmp( qApp->argv() [ 0 ], "kmix" ) == 0) x = x+3; + if ( ( ( const QSlider * ) widget ) ->orientation() == Qt::Horizontal ) + { + int x2 = x + w - 1; + y = y + ( h - 5 ) / 2; + p->setPen( cg.background().dark( 135 ) ); + p->drawLine( x + 1, y, x2 - 1, y ); //1 + p->drawLine( x, y + 4, x2, y + 4 ); //5 + p->setPen( cg.background().dark( 150 ) ); + p->drawLine( x, y + 1, x2, y + 1 ); //2 + p->setPen( cg.background().dark( 115 ) ); + p->drawLine( x, y + 2, x2, y + 2 ); //3 + p->drawLine( x, y + 3, x2, y + 3 ); //4 + p->setPen( cg.background().light( 130 ) ); + p->drawLine( x + 1, y + 5, x2 - 1, y + 5 ); //6 + } + else + { + int y2 = y + h - 1; + x = x + ( w - 5 ) / 2; + p->setPen( cg.background().dark( 135 ) ); + p->drawLine( x, y + 1, x, y2 - 1 ); + p->drawLine( x + 4, y, x + 4, y2 ); + p->setPen( cg.background().dark( 150 ) ); + p->drawLine( x + 1, y, x + 1, y2 ); + p->setPen( cg.background().dark( 115 ) ); + p->drawLine( x + 2, y, x + 2, y2 ); + p->drawLine( x + 3, y, x + 3, y2 ); + p->setPen( cg.background().light( 130 ) ); + p->drawLine( x + 5, y + 1, x + 5, y2 - 1 ); + } + break; + } + case KPE_SliderHandle: + { + if (!widget) + { + p->drawPixmap( r.x(), r.y(), *getPixmap( flags & Style_Enabled ? RadioOffHover : RadioOff)); + break; + } + if ((( const QSlider * ) widget ) ->orientation() == Qt::Horizontal) + (widget && widget->height() < 17) ? p->drawPixmap( r.x(), r.y(), *getPixmap( flags & Style_Enabled ? RadioOffHover : RadioOff)) : p->drawPixmap( r.x(), (optionHandler->style() == Milk) ? r.y() : r.y()+2, *getPixmap( flags & Style_Enabled ? HSlider : HSliderInactive)); + else + { + bool right = (( const QSlider * ) widget )->tickmarks() == QSlider::NoMarks || (( const QSlider * ) widget )->tickmarks() == QSlider::Right; + (widget && widget->width() < 17) ? p->drawPixmap( r.x()+2, r.y(), *getPixmap( flags & Style_Enabled ? RadioOffHover : RadioOff)) : p->drawPixmap( (optionHandler->style() == Milk) ? r.x() : right ? r.x()+5 : r.x()-3, r.y(), *getPixmap( flags & Style_Enabled ? (right ? VSlider : VSliderAbove) : (right ? VSliderInactive : VSliderAboveInactive))); + } + break; + } + case KPE_ListViewExpander: + { + p->fillRect(r,Qt::green); + // int radius = ( r.width() - 4 ) / 2; + // int centerx = r.x() + r.width() / 2; + // int centery = r.y() + r.height() / 2; + // + // int red, green, blue; + // red = ( cg.dark().red() >> 1 ) + ( cg.base().red() >> 1 ); + // green = ( cg.dark().green() >> 1 ) + ( cg.base().green() >> 1 ); + // blue = ( cg.dark().blue() >> 1 ) + ( cg.base().blue() >> 1 ); + // QColor blendColor( red, green, blue ); + // + // p->setPen( cg.dark() ); + // p->drawLine( r.x() + 1, r.y(), r.right() - 1, r.y() ); + // p->drawLine( r.x() + 1, r.bottom(), r.right() - 1, r.bottom() ); + // p->drawLine( r.x(), r.y() + 1, r.x(), r.bottom() - 1 ); + // p->drawLine( r.right(), r.y() + 1, r.right(), r.bottom() - 1 ); + // p->setPen( blendColor ); + // p->drawPoint( r.x(), r.y() ); + // p->drawPoint( r.right(), r.y() ); + // p->drawPoint( r.x(), r.bottom() ); + // p->drawPoint( r.right(), r.bottom() ); + // p->setPen( cg.light() ); + // p->drawRect( r.x() + 1, r.y() + 1, r.width() - 2, r.height() - 2 ); + // p->fillRect( r.x() + 2, r.y() + 2, r.width() - 4, r.height() - 4, + // cg.background() ); + // p->setPen( cg.text() ); + // p->drawLine( centerx - radius, centery, centerx + radius, centery ); + // if ( flags & Style_On ) + // p->drawLine( centerx, centery - radius, centerx, centery + radius ); + break; + } + default: + KStyle::drawKStylePrimitive( kpe, p, widget, r, cg, flags, opt ); + } +} + +void LiquidStyle::drawControl( ControlElement element, QPainter *p, + const QWidget *widget, const QRect &r, + const QColorGroup &cg, SFlags flags, + const QStyleOption &opt ) const +{ + switch ( element ) + { + case CE_ProgressBarGroove: + { + p->setPen(cg.background().dark(160)); + p->drawRect(r); + drawCombo( p, cg, cg.background(), r.x()+1, r.y()+1, r.width()-2, r.height()+1, false, false, false, center ); + break; + } + case CE_ProgressBarContents: + { +// qWarning("%s - %s,%s : %s,%s",qApp->argv()[0],widget->className(),widget->name(),widget->parentWidget()->className(),widget->parentWidget()->name()); + const QProgressBar *progress = ( const QProgressBar * ) widget; + QRect contentsR( subRect( SR_ProgressBarContents, widget ) ); + double val = progress->progress(); + bool reverse = QApplication::reverseLayout(); + val = val / progress->totalSteps(); + if ( val > 0.0 ) + { + int w = QMIN( contentsR.width(), ( int ) (val * contentsR.width() ) ); + if ( w > 1 ) + { + int x = contentsR.x(); + int y = contentsR.y(); + QRect progressRect; + if (reverse) + progressRect = QRect(x+(contentsR.width()-w), y, w, contentsR.height()+1); + else + progressRect = QRect(x, y, w, contentsR.height()+1); + if (optionHandler->ProgressBar() == liquid) + { + int x2 = x + w - 1; + int y2 = contentsR.bottom(); + //Clip to the old rectangle + p->setClipRect(progressRect, QPainter::CoordPainter); + //Expand + progressRect.setLeft(progressRect.x() - progAnimShift); + p->setPen(cg.button().dark(120)); + p->drawLine(x, y, x2, y); + p->drawLine(x, y, x, y2); + p->drawLine(x+1, y2+1, x2-1, y2+1); + p->setPen(cg.button().dark(110)); + p->drawLine(x2, y, x2, y2); + p->drawLine(x, y2, x2, y2); + QPixmap * pix = getPixmap( Progress ); + p->drawTiledPixmap(/*x+1, y+1, w-2, contentsR.height()-2*/progressRect, *pix); + } + else if (optionHandler->ProgressBar() == baghira) + { + drawCombo( p, cg, cg.button(), r.x()-1, r.y()-1, w, contentsR.height()+5, false, false, false, center); + } + else + { + ButtonTile *progress2Tile = progress2Dict.find( cg.button().rgb() ); + if ( !progress2Tile ) + { + QPixmap *pix = getPixmap(progress2); + progress2Tile = separateTiles( pix, 0, 15, 38, 1, 0, true); + if ( !progress2Tile ) + { + qWarning( "Progress tile is NULL!" ); + return ; + } + else + { + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + ptr->progress2Dict.insert( cg.button().rgb(), progress2Tile ); + } + } + //Clip to the old rectangle + p->setClipRect(progressRect, QPainter::CoordPainter); + //Expand + progressRect.setLeft(progressRect.x() - 38 + prog2AnimShift); + int h; /*x, y, w;*/ + progressRect.rect(&x, &y, &w, &h); + bool tooSmall = h < 32; + int mid = h/2; + p->drawTiledPixmap(x,tooSmall ? mid + 1 : progressRect.bottom()-15,w,16, *progress2Tile->pixmap(TileBtm)); + p->drawTiledPixmap(x,tooSmall ? mid : y+15,w,tooSmall ? 1 : h-31, *progress2Tile->pixmap(TileMiddle)); + p->drawTiledPixmap(x,tooSmall ? mid - 15 : y,w,15, *progress2Tile->pixmap(TileTop)); + } + } + } + break; + }/* + case CE_ToolButtonLabel: + { + const QToolButton *toolbutton = (const QToolButton *) widget; + QRect rect = r; + Qt::ArrowType arrowType = opt.isDefault() + ? Qt::DownArrow : opt.arrowType(); + + int shiftX = 0; + int shiftY = 0; + if (flags & (Style_Down | Style_On)) { + shiftX = pixelMetric(PM_ButtonShiftHorizontal, widget); + shiftY = pixelMetric(PM_ButtonShiftVertical, widget); + } + + if (!opt.isDefault()) + { + PrimitiveElement pe; + switch (arrowType) + { + case Qt::LeftArrow: pe = PE_ArrowLeft; break; + case Qt::RightArrow: pe = PE_ArrowRight; break; + case Qt::UpArrow: pe = PE_ArrowUp; break; + default: + case Qt::DownArrow: pe = PE_ArrowDown; break; + } + + rect.moveBy(shiftX, shiftY); + drawPrimitive(pe, p, rect, cg, flags, opt); + } + else + { + QColor btext = Qt::black;//(flags & (Style_Down | Style_On)) ? qApp->palette().color(QPalette::Active,QColorGroup::ButtonText) : toolbutton->paletteForegroundColor(); + + if (toolbutton->iconSet().isNull() && + ! toolbutton->text().isNull() && + ! toolbutton->usesTextLabel()) { + int alignment = AlignCenter | ShowPrefix; + if (!styleHint(SH_UnderlineAccelerator, widget, QStyleOption::Default, 0)) + alignment |= NoAccel; + + rect.moveBy(shiftX, shiftY); + drawItem(p, rect, alignment, cg, + flags & Style_Enabled, 0, toolbutton->text(), + toolbutton->text().length(), &btext); + } else { + QPixmap pm; + QIconSet::Size size = + toolbutton->usesBigPixmap() ? QIconSet::Large : QIconSet::Small; + QIconSet::State state = + toolbutton->isOn() ? QIconSet::On : QIconSet::Off; + QIconSet::Mode mode; + if (! toolbutton->isEnabled()) + mode = QIconSet::Disabled; + else if (flags & (Style_Down | Style_On) || + (flags & Style_Raised) && (flags & Style_AutoRaise)) + mode = QIconSet::Active; + else + mode = QIconSet::Normal; + pm = toolbutton->iconSet().pixmap( size, mode, state ); + + if ( toolbutton->usesTextLabel() ) + { + p->setFont( toolbutton->font() ); + QRect pr = rect, tr = rect; + int alignment = ShowPrefix; + if (!styleHint(SH_UnderlineAccelerator, widget, QStyleOption::Default, 0)) + alignment |= NoAccel; + + if ( toolbutton->textPosition() == QToolButton::Under ) + { + int fh = p->fontMetrics().height(); + pr.addCoords( 0, 1, 0, -fh-3 ); + tr.addCoords( 0, pr.bottom(), 0, -3 ); + pr.moveBy(shiftX, shiftY); + drawItem( p, pr, AlignCenter, cg, TRUE, &pm, QString::null ); + alignment |= AlignCenter; + } + else + { + pr.setWidth( pm.width() + 8 ); + tr.addCoords( pr.right(), 0, 0, 0 ); + pr.moveBy(shiftX, shiftY); + + drawItem( p, pr, AlignCenter, cg, TRUE, &pm, QString::null ); + alignment |= AlignLeft | AlignVCenter; + } + + tr.moveBy(shiftX, shiftY); + drawItem( p, tr, alignment, cg, + flags & Style_Enabled, 0, toolbutton->textLabel(), + toolbutton->textLabel().length(), &btext); + } + else + { + rect.moveBy(shiftX, shiftY); + drawItem( p, rect, AlignCenter, cg, TRUE, &pm, QString::null ); + } + } + } + + break; + }*/ + +/* + case CE_HeaderLabel: + { + QRect rect = r; + const QHeader* header = (const QHeader *) widget; + int section = opt.headerSection(); + + QIconSet* icon = header->iconSet( section ); + if ( icon ) { + QPixmap pixmap = icon->pixmap( QIconSet::Small, + flags & Style_Enabled ? + QIconSet::Normal : QIconSet::Disabled ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + // "pixh - 1" because of tricky integer division + + QRect pixRect = rect; + pixRect.setY( rect.center().y() - (pixh - 1) / 2 ); + drawItem ( p, pixRect, AlignVCenter, cg, flags & Style_Enabled, + &pixmap, QString::null ); + rect.setLeft( rect.left() + pixw + 2 ); + } + drawItem ( p, rect, AlignVCenter, cg, flags & Style_Enabled, + 0, header->label( section ), -1, (isTaskContainer && (flags & Style_MouseOver)) ? &(qApp->palette().color(QPalette::Active,QColorGroup::ButtonText)) : &(cg.buttonText()) ); + break; + }*/ + case CE_ProgressBarLabel: + { + if (optionHandler->DrawProgressLabel()) + { + QRect contentsR( subRect( SR_ProgressBarContents, widget ) ); + if ( !contentsR.isValid() ) + return ; + QFont font( p->font() ); + font.setBold( true ); + p->setFont( font ); + p->setPen( widget->colorGroup().buttonText() ); + p->setClipRect(r, QPainter::CoordPainter); + p->drawText( contentsR, AlignCenter, ( ( const QProgressBar * ) widget ) ->progressString() ); + } + break; + } + case CE_TabBarTab: + { // new style with tiled pixmaps + if ( !widget || !widget->parentWidget(true) ) + break; + const QTabBar *tabBar = ( const QTabBar * ) widget; + bool selected = flags & Style_Selected; + bool hover = currentTabBar && currentTabBar == tabBar && tabBar->indexOf(opt.tab()->identifier()) == hoveredTabIndex; + + myPosition pos; + if (tabBar->count() == 1) + pos = full; + else if ((tabBar->indexOf(opt.tab()->identifier()) == 0)) + pos = left; + else if (tabBar->indexOf(opt.tab()->identifier()) == tabBar->count() - 1) + pos = right; + else + pos = center; + + QColor c; + if (hover || selected) + { + if (optionHandler->useCustomColors()) + c = optionHandler->customColor(CustomTabOn); + else + c = optionHandler->buttonColor(); + } + else + { + if (optionHandler->useCustomColors()) + c = optionHandler->customColor(CustomTabOff); + else + c = optionHandler->InactiveButtonColor(); + } + + bool isDialog = optionHandler->TabStyle() == Clever && widget->topLevelWidget()->inherits("QDialog"); + if (isDialog || optionHandler->TabStyle() == Chooser) + drawCombo( p, cg, c, r.x(), r.y(), r.width(), r.height(), false, false, false, pos ); + else + { + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + bool above = tabBar->shape() == QTabBar::RoundedAbove || tabBar->shape() == QTabBar::TriangularAbove; + QPixmap *pix; + if (above) + pix = selected ? getPixmap( TabDown ) : getPixmap( Tab ); + else + pix = selected ? getPixmap( belowTabDown ) : getPixmap( belowTab ); + ButtonTile *tabTile = above ? tabDict.find( c.rgb() ) : inverseTabDict.find(c.rgb()); + if ( !tabTile ) + tabTile = separateTiles( pix, 9, 15, 67, 1, 0, false); + if ( !tabTile ) + { + qWarning( "Tab tile is NULL!" ); + return ; + } + else + above ? ptr->tabDict.insert( c.rgb(), tabTile ) : ptr->inverseTabDict.insert( c.rgb(), tabTile ); + + int offset; + selected ? offset = 0 : offset = 2; + + if ( r.width() > 18 ) + { + p->drawTiledPixmap( r.x() + 9, r.y() + offset, r.width() - 18, 15, *tabTile->pixmap( TileTop ) ); + p->drawTiledPixmap( r.x() + 9, r.height() - 11, r.width() - 18, 11, *tabTile->pixmap( TileBtm ) ); + } + if ( r.height() + offset > 26 ) + { + p->drawTiledPixmap( r.x() + 0, r.y() + 15 + offset, 9, r.height() - 26 - offset, *tabTile->pixmap( TileLeft ) ); + p->drawTiledPixmap( r.right() - 8, r.y() + 15 + offset, 9, r.height() - 26 - offset, *tabTile->pixmap( TileRight ) ); + } + if ( r.width() > 18 && r.height() + offset > 22 ) + p->drawTiledPixmap( r.x() + 9, r.y() + 15 + offset, r.width() - 18, r.height() - 26 - offset, *tabTile->pixmap( TileMiddle ) ); + p->drawPixmap( r.x() + 0, r.y() + offset, *tabTile->pixmap( TileTopLeft ) ); + p->drawPixmap( r.right() - 8, r.y() + offset, *tabTile->pixmap( TileTopRight ) ); + p->drawPixmap( r.x() + 0, r.height() - 11, *tabTile->pixmap( TileBtmLeft ) ); + p->drawPixmap( r.right() - 8, r.height() - 11, *tabTile->pixmap( TileBtmRight ) ); + + p->setPen( optionHandler->buttonColor()); + bool drawPoint = optionHandler->CenterTabs() || pos == center || pos == right; + if ( selected ) + { + if (drawPoint) p->drawPoint(r.x(), above ? r.bottom() : r.y()); + p->drawPoint(r.right(), above ? r.bottom() : r.y()); + } + else + { + p->drawLine( r.x() + drawPoint ? 0 : 1, above ? r.bottom() : r.y(), r.right(), above ? r.bottom() : r.y() ); + p->setPen( optionHandler->buttonColor().dark( 158 )); + p->drawLine( r.x() + drawPoint ? 0 : 1, above ? r.bottom()-1 : r.y()+1, r.right(), above ? r.bottom()-1 : r.y() + 1 ); + } + } + break; + } + case CE_TabBarLabel: + { + if ( opt.isDefault() ) + return ; + QTab *t = opt.tab(); + const QTabBar * tb = ( const QTabBar * ) widget; + if ( ( tb->currentTab() != t->identifier() )) + { + if (optionHandler->TabStyle() == TrueTab || + (optionHandler->TabStyle() == Clever && !(widget->topLevelWidget()->inherits("QDialog")))) + { + drawItem( p, QRect( r.x(), r.y() + 1, r.width(), r.height() ), AlignCenter | ShowPrefix, cg, flags & Style_Enabled, 0, t->text(), -1/*, &cg.text()*/ ); + break; + } + drawItem( p, QRect( r.x(), r.y(), r.width(), r.height() ), AlignCenter | ShowPrefix, cg, flags & Style_Enabled, 0, t->text(), -1/*, &cg.text()*/ ); + break; + } + drawItem( p, QRect( r.x(), r.y(), r.width(), r.height() ), AlignCenter | ShowPrefix, cg, flags & Style_Enabled, 0, t->text(), -1/*, &cg.text()*/ ); + break; + } + case CE_PushButton: + { + // if (_htmlWidgetWId == widget->winId()) + // return; + QPushButton *btn = ( QPushButton* ) widget; + const_cast<LiquidStyle*>( this ) ->isHTMLButton = isHTMLWidget( btn ); + ButtonFadeInfo *bfi_ = bfi[btn->winId()]; + if ( widget == highlightWidget || (bfi_ && !bfi_->fadeIn) ) + flags |= Style_MouseOver; + if (btn->isDefault()) + flags |= Style_HasFocus; + // Qt messes this up with WindowOrigin, so we do it ourselves :P + if ( !isPlain() && !btn->autoMask() ) + const_cast<LiquidStyle*>( this ) ->btnOffset = btn->backgroundOffset(); + const_cast<LiquidStyle*>( this ) ->paintWidget = const_cast<QWidget*>( widget ); + drawPrimitive( PE_ButtonDefault, p, r, cg, flags, QStyleOption( btn )); + const_cast<LiquidStyle*>( this ) ->paintWidget = 0L; + const_cast<LiquidStyle*>( this ) ->isHTMLButton = false; + break; + } + case CE_PushButtonLabel: + { + // if (_htmlWidgetWId == widget->winId()) + // return; + const QPushButton *btn = ( const QPushButton* ) widget; + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + + if ( btn->isOn() || btn->isDown() ) + flags |= Style_Sunken; + + int xoff = x; + if ( btn->iconSet() && !btn->iconSet() ->isNull() ) + { + QIconSet::Mode mode = btn->isEnabled() ? QIconSet::Normal : QIconSet::Disabled; + if ( mode == QIconSet::Normal && btn->hasFocus() ) + mode = QIconSet::Active; + + QIconSet::State state = QIconSet::Off; + if ( btn->isToggleButton() && btn->isOn() ) + state = QIconSet::On; + + QPixmap pix( btn->iconSet() ->pixmap( QIconSet::Small, mode, state ) ); + xoff += (x<6?8:2); + if (btn->text().isEmpty() && !btn->pixmap()) + p->drawPixmap( x + w/2 - pix.width()/2, y + h / 2 - pix.height() / 2, pix ); + else + p->drawPixmap( x<6?6:x, y + ( h - pix.height() ) / 2, pix ); + } + + if ( btn->isMenuButton() ) + { + drawPrimitive( PE_ArrowDown, p, QRect( w-14, (int)(h/2), 7, 7 ) , cg, flags, opt ); + w -= 14; + } + QColor tmp; + + tmp = btn->isDown() && !optionHandler->IcyButtons() ? btn->colorGroup().highlightedText() : btn->colorGroup().buttonText(); + drawItem( p, QRect( xoff, optionHandler->style() == Milk ? y-1 : y, w, h ), AlignCenter | ShowPrefix, cg, btn->isEnabled(), btn->pixmap(), btn->text(), -1, &tmp ); + break; + } + case CE_MenuBarItem: + { + QMenuItem *mi = opt.menuItem(); + bool active = flags & Style_Active; + bool focused = flags & Style_HasFocus; + + if ( active && focused ) + { + optionHandler->glossyMenus() ? + drawCombo( p, cg, cg.highlight(), r.x(), r.y()-1, r.width(), r.height() + 5, false, false, false, center ) : + p->fillRect(r,cg.highlight()); + } + + // QColor tmpColor( cg.background().dark( 120 ) ); + if ( optionHandler->useShadowText() && !( active && focused )) + { + p->setPen(cg.background().dark( 120 )); + p->drawText(r, AlignCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, mi->text()); + } + // drawItem( p, QRect( r.x() + 1, r.y() + 1, r.width(), r.height() ), AlignCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, cg, flags & Style_Enabled, mi->pixmap(), mi->text(), -1, &tmpColor ); + + // drawItem( p, r, AlignCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, cg, flags & Style_Enabled, mi->pixmap(), mi->text(), -1, active && focused ? &(cg.highlightedText()) : &(cg.text()) ); + p->setPen(active && focused ? cg.highlightedText() : cg.text()); + p->drawText(r, AlignCenter | AlignVCenter | ShowPrefix | DontClip | SingleLine, mi->text()); + break; + } + case CE_PopupMenuItem: + { + int x,y,w, h; + r.rect( &x, &y, &w, &h ); + + const QPopupMenu *popupmenu = ( const QPopupMenu * ) widget; + QMenuItem *mi = opt.menuItem(); + + int tab = opt.tabWidth(); + int maxpmw = opt.maxIconWidth(); + bool dis = mi && !mi->isEnabled(); + bool checkable = popupmenu->isCheckable(); + bool act = flags & Style_Active; + bool enabled = flags & Style_Enabled; + int checkcol = maxpmw; + + QColor menuBgColor( optionHandler->UseCustomMenuColor() ? optionHandler->Color() : optionHandler->bgColor() ); + + if ( checkable ) + checkcol = QMAX( maxpmw, 20 ); + + if ( mi && mi->isSeparator() ) + { + p->setPen( menuBgColor.dark( 130 ) ); + p->drawLine( x + 1, y, x + w - 1, y ); + p->setPen( menuBgColor.light( 120 ) ); + p->drawLine( x+1, y + 1, x + w - 1 , y + 1 ); + return ; + } + if ( act && mi && enabled) + { + optionHandler->glossyMenus() ? + drawCombo( p, cg, cg.highlight(), r.x(), r.y(), r.width(), r.height() + 2, false/*sunken*/, false/*hover*/, false, center ) : + p->fillRect(x,y,w,h,cg.highlight()); + } + else + { + if (popupBack.isNull()) + p->fillRect( x, y, w, h, popupmenu->backgroundBrush() ); + else + p->drawTiledPixmap( x, y, w, h, popupBack ); + + if (act) + { + p->setPen(cg.highlight()); + p->drawRect(x,y,w,h); + } + } + if ( !mi ) + return ; + + // Menu contents drawing code based on Qt's styles. Qt is property of + // TrollTech: www.trolltech.com. Used with permission. + int xpos = x; + QRect vrect = visualRect( QRect( xpos, y, checkcol, h ), r ); + int xvis = vrect.x(); + + // icon + if (optionHandler->drawMenuStripe()) + p->fillRect(x,y,h,h, optionHandler->menuStripeColor()); + if ( mi->iconSet() ) + { + QIconSet::Mode mode = dis ? QIconSet::Disabled : QIconSet::Normal; + if ( act && !dis ) + mode = QIconSet::Active; + QPixmap pixmap; + if ( checkable && mi->isChecked() ) + pixmap = mi->iconSet() ->pixmap( QIconSet::Small, mode, QIconSet::On ); + else + pixmap = mi->iconSet() ->pixmap( QIconSet::Small, mode ); + int pixw = pixmap.width(); + int pixh = pixmap.height(); + QRect pmr( 0, 0, pixw, pixh ); + pmr.moveCenter( vrect.center() ); + p->setPen( cg.text() ); + p->drawPixmap( pmr.topLeft(), pixmap ); + } + else if ( checkable ) + { + if ( mi->isChecked() ) + { + int xp = xpos + windowsItemFrame; + + SFlags cflags = Style_Default; + if ( !dis ) + cflags |= Style_Enabled; + if ( act ) + cflags |= Style_On; + drawPrimitive( PE_CheckMark, p, visualRect( QRect( xp, y + windowsItemFrame, checkcol - 2 * windowsItemFrame, h - 2 * windowsItemFrame ), r ), cg, cflags ); + } + } + QColor discol; + if ( dis ) + { + discol = cg.text(); + p->setPen( discol ); + } + + int xm = windowsItemFrame + checkcol + windowsItemHMargin; + xpos += xm; + + vrect = visualRect( QRect( xpos, y + windowsItemVMargin, w - xm - tab + 1, h - 2 * windowsItemVMargin ), r ); + xvis = vrect.x(); + if ( mi->custom() ) + { + p->save(); + if ( dis && !act ) + { + p->setPen( cg.light() ); + mi->custom() ->paint( p, cg, act, !dis, xvis + 1, y + windowsItemVMargin + 1, w - xm - tab + 1, h - 2 * windowsItemVMargin ); + p->setPen( discol ); + } + mi->custom() ->paint( p, cg, act, !dis, xvis, y + windowsItemVMargin, w - xm - tab + 1, h - 2 * windowsItemVMargin ); + p->restore(); + } + + // Text + QString s = mi->text(); + if ( !s.isNull() ) + { + QColor textColor, shadowColor; + shadowColor = optionHandler->bgColor().dark( 130 ); + + if ( dis ) + textColor = shadowColor.light( 115 ); + else if (/*!optionHandler->glossyMenus() && */act && mi) + textColor = cg.highlightedText(); + else if ( optionHandler->UseCustomMenuColor()) + textColor = optionHandler->textColor(); + else + textColor = cg.text(); + + int t = s.find( '\t' ); + int text_flags = AlignVCenter | ShowPrefix | DontClip | SingleLine; + text_flags |= ( QApplication::reverseLayout() ? AlignRight : AlignLeft ); + if ( t >= 0 ) + { // draw tab text + int xp; + xp = x + w - tab - 20 - windowsItemHMargin - windowsItemFrame + 1; + QString tabStr( s.right( s.length() - t - 1 ) ); + if ( !tabStr.isEmpty() ) + { + if ( optionHandler->useShadowText() ) + { + p->setPen( shadowColor ); + p->drawText( xp + 1, y + windowsItemVMargin + 1, w - xm - tab + 1, h - 2 * windowsItemVMargin, text_flags, tabStr ); + } + p->setPen( textColor ); + p->drawText( xp, y + windowsItemVMargin, w - xm - tab + 1, h - 2 * windowsItemVMargin, text_flags, tabStr ); + } + s = s.left( t ); + } + if ( optionHandler->useShadowText() && !(act && mi) ) + { + p->setPen( shadowColor ); + p->drawText( xvis + 1, y + windowsItemVMargin + 1, w - xm - tab + 1, h - 2 * windowsItemVMargin, text_flags, s, t ); + } + p->setPen( textColor ); + p->drawText( xvis, y + windowsItemVMargin, w - xm - tab + 1, h - 2 * windowsItemVMargin, text_flags, s, t ); + } + else if ( mi->pixmap() ) + // draw pixmap + { + QPixmap * pixmap = mi->pixmap(); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( OpaqueMode ); + p->drawPixmap( xvis, y + windowsItemFrame, *pixmap ); + if ( pixmap->depth() == 1 ) + p->setBackgroundMode( TransparentMode ); + } + // Child menu + if ( mi->popup() ) + { + int dim = (int)((float)( h - 2 * windowsItemFrame ) / 2); + PrimitiveElement arrow; + arrow = ( QApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight ); + xpos = x + w - windowsArrowHMargin - windowsItemFrame/* - dim*/-8; + vrect = visualRect( QRect( xpos, y + h / 2 - dim / 2, /*dim*/8, dim ), r ); + if ( act ) + { + if ( !dis ) + discol = cg.highlightedText(); + QColorGroup g2( discol, cg.highlight(), white, white, dis ? discol : white, discol, white ); + drawPrimitive( arrow, p, vrect, g2, Style_Enabled ); + } + else + { + if ( !dis ) + discol = optionHandler->textColor(); + QColorGroup g2( discol, cg.background(), white, white, dis ? discol : white, discol, white ); + drawPrimitive( arrow, p, vrect, g2, mi->isEnabled() ? Style_Enabled : Style_Default ); + } + } + break; + } + /* + case CE_ToolBoxTab: + { + break; + }*/ + default: + KStyle::drawControl( element, p, widget, r, cg, flags, opt ); + } +} + + +// void LiquidStyle::drawControlMask( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QStyleOption& opt ) const { +// switch ( element ) { +// case CE_PushButton: { +// p->fillRect( r, Qt::color1 ); +// break; +// } +// default: +// KStyle::drawControlMask( element, p, widget, r, opt ); +// break; +// } +// } + +// void LiquidStyle::drawComplexControlMask( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QStyleOption &opt ) const { +// // switch ( control ) { +// // case CC_ComboBox: { +// // drawControlMask( CE_PushButton, p, widget, r, opt ); +// // break; +// // } +// // default: +// KStyle::drawComplexControlMask( control, p, widget, r, opt ); +// // } +// } + +void LiquidStyle::drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags, SCFlags controls, SCFlags active, const QStyleOption &opt ) const +{ + switch ( control ) + { + case CC_ComboBox: + { + bool sunken = (active & SC_ComboBoxArrow);// || (flags & Style_Active) || (flags & Style_Sunken) || (active & SC_ComboBoxListBoxPopup); + bool hovered = (widget == highlightWidget) || (flags & Style_HasFocus); + // bool isHtml = isHTMLWidget( widget ); + const_cast<LiquidStyle*>( this ) ->paintWidget = const_cast<QWidget*>( widget ); + QPen oldPen( p->pen() ); + if ( controls & SC_ComboBoxArrow ) + { + if ( controls & SC_ComboBoxEditField && ( ( const QComboBox * ) widget ) ->editable()) + { // editable? +#if 0 + if ( optionHandler->buttonStyle() == Brushed ) + { // rectangular? + drawRectangularButton( p, cg, sunken ? cg.button().light( 110 ) : cg.button(), r.x(), r.y(), r.width(), r.height(), sunken, hovered, true, full/*, isHtml*/); + p->fillRect( r.x() + 6, r.y() +2, r.width()-32, r.height() - 7, cg.background()); + p->setPen( oldPen ); + return ; + } + else +#endif + { // round frame + drawRoundFrame( p, r, cg, (flags & Style_HasFocus) || sunken , widget->backgroundOffset()); + p->setPen(cg.mid()); + p->drawPixmap(r.right() - 16, r.height()/2 - 2, *sbDown); + p->setPen( oldPen ); + // return; + } +#if 0 + else + { // default! + drawCombo( p, cg, active == SC_ComboBoxArrow ? cg.button().light( 110 ) : cg.button(), r.x(), r.y(), r.width(), r.height(), sunken, hovered, true, full ); + p->fillRect( r.x() + 6, r.y() +2, r.width()-32, r.height() - 7, cg.background()); + p->setPen( oldPen ); + return; + } +#endif + } + else + { // end editable - default handling + if ( optionHandler->buttonStyle() == Brushed ) + { // retangular? + drawRectangularButton( p, cg, sunken ? cg.button().light( 110 ) : cg.button(), r.x(), r.y(), r.width(), r.height(), sunken, hovered, true, full, isHTMLWidget( widget )); + // p->setPen( oldPen ); + // return ; + } + else + { //default plain good old combobox... ;) + drawCombo( p, cg, active == SC_ComboBoxArrow ? cg.button().light( 110 ) : cg.button(), r.x(), r.y(), r.width(), r.height(), sunken, hovered, true, full, isHTMLWidget( widget ) ); + // p->setPen( oldPen ); + // return; + } + } + } + const_cast<LiquidStyle*>( this ) ->paintWidget = 0L; + break; + } + case CC_ToolButton: + { + const QToolButton *toolbutton = ( const QToolButton * ) widget; + const_cast<LiquidStyle*>( this ) ->paintWidget = const_cast<QWidget*>( widget ); + const KAccessToolBarButton *toolbutton2 = 0L; + QRect button, menuarea; + button = querySubControlMetrics( control, widget, SC_ToolButton, opt ); + menuarea = querySubControlMetrics( control, widget, SC_ToolButtonMenu, opt ); + if (::qt_cast<KToolBarButton*>(toolbutton)) + { + toolbutton2 = (const KAccessToolBarButton*)toolbutton; +#if GCC_VERSION < 40000 + if (toolbutton2->iconTextMode() == 3) + button.setBottom(button.bottom() - p->fontMetrics().height() - 1); +#endif + } + else if (toolbutton->usesTextLabel() && toolbutton->textPosition() == QToolButton::BelowIcon) + button.setBottom(button.bottom() - p->fontMetrics().height()); + menuarea.setX(menuarea.x() - 1); + SFlags bflags = flags, mflags = flags; + + if ( active & SC_ToolButton ) + bflags |= Style_Down; + if ( active & SC_ToolButtonMenu ) + mflags |= Style_Down; + + if ( widget == highlightWidget ) + bflags |= Style_MouseOver; + if ( controls & SC_ToolButton ) + { + bool sunken = mflags & ( Style_Down /*| Style_On*/ ); + bool hover = bflags & (Style_MouseOver | Style_On ); + + if ( !optionHandler->useToolButtonFrame())// || !(toolbutton->parentWidget() && ( ::qt_cast<QToolBar*>(toolbutton->parentWidget()) || toolbutton->parentWidget()->inherits("KonqFrameTabs")))) + { + if ((!(hover || sunken) || (toolbutton->usesTextLabel() && toolbutton->textPosition() == QToolButton::BelowIcon)) && toolbutton->parentWidget() && !::qt_cast<QToolBar*>(toolbutton->parent()) && toolbutton->parentWidget()->paletteBackgroundPixmap() && !toolbutton->parentWidget()->paletteBackgroundPixmap()->isNull()) + { + QPixmap pixmap = *(toolbutton->parentWidget()->paletteBackgroundPixmap()); + if (hover || sunken) + p->drawTiledPixmap( r.x(), button.bottom()+1, r.width(), p->fontMetrics().height(), pixmap, toolbutton->x(), toolbutton->y()+button.height() ); + else + p->drawTiledPixmap( r, pixmap, toolbutton->pos() ); + } + if (hover || sunken) + { + const_cast<LiquidStyle*>( this ) ->paintWidget = const_cast<QWidget*>( widget ); + if (optionHandler->toolbuttonStyle() != Brushed) + drawCombo( p, cg, sunken ? cg.button().light( 110 ) : + (hover || (cg.button() != qApp->palette().active().button())) ? cg.button() : + optionHandler->InactiveButtonColor(), button.x(), button.y(), button.width(), + button.height(), sunken, hover, false, full ); + else + drawRectangularButton( p, cg, sunken ? cg.button().light( 110 ) : cg.button(), + button.x(), button.y(), button.width(), button.height(), + sunken, hover, false); + const_cast<LiquidStyle*>( this ) ->paintWidget = 0L; + } + } + else + { + myPosition pos = full; + KToolBar *bar = NULL; + + if (toolbutton2 && toolbutton2->parentWidget() && ::qt_cast<KToolBar*>(toolbutton2->parentWidget()) ) + { //position calculation - would be nice if ktoolbarbutton provided this as flag + bar = (KToolBar*)toolbutton2->parentWidget(); + int buttonId = toolbutton2->id(); + int buttonIndex = bar->itemIndex(buttonId); + + // ok, this is a very hackish heck of a hack... + // kbookmarkbar (e.g. used by konqueror) accesses the iterator of the toolbar + // this confuses the iterator of the toolbar a bit, as it is used from the bookmark stuff and my function at the same time (seems, as if kbookmarkbar acts on shown toolbars) + // unfortunately, there's no way to figure out if it does for this specific toolbar + // so i check for the toolbars name, knowing this will work for current konqueror - but may fail on further versions + // even worse - the stuff is hardcoded (assuming first item to be left aligned, last one right and the rest centered) + // this is crap at all - so if the best thing would be to patch qtoolbutton to provide conjuncted buttons - i'll ask them (maybe qt4) + if (bar && ( qstrcmp( bar->name(), "bookmarkToolBar" ) == 0 )) + { + return; + buttonIndex == 0 ? + pos = left : + buttonIndex == bar->count() - 1 ? + pos = right : + pos = center; + } + else if (bar->orientation() == Qt::Horizontal) + { + if (buttonIndex == 0) + { + KToolBarButton *tmpButton = bar->getButton(bar->idAt(buttonIndex+1)); + (tmpButton && tmpButton->x() == toolbutton2->x()+toolbutton2->width()) ? pos = left : pos = full; + } + else if (buttonIndex == bar->count() - 1) + { + KToolBarButton *tmpButton = NULL; + tmpButton = bar->getButton(bar->idAt(buttonIndex-1)); + (tmpButton && tmpButton->x() + tmpButton->width() == toolbutton2->x()) ? pos = right : pos = full; + } + else + { + KToolBarButton *tmpButton1 = bar->getButton(bar->idAt(buttonIndex-1)); + KToolBarButton *tmpButton2 = bar->getButton(bar->idAt(buttonIndex+1)); + tmpButton1 && tmpButton1->x() + tmpButton1->width() == toolbutton2->x() ? + pos = center : pos = left; + if (!(tmpButton2 && tmpButton2->x() == toolbutton2->x()+toolbutton2->width())) + pos == left ? pos = full : pos = right; + } + } + else + { + if (buttonIndex == 0) + { + KToolBarButton *tmpButton = bar->getButton(bar->idAt(buttonIndex+1)); + (tmpButton && tmpButton->y() == toolbutton2->y()+toolbutton2->height()) ? + pos = left : pos = full; + } + else if (buttonIndex == bar->count() - 1) + { + KToolBarButton *tmpButton = NULL; + tmpButton = bar->getButton(bar->idAt(buttonIndex-1)); + (tmpButton && tmpButton->y() + tmpButton->height() == toolbutton2->y()) ? + pos = right : pos = full; + } + else + { + KToolBarButton *tmpButton1 = bar->getButton(bar->idAt(buttonIndex-1)); + KToolBarButton *tmpButton2 = bar->getButton(bar->idAt(buttonIndex+1)); + tmpButton1 && tmpButton1->y() + tmpButton1->height() == toolbutton2->y() ? + pos = center : pos = left; + if (!(tmpButton2 && tmpButton2->y() == toolbutton2->y()+toolbutton2->height())) + pos == left ? pos = full : pos = right; + } + } + } + + if (optionHandler->toolbuttonStyle() != Brushed) + { + (bar && bar->orientation() == Qt::Vertical) ? + drawCombo( p, cg, sunken ? cg.button().light( 110 ) : (hover || (cg.button() != qApp->palette().active().button())) ? cg.button() : optionHandler->InactiveButtonColor(), button.x(), (pos == full || pos == left) ? button.y() : button.y() - 7, button.width(), (pos == full) ? button.height()+2 : (pos == center) ? button.height()+16 : button.height()+9, sunken, hover, false, center ) : + drawCombo( p, cg, sunken ? cg.button().light( 110 ) : (hover || (cg.button() != qApp->palette().active().button())) ? cg.button() : optionHandler->InactiveButtonColor(), button.x(), button.y(), button.width(), button.height()/*+2*/, sunken, hover, false, pos ); + } + else + { + (bar && bar->orientation() == Qt::Vertical) ? + drawRectangularButton( p, cg, sunken ? cg.button().light( 110 ) : (hover || (cg.button() != qApp->palette().active().button())) ? cg.button() : optionHandler->InactiveButtonColor(), button.x(), (pos == full || pos == left) ? button.y() : button.y()-4, button.width(), (pos == full) ? button.height() : (pos == center) ? button.height()+8 : button.height()+4, sunken, hover, false) : + drawRectangularButton( p, cg, sunken ? cg.button().light( 110 ) : (hover || (cg.button() != qApp->palette().active().button())) ? cg.button() : optionHandler->InactiveButtonColor(), button.x(), button.y(), button.width(), button.height(), sunken, hover, false, pos); + } + } + } + // Draw a toolbutton menu indicator if required + if ( controls & SC_ToolButtonMenu ) + { + if ( mflags & ( Style_Down | Style_On | Style_Raised ) ) + drawPrimitive( PE_ButtonDropDown, p, menuarea, cg, mflags, opt ); + drawPrimitive( PE_ArrowDown, p, menuarea, cg, mflags, opt ); + } +#if 0 + if ( toolbutton->hasFocus() && !toolbutton->focusProxy() ) + { + QRect fr = toolbutton->rect(); + fr.addCoords( 3, 3, -3, -3 ); + drawPrimitive( PE_FocusRect, p, fr, cg ); + } +#endif + const_cast<LiquidStyle*>( this ) ->paintWidget = 0L; + break; + } + case CC_ScrollBar: + { + const_cast<LiquidStyle*>( this ) ->currentScrollBar = ( QScrollBar * ) widget; + KStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); + break; + } + case CC_SpinWidget: { + const QSpinWidget * sw = (const QSpinWidget *) widget; + SFlags flags; + PrimitiveElement pe; + + if ( controls & SC_SpinWidgetFrame ) + drawEditFrame( p, r, cg, false, sw->hasFocus()); + + if ( controls & SC_SpinWidgetUp ) { + flags = Style_Default | Style_Enabled; + if (active == SC_SpinWidgetUp ) { + flags |= Style_On; + flags |= Style_Sunken; + } else + flags |= Style_Raised; + pe = PE_SpinWidgetUp; + + QRect re = sw->upRect(); + QColorGroup ucg = sw->isUpEnabled() ? cg : sw->palette().disabled(); + p->fillRect(re, ucg.base()); + drawPrimitive(pe, p, re, ucg, flags); + } + + if ( controls & SC_SpinWidgetDown ) { + flags = Style_Default | Style_Enabled; + if (active == SC_SpinWidgetDown ) { + flags |= Style_On; + flags |= Style_Sunken; + } else + flags |= Style_Raised; + pe = PE_SpinWidgetDown; + + QRect re = sw->downRect(); + QColorGroup dcg = sw->isDownEnabled() ? cg : sw->palette().disabled(); + p->fillRect(re, dcg.base()); + drawPrimitive(pe, p, re, dcg, flags); + } + break; } + + // SLIDER - KDE code for double buffering + // ------------------------------------------------------------------- + case CC_Slider: { + const QSlider* slider = (const QSlider*)widget; + QRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, opt); + QRect handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, opt); + + // Double-buffer slider for no flicker + QPixmap pix(widget->size()); + QPainter p2; + p2.begin(&pix); + if ( slider->parentWidget() && + (slider->parentWidget()->paletteBackgroundPixmap() && !slider->parentWidget()->paletteBackgroundPixmap()->isNull() )) { + QPixmap pixmap = *(slider->parentWidget()->backgroundPixmap()); + if (QWidget *topDaddy = slider->topLevelWidget()){ + QPoint zero = QPoint(0,0); +#if 0 + zero = slider->mapTo(topDaddy, zero); + int zxmpw = zero.x()%pixmap.width(); + int zymph; +#endif + // probably due to argb mismatches in drawpixmap, this fails on kompmgr startups + p2.drawTiledPixmap(r, pixmap, slider->mapTo(topDaddy, zero)); +#if 0 + for (int dx = 0; dx < pix.width(); dx += pixmap.width()) + { + zymph = zero.y()%pixmap.height(); + for (int dy = 0; dy < pix.height(); dy += pixmap.height()) + { + copyBlt (&pix, dx, dy, &pixmap, + zxmpw, zymph, + pix.width()-dx>pixmap.width()-zxmpw?pixmap.width()-zxmpw:pix.width()-dx, pix.height()-dy>pixmap.height()-zymph?pixmap.height()-zymph:pix.height()-dy); + zymph=0; + } + zxmpw=0; + } +#endif + } else + { + // probably due to argb mismatches in drawpixmap, this fails on kompmgr startups + p2.drawTiledPixmap(r, pixmap, slider->pos()); +#if 0 + for (int dx = 0; dx < pix.width(); dx += pixmap.width()) + for (int dy = 0; dy < pix.height(); dy += pixmap.height()) + copyBlt (&pix, dx, dy, &pixmap, 0, 0, + pix.width()-dx>pixmap.width()?pixmap.width():pix.width()-dx, pix.height()-dy>pixmap.height()?pixmap.height():pix.height()-dy); +#endif + } + // p2.begin(&pix); + } else{ + // p2.begin(&pix); + pix.fill(cg.background()); + } + + // Draw slider groove + if ((controls & SC_SliderGroove) && groove.isValid()) { + drawKStylePrimitive( KPE_SliderGroove, &p2, widget, groove, cg, flags, opt ); + + // Draw the focus rect around the groove + /* if (slider->hasFocus()) + drawPrimitive(PE_FocusRect, &p2, groove, cg);*/ + } + + // Draw the tickmarks + if (controls & SC_SliderTickmarks) + QCommonStyle::drawComplexControl(control, &p2, widget, + r, cg, flags, SC_SliderTickmarks, active, opt); + + // Draw the slider handle + if ((controls & SC_SliderHandle) && handle.isValid()) { + if (active == SC_SliderHandle) + flags |= Style_Active; + drawKStylePrimitive( KPE_SliderHandle, &p2, widget, handle, cg, flags, opt ); + } + + p2.end(); + bitBlt((QWidget*)widget, r.x(), r.y(), &pix); + break; + } + +#ifndef QT_NO_LISTVIEW + case CC_ListView: { + if ( controls & SC_ListView ) { + QCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, controls, active, opt ); + } + if ( controls & ( SC_ListViewBranch | SC_ListViewExpand ) ) { + if ( opt.isDefault() ) + break; + + QListViewItem *item = opt.listViewItem(); + QListViewItem *child = item->firstChild(); + QListView* v = item->listView(); + bool drawDotlines = optionHandler->DrawDotlines(); + static QBitmap *verticalLine = 0, *horizontalLine = 0; + static QCleanupHandler<QBitmap> qlv_cleanup_bitmap; + int dotoffset = 0; + + if (drawDotlines && (optionHandler->DotlineStyle() == Dots)){ + if ( !verticalLine ) { + // make 128*1 and 1*128 bitmaps that can be used for + // drawing the right sort of lines. + verticalLine = new QBitmap( 1, 128, TRUE ); + horizontalLine = new QBitmap( 128, 1, TRUE ); + QPointArray a( 64 ); + QPainter p; + p.begin( verticalLine ); + int i; + for( i=0; i<64; i++ ) + a.setPoint( i, 0, i*2+1 ); + p.setPen( optionHandler->DotlineColor() ); + p.drawPoints( a ); + p.end(); + QApplication::flushX(); + verticalLine->setMask( *verticalLine ); + p.begin( horizontalLine ); + for( i=0; i<64; i++ ) + a.setPoint( i, i*2+1, 0 ); + p.setPen( optionHandler->DotlineColor() ); + p.drawPoints( a ); + p.end(); + QApplication::flushX(); + horizontalLine->setMask( *horizontalLine ); + qlv_cleanup_bitmap.add( &verticalLine ); + qlv_cleanup_bitmap.add( &horizontalLine ); + } + } + + + int y = r.y(); + int c; + QPointArray dotlines; + if ( drawDotlines && active == SC_All && controls == SC_ListViewExpand ) { + c = 2; + dotlines.resize( 2 ); + dotlines[ 0 ] = QPoint( r.right(), r.top() ); + dotlines[ 1 ] = QPoint( r.right(), r.bottom() ); + } + else { + int linetop = 0, linebot = 0; + // each branch needs at most two lines, ie. four end points + dotoffset = (item->itemPos() + item->height() - y) %2; + dotlines.resize( item->childCount() * 4 ); + c = 0; + + // skip the stuff above the exposed rectangle + while ( child && y + child->height() <= 0 ) { + y += child->totalHeight(); + child = child->nextSibling(); + } + + int bx = r.width() / 2; + + // paint stuff in the magical area + while ( child && y < r.height() ) { + int lh; + if ( !item->multiLinesEnabled() ) + lh = child ? child->height() : 0; + else + lh = p->fontMetrics().height() + 2 * v->itemMargin(); + lh = QMAX( lh, QApplication::globalStrut().height() ); + if ( lh % 2 > 0 ) + lh++; + linebot = y + lh / 2; + if ( ( child->isExpandable() || child->childCount() ) && ( child->height() > 0 ) ) { + if ( optionHandler->ExpanderStyle() == MS ) { // f****** M$ +/- style :-( + // needs a box + p->setPen( optionHandler->DotlineColor() ); + p->drawRect( bx - 4, linebot - 4, 9, 9 ); + // plus or minus + p->setPen( optionHandler->UseCustomExpanderColor() ? optionHandler->CustomExpanderColor() : cg.text() ); + p->drawLine( bx - 2, linebot, bx + 2, linebot ); + if ( !child->isOpen() ) + p->drawLine( bx, linebot - 2, bx, linebot + 2 ); + } else { // ultracool triangles ;-) + QPointArray a; + p->setPen( optionHandler->UseCustomExpanderColor() ? optionHandler->CustomExpanderColor() : cg.text() ); + if ( child->isOpen() ) { + a.setPoints( 3, bx - 4, linebot - 2, + bx, linebot + 2, + bx + 4, linebot - 2 ); + } //DownArrow + else { + a.setPoints( 3, bx - 2, linebot - 4, + bx + 2, linebot, + bx - 2, linebot + 4 ); + } //RightArrow + p->setBrush( optionHandler->UseCustomExpanderColor() ? optionHandler->CustomExpanderColor() : cg.text() ); + p->drawPolygon( a ); + + p->setBrush( NoBrush ); + } + // dotlinery + if ( drawDotlines ) { + dotlines[ c++ ] = QPoint( bx, linetop ); + dotlines[ c++ ] = QPoint( bx, linebot - (/* optionHandler->plusMinus() ? 4 : */5 ) ); + dotlines[ c++ ] = QPoint( bx + 5, linebot ); + dotlines[ c++ ] = QPoint( r.width(), linebot ); + linetop = linebot + 5; + } + } else { + // just dotlinery + if ( drawDotlines ) { + dotlines[ c++ ] = QPoint( bx + 2, linebot ); + dotlines[ c++ ] = QPoint( r.width(), linebot ); + } + } + + y += child->totalHeight(); + child = child->nextSibling(); + } + + // Expand line height to edge of rectangle if there's a + // child, and it's visible + if ( child && ( child->height() > 0 ) ) { + linebot = r.height(); + } + + if ( drawDotlines ) { + if ( linetop < linebot ) { + dotlines[ c++ ] = QPoint( bx, linetop ); + dotlines[ c++ ] = QPoint( bx, linebot ); + } + } + } + + if ( drawDotlines && optionHandler->DotlineStyle() == Line) { + int line; // index into dotlines + p->setPen( optionHandler->DotlineColor() ); + + if ( controls & SC_ListViewBranch ) + for ( line = 0; line < c; line += 2 ) { + p->drawLine( dotlines[ line ].x(), dotlines[ line ].y(), + dotlines[ line + 1 ].x(), dotlines[ line + 1 ].y() ); + } + + } + else if (drawDotlines && (optionHandler->DotlineStyle() == Dots)) { + int line; // index into dotlines + if ( controls & SC_ListViewBranch ){ + p->setPen( optionHandler->DotlineColor() ); + for( line = 0; line < c; line += 2 ) { + // assumptions here: lines are horizontal or vertical. + // lines always start with the numerically lowest + // coordinate. + + // point ... relevant coordinate of current point + // end ..... same coordinate of the end of the current line + // other ... the other coordinate of the current point/line + if ( dotlines[line].y() == dotlines[line+1].y() ) { + int end = dotlines[line+1].x(); + int point = dotlines[line].x(); + int other = dotlines[line].y(); + while( point < end ) { + int i = 128; + if ( i+point > end ) + i = end-point; + p->drawPixmap( point, other, *horizontalLine, 0, 0, i, 1 ); + point += i; + } + } + else { + int end = dotlines[line+1].y(); + int point = dotlines[line].y(); + int other = dotlines[line].x(); + int pixmapoffset = ((point & 1) != dotoffset ) ? 1 : 0; + while( point < end ) { + int i = 128; + if ( i+point > end ) + i = end-point; + p->drawPixmap( other, point, *verticalLine, 0, pixmapoffset, 1, i ); + point += i; + } + } + } + } + } + } + + break; + } +#endif // QT_NO_LISTVIEW + +#ifndef QT_NO_TITLEBAR + case CC_TitleBar: + { + switch (optionHandler->style()) + { + case Jaguar: + if (!widget->isActiveWindow()) p->drawTiledPixmap(r, *getPixmap( TitleBar )); + p->setPen(optionHandler->titleColor(1).dark(180)); + p->drawLine(r.left(), r.bottom(), r.right(), r.bottom()); + break; + case Panther: + case Tiger: + case Milk: + { + if (widget->isActiveWindow()) p->drawTiledPixmap(r, *getPixmap( TitleBar )); + p->setPen(optionHandler->titleColor(1).dark(180)); + p->drawLine(r.left(), r.bottom(), r.right(), r.bottom()); + break; + } + case Brushed: + break; + } + if ( controls & SC_TitleBarLabel ) + { + QRect ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarLabel ), widget ); + p->setPen( cg.text() ); + p->drawText(ir.x()+2, ir.y(), ir.width()-2, ir.height(), AlignCenter | AlignVCenter | SingleLine, widget->caption() ); + } + + QRect ir; + bool down = FALSE; + QPixmap pm; + + if ( controls & SC_TitleBarCloseButton ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarCloseButton ), widget ); + down = active & SC_TitleBarCloseButton; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(0).dark(120) : optionHandler->titleButtonColor(0), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? optionHandler->titleButtonColor(0).dark(120) : optionHandler->titleButtonColor(0), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + if ( controls & SC_TitleBarSysMenu ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarSysMenu ), widget ); + down = active & SC_TitleBarSysMenu; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + + if ( controls & SC_TitleBarMaxButton ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarMaxButton ), widget ); + down = active & SC_TitleBarMaxButton; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(2).dark(120) : optionHandler->titleButtonColor(2), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? optionHandler->titleButtonColor(2).dark(120) : optionHandler->titleButtonColor(2), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + + if ( controls & SC_TitleBarMinButton ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarMinButton ), widget ); + down = active & SC_TitleBarMinButton; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(1).dark(120) : optionHandler->titleButtonColor(1), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? optionHandler->titleButtonColor(1).dark(120) : optionHandler->titleButtonColor(1), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + if ( controls & SC_TitleBarNormalButton ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarNormalButton ), widget ); + down = active & SC_TitleBarNormalButton; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? optionHandler->titleButtonColor(1).dark(120) : optionHandler->titleButtonColor(1), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? optionHandler->titleButtonColor(1).dark(120) : optionHandler->titleButtonColor(1), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + + if ( controls & SC_TitleBarShadeButton ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarShadeButton ), widget ); + down = active & SC_TitleBarShadeButton; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + + if ( controls & SC_TitleBarUnshadeButton ) + { + ir = visualRect( querySubControlMetrics( CC_TitleBar, widget, SC_TitleBarUnshadeButton ), widget ); + down = active & SC_TitleBarUnshadeButton; + if (optionHandler->buttonStyle() == Brushed) + drawRectangularButton( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height(), down, false, false, full); + else + drawCombo( p, cg, down ? cg.button().dark(120) : cg.button(), ir.x(), ir.y(), ir.width(), ir.height()+2, down, false, false, full ); + } + break; + } +#endif //QT_NO_TITLEBAR + + default: + KStyle::drawComplexControl( control, p, widget, + r, cg, flags, controls, active, opt ); + break; + } +} + +int LiquidStyle::styleHint(StyleHint sh, const QWidget * w, const QStyleOption & opt, QStyleHintReturn * shr) const +{ + switch (sh) + { + case QStyle::SH_GUIStyle: + // if (w && ::qt_cast<QMenuBar*>(w)) + // return WindowsStyle; + return MacStyle; + case QStyle::SH_TabBar_Alignment: + if (optionHandler->CenterTabs() && !QApplication::reverseLayout()) + return AlignHCenter; + else + return KStyle::styleHint(sh, w, opt, shr); + default: + return KStyle::styleHint(sh, w, opt, shr); + } +} + +QRect LiquidStyle::subRect( SubRect r, const QWidget *widget ) const { + if (r == SR_ComboBoxFocusRect){ + return querySubControlMetrics( CC_ComboBox, widget, SC_ComboBoxEditField ); + } + return ( KStyle::subRect( r, widget ) ); +} + +int LiquidStyle::pixelMetric( PixelMetric m, const QWidget *widget ) const +{ + switch ( m ) + { + case PM_ButtonMargin: + return ( 5 ); + case PM_ButtonDefaultIndicator: + return ( 0 ); + case PM_ExclusiveIndicatorWidth: + case PM_ExclusiveIndicatorHeight: + return ( 16 ); + case PM_IndicatorWidth: + case PM_IndicatorHeight: + return ( 16 ); + case PM_ScrollBarExtent: + return ( 15 ); + case PM_ScrollBarSliderMin: + if (isOOO) return 10; return ( 40 ); + case PM_SplitterWidth: + return 6; + case PM_SliderControlThickness: + return(15); + case PM_SliderThickness: + return ( 22 ); + /* if (widget && (widget->width() < widget->height() && widget->width() < 17) || (widget->width() > widget->height() && widget->height() < 17)) + return (16);*/ + case PM_SliderLength: + return ( optionHandler->style() == Milk ? 15 : 13 ); + case PM_TabBarTabOverlap: + return 0; + case PM_DefaultFrameWidth: + { + /* + if (widget && ::qt_cast<QFrame*>(widget) && ((QFrame*)widget)->frameShape() == QFrame::LineEditPanel) + return 6;*/ + if (widget && widget->parentWidget() && ::qt_cast<QTabWidget*>(widget->parentWidget()) && widget->parentWidget()->parentWidget() && (widget->parentWidget()->parentWidget()->inherits("KonqMainWindow") || widget->parentWidget()->parentWidget()->inherits("KonqFrameContainer"))) //for the konqueror statusbar offset, thanks konqueror team... ... ... f***f***f***!!! + return 0; + return 2; + } + case PM_TabBarBaseOverlap: + case PM_TabBarBaseHeight: + { + if (!widget || !::qt_cast<QTabWidget*>(widget) || !widget->children()) + return 0; + QObjectListIt it( *widget->children() ); // iterate over the buttons + QObject *obj; + QTabBar *tabBar = 0L; + while ( (obj = it.current()) != 0 ) + { + ++it; + if (::qt_cast<QTabBar*>(obj)) + { + tabBar = (QTabBar*)obj; + break; + } + } + if (!tabBar || !tabBar->isVisible()) + return 0; + if (optionHandler->TabStyle() == Chooser || (optionHandler->TabStyle() == Clever && widget && widget->topLevelWidget()->inherits("QDialog"))) + return 12; + if (m == PM_TabBarBaseOverlap) + return 2; + return 7; + } + case PM_TabBarTabHSpace: + if (optionHandler->TabStyle() == Chooser || (optionHandler->TabStyle() == Clever && widget && widget->topLevelWidget()->inherits("QDialog"))) return 18; + return 24; + case PM_TabBarTabVSpace: + { + if (optionHandler->TabStyle() == Chooser || (optionHandler->TabStyle() == Clever && widget && widget->topLevelWidget()->inherits("QDialog"))) return 6; + return 10; + } + case PM_TabBarTabShiftHorizontal: + return 0; + case PM_TabBarTabShiftVertical: + if (optionHandler->TabStyle() == Chooser || (optionHandler->TabStyle() == Clever && widget && widget->topLevelWidget()->inherits("QDialog"))) return 0; + return 2; + case PM_ButtonShiftHorizontal: + return 0; + case PM_ButtonShiftVertical: + return 0; + default: + return KStyle::pixelMetric( m, widget ); + } +} + +QSize LiquidStyle::sizeFromContents( ContentsType contents, + const QWidget *widget, + const QSize &contentSize, + const QStyleOption& opt ) const { + switch ( contents ) { + case CT_PushButton: { + // this is a little funky - we give values not based on pixelMetric + // because we want a custom width/height and we can only give one + // value in pixelMetric (used in sizeHint). Odd but works well + const QPushButton * button = ( const QPushButton* ) widget; + + int w = contentSize.width() + 26 > 80 ? contentSize.width() + 26 : 80; + int h = contentSize.height() > 24 ? contentSize.height() : 25; + + if ( button->text().isEmpty() ) + return ( QSize( contentSize.width() + 2 * pixelMetric( PM_ButtonMargin, widget ), h ) ); + + return ( QSize( w, h ) ); + } + + case CT_ToolButton: { + if (widget->parentWidget() && ::qt_cast<QTabWidget*>(widget->parentWidget())){ + return QSize(contentSize.width() + 6, contentSize.height() + 5); + } + else{ + int w = contentSize.width() + 6; + int sh = contentSize.height() + 5; + int sw = (int)(1.3*sh); + if (w < sw) + return QSize(sw, sh); + else + return QSize(w, sh); + } + } + + case CT_Slider: { + int h = contentSize.height() > 24 ? contentSize.height() : 24; + return ( QSize( contentSize.width(), h ) ); + } + + case CT_ComboBox: { + // QSize sz = KStyle::sizeFromContents( contents, widget, contentSize, opt ); + // return ( QSize( sz.width()+3, sz.height() > 25 ? sz.height() : 25 ) ); + if ( ::qt_cast<const QComboBox *>(widget) && ((const QComboBox *)widget)->editable()) + return ( QSize( contentSize.width()+27, contentSize.height() + 4 > 22 ? contentSize.height() + 4 : 26 ) ); + else + return ( QSize( contentSize.width()+27, contentSize.height() + 2 > 24 ? contentSize.height() + 2 : 24 ) ); + } + case CT_PopupMenuItem: { + if ( ! widget || opt.isDefault() ) + break; + + const QPopupMenu *popup = ( const QPopupMenu * ) widget; + bool checkable = popup->isCheckable(); + QMenuItem *mi = opt.menuItem(); + int maxpmw = opt.maxIconWidth(); + int w = contentSize.width(); + int h = contentSize.height(); + + if ( mi->custom() ) { + w = mi->custom() ->sizeHint().width(); + h = mi->custom() ->sizeHint().height(); + if ( !mi->custom() ->fullSpan() ) + h += 2 * windowsItemVMargin + 2 * windowsItemFrame; + } else if ( mi->widget() ) {} + else if ( mi->isSeparator() ) { + w = 10; + h = windowsSepHeight; + } else { + if ( mi->pixmap() ) + h = QMAX( h, mi->pixmap() ->height() + 2 * windowsItemFrame ); + else if ( ! mi->text().isNull() ) + h = QMAX( h, popup->fontMetrics().height() + 2 * windowsItemVMargin + + 2 * windowsItemFrame ); + if ( mi->iconSet() != 0 ) + h = QMAX( h, mi->iconSet() ->pixmap( QIconSet::Small, + QIconSet::Normal ).height() + + 2 * windowsItemFrame ); + } + if ( !mi->text().isNull() && mi->text().find( '\t' ) >= 0 ) + w += windowsTabSpacing; + else if ( mi->popup() ) + w += 2 * windowsArrowHMargin; + if ( checkable && maxpmw < 20 ) + w += 20 - maxpmw; + if ( maxpmw ) + w += maxpmw + 6; + if ( checkable || maxpmw > 0 ) + w += windowsCheckMarkHMargin; + w += 20; + return ( QSize( w, h ) ); + } + default: + break; + } + return KStyle::sizeFromContents( contents, widget, contentSize, opt ); +} + + +QPixmap LiquidStyle::stylePixmap( StylePixmap stylepixmap, + const QWidget* widget, + const QStyleOption& opt ) const { + return KStyle::stylePixmap( stylepixmap, widget, opt ); +} + +#include "eventfilter.cpp" + +QRect LiquidStyle::querySubControlMetrics( ComplexControl control, const QWidget *widget, SubControl subcontrol, const QStyleOption &opt ) const +{ + if ( control == CC_ComboBox && subcontrol == SC_ComboBoxEditField ) + return QRect( 8, 3, widget->width() - 32, widget->height() - 7 ); + if (control == CC_TitleBar) + { + switch (subcontrol) + { + case SC_TitleBarSysMenu: + return QRect( widget->width() - 24, 1, 16, 16 ); + case SC_TitleBarMinButton: + return QRect( 26, 1, 16, 16 ); + case SC_TitleBarMaxButton: + return QRect( 47, 1, 16, 16 ); + case SC_TitleBarCloseButton: + return QRect( 5, 1, 16, 16 ); + case SC_TitleBarLabel: + return QRect( 68, 1, widget->width() - 107, 16 ); + case SC_TitleBarNormalButton: + return QRect( 26, 1, 16, 16 ); + case SC_TitleBarShadeButton: + return QRect( widget->width() - 29, 1, 24, 16 ); + case SC_TitleBarUnshadeButton: + return QRect( widget->width() - 29, 1, 24, 16 ); + default: + return ( KStyle::querySubControlMetrics( control, widget, subcontrol, opt ) ); + } + } + else + return ( KStyle::querySubControlMetrics( control, widget, subcontrol, opt ) ); +} + +QImage LiquidStyle::fetchImage( const char *name ){ + return uic_findImage( name ); +} + +QColor LiquidStyle::mapFadeColor(QColor &color, int index) const +{ + QRgb **rgb = fadeColorMap.find(color.rgb()); + if (rgb) + return QColor((*rgb)[index]); + // no color map found, create one and return the queried value + rgb = new QRgb*; + *rgb = new QRgb[10]; + int iRed = optionHandler->InactiveButtonColor().red(); + int iGreen = optionHandler->InactiveButtonColor().green(); + int iBlue = optionHandler->InactiveButtonColor().blue(); + int cRed = color.red(); + int cGreen = color.green(); + int cBlue = color.blue(); + for (int i = 10; i < 20; i++) + { + (*rgb)[i-10] = qRgb( iRed + (cRed-iRed)*(i)/20, iGreen + (cGreen-iGreen)*(i)/20, iBlue + (cBlue-iBlue)*(i)/20); + } + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + ptr->fadeColorMap.insert(color.rgb(), rgb); + return QColor((*rgb)[index]); +} + +QPixmap* LiquidStyle::processEmbedded( const char *label, const QColor &c, bool blend, const QColor *bg ) const { + QImage img( uic_findImage( label ) ); + img.detach(); + if ( img.isNull() ) { // shouldn't happen, been tested + qWarning( "Invalid embedded label %s", label ); + return ( NULL ); + } + return ( adjustHSV( img, c, bg ) ); +} + +QPixmap* LiquidStyle::getPixmap( BitmapData item ) const +{ + if ( pixmaps[ item ] ) + return ( pixmaps[ item ] ); + QColor bgColor( optionHandler->InactiveButtonColor() ); + QColor btnColor( isOOO ? optionHandler->CustomButtonColor() : qApp->palette().active().button() ); + QColor btnHoverColor( isOOO ? optionHandler->CustomButtonColor().light(120) : btnColor.light( 120 ) ); + QColor sbGrooveColor( optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBGroove ) : bgColor ); + QColor sbSliderColor( optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBSlider ) : bgColor ); + QColor sbSliderHoverColor( optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBSliderHover ) : isOOO?optionHandler->CustomButtonColor():btnColor ); + QColor sbSliderPressedColor( optionHandler->useCustomColors() ? + optionHandler->customColor( CustomSBSliderPressed ) : btnColor.dark(110) ); + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + switch ( item ) + { + case RadioOn: + ptr->pixmaps[ RadioOn ] = processEmbedded( (optionHandler->style() == Milk) ? "radio_down-milk" : "radio_down", optionHandler->useCustomColors() ? optionHandler->customColor( CustomRadioOn ) : btnColor, true ); + break; + case RadioOff: + ptr->pixmaps[ RadioOff ] = processEmbedded( (optionHandler->style() == Milk) ? "radio-milk" : "radio", optionHandler->useCustomColors() ? optionHandler->customColor( CustomRadioOff ) : bgColor, true ); + break; + case RadioOnHover: + ptr->pixmaps[ RadioOnHover ] = processEmbedded( (optionHandler->style() == Milk) ? "radio_down-milk" : "radio_down", optionHandler->useCustomColors() ? optionHandler->customColor( CustomRadioOn ).light( 110 ) : btnHoverColor, true ); + break; + case RadioOffHover: + ptr->pixmaps[ RadioOffHover ] = processEmbedded( (optionHandler->style() == Milk) ? "radio-milk" : "radio", optionHandler->useCustomColors() ? optionHandler->customColor( CustomRadioOn ) : btnColor, true ); + case RadioOnPressed: + ptr->pixmaps[ RadioOnPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "radio_down-milk" : "radio_down", optionHandler->useCustomColors() ? optionHandler->customColor( CustomRadioOn ).dark( 120 ) : btnHoverColor.dark( 120 ), true ); + break; + case RadioOffPressed: + ptr->pixmaps[ RadioOffPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "radio-milk" : "radio", optionHandler->useCustomColors() ? optionHandler->customColor( CustomRadioOn ).dark( 120 ) : btnColor.dark( 120 ), true ); + break; + case Tab: + ptr->pixmaps[ Tab ] = processEmbedded( (optionHandler->style() == Jaguar) ? "tab-jaguar" : (optionHandler->style() == Milk) ? "tab-milk" : "tab", optionHandler->useCustomColors() ? optionHandler->customColor( CustomTabOff ) : optionHandler->InactiveButtonColor(), true ); + break; + case belowTab: + ptr->pixmaps[ belowTab ] = processEmbedded( (optionHandler->style() == Jaguar) ? "tab-jaguar" : (optionHandler->style() == Milk) ? "tab-milk" : "tab", optionHandler->useCustomColors() ? optionHandler->customColor( CustomTabOff ) : optionHandler->InactiveButtonColor(), true ); + *ptr->pixmaps[ belowTab ] = ptr->pixmaps[ belowTab ] ->xForm( iMatrix ); + break; + case TabDown: + ptr->pixmaps[ TabDown ] = processEmbedded( (optionHandler->style() == Jaguar) ? "tab-jaguar" : (optionHandler->style() == Milk) ? "tab-milk" : "tab", optionHandler->useCustomColors() ? optionHandler->customColor( CustomTabOn ) : btnColor, true ); + break; + case belowTabDown: + ptr->pixmaps[ belowTabDown ] = processEmbedded( (optionHandler->style() == Jaguar) ? "tab-jaguar" : (optionHandler->style() == Milk) ? "tab-milk" : "tab", optionHandler->useCustomColors() ? optionHandler->customColor( CustomTabOn ) : btnColor, true ); + *ptr->pixmaps[ belowTabDown ] = ptr->pixmaps[ belowTabDown ] ->xForm( iMatrix ); + break; + case TabFocus: + ptr->pixmaps[ TabFocus ] = processEmbedded( (optionHandler->style() == Jaguar) ? "tab-jaguar" : (optionHandler->style() == Milk) ? "tab-milk" : "tab", optionHandler->useCustomColors() ? optionHandler->customColor( CustomTabOn ).light( 120 ) : btnHoverColor, true ); + break; + case CB: + ptr->pixmaps[ CB ] = processEmbedded( (optionHandler->style() == Milk) ? "checkbox-milk" : "checkbox", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOff ) : bgColor, true ); + break; + case CBDown: + ptr->pixmaps[ CBDown ] = processEmbedded( (optionHandler->style() == Milk) ? "checkboxdown-milk" : "checkboxdown", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ) : btnColor, true ); + break; + case CBDownHover: + ptr->pixmaps[ CBDownHover ] = processEmbedded( (optionHandler->style() == Milk) ? "checkboxdown-milk" : "checkboxdown", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ).light( 110 ) : btnHoverColor, true ); + break; + case CBTri: + ptr->pixmaps[ CBTri ] = processEmbedded( (optionHandler->style() == Milk) ? "checkboxdown-milk" : "checkboxdown", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ) : btnColor, true ); + *ptr->pixmaps[ CBTri ] = ptr->pixmaps[ CBTri ] ->xForm( mMatrix ); + break; + case CBTriHover: + ptr->pixmaps[ CBTriHover ] = processEmbedded( (optionHandler->style() == Milk) ? "checkboxdown-milk" : "checkboxdown", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ).light( 110 ) : btnHoverColor, true ); + *ptr->pixmaps[ CBTriHover ] = ptr->pixmaps[ CBTriHover ] ->xForm( mMatrix ); + break; + case CBHover: + ptr->pixmaps[ CBHover ] = processEmbedded( (optionHandler->style() == Milk) ? "checkbox-milk" : "checkbox", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ) : btnColor, true ); + break; + case CBDownPressed: + ptr->pixmaps[ CBDownPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "checkboxdown-milk" : "checkboxdown", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ).dark( 120 ) : btnHoverColor.dark( 120 ), true ); + break; + case CBTriPressed: + ptr->pixmaps[ CBTriPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "checkboxdown-milk" : "checkboxdown", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ).dark( 120 ) : btnHoverColor.dark( 120 ), true ); + *ptr->pixmaps[ CBTriPressed ] = ptr->pixmaps[ CBTriPressed ] ->xForm( mMatrix ); + break; + case CBPressed: + ptr->pixmaps[ CBPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "checkbox-milk" : "checkbox", optionHandler->useCustomColors() ? optionHandler->customColor( CustomCBOn ).dark( 120 ) : btnColor.dark( 120 ), true ); + break; + case HSlider: + ptr->pixmaps[ HSlider ] = processEmbedded( (optionHandler->style() == Milk) ? "sliderarrow-milk" : "sliderarrow", btnColor, true ); + break; + case VSlider: + ptr->pixmaps[ VSlider ] = processEmbedded( (optionHandler->style() == Milk) ? "sliderarrow-milk" : "sliderarrow", btnColor, true ); + *ptr->pixmaps[ VSlider ] = ptr->pixmaps[ VSlider ] ->xForm( lMatrix ); + break; + case VSliderAbove: + ptr->pixmaps[ VSliderAbove ] = processEmbedded( (optionHandler->style() == Milk) ? "sliderarrow-milk" : "sliderarrow", btnColor, true ); + *ptr->pixmaps[ VSliderAbove ] = ptr->pixmaps[ VSliderAbove ] ->xForm( rMatrix ); + break; + case HSliderInactive: + ptr->pixmaps[ HSliderInactive ] = processEmbedded( (optionHandler->style() == Milk) ? "sliderarrow-milk" : "sliderarrow", bgColor, true ); + break; + case VSliderInactive: + ptr->pixmaps[ VSliderInactive ] = processEmbedded( (optionHandler->style() == Milk) ? "sliderarrow-milk" : "sliderarrow", bgColor, true ); + *ptr->pixmaps[ VSliderInactive ] = ptr->pixmaps[ VSliderInactive ] ->xForm( lMatrix ); + break; + case VSliderAboveInactive: + ptr->pixmaps[ VSliderAboveInactive ] = processEmbedded( (optionHandler->style() == Milk) ? "sliderarrow-milk" : "sliderarrow", bgColor, true ); + *ptr->pixmaps[ VSliderAboveInactive ] = ptr->pixmaps[ VSliderAboveInactive ] ->xForm( rMatrix ); + break; + case VSBSliderTop: + ptr->pixmaps[ VSBSliderTop ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderColor, sbGrooveColor.dark( 120 ), true) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_top-milk" : "sbslider_top", sbSliderColor, true, &sbGrooveColor ); + break; + case VSBSliderBtm: + ptr->pixmaps[ VSBSliderBtm ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderColor, sbGrooveColor.dark( 120 ), false) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_btm-milk" : "sbslider_btm", sbSliderColor, true, &sbGrooveColor ); + break; + case VSBSliderMid: + ptr->pixmaps[ VSBSliderMid ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_mid-milk" : "sbIslider_mid", sbSliderColor, &sbGrooveColor ); + break; + case VSBSliderTopActive: + ptr->pixmaps[ VSBSliderTopActive ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderHoverColor, sbGrooveColor.dark( 120 ), true) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_top-milk" : "sbslider_top", sbSliderHoverColor, true, &sbGrooveColor ); + break; + case VSBSliderBtmActive: + ptr->pixmaps[ VSBSliderBtmActive ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderHoverColor, sbGrooveColor.dark( 120 ), false) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_btm-milk" : "sbslider_btm", sbSliderHoverColor, true, &sbGrooveColor ); + break; + case VSBSliderMidActive: + ptr->pixmaps[ VSBSliderMidActive ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_mid-milk" : "sbslider_mid", sbSliderHoverColor, false, &sbGrooveColor ); + break; + case VSBSliderTopPressed: + ptr->pixmaps[ VSBSliderTopPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_top-milk" : "sbslider_top", sbSliderPressedColor, true, &sbGrooveColor ); + *ptr->pixmaps[ VSBSliderTopPressed ] = ptr->pixmaps[ VSBSliderTopPressed ] ->xForm( mMatrix ); + break; + case VSBSliderBtmPressed: + ptr->pixmaps[ VSBSliderBtmPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_btm-milk" : "sbslider_btm", sbSliderPressedColor, true, &sbGrooveColor ); + *ptr->pixmaps[ VSBSliderBtmPressed ] = ptr->pixmaps[ VSBSliderBtmPressed ] ->xForm( mMatrix ); + break; + case VSBSliderMidPressed: + ptr->pixmaps[ VSBSliderMidPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_mid-milk" : "sbslider_mid", sbSliderPressedColor, false, &sbGrooveColor ); + if (optionHandler->style() == Milk) + *ptr->pixmaps[ VSBSliderMidPressed ] = ptr->pixmaps[ VSBSliderMidPressed ] ->xForm( iMatrix ); + break; + + case HSBSliderTop: + ptr->pixmaps[ HSBSliderTop ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderColor, sbGrooveColor.dark( 120 ), true) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_top-milk" : "sbslider_top", sbSliderColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderTop ] = ptr->pixmaps[ HSBSliderTop ]->xForm( rMatrix ); + break; + case HSBSliderBtm: + ptr->pixmaps[ HSBSliderBtm ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderColor, sbGrooveColor.dark( 120 ), false) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_btm-milk" : "sbslider_btm", sbSliderColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderBtm ] = ptr->pixmaps[ HSBSliderBtm ] ->xForm( rMatrix ); + break; + case HSBSliderMid: + ptr->pixmaps[ HSBSliderMid ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_mid-milk" : "sbIslider_mid", sbSliderColor, false, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderMid ] = ptr->pixmaps[ HSBSliderMid ]->xForm( rMatrix ); + break; + case HSBSliderTopActive: + ptr->pixmaps[ HSBSliderTopActive ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderHoverColor, sbGrooveColor.dark( 120 ), true) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_top-milk" : "sbslider_top", sbSliderHoverColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderTopActive ] = ptr->pixmaps[ HSBSliderTopActive ] ->xForm( rMatrix ); + break; + case HSBSliderBtmActive: + ptr->pixmaps[ HSBSliderBtmActive ] = optionHandler->shadowSbSlider() ? createSliderEnd( sbSliderHoverColor, sbGrooveColor.dark( 120 ), false) : processEmbedded( (optionHandler->style() == Milk) ? "sbslider_btm-milk" : "sbslider_btm", sbSliderHoverColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderBtmActive ] = ptr->pixmaps[ HSBSliderBtmActive ] ->xForm( rMatrix ); + break; + case HSBSliderMidActive: + ptr->pixmaps[ HSBSliderMidActive ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_mid-milk" : "sbslider_mid", sbSliderHoverColor, false, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderMidActive ] = ptr->pixmaps[ HSBSliderMidActive ] ->xForm( rMatrix ); + break; + case HSBSliderTopPressed: + ptr->pixmaps[ HSBSliderTopPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_top-milk" : "sbslider_top", sbSliderPressedColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderTopPressed ] = ptr->pixmaps[ HSBSliderTopPressed ] ->xForm( mMatrix ); + *ptr->pixmaps[ HSBSliderTopPressed ] = ptr->pixmaps[ HSBSliderTopPressed ] ->xForm( rMatrix ); + break; + case HSBSliderBtmPressed: + ptr->pixmaps[ HSBSliderBtmPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_btm-milk" : "sbslider_btm", sbSliderPressedColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderBtmPressed ] = ptr->pixmaps[ HSBSliderBtmPressed ] ->xForm( mMatrix ); + *ptr->pixmaps[ HSBSliderBtmPressed ] = ptr->pixmaps[ HSBSliderBtmPressed ] ->xForm( rMatrix ); + break; + case HSBSliderMidPressed: + ptr->pixmaps[ HSBSliderMidPressed ] = processEmbedded( (optionHandler->style() == Milk) ? "sbslider_mid-milk" : "sbslider_mid", sbSliderPressedColor, false, &sbGrooveColor ); + if (optionHandler->style() == Milk) + *ptr->pixmaps[ HSBSliderMidPressed ] = ptr->pixmaps[ HSBSliderMidPressed ] ->xForm( lMatrix ); + else + *ptr->pixmaps[ HSBSliderMidPressed ] = ptr->pixmaps[ HSBSliderMidPressed ] ->xForm( rMatrix ); + break; + case VSBSliderTopBg: + ptr->pixmaps[ VSBSliderTopBg ] = processEmbedded( (optionHandler->style() == Milk) ? "sbgroove_top-milk" : "sbgroove_top", sbGrooveColor, true, &sbGrooveColor ); + break; + case VSBSliderBtmBg: + ptr->pixmaps[ VSBSliderBtmBg ] = processEmbedded( (optionHandler->style() == Milk) ? "sbgroove_btm-milk" : "sbgroove_btm", sbGrooveColor, true, &sbGrooveColor ); + break; + case VSBSliderMidBg: + ptr->pixmaps[ VSBSliderMidBg ] = processEmbedded( (optionHandler->style() == Milk) ? "sbgroove_mid-milk" : "sbgroove_mid", sbGrooveColor, false, &sbGrooveColor ); + break; + case VSBSliderMidBgI: + ptr->pixmaps[ VSBSliderMidBgI ] = processEmbedded( (optionHandler->style() == Milk) ? "sb_subadd-milk" : "sb_subadd", sbGrooveColor, false, &sbGrooveColor ); + break; + case HSBSliderTopBg: + ptr->pixmaps[ HSBSliderTopBg ] = processEmbedded( (optionHandler->style() == Milk) ? "sbgroove_top-milk" : "sbgroove_top", sbGrooveColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderTopBg ] = ptr->pixmaps[ HSBSliderTopBg ] ->xForm( rMatrix ); + break; + case HSBSliderBtmBg: + ptr->pixmaps[ HSBSliderBtmBg ] = processEmbedded( (optionHandler->style() == Milk) ? "sbgroove_btm-milk" : "sbgroove_btm", sbGrooveColor, true, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderBtmBg ] = ptr->pixmaps[ HSBSliderBtmBg ] ->xForm( rMatrix ); + break; + case HSBSliderMidBg: + ptr->pixmaps[ HSBSliderMidBg ] = processEmbedded( (optionHandler->style() == Milk) ? "sbgroove_mid-milk" : "sbgroove_mid", sbGrooveColor, false, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderMidBg ] = ptr->pixmaps[ HSBSliderMidBg ] ->xForm( rMatrix ); + break; + case HSBSliderMidBgI: + ptr->pixmaps[ HSBSliderMidBgI ] = processEmbedded( (optionHandler->style() == Milk) ? "sb_subadd-milk" : "sb_subadd", sbGrooveColor, false, &sbGrooveColor ); + *ptr->pixmaps[ HSBSliderMidBgI ] = ptr->pixmaps[ HSBSliderMidBgI ] ->xForm( rMatrix ); + break; + + case Progress: + ptr->pixmaps[ Progress ] = processEmbedded( "progress", btnColor ); + break; + case progress2: + ptr->pixmaps[ progress2 ] = processEmbedded( "progress2", btnColor ); + break; + + case TitleBar: + { + if (optionHandler->style() == Jaguar) + { + ptr->pixmaps[ TitleBar ] = new QPixmap(32,22); + ptr->pixmaps[ TitleBar ]->fill( optionHandler->titleColor(0) ); + QPainter p; + p.begin( ptr->pixmaps[ TitleBar ] ); + p.setPen( QColor( + (optionHandler->titleColor(0).red()+optionHandler->titleColor(1).red())/2, + (optionHandler->titleColor(0).green()+optionHandler->titleColor(1).green())/2, + (optionHandler->titleColor(0).blue()+optionHandler->titleColor(1).blue())/2 )); + for ( int i = 1; i < 22; i += 4 ) + { + p.drawLine( 0, i, 31, i ); + p.drawLine( 0, i+2, 31, i+2 ); + } + p.setPen( optionHandler->titleColor(1)); + for ( int i = 2; i < 22; i += 4 ) + p.drawLine( 0, i, 31, i ); + p.end(); + } + else + ptr->pixmaps[ TitleBar ] = &KPixmapEffect::gradient (*((KPixmap*)(new QPixmap(32,22))), optionHandler->titleColor(0), optionHandler->titleColor(1), KPixmapEffect::VerticalGradient, 22); + break; + } + default: + break; + } + return ( pixmaps[ item ] ); +} + + +#include "baghira.moc" diff --git a/style/baghira.h b/style/baghira.h new file mode 100644 index 0000000..1336ac2 --- /dev/null +++ b/style/baghira.h @@ -0,0 +1,627 @@ +#ifndef __LIQUID_STYLE_H +#define __LIQUID_STYLE_H + +#include <qcstring.h> +#include <qdir.h> +#include <qintdict.h> +#include <qprogressbar.h> +#include <qtimer.h> +#include <qwmatrix.h> +#include <kpixmap.h> +#include <qwidget.h> +#include <kstyle.h> + +// #define BITMAP_ITEMS 75 // Don't worry, they're demand loaded ;-) +#define LIQUID_MENU_CHANGE 667 +#define MOSFET_BUTTON_CHANGE 661 + +class QColor; +class QHeader; +class QImage; +class QMenuBar; +class QPalette; +class QPoint; +class QPushButton; +class QRect; +class QScrollBar; +class QSize; +class QString; +class QTabBar; +class LiquidStyle; + +enum BitmapData{RadioOn = 0, RadioOff, RadioOnHover, RadioOffHover, RadioOnPressed, RadioOffPressed, + VSBSliderTop, VSBSliderMid, VSBSliderBtm, + VSBSliderTopActive, VSBSliderMidActive, VSBSliderBtmActive, + VSBSliderTopPressed, VSBSliderMidPressed, VSBSliderBtmPressed, + VSBSliderTopBg, VSBSliderMidBg, VSBSliderMidBgI, VSBSliderBtmBg, + HSBSliderTop, HSBSliderMid, HSBSliderBtm, + HSBSliderTopActive, HSBSliderMidActive, HSBSliderBtmActive, + HSBSliderTopPressed, HSBSliderMidPressed, HSBSliderBtmPressed, + HSBSliderTopBg, HSBSliderMidBg, HSBSliderMidBgI, HSBSliderBtmBg, + Tab, TabDown, TabFocus, belowTab, belowTabDown, + ButtonShadow, CB, CBDown, CBTri, CBHover, CBDownHover, CBTriHover, CBPressed, CBDownPressed, CBTriPressed, + HSlider, VSlider, VSliderAbove, HSliderInactive, VSliderInactive, VSliderAboveInactive, + Progress, rectbutton, combo, comboShadow, progress2, TitleBar, BITMAP_ITEMS}; + +enum CustomColor{CustomCBOn = 0, CustomCBOff, CustomRadioOn, CustomRadioOff, + CustomTabOn, CustomTabOff, CustomSBSlider, CustomSBSliderHover, CustomSBSliderPressed, CustomSBGroove}; + +enum PulseType{PushButton, ComboBox, AppletHandle, Splitter, ToolButton}; + +enum MenuBackground{Standard=0, Plain, Stipples, Gradient}; + +enum InactiveButtonColor{Original=0, Background, Active, Custom}; + +enum myExpanderStyle{Apple=0, MS}; + +enum progressStyle{mac=0, liquid, baghira}; + +enum DotlineStyle{Line=0, Dots}; + +enum Tile{TileTopLeft = 0, TileTop, TileTopRight, + TileLeft, TileMiddle, TileRight, TileBtmLeft, TileBtm, TileBtmRight}; + +enum myPosition{left = 0, center, right, full}; + +enum tabStyle {TrueTab = 0, Clever, Chooser}; + +enum Style {Jaguar = 0, Panther, Brushed, Tiger, Milk, NUMSTYLES }; + +class ButtonTile + { + public: + ButtonTile() + { + for ( int i = 0;i < 9;++i ) + pixmaps[ i ] = 0; + } + ~ButtonTile() + { + for ( int i = 0;i < 9;++i ) + if ( pixmaps[ i ] ) delete pixmaps[ i ]; + } + QPixmap* pixmap( Tile pos ) + { + return ( pixmaps[ ( int ) pos ] ); + } + void setPixmap( Tile pos, QPixmap *pix ) + { + pixmaps[ ( int ) pos ] = pix; + } + protected: + QPixmap *pixmaps[ 9 ]; + }; + + +class OptionHandler : public QObject +{ + Q_OBJECT +public: + OptionHandler( QObject *parent ); + void reloadSettings(); + inline static bool useShadowText() + { + return ( shadowText ); + } + const QColor& textColor(); + const QColor& bgColor(); + const QColor& buttonColor(); + static int custCols[8]; + + inline void reset() + { + menusProcessed = false; + } + + inline static bool glossyMenus() + { + return glossyMenus_; + } + + inline static bool drawMenuStripe() + { + return (drawMenuStripe_); + } + + inline static QColor menuStripeColor() + { + return menuStripeColor_; + } + + inline static QColor textColorHigh() + { + return fgColorHigh; + } + + inline static QColor menuColorHigh() + { + return colorHigh; + } + + inline static bool bevelHighlights() + { + return (bevelHighlights_); + } + inline static bool useBgStipple() + { + return ( bgStipple ); + } + inline static Style style() + { + return (style_); + } + inline static int stippleContrast() + { + return ( contrast ); + } + inline static bool useReverseBtnColor() + { + return ( reverseBtnColor ); + } + inline static bool useToolButtonFrame() + { + return ( tbFrame ); + } + + inline static bool useCustomColors() + { + return ( customWidgetColor ); + } + inline static const QColor& customColor( int idx ) + { + return ( customColors[ idx ] ); + } + + inline static bool DrawDotlines() + { + return ( drawDotlines ); + } + inline static bool squeezeSbSlider() + { + return ( squeezesbslider ); + } + inline static bool shadowSbSlider() + { + return (shadowsbslider); + } + inline static bool drawGroupBoxShadow() + { + return ( groupboxshadow ); + } + inline static int ShadowDarkness() + { + return ( shadowDarkness ); + } + inline static int InactiveButtonColorType() + { + return ( inactiveButtonColor ); + } + inline static int MenuBackground() + { + return (menuBackground); + } + inline static int MenuOpacity() + { + return (menuOpacity); + } + inline static bool UseCustomMenuColor() + { + return (useCustomMenuColor); + } + inline static int DotlineStyle() + { + return (dotlineStyle); + } + inline static bool MenuColorButton() + { + return (menuColorButton); + } + inline static int ExpanderStyle() + { + return (expanderStyle); + } + inline static bool UseCustomExpanderColor() + { + return (useCustomExpanderColor); + } + inline static QColor CustomExpanderColor() + { + return (expanderColor); + } + inline static QColor DotlineColor() + { + return (dotlineColor); + } + inline QColor InactiveButtonColor() + { + switch (inactiveButtonColor) + { + case 0 : return (QColor(232,232,232)); + case 1 : return (bgColor()); + case 2 : return (buttonColor()); + case 3 : return (customInactiveButtonColor); + } + } + inline static bool CenterTabs() + { + return centerTabs; + } + + inline static bool SmoothListViewHeaders() + { + return smoothListViewHeaders; + } + + inline static bool SmootherLVH() + { + return smootherLVH; + } + + inline static bool IcyButtons() + { + return icyButtons; + } + + inline static Style buttonStyle() + { + return _buttonStyle; + } + + inline static int ProgressBar() + { + return progressBar; + } + + inline static bool RemoveKickerBevel() + { + return removeKickerBevel; + } + + inline static Style toolbuttonStyle() + { + return _toolbuttonStyle; + } + + inline void setGroupShadowButton() + { + groupShadowButton = true; + } + inline void setNotGroupShadowButton() + { + groupShadowButton = false; + } + inline bool GroupShadowButton() + { + return groupShadowButton; + } + + inline void setScrollerActive() + { + scrollerActive = true; + } + + inline void setScrollerInactive() + { + scrollerActive = false; + } + + inline bool ScrollerActive() + { + return scrollerActive; + } + + inline static QColor Color() + { + return color; + } + + inline static QColor Color2() + { + return color2; + } + + inline static bool DrawProgressLabel() + { + return drawProgressLabel; + } + + inline static tabStyle TabStyle() + { + return tabStyle_; + } + + inline static QColor & BrushTint() + { + return brushTint; + } + + inline static bool TintBrush() + { + return tintBrush; + } + + inline static bool AnimateSlider() + { + return animateSlider; + } + inline static bool AnimateProgress() + { + return animateProgress; + } + inline static QColor CustomButtonColor() + { + return customButtonColor; + } + + inline static bool AnimateButton() + { + return animateButton; + } + + inline static QColor aDecoColor1() + { + return aDecoColor1_; + } + inline static QColor aDecoColor2() + { + return aDecoColor2_; + } + inline static QColor titleColor( int i ) + { + return titleColor_[i]; + } + inline static QColor titleButtonColor( int i ) + { + return titleButtonColor_[i]; + } + + QMenuBar *currentMenu; + QPixmap *indicatedMenuItemPix; + QRect *indicatedMenuItemRect; + QPixmap *lastIndicatedMenuItemPix; + QRect *lastIndicatedMenuItemRect; + bool mouseOverMenu; + WId lastIndicatedMenuItemID; + static unsigned long wmDesign; + + +public slots: + inline void warningSlot() + { + qWarning("widget destroyed"); + } + +protected: + static QColor titleColor_[2]; + static QColor titleButtonColor_[3]; + + // menu + static int menuBackground; + static int menuOpacity; + static bool menuColorButton; + static bool animateButton; + static bool shadowText; + static bool drawMenuStripe_; + static QColor menuStripeColor_; + static bool glossyMenus_; + //color + static QColor customButtonColor; + //widgets + static bool customWidgetColor; + static QColor customColors[ 10 ]; + //menu + static bool useCustomMenuColor; + static QColor color, color2, colorHigh, fgColor, fgColorHigh; + //incativeButton + static int inactiveButtonColor; + static QColor customInactiveButtonColor; + + //Design + //stipples + static bool bgStipple, bevelHighlights_; + static Style style_; + static int contrast; + //shadows + static bool groupboxshadow; + static int shadowDarkness; + //istviews; + static bool drawDotlines, useCustomExpanderColor; + static int expanderStyle; + static QColor expanderColor, dotlineColor; + static int dotlineStyle; + //slider + static bool squeezesbslider; + static bool shadowsbslider; + //toolbar + static bool reverseBtnColor, tbFrame; + //tweaks + static bool centerTabs; + static bool smoothListViewHeaders; + static bool smootherLVH; + static bool icyButtons; + static Style _buttonStyle; + bool menusProcessed; + bool scrollerActive; + int menuLevelCounter; + bool groupShadowButton; + static int progressBar; + static bool removeKickerBevel; + static Style _toolbuttonStyle; + static bool drawProgressLabel; + static tabStyle tabStyle_; + + QString colorStr, fgColorStr/*, panelColorStr*/; + static QColor brushTint; + static QColor aDecoColor1_; + static QColor aDecoColor2_; + static bool tintBrush; + static bool animateSlider; + static bool animateProgress; +}; + +class EventKiller : public QObject +{ + Q_OBJECT +public: + bool eventFilter( QObject *, QEvent *) + { + return TRUE; + } +}; + +class BMShower : public QObject +{ + Q_OBJECT +public: + BMShower(QObject *parent); + bool eventFilter( QObject *object, QEvent *event ); +}; + +class ButtonFadeInfo +{ +public: + ButtonFadeInfo() + { + timerId=0; index=0; fadeIn=TRUE; + } +public: + int timerId; + int index; + bool fadeIn; +}; + +class LiquidStyle : public KStyle +{ + Q_OBJECT +public: + friend class OptionHandler; + LiquidStyle(); + virtual ~LiquidStyle(); + bool isPlain() const; + + virtual void polish( QWidget *w ); +// virtual void polishPopupMenu( QPopupMenu *w ); + virtual void unPolish( QWidget *w ); + virtual void polish( QPalette &p ); + virtual void unPolish( QApplication *a ); + int styleHint(StyleHint sh, const QWidget * w, const QStyleOption & opt, QStyleHintReturn * shr) const; + void drawKStylePrimitive( KStylePrimitive kpe, QPainter* p, const QWidget* widget, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default, const QStyleOption& = QStyleOption::Default ) const; + void drawPrimitive( PrimitiveElement pe, QPainter* p, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default, const QStyleOption& = QStyleOption::Default ) const; + void drawControl( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default, const QStyleOption& = QStyleOption::Default ) const; +// void drawControlMask( ControlElement element, QPainter *p, const QWidget *widget, const QRect &r, const QStyleOption& = QStyleOption::Default ) const; + void drawComplexControl( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QColorGroup &cg, SFlags flags = Style_Default, SCFlags controls = SC_All, SCFlags active = SC_None, const QStyleOption& = QStyleOption::Default ) const; +// void drawComplexControlMask( ComplexControl control, QPainter *p, const QWidget *widget, const QRect &r, const QStyleOption& = QStyleOption::Default ) const; + + int pixelMetric( PixelMetric m, const QWidget *widget = 0 ) const; + + QSize sizeFromContents( ContentsType contents, const QWidget *widget, const QSize &contentSize, const QStyleOption& opt ) const; + QRect subRect( SubRect r, const QWidget *widget ) const; + QRect querySubControlMetrics( ComplexControl control, const QWidget *widget, SubControl subcontrol, const QStyleOption &opt = QStyleOption::Default ) const; + // Fix Qt3's wacky image positions + QPixmap stylePixmap( StylePixmap stylepixmap, const QWidget *widget = 0, const QStyleOption& = QStyleOption::Default ) const; + bool eventFilter( QObject *object, QEvent *event ); + +private slots: + void updateProgressPos(); + void updateSliderPos(); + void progressBarDestroyed(QObject*); + void fakeMouse(); + +protected: + void clearImage( QImage &img ) const; + ButtonTile* createButtonTile( const QColor &c, const QColor &bgColor, QImage *buttonImage, QImage *shadowImage, QImage *glowImage, QIntDict <ButtonTile>*buttonDict, QIntDict<ButtonTile>*shadowDict, QIntDict<ButtonTile>*glowDict, int w, int h, int xOff, int yOff, int centerW, int centerH, int shadowH, int glowWH, bool sunken) const; + ButtonTile* createRoundFrameTile(QImage &img, const QColor &color, const QColor *bg, const QColor &baseColor ) const; + QPixmap* createSliderEnd( const QColor &c, const QColor &bgColor, bool top/*, bool vertical*/ ) const; + ButtonTile* separateTiles( QPixmap *pix, int xO, int yO, int w, int h, int sh, bool sunken) const; + + QPixmap* getPixmap( BitmapData item ) const; + QPixmap* adjustHSV( QImage &img, const QColor &c, const QColor *bg = NULL ) const; + QImage* adjustHSVImage( QImage &img, const QColor &c, const QColor *bg = NULL ) const; + void adjustHSV( QPixmap &pix, const QColor &c ) const; + QImage* tintBrush( const QImage &img, const QColor &c ) const; + QPixmap* processEmbedded( const char *label, const QColor &c, bool blend = false, const QColor *bg = NULL ) const; + void drawRoundButton( QPainter *p, const QColorGroup &cg, const QColor &c, /*const QColor &bg,*/ int x, int y, int w, int h, bool pushedDown = false, bool hover = false, int bgX = -1, int bgY = -1) const; + void drawRectangularButton( QPainter *p, const QColorGroup &cg, const QColor &c, int x, int y, int w, int h, bool sunken = false, bool hover = false, bool isCombo = false, int position = full, bool isHtml = false) const; + void drawCombo( QPainter *painter, const QColorGroup &cg, const QColor &c, int x, int y, int w, int h, bool sunken, bool hover, bool isCombo, int position = full, bool isHTML = false ) const; + void drawEditFrame( QPainter *p, const QRect &r, const QColorGroup &cg, bool isHTML = false, bool focused = false, bool inverse = false/*, bool round = false*/ ) const; + void drawRoundFrame( QPainter *p, const QRect &r, const QColorGroup &cg, bool focused, QPoint offset ) const; + void drawHTMLCBBorder( const QPixmap &pix, const QColor &c ) const; + bool isHTMLWidget( const QWidget *w ) const; + + +private: + LiquidStyle( const LiquidStyle & ); + LiquidStyle& operator=( const LiquidStyle & ); + int getBrightness(unsigned int rgb) const; + QImage fetchImage( const char *name ); + QColor mapFadeColor(QColor &color, int index) const; + void fadeIn(QPushButton *button); + void fadeOut(QPushButton *button); + QColor brushedMetalColor(QColor &c) const; + QColor originalBgColor; + + + QBitmap *sbLeft, *sbRight, *sbUp, *sbDown, *checkmark; + QImage *btnBorderImg, *btnShadowImg, *slider_top, *slider_btm, *slider_top_shd, *slider_btm_shd, *rectbutton, *combo, *comboShadow, *buttonGlow, *roundFrame; + QPixmap *btnBlendPix, *menuPix, *groupShadow ; + QPixmap plainBrush, gradBrush; + QBrush pagerBrush, pagerHoverBrush; + + QPixmap *pixmaps[ BITMAP_ITEMS ]; + QPixmap sbBuffer; + QScrollBar *currentScrollBar; + QWMatrix lMatrix; + QWMatrix rMatrix; + QWMatrix iMatrix; + QWMatrix mMatrix; + QWMatrix m2Matrix; + + bool isKicker, isOOO, isHTMLButton, initialPaletteLoaded, inExitPolish; + + QHeader *currentHeader; + QTabBar *currentTabBar; + int headerHoverID; + int headerSortID; + QPoint btnOffset; + QPoint cursorPos_; + QWidget *currentTaskContainer; + KPixmap activeToolbarPix; + bool isTaskContainer, taskContainerHover; + + QPalette polishedPalette, tooltipPalette; + unsigned int qtrcModificationTime; + + int progAnimShift; + int prog2AnimShift; + int sliderAnimShift; + int hoveredTabIndex; + bool mouseButtonPressed_; + + OptionHandler *optionHandler; + + QIntDict<ButtonTile>btnDict; + QIntDict<ButtonFadeInfo>bfi; + QIntDict<QRgb*>fadeColorMap; + QIntDict<ButtonTile>btnShadowedDict; + QIntDict<ButtonTile>buttonGlowDict; + QIntDict<ButtonTile>comboDict; + QIntDict<ButtonTile>comboShadowedDict; + QIntDict<ButtonTile>tabDict; + QIntDict<ButtonTile>inverseTabDict; + QIntDict<ButtonTile>rectBtnDict; + QIntDict<ButtonTile>progress2Dict; + QMap<QWidget*, int> progAnimWidgets; + + QPixmap *tmpBtnPix; + ButtonTile *inactiveRoundFrame; + ButtonTile *activeRoundFrame; + + QWidget *highlightWidget; + QScrollBar *activeScroller; + EventKiller *eventKiller; + BMShower *bmShower; + static QPixmap popupBack; + QWidget *paintWidget; +}; + +#endif diff --git a/style/baghira.themerc b/style/baghira.themerc new file mode 100644 index 0000000..d6bfd1f --- /dev/null +++ b/style/baghira.themerc @@ -0,0 +1,6 @@ +[Misc] +Name=Baghira +Comment=The Big Black Cat +ConfigPage=kstyle_baghira_config +[KDE] +WidgetStyle=Baghira diff --git a/style/bitmaps.h b/style/bitmaps.h new file mode 100644 index 0000000..a4fafc4 --- /dev/null +++ b/style/bitmaps.h @@ -0,0 +1,21 @@ +#ifndef __BITMAPS_H +#define __BITMAPS_H + +static unsigned char sbarrow_down_bits[] = { +// 0x00, 0x00, 0x7f, 0x7f, 0x3e, 0x1c, 0x08}; + 0x7f, 0x3e, 0x3e, 0x1c, 0x1c, 0x08 }; +static unsigned char sbarrow_left_bits[] = { +// 0x18, 0x1c, 0x1e, 0x1f, 0x1e, 0x1c, 0x18}; + 0x20, 0x38, 0x3e, 0x3f, 0x3e, 0x38, 0x20 }; +static unsigned char sbarrow_right_bits[] = { +// 0x0c, 0x1c, 0x3c, 0x7c, 0x3c, 0x1c, 0x0c}; + 0x01, 0x07, 0x1f, 0x3f, 0x1f, 0x07, 0x01 }; +static unsigned char sbarrow_up_bits[] = { +// 0x08, 0x1c, 0x3e, 0x7f, 0x7f, 0x00, 0x00}; + 0x08, 0x1c, 0x1c, 0x3e, 0x3e, 0x7f }; +static unsigned char checkmark_bits[] = { + 0x40, 0x60, 0x71, 0x3b, 0x1f, 0x0e, 0x04 }; + +#endif + + diff --git a/style/configure.in.in b/style/configure.in.in new file mode 100644 index 0000000..b0f4a88 --- /dev/null +++ b/style/configure.in.in @@ -0,0 +1,5 @@ +compile_kompmgr=yes +KDE_CHECK_HEADERS(X11/extensions/Xdamage.h,,compile_kompmgr=no,[#include <X11/Xlib.h>]) +KDE_CHECK_HEADERS(X11/extensions/Xcomposite.h,,compile_kompmgr=no,[#include <X11/Xlib.h>]) +KDE_CHECK_HEADERS(X11/extensions/Xrender.h,,compile_kompmgr=no,[#include <X11/Xlib.h>]) +AM_CONDITIONAL(include_kompmgr, test "$compile_kompmgr" = "yes" ) diff --git a/style/eventfilter.cpp b/style/eventfilter.cpp new file mode 100644 index 0000000..ada0475 --- /dev/null +++ b/style/eventfilter.cpp @@ -0,0 +1,990 @@ +#include <qcursor.h> +#include <kpixmapeffect.h> +#include <X11/keysym.h> +#include <X11/extensions/XTest.h> +#include <fixx11h.h> + +bool LiquidStyle::eventFilter( QObject *obj, QEvent *ev ) +{ +// qWarning("%s, %s <- %s, %s: %d", obj->className(), obj->name(), obj->parent() ? obj->parent()->className() : "none", obj->parent()?obj->parent()->name():"none",ev->type()); + switch (ev->type()) + { + case QEvent::None: + case QEvent::Timer: + { + // first check if this is one of our fading pushbuttons - return elsewise + if (!(optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj))) + return false; + ButtonFadeInfo *bfi_ = bfi[((QPushButton*)obj)->winId()]; + if (!bfi_ || ((QTimerEvent*)ev)->timerId() != bfi_->timerId) + return false; + // ok, this is one of our fading buttons asking for repaint + ((QPushButton*)obj)->repaint(false); + int index = bfi_->fadeIn?bfi_->index + 1:bfi_->index - 1; + // handle border cases + if (index < 0) // fade-out run has finished, either stop fading stuff, or start fade-in + { + bfi_->fadeIn=true; + if (((QPushButton*)obj)->isDefault()) + { + bfi_->index=0; + } + else + { + obj->killTimer(bfi_->timerId); + // qWarning("%u: stopped (%d)", ((QPushButton*)obj)->winId(), bfi_->timerId); + bfi_->timerId=0; + ((QPushButton*)obj)->repaint(false); // must be to clean out button + } + } + else if (index > 9) // fade-in run has finished, either stop fading stuff, or start fade-out + { + if (((QPushButton*)obj)->isDefault()) + { + bfi_->fadeIn=false; + bfi_->index=9; + } + else + { + obj->killTimer(bfi_->timerId); + // qWarning("%u: stopped (%d)", ((QPushButton*)obj)->winId(), bfi_->timerId); + bfi_->timerId=0; + } + } + else + bfi_->index = index; + } + case QEvent::MouseMove: + if (::qt_cast<QTabBar*>(obj)) + { + QTabBar *tb = (QTabBar*)obj; + QRect tmpRect; + bool done = false; + QMouseEvent *me = ( QMouseEvent*)ev; + int oldTab = hoveredTabIndex; + if (hoveredTabIndex == -1) + { + for (int i = 0; i < tb->count(); i++) + { + if (tb->tabAt(i)) + { + tmpRect = tb->tabAt(i)->rect(); + if ( tmpRect.x() < me->x() && me->x() < tmpRect.right()) + { + hoveredTabIndex = i; + break; + } + } + } + } + else + { + if ((oldTab > 0) && tb->tabAt(oldTab-1)) + { + tmpRect = tb->tabAt(oldTab-1)->rect(); + if ((tmpRect.x() < me->x()) && (me->x() < tmpRect.right())) + { + hoveredTabIndex = oldTab-1; + done = true; + } + } + if (!done && (oldTab < tb->count()-1) && tb->tabAt(oldTab+1)) + { + tmpRect = tb->tabAt(oldTab+1)->rect(); + if ((tmpRect.x() < me->x()) && (me->x() < tmpRect.right())) + { + hoveredTabIndex = oldTab+1; + } + } + } + if ( oldTab != hoveredTabIndex ) + { + // reset old tab + if ( oldTab != -1 ) + if (tb->tabAt(oldTab)) tb->repaint( tb->tabAt(oldTab)->rect(), false ); + if ( hoveredTabIndex != -1 ) + tb->repaint( tmpRect, false ); + } + return false; + } + else if ( ::qt_cast<QHeader*>(obj) ) + { + QHeader *hw = (QHeader*)obj; + QMouseEvent * me = ( QMouseEvent * ) ev; + int oldHeader = headerHoverID; + headerHoverID = hw->orientation() == Qt::Horizontal ? hw->sectionAt( me->x() + hw->offset() ) : hw->sectionAt( me->y() + hw->offset() ); + if ( oldHeader != headerHoverID ) + { + // reset old header + if ( oldHeader != -1 ) + hw->repaint(hw->sectionRect ( oldHeader ), false); +// hw->repaint( hw->sectionPos( oldHeader )-hw->offset(), 0, hw->sectionSize( oldHeader ), hw->height(), false ); + if ( headerHoverID != -1 ) + hw->repaint(hw->sectionRect ( headerHoverID ), false); +// hw->repaint( hw->sectionPos( headerHoverID )-hw->offset(), 0, hw->sectionSize( headerHoverID ), hw->height(), false ); + } + return false; + } + return false; + case QEvent::Paint: + if ( ::qt_cast<QToolButton*>(obj) ) + { + QToolButton * btn = ( QToolButton * ) obj; + if (!obj->inherits( "TaskContainer" )) + { + if (btn->backgroundOrigin() != QWidget::WindowOrigin) + btn->setBackgroundOrigin( QWidget::WindowOrigin ); + } + else + { + isTaskContainer = true; + if ( currentTaskContainer == btn ) + taskContainerHover = true; + else + taskContainerHover = false; + } + return false; + } + else if (::qt_cast<QMenuBar*>(obj)) + { + QWidget *w = (QWidget *)obj; + if(w->backgroundMode() != Qt::PaletteBackground) + { + w->setBackgroundMode(PaletteBackground); + w->setBackgroundOrigin(QWidget::WindowOrigin); + } + return false; + } + else if ( ::qt_cast<QHeader*>(obj) ) + { + QHeader *hw = (QHeader*)obj; + if (hw->parentWidget() && ::qt_cast<QListView*>(hw->parentWidget())) + headerSortID = ((QListView*)hw->parentWidget())->sortColumn(); + return false; + } + else if ( obj->inherits( "QDockWindow" ) ) + { + if (KStyle::eventFilter( obj, ev )) + return true; + QWidget * w = ( QWidget * ) obj; + if ( w->backgroundMode() != Qt::PaletteBackground ) + { + w->setBackgroundMode( Qt::PaletteBackground ); + w->setBackgroundOrigin( QWidget::WindowOrigin ); + } + return false; + } + else if ( obj->inherits( "QRadioButton" ) || obj->inherits( "QCheckBox" ) ) + { + QButton * btn = ( QButton * ) obj; + bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "QStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); + bool isRadio = obj->inherits( "QRadioButton" ); + btn->erase(); + QPainter p; + p.begin( btn ); + QFontMetrics fm = btn->fontMetrics(); + QSize lsz = fm.size( ShowPrefix, btn->text() ); + QSize sz = isRadio ? + QSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) : + QSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) ); + int x = 0; + int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2; + SFlags flags = Style_Default; + if ( btn->isEnabled() ) + flags |= Style_Enabled; + if ( btn->hasFocus() ) + flags |= Style_HasFocus; + if ( btn->isDown() ) + flags |= Style_Down; + if ( highlightWidget == btn ) + flags |= Style_MouseOver; + if ( btn->state() == QButton::On ) + flags |= Style_On; + else if ( btn->state() == QButton::Off ) + flags |= Style_Off; + if ( isRadio ) + drawControl( CE_RadioButton, &p, btn, QRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + else + drawControl( CE_CheckBox, &p, btn, QRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + x = sz.width() + 6; + y = 0; + if ( btn->hasFocus() ) + { + QColor tmp( btn->colorGroup().background().dark( 130 ) ); + drawItem( &p, QRect( sz.width() + 6 + 2, 1, btn->width() - ( sz.width() + 6 + 1 ), btn->height() ), AlignLeft | AlignVCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), btn->pixmap(), btn->text(), -1, &tmp ); + drawItem( &p, QRect( sz.width() + 6 + 3, 2, btn->width() - ( sz.width() + 6 + 1 ), btn->height() ), AlignLeft | AlignVCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), btn->pixmap(), btn->text(), -1, &tmp ); + } + drawItem( &p, QRect( sz.width() + 6 + 1, 0, btn->width() - ( sz.width() + 6 + 1 ), btn->height() ), AlignLeft | AlignVCenter | ShowPrefix, btn->colorGroup(), btn->isEnabled(), btn->pixmap(), btn->text() ); + p.end(); + return true; + } + else if (obj->inherits("KColorGrid") && !(((QWidget*)obj)->width() && ((QWidget*)obj)->height())) + return true; + return false; + case QEvent::KeyPress: + case QEvent::KeyRelease: + return false; + case QEvent::Wheel: + if ( ::qt_cast<QScrollView*>(obj) ) + { + optionHandler->setScrollerActive(); + return false; + } + return false; + case QEvent::Enter: + if ( ::qt_cast<QToolButton*>(obj) ) + { + bool isTask = obj->inherits( "TaskContainer" ); + QToolButton * btn = ( QToolButton * ) obj; + if (isTask) + { + currentTaskContainer = btn; + btn->repaint( false ); + return false; + } + else if ( btn->isEnabled() ) + { + highlightWidget = btn; + btn->repaint( false ); + return false; + } + } + else if ( ::qt_cast<QPushButton*>(obj) || ::qt_cast<QComboBox*>(obj) || obj->inherits( "QSplitterHandle" ) || obj->inherits( "AppletHandleDrag" ) ) + { + QWidget * btn = ( QWidget * ) obj; + if ( btn->isEnabled() ) + { + highlightWidget = btn; + btn->repaint( false ); + if (optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj)) + fadeIn((QPushButton*)obj); + } + return false; + } + else if (::qt_cast<KToolBar*>(obj)) + { + QObjectList *handlerList = obj->queryList( "QDockWindowHandle" ); + for (uint i= 0; i < handlerList->count(); i++) + ((QWidget*)(handlerList->at(i)))->repaint(false); + return false; + } + if ( ::qt_cast<QScrollBar*>(obj) ) + { + QScrollBar * sb = ( QScrollBar * ) obj; + if ( !sb->draggingSlider() ) + { + if ( sb->isEnabled() ) + { + activeScroller = sb; + highlightWidget = sb; + sb->repaint( false ); + } + } + return false; + } + else if ( ::qt_cast<QScrollView*>(obj) ) + { + QScrollView *sv = ( QScrollView * ) obj; + if (sv->vScrollBarMode() == QScrollView::AlwaysOff && sv->hScrollBarMode() == QScrollView::AlwaysOff) + return false; + optionHandler->setScrollerActive(); + if (!(highlightWidget == sv->verticalScrollBar())) + sv->verticalScrollBar()->repaint(false); + if (!(highlightWidget == sv->horizontalScrollBar())) + sv->horizontalScrollBar()->repaint(false); + return false; + } + else if ( ::qt_cast<QHeader*>(obj) ) + { + currentHeader = (QHeader*)obj; + headerHoverID = -1; + return false; + } + else if (::qt_cast<QTabBar*>(obj)) + { + currentTabBar = (QTabBar*)obj; + hoveredTabIndex = -1; + return false; + } + else if ( obj->inherits( "KateView" ) || obj->inherits( "TEWidget") || obj->inherits("CHexViewWidget")) + { + QObjectList *scrollerList = obj->queryList( "QScrollBar" ); + optionHandler->setScrollerActive(); + for (uint i= 0; i < scrollerList->count(); i++) + ((QWidget*)(scrollerList->at(i)))->repaint(false); + return false; + } + else if (obj->inherits("KDockWidgetAbstractHeaderDrag")) + { + ((QWidget *)obj)->repaint(); + return false; + } + else if (obj->inherits( "KAnimWidget" )) + { + return true; + } + else if ( obj->inherits( "QLineEdit" ) && obj->parent() && ::qt_cast<QComboBox*>(obj->parent())) + { + QWidget * btn = ( QWidget * ) obj->parent(); + if ( btn->isEnabled() ) + { + highlightWidget = btn; + btn->repaint( false ); + } + return false; + } + else if ( obj->inherits( "QRadioButton" ) || obj->inherits( "QCheckBox" ) ) + { + QButton * btn = ( QButton * ) obj; + if (btn->isEnabled()) + { + bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "QStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); + bool isRadio = obj->inherits( "QRadioButton" ); + highlightWidget = btn; + QFontMetrics fm = btn->fontMetrics(); + QSize lsz = fm.size( ShowPrefix, btn->text() ); + QSize sz = isRadio ? + QSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) : + QSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) ); + int x = 0; + int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2; + QPainter p; + p.begin( btn ); + SFlags flags = Style_Default; + if ( btn->isEnabled() ) + flags |= Style_Enabled; + if ( btn->hasFocus() ) + flags |= Style_HasFocus; + if ( btn->isDown() ) + flags |= Style_Down; + if ( highlightWidget == btn ) + flags |= Style_MouseOver; + if ( btn->state() == QButton::On ) + flags |= Style_On; + else if ( btn->state() == QButton::Off ) + flags |= Style_Off; + if ( isRadio ) + drawControl( CE_RadioButton, &p, btn, QRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + else + drawControl( CE_CheckBox, &p, btn, QRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + p.end(); + } + return false; + } + return false; + case QEvent::Leave: + if ( ::qt_cast<QToolButton*>(obj) ) + { + QToolButton * btn = ( QToolButton * ) obj; + if (obj->inherits( "TaskContainer" )) + { + currentTaskContainer = NULL; + btn->repaint( false ); + return false; + } + else if ( btn == highlightWidget ) + { + highlightWidget = NULL; + btn->repaint( false ); + return false; + } + } + else if ( ::qt_cast<QPushButton*>(obj) || ::qt_cast<QComboBox*>(obj) || obj->inherits( "QSplitterHandle" ) || obj->inherits( "AppletHandleDrag" ) ) + { + QWidget * btn = ( QWidget * ) obj; + if ( btn == highlightWidget ) + { + highlightWidget = NULL; + if (optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj)) + fadeOut((QPushButton*)obj); + else + btn->repaint( false ); + } + return false; + } + else if (::qt_cast<KToolBar*>(obj)) + { + QObjectList *handlerList = obj->queryList( "QDockWindowHandle" ); + for (uint i= 0; i < handlerList->count(); i++) + ((QWidget*)(handlerList->at(i)))->repaint(false); + return false; + } + if ( ::qt_cast<QScrollBar*>(obj) ) + { + QScrollBar * sb = ( QScrollBar * ) obj; + if ( sb == highlightWidget && !sb->draggingSlider() ) + { + activeScroller = NULL; + highlightWidget = NULL; + sb->repaint( false ); + } + return false; + } + else if ( ::qt_cast<QScrollView*>(obj) ) + { + QScrollView *sv = (QScrollView*)obj; +// if (sv->clipRegion().boundingRect().contains(sv->mapFromGlobal(QCursor::pos()))) +// return false; // mouse is still in the scrollview + if (sv->vScrollBarMode() == QScrollView::AlwaysOff && sv->hScrollBarMode() == QScrollView::AlwaysOff) + return false; // no sliders available - don't mess up things + optionHandler->setScrollerInactive(); + if (!(highlightWidget == sv->verticalScrollBar())) + sv->verticalScrollBar()->repaint(false); + if (!(highlightWidget == sv->horizontalScrollBar())) + sv->horizontalScrollBar()->repaint(false); + return false; + } + else if ( ::qt_cast<QHeader*>(obj) ) + { + QHeader *hw = (QHeader*)obj; + currentHeader = NULL; + if ( headerHoverID != -1 ) + hw->repaint( hw->sectionPos( headerHoverID )-hw->offset(), 0, hw->sectionSize( headerHoverID ), hw->height(), false ); + headerHoverID = -1; + return false; + } + else if (::qt_cast<QTabBar*>(obj)) + { + QTabBar *tb = (QTabBar*)obj; + currentTabBar = NULL; + if ( hoveredTabIndex != -1 ) + { + QTab *tmpTab = tb->tabAt(hoveredTabIndex); + if (tmpTab) tb->repaint( tmpTab->rect(), false ); + } + hoveredTabIndex = -1; + return false; + } + else if ( obj->inherits( "KateView" ) || obj->inherits( "TEWidget") || obj->inherits("CHexViewWidget")) + { + QObjectList *scrollerList = obj->queryList( "QScrollBar" ); + optionHandler->setScrollerInactive(); + for (uint i= 0; i < scrollerList->count(); i++) + ((QWidget*)(scrollerList->at(i)))->repaint(false); + return false; + } + else if (obj->inherits("KDockWidgetAbstractHeaderDrag")) + { + ((QWidget *)obj)->repaint(); + return false; + } + else if (obj->inherits( "KAnimWidget" )){ + return true; + } + else if ( obj->inherits( "QLineEdit" ) && obj->parent() && ::qt_cast<QComboBox*>(obj->parent())) { + QWidget *btn = (QWidget*)obj->parent(); + if ( btn == highlightWidget ) + highlightWidget = NULL; + btn->repaint( false ); + return false; + } + else if ( obj->inherits( "QRadioButton" ) || obj->inherits( "QCheckBox" ) ) + { + QButton * btn = ( QButton * ) obj; + if (btn == highlightWidget) + { + bool isRadio = obj->inherits( "QRadioButton" ); + bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "QStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) ); + highlightWidget = NULL; + QFontMetrics fm = btn->fontMetrics(); + QSize lsz = fm.size( ShowPrefix, btn->text() ); + QSize sz = isRadio ? + QSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) : + QSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) ); + int x = 0; + int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2; + QPainter p; + p.begin( btn ); + SFlags flags = Style_Default; + if ( btn->isEnabled() ) + flags |= Style_Enabled; + if ( btn->hasFocus() ) + flags |= Style_HasFocus; + if ( btn->isDown() ) + flags |= Style_Down; + if ( highlightWidget == btn ) + flags |= Style_MouseOver; + if ( btn->state() == QButton::On ) + flags |= Style_On; + else if ( btn->state() == QButton::Off ) + flags |= Style_Off; + if ( isRadio ) + drawControl( CE_RadioButton, &p, btn, QRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + else + drawControl( CE_CheckBox, &p, btn, QRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags ); + p.end(); + } + return false; + } + return false; + case QEvent::MouseButtonPress: +// qWarning("class: %s, name: %s",obj->className(), obj->name()); + if ( optionHandler->style() > Panther && ::qt_cast<QToolBar*>(obj)) + { + QMouseEvent *mev = (QMouseEvent *) ev; + if (mev->button() != Qt::LeftButton) + return false; + mouseButtonPressed_ = true; + cursorPos_ = mev->globalPos(); + QTimer::singleShot(50,this,SLOT(fakeMouse())); + return true; // fire this event + } + if ( ::qt_cast<QScrollBar*>(obj) && ((QMouseEvent*)ev)->button() != Qt::RightButton) + { + QScrollBar * sb = ( QScrollBar * ) obj; + activeScroller = NULL; + sb->repaint( false ); + return false; + } + else if (obj->inherits( "KAnimWidget" )) + { + ((QFrame *)obj)->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); + return false; + } + return false; + case QEvent::MouseButtonRelease: + if ( mouseButtonPressed_ ) + { + mouseButtonPressed_= false; + } + if ( ::qt_cast<QScrollBar*>(obj) ) + { + QScrollBar * sb = ( QScrollBar * ) obj; + QMouseEvent * me = ( QMouseEvent * ) ev; + if ( sb == highlightWidget) + { + if ( sb->rect().contains( me->pos() ) ) + { + activeScroller = sb; + sb->repaint( false ); + } + else + { + // this assumes, scrollers are right/bottom to scrollview + if ( ((sb->orientation() == Vertical) && (me->pos().x() < 0)) || ((sb->orientation() == Horizontal) && (me->pos().y() < 0)) ) + { + optionHandler->setScrollerActive(); + sb->repaint( false ); + } + } + } + return false; + } + else if ( ::qt_cast<QHeader*>(obj) && obj->parent() && ::qt_cast<QListView*>(obj->parent())) + { + QMouseEvent * me = ( QMouseEvent * ) ev; + headerSortID = ((QHeader*)obj)->sectionAt( me->x() + ((QHeader*)obj)->offset()); + return false; + } + else if (obj->inherits( "KAnimWidget" )){ + ((QFrame *)obj)->setFrameShape(QFrame::NoFrame); + return false; + } + return false; + case QEvent::FocusIn: + if (optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj)) + { + fadeIn((QPushButton*)obj); + return false; + } + if ( obj->inherits( "QLineEdit" ) ) + { + QObject *daddy = obj->parent(); + if ( daddy && daddy->inherits( "QSpinWidget" )) + ((QWidget*)daddy)->repaint(false); + else + ((QWidget*)obj)->repaint(false); + return false; + } + return false; + case QEvent::FocusOut: + if (optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj)) + { + fadeOut((QPushButton*)obj); + return false; + } + if ( obj->inherits( "QLineEdit" ) ) + { + if ( obj->parent() && obj->parent()->inherits( "QSpinWidget" )) + ((QWidget*)obj->parent())->repaint(false); + else + ((QWidget*)obj)->repaint(false); + return false; + } + return false; + case QEvent::Move: + if ( !(::qt_cast<QToolBar*>(obj) || obj->inherits( "KActiveLabel" ))) + return false; + case QEvent::Show: + if (optionHandler->style() == Tiger && ::qt_cast<QToolBar*>(obj)) + { + QToolBar *tb = (QToolBar*)obj; + QPoint pt = tb->mapTo(tb->topLevelWidget(), QPoint(0,0)); + if (pt.y() == 0) + { + activeToolbarPix = QPixmap(32,tb->height()); + KPixmapEffect::gradient(activeToolbarPix, optionHandler->aDecoColor1(), optionHandler->aDecoColor2(), KPixmapEffect::VerticalGradient, 0); + QPainter painter(&activeToolbarPix); + painter.setPen( optionHandler->aDecoColor2().dark(130) ); + painter.drawLine ( 0, tb->height()-1, 31, tb->height()-1 ); + painter.end(); + tb->installEventFilter(eventKiller); + if (tb->isActiveWindow()) + { + tb->setPaletteBackgroundColor(optionHandler->aDecoColor2()); + tb->setPaletteBackgroundPixmap(activeToolbarPix); + } + else + { + QPalette pal( tb->palette() ); + pal.setColor( QColorGroup::Background, qApp->palette().color(QPalette::Active, QColorGroup::Background) ); + pal.setBrush ( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background) ); + tb->setPalette( pal ); + } + tb->removeEventFilter(eventKiller); + } + else + { + QPalette pal( tb->palette() ); + pal.setBrush ( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background) ); + tb->installEventFilter(eventKiller); + tb->setPalette( pal ); + tb->removeEventFilter(eventKiller); + } + } + if (optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj)) + { + ButtonFadeInfo *bfi_ = bfi[((QPushButton*)obj)->winId()]; + if (bfi_) + return false; + bfi_ = new ButtonFadeInfo(); + bfi.insert(((QPushButton*)obj)->winId(),bfi_); + if (((QPushButton*)obj)->isDefault()) + fadeIn((QPushButton*)obj); + return false; + } + if (::qt_cast<QProgressBar*>(obj)) + { + progAnimWidgets[(QWidget*)obj] = 0; + return false; + } + if ( !qstrcmp(obj->name(), "kde toolbar widget") ) + { + QWidget* lb = static_cast<QWidget*>(obj); + if (lb->backgroundMode() == Qt::PaletteButton) + lb->setBackgroundMode(Qt::PaletteBackground); + lb->removeEventFilter(this); + return false; + } + else if ( !obj->inherits( "KActiveLabel" )) + return false; + case QEvent::Resize:{ + QResizeEvent* rev = (QResizeEvent*) ev; + if (::qt_cast<QPopupMenu*>(obj) && optionHandler->MenuBackground() == Gradient) + { + KPixmap tmpPix = QPixmap(rev->size().width(),32); + ((QWidget *)obj)->setPaletteBackgroundPixmap(KPixmapEffect::unbalancedGradient(tmpPix, optionHandler->Color(), optionHandler->Color2(), KPixmapEffect::HorizontalGradient, 100, 100)); + } + else if (optionHandler->style() == Tiger && ::qt_cast<QToolBar*>(obj) && rev->size().height() != rev->oldSize().height()) + { + QToolBar *tb = (QToolBar*)obj; + QPoint pt = tb->mapTo(tb->topLevelWidget(), QPoint(0,0)); + if (pt.y() == 0) + { + activeToolbarPix = QPixmap(32,rev->size().height()); + KPixmapEffect::gradient(activeToolbarPix, optionHandler->aDecoColor1(), optionHandler->aDecoColor2(), KPixmapEffect::VerticalGradient, 0); + QPainter painter(&activeToolbarPix); + painter.setPen( optionHandler->aDecoColor2().dark(130) ); + painter.drawLine ( 0, rev->size().height()-1, 31, rev->size().height()-1 ); + painter.end(); + tb->installEventFilter(eventKiller); + if (tb->isActiveWindow()) + { + tb->setPaletteBackgroundColor(optionHandler->aDecoColor2()); + tb->setPaletteBackgroundPixmap(activeToolbarPix); + } + else + { + QPalette pal( tb->palette() ); + pal.setColor( QColorGroup::Background, qApp->palette().color(QPalette::Active, QColorGroup::Background) ); + pal.setBrush ( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background) ); + tb->setPalette( pal ); + } + tb->removeEventFilter(eventKiller); + } + else + { + QPalette pal( tb->palette() ); + pal.setBrush ( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background) ); + tb->installEventFilter(eventKiller); + tb->setPalette( pal ); + tb->removeEventFilter(eventKiller); + } + } + /*hmhmhmm... this may break qgroupbox children?!?*/ + else if (::qt_cast<QGroupBox*>(obj)) + { + QGroupBox* gb = (QGroupBox*)(obj); + if(gb->title().isEmpty()) return false; + QResizeEvent * e = (QResizeEvent*)ev; + int fm = gb->fontMetrics().height()+(gb->isCheckable()?4:1); + gb->setFrameRect(QRect(gb->rect().x(), gb->rect().y()+fm, e->size().width(), e->size().height()-fm/*-gb->frameWidth()*/)); + if(gb->layout()) + gb->layout()->setGeometry(QRect(gb->rect().x(), gb->rect().y(), e->size().width(), e->size().height())); + return true; + } + else if ( obj->inherits( "KActiveLabel" )) + { + QWidget * w = ( QWidget * ) obj; + QPalette pal( w->palette() ); + QPixmap *tile = pal.brush( QPalette::Active, QColorGroup::Background ).pixmap(); + if ( tile ) + { + QSize sz( ev->type() == QEvent::Resize ? rev->size() : w->size() ); + QPixmap pix( sz.width(), sz.height() ); + QPainter p; + if (optionHandler->style() == Brushed) + { + p.begin( &pix ); + // calc brush offsets + QWidget *window = w->topLevelWidget(); + int leftWidth; + int rightWidth; + if (window) + { + QPoint zero = w->mapTo(window, QPoint(0,0)); + leftWidth = (window->width()-1024)/2 - zero.x(); + rightWidth = pix.width() - (1024 + leftWidth); + if (leftWidth > 0) + p.drawTiledPixmap(0, 0, leftWidth, sz.height(), plainBrush); + p.drawTiledPixmap(leftWidth>0?leftWidth:0, 0, + pix.width()-(leftWidth>0?leftWidth:0)-(rightWidth>0?rightWidth:0), sz.height(), + gradBrush,leftWidth>0?0:(zero.x()-(window->width()-1024)/2)); + if (rightWidth > 0) + p.drawTiledPixmap(pix.width()-rightWidth, 0, rightWidth, sz.height(), plainBrush); + } + else if (pix.width() > 1024) + { + leftWidth = (pix.width()-1024)/2; + rightWidth = pix.width() - leftWidth; + p.drawTiledPixmap(0, 0, leftWidth, sz.height(), plainBrush); + p.drawTiledPixmap(leftWidth, 0, 1024, sz.height(), gradBrush); + p.drawTiledPixmap(leftWidth + 1024, 0, rightWidth, sz.height(), plainBrush); + } + else + p.drawTiledPixmap(0, 0, pix.width(), sz.height(), gradBrush, (1024-pix.width())/2, 0); + p.end(); + QBrush brush( pal.active().background(), pix ); + pal.setBrush( QColorGroup::Base, brush ); + w->setPalette( pal ); + } + else + { + p.begin(w); + p.drawTiledPixmap(QRect(0,0,sz.width(),sz.height()), *tile, w->backgroundOffset()); + } + } + return false; + } + else if ((optionHandler->style() == Brushed) && obj->isWidgetType() && ((QWidget*)obj)->isTopLevel() && + !(::qt_cast<QPopupMenu*>(obj) || ::qt_cast<QMenuBar*>(obj) || ((QWidget*)obj)->isDesktop () || ::qt_cast<QListBox*>(obj) || + obj->inherits("QTipLabel") || obj->inherits("AlphaWidget") || obj->inherits("ScrollWidget") ) && (ev->type() == QEvent::Show || + rev->size().width() != rev->oldSize().width())) + { + QWidget* widget = (QWidget*)obj; + // create new brushpix + QPixmap tmpBrushPix(ev->type() == QEvent::Show?widget->width():rev->size().width(), plainBrush.height()); + QPainter lightMe(&tmpBrushPix); + // calc brush offsets + int tmpWidth; + if ((tmpWidth = tmpBrushPix.width()) > 1024) + { + int leftWidth = (tmpWidth-1024)/2; + int rightWidth = tmpWidth - leftWidth; + lightMe.drawTiledPixmap(0, 0, leftWidth, plainBrush.height(), plainBrush,256-leftWidth,0); + lightMe.drawPixmap(leftWidth, 0, gradBrush); + lightMe.drawTiledPixmap(leftWidth + 1024, 0, rightWidth, plainBrush.height(), plainBrush); + } + else + lightMe.drawPixmap(0, 0, gradBrush, (1024-tmpWidth)/2, 0, tmpWidth); + lightMe.end(); + //update palette + QPalette pal( qApp->palette()); + QBrush brush( pal.active().background(), tmpBrushPix ); + pal.setBrush ( QColorGroup::Background, brush ); + //reset apps palette + qApp->installEventFilter(eventKiller); // pssst... don't let anyone know... + qApp->setPalette(pal); + pal = QPalette(widget->palette()); + pal.setBrush ( QColorGroup::Background, brush ); + widget->installEventFilter(eventKiller); // pssst... don't let anyone know... + widget->setPalette(pal); + widget->removeEventFilter(eventKiller); // ...that we just replaced the palette + QObjectList *kids = widget->queryList("QWidget"); //TODO: implement a faster version, depending on ::qt_cast<QWidget*>() + for (uint i= 0; i < kids->count(); i++) + { + QWidget *kid = (QWidget*)kids->at(i); + if (kid && kid->paletteBackgroundPixmap() && !(kid->isTopLevel() || kid->inherits( "KonqIconViewWidget" ) || kid->inherits( "khtml") || kid->inherits( "KActiveLabel") || qstrcmp( kid->name(), "_B_ALI_HEADER" ) == 0 || (kid->parentWidget() && kid->parentWidget()->inherits("Thumbnail") || kid->parentWidget()->inherits("MarkListItem")) )) + { + //we can loose those kids anytime - especially if the user plays on konqueror... + if (::qt_cast<KToolBarButton*>(kid)) + kid->setErasePixmap(tmpBrushPix); + else + { + pal = QPalette(kid->palette()); + pal.setBrush ( QColorGroup::Background, brush ); + kid->installEventFilter(eventKiller); // pssst... don't let anyone know... + kid->setPalette(pal); + kid->removeEventFilter(eventKiller); // ...that we just replaced the palette + } + } + } + delete kids; + qApp->removeEventFilter(eventKiller); // ...that we just replaced the palette + return false; + } + return false; + } + case QEvent::Hide: + if (optionHandler->AnimateButton() && ::qt_cast<QPushButton*>(obj)) + { + ButtonFadeInfo *bfi_ = bfi[((QPushButton*)obj)->winId()]; + if (bfi_) + { + obj->killTimer(bfi_->timerId); + // qWarning("%u: stopped (%d)", ((QPushButton*)obj)->winId(), bfi_->timerId); + bfi_->index=0; + bfi_->timerId=0; + } + } + case QEvent::ApplicationPaletteChange: + if ( obj->inherits( "QTipLabel" ) ) + { + ( ( QWidget* ) obj ) ->setPalette( tooltipPalette ); + return true; + } + return false; + case QEvent::PaletteChange: + if (obj->inherits("QStatusBar")) + { + obj->installEventFilter(eventKiller); + ((QWidget*)obj)->setPalette(qApp->palette()); + obj->removeEventFilter(eventKiller); + return true; + } + if ( obj->inherits( "QTipLabel" ) ) + { + ( ( QWidget* ) obj ) ->setPalette( tooltipPalette ); + return true; + } + if (obj->inherits("KCalcButton")) + { + QWidget *w = (QWidget*)obj; + QPalette pal( w->palette() ); + pal.setBrush( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background)); + w->installEventFilter(eventKiller); + w->setPalette( pal ); + w->removeEventFilter(eventKiller); + w->setBackgroundOrigin( QWidget::WindowOrigin ); + return true; + } + return false; + case QEvent::WindowActivate: + if (optionHandler->style() == Tiger && ::qt_cast<QToolBar*>(obj)) + { + QToolBar *tb = (QToolBar*)obj; + QPoint pt = tb->mapTo(tb->topLevelWidget(), QPoint(0,0)); + if (pt.y() == 0) + { + tb->installEventFilter(eventKiller); + tb->setPaletteBackgroundColor(optionHandler->aDecoColor2()); + tb->setPaletteBackgroundPixmap(activeToolbarPix); + tb->removeEventFilter(eventKiller); + } + } + return false; + case QEvent::WindowDeactivate: + if (optionHandler->style() == Tiger && ::qt_cast<QToolBar*>(obj)) + { + QToolBar *tb = (QToolBar*)obj; + QPoint pt = tb->mapTo(tb->topLevelWidget(), QPoint(0,0)); + if (pt.y() == 0) + { + QPalette pal( tb->palette() ); + pal.setColor( QColorGroup::Background, qApp->palette().color(QPalette::Active, QColorGroup::Background) ); + pal.setBrush ( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background) ); + tb->installEventFilter(eventKiller); + tb->setPalette( pal ); + obj->removeEventFilter(eventKiller); + } + } + return false; + default: + return false; + } +} + +void LiquidStyle::fakeMouse() +{ + if (mouseButtonPressed_) // delayed mousepress for move event + { + QCursor::setPos ( cursorPos_ ); + XTestFakeButtonEvent(qt_xdisplay(),1, false, 0); + XTestFakeKeyEvent(qt_xdisplay(),XKeysymToKeycode(qt_xdisplay(), XK_Alt_L), true, 0); + XTestFakeButtonEvent(qt_xdisplay(),1, true, 0); + XTestFakeKeyEvent(qt_xdisplay(),XKeysymToKeycode(qt_xdisplay(), XK_Alt_L), false, 0); + XFlush(qt_xdisplay()); + } +} + +void LiquidStyle::fadeIn(QPushButton *button) +{ + ButtonFadeInfo *bfi_ = bfi[button->winId()]; + if (!bfi_) + { + bfi_ = new ButtonFadeInfo(); + bfi.insert(button->winId(),bfi_); + } + bfi_->fadeIn = true; + if (bfi_->timerId == 0) + { + bfi_->index = 0; + bfi_->timerId = button->startTimer(button->isDefault()?100:50); + // qWarning("%u: started (%d)", button->winId(), bfi_->timerId); + } +} + +void LiquidStyle::fadeOut(QPushButton *button) +{ + ButtonFadeInfo *bfi_ = bfi[button->winId()]; + if (!bfi_) + { + bfi_ = new ButtonFadeInfo(); + bfi.insert(button->winId(),bfi_); + } + bfi_->fadeIn = false; + if (bfi_->timerId == 0) + { + bfi_->index = 9; + bfi_->timerId = button->startTimer(50); + // qWarning("%u: started (%d)", button->winId(), bfi_->timerId); + } +} + +BMShower::BMShower(QObject *parent) : QObject(parent) +{ +} + +bool BMShower::eventFilter( QObject *obj, QEvent *ev ) +{ + if (ev->type() == QEvent::Show && (obj->isWidgetType() && ((QWidget*)obj)->isTopLevel() && + !(::qt_cast<QPopupMenu*>(obj) || ::qt_cast<QMenuBar*>(obj) || ((QWidget*)obj)->isDesktop () || ::qt_cast<QListBox*>(obj) || + obj->inherits("QTipLabel") || obj->inherits("AlphaWidget") || obj->inherits("ScrollWidget") ))) + { + QResizeEvent* rev = new QResizeEvent(((QWidget*)obj)->size(), QSize(0,0)); + parent()->eventFilter( obj, rev ); + obj->removeEventFilter(this); + delete rev; + } + return false; +} diff --git a/style/fracts.h b/style/fracts.h new file mode 100644 index 0000000..1774e93 --- /dev/null +++ b/style/fracts.h @@ -0,0 +1,74 @@ +#ifndef FRACTS_H +#define FRACTS_H + +/* +If you wish to replace the button or combo Images, you may end up with very querky results. +The reason is, that the style internally fracts those images into 9 tiles. + +To get valid results, you need to adjust the values below, so they fit your images. +the format is: +w, h, xOff, yOff, centerW, centerH, shadowH, glowWH + +- w, h are width and height of the whole button. +- xOff (yOff) is the distance of the central fraction from left (upper) button side. +- centerW (centerH) is the width (height) of the central button fraction. +- shadowH is the height of the buttons shadow +- glowWH is the size of the frame the glow draws around the button + +an image may be helpful (make sure your editor uses a monospace font) + +[- - - - - - - - - - - - - - - w - - - - - - - - - - - - -]--- +|----------------|--------------------------|-----------------| | +| | | | +| yOff | | | +| | | | +|----- xOff----->o--------- centerW --------|-----------------| | +| | | | +| | centerH | h +| | | | +|----------------|--------------------------|-----------------| | +| | | | +| | | | | +| | | | +| | | | | +|----------------|--------------------------|-----------------| | +. --- + +Also please notice, that the Button tiles are treated different from the rectangualr ones, namely, (S: static, T: tiled, TH: tiled horizontally, TV: tiled vertically) + +Round Button, Combo: +|----------------|--------------------------|-----------------| +| | | | +| S | TH | S | +| | | | +|----------------|--------------------------|-----------------| +| | | | +| TV | T | TV | +| | | | +|----------------|--------------------------|-----------------| +| | | | +| | | | +| S | TH | S | +| | | | +|----------------|--------------------------|-----------------| + +Rectangular Button: +|----------------|--------------------------|-----------------| +| | | | +| TV | TH | TV | +| | | | +|----------------|--------------------------|-----------------| +| | | | +| S | TH | S | +| | | | +|----------------|--------------------------|-----------------| +| | | | +| | | | +| TV | TH | TV | +| | | | +|----------------|--------------------------|-----------------| + +*/ + + +#endif diff --git a/style/generatePixmaps.sh b/style/generatePixmaps.sh new file mode 100755 index 0000000..388b002 --- /dev/null +++ b/style/generatePixmaps.sh @@ -0,0 +1,54 @@ +#!/bin/sh +top_srcdir="${1:-../..}" +imagebase="$top_srcdir/imagebase" +UIC=$(grep "UIC = " ../Makefile | cut -f3- -d" ") +echo -e "#ifndef SPIXMAPS_H\n#define SPIXMAPS_H\n" > pixmaps.h +$UIC -embed baghira \ +$imagebase/brushed-gradient \ +$imagebase/brushed-tile \ +$imagebase/button-base \ +$imagebase/button-milk \ +$imagebase/button-glow \ +$imagebase/button-jaguar \ +$imagebase/button-shadow \ +$imagebase/checkbox \ +$imagebase/checkboxdown \ +$imagebase/checkbox-milk \ +$imagebase/checkboxdown-milk \ +$imagebase/combo \ +$imagebase/combo-milk \ +$imagebase/combo-jaguar \ +$imagebase/combo-shadow \ +$imagebase/htmlradio \ +$imagebase/htmlradio_down \ +$imagebase/progress \ +$imagebase/progress2 \ +$imagebase/radio \ +$imagebase/radio_down \ +$imagebase/radio-milk \ +$imagebase/radio_down-milk \ +$imagebase/rectbutton \ +$imagebase/roundFrame \ +$imagebase/sbgroove_btm \ +$imagebase/sbgroove_mid \ +$imagebase/sbgroove_top \ +$imagebase/sbIslider_mid \ +$imagebase/sbslider_btm \ +$imagebase/sbslider_btm_shd \ +$imagebase/sbslider_mid \ +$imagebase/sbslider_top \ +$imagebase/sbslider_top_shd \ +$imagebase/sb_subadd \ +$imagebase/sliderarrow \ +$imagebase/sbgroove_btm-milk \ +$imagebase/sbgroove_mid-milk \ +$imagebase/sbgroove_top-milk \ +$imagebase/sbslider_btm-milk \ +$imagebase/sbslider_mid-milk \ +$imagebase/sbslider_top-milk \ +$imagebase/sb_subadd-milk \ +$imagebase/sliderarrow-milk \ +$imagebase/tab \ +$imagebase/tab-milk \ +$imagebase/tab-jaguar >> pixmaps.h +echo -e "#endif //SPIXMAPS_H\n" >> pixmaps.h diff --git a/style/optionHandler.cpp b/style/optionHandler.cpp new file mode 100644 index 0000000..d96b700 --- /dev/null +++ b/style/optionHandler.cpp @@ -0,0 +1,251 @@ +#include "baghira.h" +#include <qapplication.h> +#include <qbrush.h> +#include <qcolor.h> +#include <qevent.h> +#include <qimage.h> +#include <qobject.h> +#include <qpainter.h> +#include <qpalette.h> +#include <qpopupmenu.h> +#include <qrect.h> +#include <qsettings.h> +#include <qsize.h> +#include <qstring.h> +// #include <kconfig.h> +#include <kpixmapeffect.h> +#include <stdio.h> +#include <cmath> + +#define _SCALE_ 65536 +#define _NORMALIZE_ >>16 + +#define CLAMP(x,l,u) x < l ? l :\ +x > u ? u :\ +x + +OptionHandler::OptionHandler( QObject *parent ) : QObject( parent ) { + scrollerActive = false; + groupShadowButton = false; + reloadSettings(); + } + + +const QColor& OptionHandler::textColor() { + return ( useCustomMenuColor ? fgColor : qApp->palette().active().text() ); + } + +const QColor& OptionHandler::bgColor() { + return qApp->palette().active().background(); + } + +const QColor& OptionHandler::buttonColor() { + LiquidStyle * style = ( LiquidStyle* ) parent(); + /*if (style->isKicker) return style->origPanelBrush.color(); + else */if (style->isOOO) return CustomButtonColor(); + else return qApp->palette().active().button(); + } + +void OptionHandler::reloadSettings() { + // gather options... + QSettings config; + config.beginGroup("/baghira/Style"); + //we need that first to make sure we use some proper settings ;) + customButtonColor = QColor(config.readNumEntry("Design_ButtonColor",(int)qApp->palette().active().button().rgb())); + // design handling: + // first try file: + QString tmpString; + FILE *file = NULL; + wmDesign = 5; + for (int i = 0; i < 8; i++) + custCols[i] = -1; + if (qstrcmp( qApp->argv() [ 0 ], "ksplash" ) == 0) + { + style_ = Panther; + _toolbuttonStyle = Panther; + _buttonStyle = Panther; + tabStyle_ = Clever; + bgStipple = false; + inactiveButtonColor = Background; + } + else + { + // first try for a tmp file from bab starter + int tmpFile = 0; + tmpString = QDir::homeDirPath() + "/.baghira/.bab/" + qApp->argv() [ 0 ]; + file = fopen(tmpString.latin1(), "r"); + if( file == NULL ) + { + tmpFile = 1; + tmpString = QDir::homeDirPath() + "/.baghira/" + qApp->argv() [ 0 ]; + file = fopen(tmpString.latin1(), "r"); + if( file == NULL ) + { + tmpFile = 2; + tmpString = QDir::homeDirPath() + "/.baghira/.bab/.style"; + file = fopen(tmpString.latin1(), "r"); + } + } + if (file != NULL) + { + style_ = _buttonStyle = _toolbuttonStyle = Panther; int i3 = inactiveButtonColor = -1; tabStyle_ = (tabStyle)-1; + fscanf(file,"%u\n%u\n%u\n%u\n%u\n%u\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n",&style_, &wmDesign, &_buttonStyle, &_toolbuttonStyle, &tabStyle_, &i3, &custCols[0], &custCols[1], &custCols[2], &custCols[3], &custCols[4], &custCols[5], &custCols[6], &custCols[7], &inactiveButtonColor); + fclose(file); + if (_toolbuttonStyle < 0 || _toolbuttonStyle >= NUMSTYLES) + _toolbuttonStyle = (Style)config.readNumEntry( "Special_ToolbuttonStyle", style_); + if (_buttonStyle < 0 || _buttonStyle >= NUMSTYLES) + _buttonStyle = (Style)config.readNumEntry( "Special_ButtonStyle", style_); + if (tabStyle_ < 0 || tabStyle_ > 2) + tabStyle_ = (tabStyle) config.readNumEntry( (style_ == Brushed)?"Design_TabStyleBrushed":"Design_TabStyleAqua", Clever); + if (inactiveButtonColor < 0 || inactiveButtonColor > 3) + inactiveButtonColor = config.readNumEntry( "Design_InactiveButtonStyle", Background); + if (style_ == Brushed) + bgStipple = TRUE; + else if (i3 == 0) + bgStipple = FALSE; + else + bgStipple = config.readBoolEntry( "Design_StippleBackground", true ); + // inactive Button + if (tmpFile == 0) + remove(tmpString.latin1()); // remove TEMPORARY file + else if (tmpFile == 2) + { + tmpString = QDir::homeDirPath() + "/.baghira/.bab/.deco"; + if ((file = fopen(tmpString.latin1(), "r")) != NULL) + { + fscanf(file,"%u\n%u\n",&i3, &wmDesign); + fclose(file); + } + } + } + else + { + style_ = (Style)config.readNumEntry( "Design_Default", Panther ); + _toolbuttonStyle = (Style)config.readNumEntry( "Special_ToolbuttonStyle", style_); + _buttonStyle = (Style)config.readNumEntry( "Special_ButtonStyle", style_); + tabStyle_ = (tabStyle) config.readNumEntry( (style_ == Brushed)?"Design_TabStyleBrushed":"Design_TabStyleAqua", Clever); + bgStipple = (style_ == Brushed) ? true : config.readBoolEntry( "Design_StippleBackground", true ); + inactiveButtonColor = config.readNumEntry( "Design_InactiveButtonStyle", Background); + } + } + contrast = 0; + if (wmDesign > 4) + wmDesign = style_; + if (style_ == Jaguar) + contrast = 4; + else if (style_ == Brushed) + { + tintBrush = config.readBoolEntry( "Colors_TintBrushedMetal", false ); + if (tintBrush) + brushTint.setRgb( config.readNumEntry( "Colors_BrushTint", ( int ) bgColor().rgb())); + } + // menu stuff + glossyMenus_ = config.readBoolEntry( "Menu_Glossy", true ); + menuBackground = config.readNumEntry( "Menu_Background", Standard); + menuOpacity = config.readNumEntry( "Menu_Opacity", 70); + int menuColorStyle = config.readNumEntry( "Menu_ColorStyle", 0); + menuColorButton = (menuColorStyle == 1); + useCustomMenuColor = (menuColorStyle == 2); + shadowText = config.readBoolEntry( "Menu_ShadowText", false); + if (useCustomMenuColor){ + color = QColor( config.readNumEntry( "Menu_Color1", 0 ) ); + color2 = QColor( config.readNumEntry( "Menu_Color2", 0 ) ); + colorHigh = QColor( config.readNumEntry( "Menu_ColorHighlight", 0 ) ); + fgColor = QColor( config.readNumEntry( "Menu_TextColor", 0 ) ); + fgColorHigh = QColor( config.readNumEntry( "Menu_TextColorHighlight", 0 ) ); + } + else if (menuColorButton){ + color = customButtonColor; + color2 = customButtonColor.dark(130); + } + else { + color = qApp->palette().active().background(); + color2 = qApp->palette().active().background().dark(130); + } + drawMenuStripe_ = config.readBoolEntry("Menu_DrawMenuStripe", false); + if (drawMenuStripe_) + menuStripeColor_ = QColor(config.readNumEntry("Menu_StripeColor"),(int)Qt::white.rgb()); + // color stuff + // widgets + customWidgetColor = config.readBoolEntry( "Colors_UseCustomColors", false); + if ( customWidgetColor ) { + customColors[ CustomRadioOn ].setRgb( config.readNumEntry( "Colors_RadioOn", ( int ) buttonColor().rgb() ) ); + customColors[ CustomRadioOff ].setRgb( config.readNumEntry( "Colors_RadioOff", ( int ) bgColor().rgb() ) ); + customColors[ CustomCBOn ].setRgb( config.readNumEntry( "Colors_CheckOn", ( int ) buttonColor().rgb() ) ); + customColors[ CustomCBOff ].setRgb( config.readNumEntry( "Colors_CheckOff", ( int ) bgColor().rgb() ) ); + customColors[ CustomTabOn ].setRgb( config.readNumEntry( "Colors_TabActive", ( int ) buttonColor().rgb() ) ); + customColors[ CustomTabOff ].setRgb( config.readNumEntry( "Colors_TabInactive", ( int ) bgColor().rgb() ) ); + customColors[ CustomSBSlider ].setRgb( config.readNumEntry( "Colors_Slider", ( int ) bgColor().rgb() ) ); + customColors[ CustomSBSliderHover ].setRgb( config.readNumEntry( "Colors_SliderHovered", ( int ) buttonColor().rgb() ) ); + customColors[ CustomSBSliderPressed ].setRgb( config.readNumEntry( "Colors_SliderPressed", ( int ) buttonColor().dark(110).rgb() ) ); + customColors[ CustomSBGroove ].setRgb( config.readNumEntry( "Colors_SliderGroove", ( int ) bgColor().rgb() ) ); + } + if (inactiveButtonColor == Custom) + customInactiveButtonColor = QColor( config.readNumEntry( "Design_InactiveButtonColor", (int) bgColor().rgb())); + contrast += config.readNumEntry( "Design_StippleContrast", 3); + bevelHighlights_ = config.readBoolEntry( "Design_BevelAsHighlight", true); + //shadows +groupboxshadow = (style_ == Brushed) ? false : config.readBoolEntry( "Design_ShadowGroupBoxes", true ); + shadowDarkness = config.readNumEntry( "Design_GroupBoxeShadowDarkness", 6); + //ListViews + expanderStyle = config.readNumEntry( "Special_ExpanderStyle", Apple); + useCustomExpanderColor = config.readBoolEntry( "Special_CustomExpanderColor", false); + if (useCustomExpanderColor) + expanderColor = QColor( config.readNumEntry( "Special_ExpanderColor", (int) qApp->palette().active().text().rgb())); + drawDotlines = config.readBoolEntry( "Special_DrawTreeLines", true); + if (drawDotlines){ + dotlineStyle = config.readNumEntry( "Special_TreelineStyle", Line); + dotlineColor = QColor( config.readNumEntry( "Special_TreelineColor", (int) qApp->palette().active().mid().rgb())); + } + //slider + squeezesbslider = config.readBoolEntry( "Special_SqueezeSlider", false ); + shadowsbslider = config.readBoolEntry( "Special_ShadowSlider", false ); + animateSlider = config.readBoolEntry( "Special_AnimateSlider", true ); + // toolbar + int utb = config.readNumEntry( "Special_UnhoveredToolButtons", 2 ); + tbFrame = (utb == 2) || ((style_ == Brushed) && (utb == 1)) || ((style_ != Brushed) && (utb == 0)); + + // tweaks + centerTabs = config.readBoolEntry( "Design_CenterTabs", true); + smoothListViewHeaders = (style_ == Milk) ? true : !config.readBoolEntry( "Special_UseFlatLVH", false); + smootherLVH = config.readBoolEntry( "Special_RoundTaskbuttons", false); + icyButtons = config.readNumEntry( "Design_ButtonStyle", 0) == 0; + progressBar = config.readNumEntry( "Special_ProgressStyle", baghira); + removeKickerBevel = config.readBoolEntry( "Special_RemoveKickerBevel", false); + animateButton = config.readBoolEntry( "Design_AnimateButtons", true); + animateProgress = config.readBoolEntry( "Design_AnimateProgress", true); + drawProgressLabel = config.readBoolEntry( "Special_ShowProgressValue", false); + config.endGroup(); + + config.beginGroup("/baghira/Deco"); + titleButtonColor_[0] = QColor((unsigned int)config.readNumEntry( "CloseButtonColor", QColor(200,85,70).rgb())); + titleButtonColor_[1] = QColor((unsigned int)config.readNumEntry( "MinButtonColor", QColor(230,155,40).rgb())); + titleButtonColor_[2] = QColor((unsigned int)config.readNumEntry( "MaxButtonColor", QColor(121,180,54).rgb())); + if (style_ == Jaguar) + { + titleColor_[0] = QColor((unsigned int)config.readNumEntry( "inactiveColor1_1", QColor(204,214,230).rgb())); + titleColor_[1] = QColor((unsigned int)config.readNumEntry( "inactiveColor2_1", QColor(194,196,211).rgb())); + } + else if (style_ != Brushed) + { + titleColor_[0] = QColor((unsigned int)config.readNumEntry( "activeColor1_2", QColor(238,238,238).rgb())); + titleColor_[1] = QColor((unsigned int)config.readNumEntry( "activeColor2_2", QColor(205,202,205).rgb())); + } + if (style_ == Tiger) + { + int r,g,b; + aDecoColor1_ = QColor((unsigned int)config.readNumEntry( "activeColor2_4", (unsigned int) QColor(205,202,205).rgb())); + aDecoColor2_ = QColor((unsigned int)config.readNumEntry( "activeColor1_4", (unsigned int) QColor(238,238,238).rgb())); + r = (int)CLAMP(aDecoColor1_.red() * pow((double)aDecoColor1_.red() / (double)aDecoColor2_.red(),2.0),0,255); + g = (int)CLAMP(aDecoColor1_.green() * pow((double)aDecoColor1_.green() / (double)aDecoColor2_.green(),2.0),0,255); + b = (int)CLAMP(aDecoColor1_.blue() * pow((double)aDecoColor1_.blue() / (double)aDecoColor2_.blue(),2.0),0,255); + aDecoColor2_.setRgb(r,g,b); + } + else + { + aDecoColor1_ = Qt::black; + aDecoColor2_ = Qt::black; + } + config.endGroup(); + // Option gathered + } diff --git a/style/polish.cpp b/style/polish.cpp new file mode 100644 index 0000000..f845d2b --- /dev/null +++ b/style/polish.cpp @@ -0,0 +1,878 @@ +//#include <qdir.h> +#include "baghira.h" +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <qapplication.h> +#include <qbrush.h> +#include <qcolor.h> +#include <qcombobox.h> +#include <qcursor.h> +#include <qdialog.h> +#include <qframe.h> +#include <qfile.h> +#include <qheader.h> +#include <qgroupbox.h> +//#include <qiconview.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlistbox.h> +#include <klistview.h> +#include <kmenubar.h> +#include <qpalette.h> +#include <qpainter.h> +#include <qpopupmenu.h> +#include <qpushbutton.h> +#include <qscrollbar.h> +#include <qscrollview.h> +#include <qsizepolicy.h> +#include <qslider.h> +#include <qtabbar.h> +#include <qtoolbar.h> +#include <qtoolbutton.h> +#include <kdeversion.h> +#include <kpixmapeffect.h> +#include <kglobalsettings.h> +#include <kwin.h> +#include <X11/Xlib.h> +#include <X11/Xatom.h> + +#include <fixx11h.h> +#define OPAQUE 0xffffffff +#define OPACITY "_KDE_WM_WINDOW_OPACITY" +#define _FORCE_SCROLLBARS_ 0 + +#ifndef CLAMP +#define CLAMP(x,l,u) x < l ? l :\ +x > u ? u :\ +x +#endif + + +void LiquidStyle::polish( QPalette &pal ) +{ + if ( inExitPolish ) + return ; + // clear out all old colorized pixmaps + int i; + for ( i = 0; i < BITMAP_ITEMS; ++i ) + { + if ( pixmaps[ i ] ) + { + delete pixmaps[ i ]; + pixmaps[ i ] = NULL; + } + } + // clear out all dicts + btnDict.clear(); + btnShadowedDict.clear(); + // reset brushes + pagerHoverBrush = QBrush(); + pagerBrush = QBrush(); + + bool newPalette = false; + struct stat buffer; + if ( stat( QFile::encodeName( QDir::homeDirPath() + "/.qt/qtrc" ), &buffer ) == 0 ) + { + unsigned int lastModTime = ( unsigned int ) buffer.st_mtime; + if ( lastModTime > qtrcModificationTime ) + { + qtrcModificationTime = lastModTime; + newPalette = true; + } + } + else if ( !initialPaletteLoaded ) // Hack, should always have qtrc in KDE + newPalette = true; + initialPaletteLoaded = true; + + if ( !newPalette ) + { + pal = polishedPalette; + return ; + } + + originalBgColor = pal.color(QPalette::Active, QColorGroup::Background); + if (optionHandler->style() == Brushed) + pal.setColor(QColorGroup::Background, brushedMetalColor(optionHandler->BrushTint())); + if (isOOO) + pal.setColor( QColorGroup::Button, pal.active().background() ); + else if (optionHandler->custCols[0] != -1) + { + pal.setColor(QColorGroup::Background, QColor(optionHandler->custCols[0])); + pal.setColor(QColorGroup::Button, QColor(optionHandler->custCols[1])); + pal.setColor(QColorGroup::Base, QColor(optionHandler->custCols[2])); + pal.setColor(QPalette::Active, QColorGroup::Text, QColor(optionHandler->custCols[3])); + pal.setColor(QPalette::Active, QColorGroup::Foreground, QColor(optionHandler->custCols[3])); + pal.setColor(QColorGroup::Highlight, QColor(optionHandler->custCols[4])); + pal.setColor(QPalette::Active, QColorGroup::HighlightedText, QColor(optionHandler->custCols[5])); + pal.setColor(QPalette::Active, QColorGroup::ButtonText, QColor(optionHandler->custCols[6])); + pal.setColor(QColorGroup::Mid, QColor((qRed(optionHandler->custCols[2])+qRed(optionHandler->custCols[3]))/2,(qGreen(optionHandler->custCols[2])+qGreen(optionHandler->custCols[3]))/2,(qBlue(optionHandler->custCols[2])+qBlue(optionHandler->custCols[3]))/2)); + + pal.setColor(QPalette::Inactive, QColorGroup::Text, QColor(optionHandler->custCols[3])); + pal.setColor(QPalette::Inactive, QColorGroup::HighlightedText, QColor(optionHandler->custCols[5])); + pal.setColor(QPalette::Inactive, QColorGroup::ButtonText, QColor(optionHandler->custCols[6])); + } + else + pal.setColor( QColorGroup::Button, optionHandler->CustomButtonColor() ); +#if 0 + if ( isKicker ) + { + origPanelBrush = pal.brush( QPalette::Active, QColorGroup::Background ); + origPanelPalette = pal; + QColor c( pal.active().background() ); + + if ( optionHandler->usePanelCustomColor() && optionHandler->panelCustomColor().isValid() ) + c = optionHandler->panelCustomColor(); + + kickerColor = c; + + pal.setColor( QColorGroup::Mid, optionHandler->CustomButtonColor().dark( 110 ) ); + pal.setColor( QColorGroup::Dark, optionHandler->CustomButtonColor().dark( 130 ) ); + pal.setColor( QColorGroup::Midlight, optionHandler->CustomButtonColor().light( 110 ) ); + pal.setColor( QColorGroup::Light, optionHandler->CustomButtonColor().light( 115 ) ); + pal.setColor( QColorGroup::Button, optionHandler->CustomButtonColor()); + + if (optionHandler->style() == Brushed) + { + QBrush brush( c, gradBrush ); + pal.setBrush( QColorGroup::Background, brush ); + } + else if ( optionHandler->usePanelStipple() ) + { + QPixmap stipple( 64, 64 ); + stipple.fill( c.rgb() ); + QPainter p( &stipple ); + p.setPen( c.dark( 100 + (int)(optionHandler->stippleContrast()/4) ) ); + for ( int i = 1; i < 64; i += 4 ) + { + p.drawLine( 0, i, 63, i ); + p.drawLine( 0, i+2, 63, i+2 ); + } + p.setPen( c.dark( 100 + optionHandler->stippleContrast()) ); + for ( int i = 2; i < 63; i += 4 ) + p.drawLine( 0, i, 63, i ); + p.end(); + QBrush brush( c, stipple ); + pal.setBrush( QColorGroup::Background, brush ); + } + else + pal.setBrush( QColorGroup::Background, c ); + } +#endif + /*else*/ if (optionHandler->style() == Brushed) + { + QColor c( pal.active().background() ); + QBrush brush( c, gradBrush ); + pal.setBrush( QColorGroup::Background, brush ); + } + else if ( !isPlain() ) + { + QColor c( pal.active().background() ); + QPixmap stipple( 64, 64 ); + stipple.fill( c.rgb() ); + QPainter p; + p.begin( &stipple ); + p.setPen( c.dark( 100 + (int)(optionHandler->stippleContrast()/2) ) ); + for ( i = 1; i < 64; i += 4 ) + { + p.drawLine( 0, i, 63, i ); + p.drawLine( 0, i+2, 63, i+2 ); + } + p.setPen( c.dark( 100 + optionHandler->stippleContrast() ) ); + for ( i = 2; i < 63; i += 4 ) + p.drawLine( 0, i, 63, i ); + p.end(); + QBrush brush( c, stipple ); + pal.setBrush( QColorGroup::Background, brush ); + } + + if (optionHandler->bevelHighlights()) + { + QColor c(pal.active().highlight()); + QColor c2(c.light(140)); + QPixmap pix2 = QPixmap(48,48); + QPainter coolPainter(&pix2); + KPixmap pix = QPixmap(48,24); + KPixmapEffect::gradient(pix,c,c2,KPixmapEffect::VerticalGradient,0); + coolPainter.drawPixmap(0,0,pix); + KPixmapEffect::gradient(pix,c2,c,KPixmapEffect::VerticalGradient,0); + coolPainter.drawPixmap(0,24,pix); + QBrush brush(c, pix2); + pal.setBrush(QColorGroup::Highlight, brush); + } + polishedPalette = pal; + optionHandler->reset(); +} + +void LiquidStyle::unPolish( QApplication *app ) +{ + popupBack.resize(0,0); + QPalette pal( app->palette() ); + inExitPolish = true; + + if ( !isPlain() ) + { + // reset any stipples + if ( pal.brush( QPalette::Active, QColorGroup::Background ).pixmap() ) + pal.setBrush( QColorGroup::Background, pal.active().background() ); + if ( pal.brush( QPalette::Active, QColorGroup::Button ).pixmap() ) + pal.setBrush( QColorGroup::Button, pal.active().button() ); +// app->blockSignals( TRUE ); + app->setPalette( pal ); +// app->blockSignals( FALSE ); + } + + inExitPolish = false; +} + +Atom baghira_deco_design = XInternAtom(qt_xdisplay(), "BAGHIRA_DECO_DESIGN", False); + +void LiquidStyle::polish( QWidget *w ) +{ +// bool testWidget = w->inherits("Splash"); +// int testInt = 0; +// if (w->sizePolicy().horData() == QSizePolicy::Minimum || w->sizePolicy().horData() == QSizePolicy::MinimumExpanding) +// qWarning("%s, \"%s\"",w->className(), w->name()); +// w->installEventFilter(this); + + bool tmpBool = false; + bool isViewport = qstrcmp( w->name(), "qt_viewport" ) == 0 || + qstrcmp( w->name(), "qt_clipped_viewport" ) == 0; + bool isViewportChild = w->parent() && + ( ( qstrcmp( w->parent() ->name(), "qt_viewport" ) == 0 ) || + ( qstrcmp( w->parent() ->name(), "qt_clipped_viewport" ) == 0 ) ); + + if (w->isTopLevel()) + { + if ( ::qt_cast<QPopupMenu*>(w)) // popup menu designs + { + switch (optionHandler->MenuBackground()) + { + case Plain: + w->setBackgroundMode( QWidget::PaletteBackground ); + if (optionHandler->UseCustomMenuColor()) + w->setPaletteBackgroundColor(optionHandler->Color()); + else if (optionHandler->MenuColorButton()) + w->setPaletteBackgroundColor(optionHandler->buttonColor()); + else + w->setPaletteBackgroundColor(optionHandler->bgColor()); + break; + case Stipples: + { + QColor c; + if (optionHandler->UseCustomMenuColor()) + c = QColor( optionHandler->Color() ); + else if (optionHandler->MenuColorButton()) + c = QColor( optionHandler->buttonColor() ); + else + c = QColor( originalBgColor ); + if (popupBack.isNull()) + { + popupBack = QPixmap(64,64); + QPixmap *stipple = &popupBack; + stipple->fill( c.rgb() ); + QPainter p; + p.begin( stipple ); + if (optionHandler->UseCustomMenuColor()) + { + QColor c2 = QColor( optionHandler->Color2() ); + p.setPen(QColor((3*c.red()+c2.red())/4, + (3*c.green()+c2.green())/4, + (3*c.blue()+c2.blue())/4)); + for ( int i = 1; i < 64; i += 4 ) + { + p.drawLine( 0, i, 63, i ); + p.drawLine( 0, i+2, 63, i+2 ); + } + p.setPen(c2); + for ( int i = 2; i < 63; i += 4 ) + { + p.drawLine( 0, i, 63, i ); + } + } + else + { + p.setPen( c.dark( 100 + (int)(optionHandler->stippleContrast()/4) ) ); + for ( int i = 1; i < 64; i += 4 ) + { + p.drawLine( 0, i, 63, i ); + p.drawLine( 0, i+2, 63, i+2 ); + } + p.setPen( c.dark( 100 + optionHandler->stippleContrast() ) ); + for ( int i = 2; i < 63; i += 4 ) + { + p.drawLine( 0, i, 63, i ); + } + } + p.end(); + } + w->setBackgroundMode( QWidget::NoBackground ); + break; + } + case Gradient: + { + w->setBackgroundMode( QWidget::PaletteBackground ); + KPixmap tmpPix = QPixmap(w->width(), 32); + w->setPaletteBackgroundPixmap(KPixmapEffect::unbalancedGradient(tmpPix, optionHandler->Color(), optionHandler->Color2(),KPixmapEffect::HorizontalGradient, 100, 100, 16)); + w->installEventFilter( this ); + break; + } + default: + w->setBackgroundMode( QWidget::PaletteBackground ); + break; + } + //set popup menu opacity for them as they bypass the windowmanager + unsigned long opacity = optionHandler->MenuOpacity()/100.0*OPAQUE; + XChangeProperty(qt_xdisplay(), w->winId(), XInternAtom(qt_xdisplay(), OPACITY, False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity, 1L); + goto kstpolish; + } + else + { + if (optionHandler->wmDesign < 5) // set deco design X Property + { + unsigned char *data = 0; + Atom actual; + int format, result; + unsigned long n, left; + result = XGetWindowProperty(qt_xdisplay(), w->winId(), baghira_deco_design, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, &data); + if (result != Success || data == None) // not found set design + { + int tmp = optionHandler->wmDesign != Tiger ? optionHandler->wmDesign : Panther; + XChangeProperty(qt_xdisplay(), w->winId(), baghira_deco_design, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &(tmp), 1L); + } + } + if ((optionHandler->style() == Brushed) && !( ::qt_cast<QPopupMenu*>(w) || ::qt_cast<QMenuBar*>(w) || w->isDesktop() || ::qt_cast<QListBox*>(w) || w->inherits("QTipLabel") || w->inherits("AlphaWidget") || w->inherits("ScrollWidget") || w->inherits("PlayerWidget"))) + // install resize event filter, allowing us to update the b/m gradient on horizontal resizes. some widgets must be excluded though + { + if (!isKicker) + w->installEventFilter( bmShower ); + w->installEventFilter( this ); + } + } + } // TopLevel Widgets + + if (w->inherits("KURLBar")/*ListBox*/) + { + w->setPaletteBackgroundColor(qApp->palette().color(QPalette::Active, QColorGroup::Base)); +// ((QListBox*)w)->viewport()->setPaletteBackgroundColor(qApp->palette().color(QPalette::Active, QColorGroup::Base)); + goto kstpolish; + } + + + if (w->inherits("KColorGrid")) + { + // kiconedit doesn't check for the paintevent rect size, but tries to create a (possibly) NULL Pixmap (after palette change event e.g.) + // so we catch it's paint event and destroy it if the size is NULL + // remove this after kiconedit corrected its code + w->installEventFilter( this ); + goto kstpolish; + } + + if (w->inherits("BGMonitor") || w->inherits("mapWidget") || w->isA("MyButton") || (w->parentWidget() && w->parentWidget()->inherits("Thumbnail"))) + // don't touch these widgets at all - they don't like it + { + goto kstpolish; + } + + + + if (qstrcmp( w->name(), "kde toolbar widget" ) == 0 ) + w->installEventFilter( this ); + + if (::qt_cast<QButton*>(w)) + { + w->setBackgroundOrigin(QWidget::WindowOrigin); + if (::qt_cast<QPushButton*>(w)) + { + if (w->inherits("KKeyButton")) + { + w->setBackgroundMode( QWidget::PaletteBackground); + QPalette pal( w->palette() ); + pal.setBrush( QColorGroup::Background, qApp->palette().active().background() ); + w->setPalette( pal ); + } + else if (w->inherits("KCalcButton")) + { + w->setBackgroundMode( QWidget::PaletteBackground); + QPalette pal( w->palette() ); + pal.setBrush( QColorGroup::Background, qApp->palette().brush(QPalette::Active, QColorGroup::Background)); + w->setPalette( pal ); + } + else +#if !KDE_IS_VERSION(3,4,3) + if (!(w->parent() && w->parent()->inherits("MiniBar"))) +#endif + w->setBackgroundMode( QWidget::NoBackground); + w->installEventFilter( this ); + goto kstpolish; + } + else if (w->inherits( "QRadioButton" ) || w->inherits( "QCheckBox" )) + { + w->setBackgroundOrigin(QWidget::WindowOrigin); + w->installEventFilter( this ); + goto kstpolish; + } + } + + if ( ::qt_cast<QToolBar*>(w)) + { + if (optionHandler->useToolButtonFrame() && w->inherits("KToolBar")) + ((QToolBar*)w)->boxLayout()->setSpacing( 0 ); + ((QToolBar*)w)->setMargin( 4 ); + w->setBackgroundMode(PaletteBackground); + w->setBackgroundOrigin(QWidget::WindowOrigin); + if (optionHandler->style() > Panther) + { + w->installEventFilter( this ); + if (optionHandler->wmDesign == Tiger) + { + XChangeProperty(qt_xdisplay(), w->topLevelWidget()->winId(), baghira_deco_design, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &(optionHandler->wmDesign), 1L); + } + } + + goto kstpolish ; + } + //if (testWidget) qWarning("testwidget stage %d",testInt++); + + if (tmpBool = ::qt_cast<QToolButton*>(w) || w->inherits( "QToolBarSeparator" ) || w->inherits( "KToolBarSeparator" ) ) + { + if (tmpBool && w->parentWidget() && ::qt_cast<QToolBar*>(w->parentWidget()) ) + { + w->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + } + w->setBackgroundMode( QWidget::PaletteBackground ); + w->setBackgroundOrigin(QWidget::WindowOrigin); + w->installEventFilter( this ); + goto kstpolish; + } + + if (::qt_cast<QComboBox*>(w)) + { + w->setBackgroundMode(NoBackground); + w->installEventFilter( this ); + w->setBackgroundOrigin(QWidget::WindowOrigin); + goto kstpolish; + } + + if (w->inherits("TaskBar")) + { + w->setBackgroundOrigin(QWidget::WidgetOrigin); + goto kstpolish; + } + + if (w->inherits("QSpinWidget") || w->inherits("KDockWidgetAbstractHeaderDrag")){ + w->installEventFilter( this ); + goto kstpolish; + } + + if ( !isPlain () && (w->inherits( "KonqIconViewWidget" ) || w->inherits( "khtml")/* || w->inherits( "QtVisionView")*/)) + { + // if you want custom backgrounds in konqueror, you have to reset pixmap, since Konq animation can't handle it + // original liquid did this on khtml, too (at speed loss) so we'll see, if we get errors from this... + QPalette pal( w->palette() ); + pal.setBrush( QColorGroup::Background, pal.active().background() ); + w->setPalette( pal ); + } + + if (::qt_cast<QSlider*>(w)) + { + //avoid flicker + w->setBackgroundMode( QWidget::NoBackground ); + goto kstpolish; + } + + if ((::qt_cast<QScrollView*>(w) || w->inherits("KateView") || w->inherits("TEWidget") || w->inherits("CHexViewWidget")) && !(w->isA("KOAgenda"))) + { + if (::qt_cast<KListView*>(w) && optionHandler->custCols[7] != -1 && ((KListView*)w)->alternateBackground() == KGlobalSettings::alternateBackgroundColor()) + { + ((KListView*)w)->setAlternateBackground(QColor(optionHandler->custCols[7])); + } +#if _FORCE_SCROLLBARS_ + if (::qt_cast<QScrollView*>(w) && !w->inherits( "KActiveLabel" )) + { + ((QScrollView*)w)->setVScrollBarMode(QScrollView::AlwaysOn); + } +#endif + if (::qt_cast<QListBox*>(w) && w->isTopLevel()) + //set opacity for them as they bypass the windowmanager + { + uint opacity = 0.8*OPAQUE; + XChangeProperty(qt_xdisplay(), w->winId(), XInternAtom(qt_xdisplay(), OPACITY, False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity, 1L); + } +#if 0 + // doesn't work properly - best would be to have the items drawn via style() + int height = ((QListBox*)w)->itemHeight(); + if (height > 0) + { + QPalette pal = w->palette(); + QColor c(pal.active().highlight()); + QColor c2(c.light(140)); + KPixmap pix = QPixmap(48,height); + KPixmapEffect::gradient(pix,c2,c,KPixmapEffect::VerticalGradient,0); + QBrush brush(c, pix); + pal.setBrush(QColorGroup::Highlight, brush); + w->setPalette(pal); + } +#endif + // listen to enter events - highlightning the scrollbars + w->setMouseTracking( true ); + w->installEventFilter( this ); + goto kstpolish; + } + + if (w->inherits("QStatusBar")) + { + w->setBackgroundOrigin(QWidget::WindowOrigin); + if ( qstrcmp( w->name(), "KonquerorFrameStatusBar" ) == 0 ) + // konqueror resets the statusbars background to Qt::White as soon as you open a new tab - our eventfilter will block this + { + w->installEventFilter( this ); + } + goto kstpolish; + } + + if (w->inherits( "QLineEdit" ) || w->inherits("QSplitterHandle") || w->isA( "AppletHandleDrag" ) || w->inherits( "KMiniPagerButton" )) + { + w->setBackgroundOrigin(QWidget::WindowOrigin); + w->installEventFilter( this ); + goto kstpolish; + } + + if (w->inherits( "TaskContainer" )) + { + w->installEventFilter( this ); + goto kstpolish; + } + + if (w->inherits( "KickerTip" )) + // kickers new tooltip uses backgroundColor() instead of paletteBackgroundColor() - causing Qt::black + { + w->setPaletteBackgroundColor(qApp->palette().color(QPalette::Active, QColorGroup::Button)); + w->setBackgroundMode( QWidget::NoBackground ); + goto kstpolish; + } + + if ( !isPlain() ) + { + if ( !isViewport && w->parent() && qstrcmp( w->parent() ->name(), "proxyview" ) == 0 ) + { + w->setBackgroundOrigin( QWidget::WindowOrigin ); + goto kstpolish ; + } + + if ( w->inherits( "PanelButtonBase" ) ) + goto kstpolish ; + if ( !isKicker&& !isViewport && !isViewportChild && !w->testWFlags( WType_Popup ) && !w->inherits( "KDesktop" ) && !w->inherits( "PasswordDlg" )) + { + if ( w->backgroundMode() == QWidget::PaletteBackground || w->backgroundMode() == QWidget::PaletteButton ) + { + w->setBackgroundOrigin( QWidget::WindowOrigin ); + } + } + } + if ( ::qt_cast<QPushButton*>(w) || ::qt_cast<QComboBox*>(w)) goto kstpolish; + if ( ::qt_cast<QMenuBar*>(w)) + { +// if (optionHandler->SupportAppleBar() && w->isTopLevel()){ +// // QPalette pal(w->palette()); +// qWarning("resetting erase pixmap"); +// QColor c( w->palette().active().background() ); +// QPixmap stipple( 64, 64 ); +// stipple.fill( c.rgb() ); +// QPainter p; +// p.begin( &stipple ); +// p.setPen( c.dark( 100 + (int)(optionHandler->stippleContrast()/2) ) ); +// for (int i = 1; i < 64; i += 4 ) { +// p.drawLine( 0, i, 63, i ); +// p.drawLine( 0, i+2, 63, i+2 ); +// } +// p.setPen( c.dark( 100 + optionHandler->stippleContrast()) ); +// for ( int i = 2; i < 63; i += 4 ) { +// p.drawLine( 0, i, 63, i ); +// } +// p.end(); +// // QBrush brush( c, stipple ); +// // pal.setBrush( QColorGroup::Background, brush ); +// // w->setPalette( pal ); +// w->setErasePixmap(stipple); +// } + w->setBackgroundMode( QWidget::PaletteBackground ); + if (optionHandler->UseCustomMenuColor()) + { + QPalette pal( w->palette() ); + pal.setBrush( QColorGroup::Highlight, optionHandler->menuColorHigh() ); + pal.setBrush( QColorGroup::HighlightedText, optionHandler->textColorHigh() ); + w->setPalette( pal ); + } + w->setBackgroundOrigin(QWidget::WindowOrigin); + w->installEventFilter( this ); +#if 0 + if (!::qt_cast<KMenuBar*>(w)) + { + bool bold = w->font().bold(); + bool italic = w->font().italic(); + bool underline = w->font().underline(); + bool overline = w->font().overline(); + w->setFont(KGlobalSettings::menuFont()); + if (bold) + (const_cast<QFont*>(&w->font()))->setBold(true); + if (italic) + (const_cast<QFont*>(&w->font()))->setItalic(true); + if (underline) + (const_cast<QFont*>(&w->font()))->setUnderline(true); + if (overline) + (const_cast<QFont*>(&w->font()))->setOverline(true); + } +#endif + goto kstpolish ; + } + + if (::qt_cast<QFrame*>(w)) + { + w->setBackgroundOrigin(QWidget::WindowOrigin); + if ( ::qt_cast<QLabel*>(w)) + { + if (w->parentWidget() && w->parentWidget()->inherits("Kontact::Splash")) + goto kstpolish; + else if ( !isPlain() && !(w->inherits( "QTipLabel" ) || w->inherits( "KSystemTray" ))) + { + w->setBackgroundMode( QWidget::PaletteBackground ); + } + else if ( w->inherits( "QTipLabel" ) ) + { + w->setPalette( tooltipPalette ); + w->setBackgroundOrigin(QWidget::WidgetOrigin); + w->installEventFilter( this ); + } + } + if (qstrcmp( w->name(), "backdrop" ) == 0) //kscd + { + ((QFrame *)w)->setFrameShape(QFrame::LineEditPanel); + ((QFrame *)w)->setFrameShadow(QFrame::Sunken); + goto kstpolish; + } + if (w->inherits( "KWinInternal::TabBox" )) + { + uint opacity = 0.8*OPAQUE; + XChangeProperty(qt_xdisplay(), w->winId(), XInternAtom(qt_xdisplay(), OPACITY, False), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &opacity, 1L); + goto kstpolish; + } + else if (w->inherits( "KAnimWidget" )) + { + ((QFrame *)w)->setFrameShape(QFrame::NoFrame); + w->installEventFilter( this ); // the widget resets it's frameshape on mouseevents - looks crap! + goto kstpolish ; + } + else if (((QFrame *)w)->frameShape() >= QFrame::Box && ((QFrame *)w)->frameShape() <= QFrame::WinPanel){ + ((QFrame *)w)->setFrameShape(QFrame::StyledPanel); + goto kstpolish ; + } + } + //if (testWidget) qWarning("testwidget stage %d",testInt++); + + + if ( w->parentWidget() && ( ( ::qt_cast<QListBox*>(w) && ::qt_cast<QPushButton*>(w->parentWidget())) || w->inherits( "KCompletionBox" ) ) ) { + QListBox* listbox = (QListBox*) w; + listbox->setBackgroundMode( NoBackground ); + w->installEventFilter( this ); + goto kstpolish; + } + //if (testWidget) qWarning("testwidget stage %d",testInt++); + + + if (::qt_cast<QHeader*>(w)){ +// if (::qt_cast<QListView*>(w->parentWidget())) +// headerSortID = ((QListView*)w->parentWidget())->sortColumn(); +// if (w->parentWidget()) qWarning(w->parentWidget()->className()); + w->setBackgroundMode( NoBackground ); + w->installEventFilter( this ); + goto kstpolish; + } + //if (testWidget) qWarning("testwidget stage %d",testInt++); + + + if (::qt_cast<QTabBar*>(w)){ +// qWarning("installing tab event"); + w->setMouseTracking( true ); + w->installEventFilter( this ); + w->setBackgroundOrigin(QWidget::WindowOrigin); + goto kstpolish; + } + + if (::qt_cast<QGroupBox*>(w) && ((QGroupBox*)w)->frameShape() == QFrame::GroupBoxPanel && !((QGroupBox*)w)->isFlat()) + { + if ( optionHandler->drawGroupBoxShadow() ) + { + w->setPaletteBackgroundPixmap ( *groupShadow ); + if (((QGroupBox*)w)->isCheckable()) + { + QWidget *cb = (QWidget*)w->child("qt_groupbox_checkbox",0,false); + cb->setPalette(w->parentWidget() ? w->parentWidget()->palette() : qApp->palette()); + QFont font( cb->font() ); + font.setBold( true ); + cb->setFont( font ); + } + } + w->setBackgroundOrigin(QWidget::WindowOrigin); + w->installEventFilter(this); + } + //if (testWidget) qWarning("testwidget stage %d",testInt++); + + + if (w->inherits("QProgressBar")) + { + w->setBackgroundMode( NoBackground ); + w->installEventFilter(this); + connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(progressBarDestroyed(QObject*))); + goto kstpolish; + } + + if ( w->inherits( "QDockWindow" ) ) { + w->setBackgroundMode( QWidget::PaletteBackground ); + w->setBackgroundOrigin(QWidget::WindowOrigin); + w->installEventFilter( this ); + goto kstpolish ; + } + + if ( ::qt_cast<QScrollBar*>(w)) { + QCursor tmpCursor(Qt::PointingHandCursor); + w->setCursor(tmpCursor); + w->installEventFilter( this ); + w->setBackgroundMode( QWidget::NoBackground ); + goto kstpolish ; + } + if ( w->inherits( "KdetvView")) { + w->setBackgroundMode( QWidget::NoBackground ); + } + //if (testWidget) qWarning("testwidget stage %d",testInt++); + kstpolish: KStyle::polish( w ); // nothing of all above? do default kde stuff +} + + + +void LiquidStyle::unPolish( QWidget *w ) { + + bool isViewport; + bool isViewportChild; + + // general - better than querying for each and ever widget if it got one... + w->removeEventFilter( this ); + + + if (w->inherits("KColorGrid")){ + goto kstunpolish; + } + + if ( w->inherits("QToolBar") || qstrcmp( w->name(), "kde toolbar widget" ) == 0 ) { + w->setBackgroundOrigin( QWidget::WidgetOrigin ); +// w->unsetPalette(); + goto kstunpolish; + } + if ( w->inherits( "QPopupMenu" ) ) { + w->unsetPalette(); + w->setBackgroundMode( QWidget::PaletteButton ); + w->removeEventFilter( this ); + XDeleteProperty (qt_xdisplay(), w->winId(), XInternAtom(qt_xdisplay(), OPACITY, False)); + goto kstunpolish; + } + if (::qt_cast<QListBox*>(w) && w->isTopLevel()){ + XDeleteProperty (qt_xdisplay(), w->winId(), XInternAtom(qt_xdisplay(), OPACITY, False)); + goto kstunpolish; + } + if ( !isPlain () && w->inherits( "KonqIconViewWidget" ) || + w->inherits( "KHTMLView" ) ) { + w->unsetPalette(); + goto kstunpolish; + } + if (w->inherits("KateView") || w->inherits("TEWidget") || w->inherits("CHexViewWidget")){ +// w->setMouseTracking( false ); + goto kstunpolish; + } + + if (w->isA( "QViewportWidget" ) || w->inherits( "QClipperWidget" ) ) + goto kstunpolish; + + if ( !isPlain() ) { + if ( w->inherits( "KActiveLabel" ) || w->inherits( "QTipLabel" ) ) { + w->unsetPalette(); + goto kstunpolish; + } + /* + else if(w->inherits("KdmClock")){ + ; // Check this! + return; + }*/ + } + else if ( w->inherits( "QMenuBar" ) ) { + w->setBackgroundMode( QWidget::PaletteButton ); + if ( !isPlain() ) + w->setBackgroundOrigin( QWidget::WidgetOrigin ); + goto kstunpolish; + }else if ( w->inherits( "QDockWindow" ) ) { + w->setBackgroundMode( QWidget::PaletteButton ); + if ( !isPlain() ) + w->setBackgroundOrigin( QWidget::WidgetOrigin ); + goto kstunpolish; + } else if ( w->inherits( "QComboBox" ) || w->inherits( "QPushButton" ) ) { + if (w->inherits( "QPushButton" )) + { + ButtonFadeInfo *bfi_ = bfi[w->winId()]; + if (bfi_){ + if (bfi_->timerId != 0) + w->killTimer(bfi_->timerId); + bfi.setAutoDelete(TRUE); + bfi.remove(w->winId()); + } + } + w->setBackgroundMode( QWidget::PaletteButton ); + } else if ( w->inherits( "QScrollBar" ) ) { +// if (!w->isEnabled()) w->setEnabled(true); + w->setBackgroundMode( QWidget::PaletteBackground ); + goto kstunpolish; + } else if ( w->inherits( "QHeader" ) ) { + w->setMouseTracking( false ); + } + + if ( w->inherits( "QToolButton" ) ) { +// w->unsetPalette(); + w->setBackgroundMode( QWidget::PaletteButton ); + if ( !isPlain() ) + w->setBackgroundOrigin( QWidget::WidgetOrigin ); + goto kstunpolish; + } + + isViewport = qstrcmp( w->name(), "qt_viewport" ) == 0 || + qstrcmp( w->name(), "qt_clipped_viewport" ) == 0; + isViewportChild = w->parent() && + ( ( qstrcmp( w->parent() ->name(), "qt_viewport" ) == 0 ) || + ( qstrcmp( w->parent() ->name(), "qt_clipped_viewport" ) == 0 ) ); + + if ( isViewportChild ) { + if ( w->inherits( "QRadioButton" ) || w->inherits( "QComboBox" ) || w->inherits( "QPushButton" ) ) { + if ( isHTMLWidget( w ) ) { + w->setBackgroundMode( QWidget::PaletteBackground ); + goto kstunpolish; + } + } + } + + if ( !isPlain() ) { + if ( !isViewport && w->parent() && qstrcmp( w->parent() ->name(), "proxyview" ) == 0 ) { + w->setBackgroundOrigin( QWidget::WidgetOrigin ); + goto kstunpolish; + } + if ( w->ownPalette() && !w->inherits( "QButton" ) && !w->inherits( "QComboBox" ) ) + goto kstunpolish; + if ( w->inherits( "PanelButtonBase" ) ) + goto kstunpolish; + + if ( !isViewport && !isViewportChild && !w->testWFlags( WType_Popup ) && + !w->inherits( "KDesktop" ) && !w->inherits( "PasswordDlg" ) ) { + + if ( w->backgroundOrigin() == QWidget::WindowOrigin ) + w->setBackgroundOrigin( QWidget::WidgetOrigin ); + goto kstunpolish; + } + } +kstunpolish: KStyle::unPolish( w ); + } diff --git a/style/utils.cpp b/style/utils.cpp new file mode 100644 index 0000000..dd24986 --- /dev/null +++ b/style/utils.cpp @@ -0,0 +1,1418 @@ +#include "baghira.h" + +#include <qbitmap.h> +#include <qimage.h> +#include <qcolor.h> +#include <qpalette.h> +#include <qrect.h> +#include <qpoint.h> +#include <qapplication.h> +#include <qpainter.h> +#include <qpen.h> +//#include <kwordwrap.h> + + +#include "config.h" + +#ifndef CLAMP +#define CLAMP(x,l,u) x < l ? l :\ + x > u ? u :\ + x +#endif + +#define ALPHA_COLOR(A,R,G,B) \ + destR = ((A * destR) + (255 - A) * R) / 255; \ + destG = ((A * destG) + (255 - A) * G) / 255; \ + destB = ((A * destB) + (255 - A) * B) / 255; \ + A = 255; + +#define ALPHA_COLOR2(A1,A2,R,G,B) \ + destR = ((A1 * destR) + (255 - A1) * R) / 255; \ + destG = ((A1 * destG) + (255 - A1) * G) / 255; \ + destB = ((A1 * destB) + (255 - A1) * B) / 255; \ + A1 = CLAMP(A1 + A2,0,255); + +#define DELTA_COLOR(D,R,G,B) \ + delta = (255 - qRed(D))/2; \ + destR = R - delta; \ + destG = G - delta; \ + destB = B - delta; + +#define SATURATION_COLOR(R,G,B) \ + grey = (299 * R + 587 * G + 114 * B) / 1000; \ + delta = 255 - grey; \ + grey = (grey *(10 - 5)) / 10; \ + iGrey = 255 - grey;\ + destR = (iGrey * (srcR - delta) + grey * R) / 255; \ + destG = (iGrey * (srcG - delta) + grey * G) / 255; \ + destB = (iGrey * (srcB - delta) + grey * B) / 255; + +#define SATURATION_COLOR2(S,R,G,B) \ + int max = 255+(int)(0.65*(100-S)); \ + destR = CLAMP((srcR + R - 128), 0, max); \ + destG = CLAMP((srcG + G - 128), 0, max); \ + destB = CLAMP((srcB + B - 128), 0, max); \ + destR = (S*destR + (100-S)*R)/100; \ + destG = (S*destG + (100-S)*G)/100; \ + destB = (S*destB + (100-S)*B)/100; + +#define TINT_WHITE(S,R,G,B) \ + int max = 255+(int)(0.65*(100-S)); \ + destR = CLAMP((128 + R), 0, max); \ + destG = CLAMP((128 + G), 0, max); \ + destB = CLAMP((128 + B), 0, max); \ + destR = (S*destR + (100-S)*R)/100; \ + destG = (S*destG + (100-S)*G)/100; \ + destB = (S*destB + (100-S)*B)/100; + + +#define SATURATION_COLOR3(S,R,G,B) \ + destR = (S*(srcR + R - 128)/100 + R)/2; \ + destG = (S*(srcG + G - 128)/100 + G)/2; \ + destB = (S*(srcB + B - 128)/100 + B)/2; + +#define GM_COLOR(R,G,B)\ + destR = CLAMP(destR + R - 128, 0, 255);\ + destG = CLAMP(destG + G - 128, 0, 255);\ + destB = CLAMP(destB + B - 128, 0, 255); + + +#define COLOR_SPACE(R,G,B) \ + if ( R < 0 ) R = 0; else if ( R > 255 ) R = 255; \ + if ( G < 0 ) G = 0; else if ( G > 255 ) G = 255; \ + if ( B < 0 ) B = 0; else if ( B > 255 ) B = 255; + +#ifndef PRINTDEVICE +#define PRINTDEVICE(_p_) qWarning("device is %s", (_p_->device()->devType() == QInternal::Widget) ?\ +"Widget": (_p_->device()->devType() == QInternal::Pixmap) ?\ +"Pixmap": (_p_->device()->devType() == QInternal::Printer) ?\ +"Printer": (_p_->device()->devType() == QInternal::Picture) ?\ +"Picture": (_p_->device()->devType() == QInternal::UndefinedDevice) ?\ +"UndefinedDevice": "fuckdevice!" ); +#endif + +int LiquidStyle::getBrightness(unsigned int rgb) const { + int red = qRed( rgb ); + int green = qGreen( rgb ); + int blue = qBlue( rgb ); + int V = red; + if (green > V) V = green; + if (blue > V) V = blue; + return V; +} + +QPixmap* LiquidStyle::adjustHSV( QImage &img, const QColor &c, const QColor *bg ) const +{ + QImage * tmp = adjustHSVImage( img, c, bg ); + + QPixmap *pix = new QPixmap; + pix->convertFromImage( *tmp ); + delete tmp; + return ( pix ); +} + + +ButtonTile* LiquidStyle::createRoundFrameTile(QImage &img, const QColor &color, const QColor *bg, const QColor &baseColor ) const +{ + QColor bgColor( bg ? *bg : qApp->palette().active().background() ); + + if ( img.depth() != 32 ) + img = img.convertDepth( 32 ); + QImage *dest = new QImage( img.width(), img.height(), 32, 0 ); + dest->setAlphaBuffer( true ); + unsigned int *data = ( unsigned int * ) img.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = img.width() * img.height(); + int current; + int delta; + int red, green, blue, grey, iGrey; + int destR, destG, destB, alpha; + int x,y; + + int srcR = color.red(); + int srcG = color.green(); + int srcB = color.blue(); + + if (!optionHandler->IcyButtons()) + { + srcR += 20; + srcG += 20; + srcB += 20; + COLOR_SPACE(srcR, srcG, srcB); + } + + for ( current = 0 ; current < total ; ++current ) + { + alpha = qAlpha( data[ current ] ); + if (alpha) + { + if (optionHandler->IcyButtons()) + { + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + blue = qBlue( data[ current ] ); + SATURATION_COLOR(red, green, blue); + } + else + { + // the coloring itself + DELTA_COLOR(data[ current ], srcR, srcG, srcB); + } + } +#if 1 + if ( alpha && alpha != 255 ) + { + // only on translucent pixels - alphablending + y = (int)(current/img.width()); + x = current - y*img.width(); + if (red < 180 || x < 2 || y < 2 || y > img.height() - 2 || x > img.width() - 3) + { + ALPHA_COLOR(alpha, bgColor.red(), bgColor.green(), bgColor.blue()); + } + else + { + ALPHA_COLOR(alpha, baseColor.red(), baseColor.green(), baseColor.blue()); + } + } +#endif + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + QPixmap destPix; + destPix = *dest; + ButtonTile *ret = separateTiles( &destPix, 11, 10, 6, 1, 0, false); + delete dest; + return ret; +} + +QImage* LiquidStyle::adjustHSVImage( QImage &img, const QColor &c, const QColor *bg ) const +{ + QColor bgColor( bg ? *bg : qApp->palette().active().background() ); + + if ( img.depth() != 32 ) + img = img.convertDepth( 32 ); + QImage *dest = new QImage( img.width(), img.height(), 32, 0 ); + dest->setAlphaBuffer( true ); + unsigned int *data = ( unsigned int * ) img.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = img.width() * img.height(); + int current; + int delta; + int red, green, blue; + int destR, destG, destB, alpha; + + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + + int hue, s, v; + c.getHsv( &hue, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + + + if (!optionHandler->IcyButtons()) + { + srcR += 20; + srcG += 20; + srcB += 20; + COLOR_SPACE(srcR, srcG, srcB); + } + + // float srcPercent, destPercent; + for ( current = 0 ; current < total ; ++current ) + { + alpha = qAlpha( data[ current ] ); + if (optionHandler->IcyButtons()) + { + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + blue = qBlue( data[ current ] ); + SATURATION_COLOR2(sq, red, green, blue); + } + else + { + // the coloring itself + DELTA_COLOR(data[ current ], srcR, srcG, srcB); + } + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} + +QImage* LiquidStyle::tintBrush( const QImage &img, const QColor &c ) const +{ +// if ( img.depth() != 32 ) +// img = img.convertDepth( 32 ); + QImage *dest = new QImage( img.width(), img.height(), 32, 0 ); + unsigned int *data = ( unsigned int * ) img.bits(); + unsigned int *destData = ( unsigned int* ) dest->bits(); + int total = img.width() * img.height(); + int current; + int delta; + int red, green, blue, grey, iGrey; + int destR, destG, destB, alpha; + + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + + // float srcPercent, destPercent; + for ( current = 0 ; current < total ; ++current ) + { + alpha = qAlpha( data[ current ] ); + blue = qBlue( data[ current ] ); + red = qRed( data[ current ] ); + green = qGreen( data[ current ] ); + SATURATION_COLOR(red, green, blue); + // force back to valid colorspace ! + COLOR_SPACE(destR, destG, destB); + destData[ current ] = qRgba( destR, destG, destB, alpha ); + } + return ( dest ); +} + +QColor LiquidStyle::brushedMetalColor(QColor &c) const +{ + if (optionHandler->TintBrush()) + { + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + int destR, destG, destB, grey, iGrey, delta; + SATURATION_COLOR(180, 180, 180); + COLOR_SPACE(destR, destG, destB); + return QColor(destR, destG, destB); + } + else + return QColor (180,180,180); +} + + + + +void LiquidStyle::clearImage( QImage &img ) const +{ + int x, y; + int w = img.width(); + int h = img.height(); + unsigned int pixel = qRgba( 0, 0, 0, 0 ); + unsigned int *data; + + for ( y = 0 ; y < h ; ++y ) + for ( data = (unsigned int *) img.scanLine( y ), x = 0 ; x < w ; data[ x++ ] = pixel ) ; + // img.fill( pixel ); +} + +void LiquidStyle::adjustHSV( QPixmap &pix, const QColor &c ) const +{ + QImage img = pix.convertToImage(); + QPixmap *result = adjustHSV( img, c); + pix = *result; + delete result; +} + + +/* buttons are fractioned to 9 parts. +w, h are width and height of the whole button. +xOff (yOff) is the distance of the central fraction from left (upper) button side. +centerW (centerH) is the width (height) of the central button fraction. +shadowH is the height of the buttons shadow*/ +ButtonTile* LiquidStyle::createButtonTile( const QColor &c, + const QColor &bgColor, + QImage *buttonImage, + QImage *shadowImage, + QImage *glowImage, + QIntDict<ButtonTile>*buttonDict, + QIntDict<ButtonTile>*shadowDict, + QIntDict<ButtonTile>*glowDict, + int w, int h, int xOff, int yOff, + int centerW, int centerH, + int shadowH, int glowWH, + bool sunken) const +{ + int x, y, delta; + int red, green, blue; + int destR, destG, destB, alpha; + bool rect = (buttonDict == &rectBtnDict); + + int hue, s, v; + c.getHsv( &hue, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + + int srcR = c.red(); + int srcG = c.green(); + int srcB = c.blue(); + + if (!optionHandler->IcyButtons()) + { + srcR += 20; + srcG += 20; + srcB += 20; + + COLOR_SPACE(srcR, srcG, srcB); + } + + unsigned int *data, *destData; + ButtonTile *tile; + + int shadowOverhead; + shadowH > glowWH ? shadowOverhead = shadowH - glowWH : shadowOverhead = 0; + QImage img( w + 2*glowWH, h + 2*glowWH + shadowOverhead, 32, 0 ); + img.setAlphaBuffer( !isPlain() || optionHandler->drawGroupBoxShadow() ? true : false); + clearImage( img ); + + // For unpressed buttons things are a little more complex. First + // we color adjust the shadow with the background color then we + // adjust the button to the button color. Finally we overlay the + // button on the shadow, (in the same loop as color adjusting). + // Technically we probably could of gotten away + // with just adjusting both the shadow and the button to the button + // color since the shadow is quite dark, but this is more correct and + // would allow configurable shadow brightness. If the shadow was + // just the button color, if someone configured it to be a rather + // light brightness, and they had a dark background color it wouldn't + // look right if based off the button color. + // + // Luckily this is only done once when the button is created for any + // given color ;-) + + // first do the shadow + if ((!sunken || optionHandler->buttonStyle() == Milk) && shadowImage) + for ( y = 0 ; y < h + shadowH ; ++y ) + { + data = ( unsigned int * ) shadowImage->scanLine( y ); + destData = ( unsigned int * ) img.scanLine( y + glowWH ); // glowWH is the yOffset -> distance of visable button to top of complete button + if (optionHandler->buttonStyle() == Jaguar) // has brighter shadows... + { + for ( x = 0 ; x < w ; ++x ) + if ((alpha = qAlpha( data[ x ] ))) + { + destData[ x + glowWH ] = qRgba( qRed(data[ x ]), qGreen(data[ x ]), qBlue(data[ x ]), alpha >> 1 ); + } + } + else + { + for ( x = 0 ; x < w ; ++x ) + if ((alpha = qAlpha( data[ x ] ))) + { + destData[ x + glowWH ] = data[x]; + } + } + } + // ... or the glow + else if (glowImage) + for ( y = 0 ; y < h + 2*glowWH ; ++y ) + { + data = ( unsigned int * ) glowImage->scanLine( y ); + destData = ( unsigned int * ) img.scanLine( y ); + for ( x = 0 ; x < w + 2*glowWH ; ++x ) + if ((alpha = qAlpha( data[ x ] ))) + { + DELTA_COLOR(data[ x ], srcR, srcG, srcB); + COLOR_SPACE(destR, destG, destB); + destData[ x ] = qRgba( destR, destG, destB, alpha ); + } + } + + // then the button and overlay + for ( y = 0 ; y < h ; ++y ) + { + data = ( unsigned int * ) buttonImage->scanLine( y ); + destData = ( unsigned int * ) img.scanLine( y + glowWH ); + for ( x = 0 ; x < w ; ++x ) + if ((alpha = qAlpha( data[ x ] ))) + { + if (!rect || (y > 1 && y < h-2 && x > 0 && x < w-1) ) + { + if (optionHandler->IcyButtons()) + { + red = qRed( data[ x ] ); + green = qGreen( data[ x ] ); + blue = qBlue( data[ x ] ); + SATURATION_COLOR2(sq, red, green, blue); + } + else + { + DELTA_COLOR(data[ x ], srcR, srcG, srcB); + } + } + else + { + red = qRed( data[ x ] ); + green = qGreen( data[ x ] ); + blue = qBlue( data[ x ] ); + TINT_WHITE(55, red, green, blue); + } + if (alpha != 255) + { + if ( qAlpha( destData[ x + glowWH ] ) ) + { + ALPHA_COLOR2(alpha, qAlpha( destData[ x + glowWH ] ), qRed( destData[ x + glowWH ]), qGreen( destData[ x + glowWH ]), qBlue( destData[ x + glowWH ])); + } + } + COLOR_SPACE(destR, destG, destB); + destData[ x + glowWH ] = qRgba( destR, destG, destB, alpha ); + } + } + + QPixmap *pix = new QPixmap; + pix->convertFromImage( img ); + tile = separateTiles( pix, xOff+glowWH, yOff+glowWH, centerW, centerH, shadowH, sunken); + + if ( sunken && glowDict) + glowDict->insert(c.rgb(),tile); + else if (!sunken && shadowDict) + shadowDict->insert( c.rgb(), tile ); + else + buttonDict->insert( c.rgb(), tile ); + + delete pix; + return ( tile ); +} + +QPixmap* LiquidStyle::createSliderEnd( const QColor &c, const QColor &bgColor, bool top) const +{ + + int x, y, delta; + int red, green, blue; + int destR, destG, destB, alpha; + + int h, s, v; + c.getHsv( &h, &s, &v ); + int sq = CLAMP((int)((45.0/128.0)*s+55),0,100); + + int srcR = bgColor.red(); + int srcG = bgColor.green(); + int srcB = bgColor.blue(); + + unsigned int *data, *destData; + + QImage img( 13, 9, 32, 0 ); + img.setAlphaBuffer( true ); // we need this always, as the slider groove is nevernever plain! + clearImage( img ); + + // just stole that from above... + // first do the shadow + for ( y = 0 ; y < 9 ; ++y ) { + top ? data = ( unsigned int * ) slider_top_shd->scanLine( y ) : data = ( unsigned int * ) slider_btm_shd->scanLine( y ); + destData = ( unsigned int * ) img.scanLine( y ); + for ( x = 0; x < 13; ++x ) + if ((alpha = qAlpha( data[ x ] ))) { + DELTA_COLOR(data[ x ], bgColor.red(), bgColor.green(), bgColor.blue()); + COLOR_SPACE(destR, destG, destB); + destData[ x ] = qRgba( destR, destG, destB, alpha ); + } + } + // then the button and overlay + + srcR = c.red(); + srcG = c.green(); + srcB = c.blue(); + + if (!optionHandler->IcyButtons()){ + srcR +=20; + srcG += 20; + srcB += 20; + + COLOR_SPACE(srcR, srcG, srcB); + } + + for ( y = 0 ; y < 7 ; ++y ) { + top ? data = ( unsigned int * ) slider_top->scanLine( y ) : data = ( unsigned int * ) slider_btm->scanLine( y ); + destData = ( unsigned int * ) img.scanLine( top ? y + 2 : y ); + for ( x = 0 ; x < 13 ; ++x ) + if ((alpha = qAlpha( data[ x ] ))) { + if (optionHandler->IcyButtons()) { + red = qRed( data[ x ] ); + green = qGreen( data[ x] ); + blue = qBlue( data[ x] ); + SATURATION_COLOR2(sq, red, green, blue); + } + else { + DELTA_COLOR(data[ x ], srcR, srcG, srcB); + } + if (alpha != 255) { + if ( qAlpha( destData[ x ] ) ) { + ALPHA_COLOR2(alpha, qAlpha( destData[ x ]), qRed( destData[ x ]), qGreen( destData[ x ]), qBlue( destData[ x ])); + } + } + COLOR_SPACE(destR, destG, destB); + destData[ x ] = qRgba( destR, destG, destB, alpha ); + } + } + QPixmap *pix = new QPixmap; + pix->convertFromImage( img ); + return ( pix ); +} + + + +// 0 / xO / xO + w +// ------------------------------------- +// | xO | w | width()-xO-w | : yO / 0 +// ------------------------------------- +// | xO | w | width()-xO-w | : h / yO +// ------------------------------------- +// | xO | w | width()-xO-w | : height()-yO-h / yO+h +// ------------------------------------- +// Overload of mosfet's original function, takes 6 more parameters to use the funktion on variable bitmaps (mosfet's function does only work for very special bitmaps) +// by giving position and dimension of the central tile + the shadow height (panther doesn't seem to have a right shadow-offset) +ButtonTile* LiquidStyle::separateTiles( QPixmap *pix, + int xO, int yO, int w, int h, + int, bool sunken) const +{ + ButtonTile * tile = new ButtonTile(); + QPixmap *tmp; + + int w1 = xO; + int w2 = w; + int w3 = pix->width() - xO - w; + int h1 = yO; + int h2 = h; + int h3 = pix->height() - yO - h; + + int xO1 = 0; + int xO2 = xO; + int xO3 = xO + w; + int yO1 = 0; + int yO2 = yO; + int yO3 = yO + h; + + if ( !sunken ) { + // Top tiles + tmp = new QPixmap( w1, h1 ); + // bitBlt(...,x,y,width,height) + copyBlt( tmp, 0, 0, pix, xO1, yO1, w1, h1 ); + tile->setPixmap( TileTopLeft, tmp ); + tmp = new QPixmap( w2, h1 ); + copyBlt( tmp, 0, 0, pix, xO2, yO1, w2, h1 ); + tile->setPixmap( TileTop, tmp ); + tmp = new QPixmap( w3, h1 ); + copyBlt( tmp, 0, 0, pix, xO3, yO1, w3, h1 ); + tile->setPixmap( TileTopRight, tmp ); + + // Middle tiles + tmp = new QPixmap( w1, h2 ); + copyBlt( tmp, 0, 0, pix, xO1, yO2, w1, h2 ); + tile->setPixmap( TileLeft, tmp ); + tmp = new QPixmap( w2, h2 ); + copyBlt( tmp, 0, 0, pix, xO2, yO2, w2, h2 ); + tile->setPixmap( TileMiddle, tmp ); + tmp = new QPixmap( w3, h2 ); + copyBlt( tmp, 0, 0, pix, xO3, yO2, w3, h2 ); + tile->setPixmap( TileRight, tmp ); + + // Bottom tiles + tmp = new QPixmap( w1, h3 ); + copyBlt( tmp, 0, 0, pix, xO1, yO3, w1, h3 ); + tile->setPixmap( TileBtmLeft, tmp ); + tmp = new QPixmap( w2, h3 ); + copyBlt( tmp, 0, 0, pix, xO2, yO3, w2, h3 ); + tile->setPixmap( TileBtm, tmp ); + tmp = new QPixmap( w3, h3 ); + copyBlt( tmp, 0, 0, pix, xO3, yO3, w3, h3 ); + tile->setPixmap( TileBtmRight, tmp ); + + } + else { + // Top tiles + tmp = new QPixmap( w1, h3 ); + // bitBlt(...,x,y,width,height) + copyBlt( tmp, 0, 0, pix, xO1, yO1, w1, h3 ); + tile->setPixmap( TileTopLeft, tmp ); + tmp = new QPixmap( w2, h3 ); + copyBlt( tmp, 0, 0, pix, xO2, yO1, w2, h3 ); + tile->setPixmap( TileTop, tmp ); + tmp = new QPixmap( w3, h3 ); + copyBlt( tmp, 0, 0, pix, xO3, yO1, w3, h3 ); + tile->setPixmap( TileTopRight, tmp ); + + // Middle tiles + tmp = new QPixmap( w1, h2 ); + copyBlt( tmp, 0, 0, pix, xO1, yO2 + h3 - h1, w1, h2 ); + tile->setPixmap( TileLeft, tmp ); + tmp = new QPixmap( w2, h2 ); + copyBlt( tmp, 0, 0, pix, xO2, yO2 + h3 - h1, w2, h2 ); + tile->setPixmap( TileMiddle, tmp ); + tmp = new QPixmap( w3, h2 ); + copyBlt( tmp, 0, 0, pix, xO3, yO2 + h3 - h1, w3, h2 ); + tile->setPixmap( TileRight, tmp ); + + // Bottom tiles + tmp = new QPixmap( w1, h1 ); + copyBlt( tmp, 0, 0, pix, xO1, yO3 + h3 - h1, w1, h1 ); + tile->setPixmap( TileBtmLeft, tmp ); + tmp = new QPixmap( w2, h1 ); + copyBlt( tmp, 0, 0, pix, xO2, yO3 + h3 - h1, w2, h1 ); + tile->setPixmap( TileBtm, tmp ); + tmp = new QPixmap( w3, h1 ); + copyBlt( tmp, 0, 0, pix, xO3, yO3 + h3 - h1, w3, h1 ); + tile->setPixmap( TileBtmRight, tmp ); + } + return ( tile ); +} + +#define _LOFF_ tile->pixmap( TileLeft )->width() +#define _ROFF_ tile->pixmap( TileRight )->width() +#define _TOFF_ tile->pixmap( TileTop )->height() +#define _BOFF_ tile->pixmap( TileBtm )->height() +#define _MWIDTH_ tile->pixmap( TileMiddle )->width() +#define _MHEIGHT_ tile->pixmap( TileMiddle )->height() +#define _LRWIDTH_ (_LOFF_ + _ROFF_) +#define _TBHEIGHT_ (_TOFF_ + _BOFF_) + +void LiquidStyle::drawRoundButton( QPainter *painter, const QColorGroup &cg, const QColor &c, int x, int y, int w, int h, bool pushedDown, bool hover, int bgX, int bgY ) const +{ + + QColor myC =(isOOO && (hover || pushedDown))?optionHandler->CustomButtonColor():c; + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + ButtonTile *tile = pushedDown ? btnDict.find( myC.rgb() ) : btnShadowedDict.find( myC.rgb() ); + + if ( !tile ) + { + tile = createButtonTile( myC, qApp->palette().color(QPalette::Active, QColorGroup::Background), ptr->btnBorderImg, ptr->btnShadowImg, ptr->buttonGlow, &(ptr->btnDict), &(ptr->btnShadowedDict), &(ptr->buttonGlowDict), 37, 21, 10, 11, 17, 1, 2, 2, pushedDown); + } + + if ( !tile ) + { + qWarning( "Button tile is NULL!" ); + return ; + } + + QPainter *p; + QPen oldPen = painter->pen(); + if (!isHTMLButton) + { + if ( !tmpBtnPix ) + ptr->tmpBtnPix = new QPixmap( w, h ); + else if ( w > tmpBtnPix->width() || h > tmpBtnPix->height() ) + { + // make temp pixmap size == largest button + ptr->tmpBtnPix->resize(w,h); + } + p = new QPainter(tmpBtnPix); + + if (!isPlain()) + { + QPixmap *stipple; + if (paintWidget && paintWidget->parentWidget()) + { + stipple = const_cast<QPixmap*>(paintWidget->parentWidget()->palette().brush(QPalette::Active, QColorGroup::Background).pixmap()); + if (!stipple || stipple->isNull()) + p->fillRect(0,0,w,h, paintWidget->parentWidget()->palette().brush(QPalette::Active, QColorGroup::Background) ); + else + p->drawTiledPixmap( 0, 0, w, h, *stipple, bgX, bgY ); + } + else + { + stipple = cg.brush( QColorGroup::Background ).pixmap(); + stipple ? p->drawTiledPixmap( 0, 0, w, h, *stipple, bgX, bgY ) : + p->fillRect(0,0,w,h, cg.brush( QColorGroup::Background )); + } + } + else + p->fillRect(0,0,w,h, cg.brush( QColorGroup::Background )); + } + else + { + p = painter; + } + +// QPainter p(tmpBtnPix); + + // tiled fills + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( _LOFF_, 0, w - _LRWIDTH_, _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( _LOFF_, h - _BOFF_, w - _LRWIDTH_, _BOFF_, *tile->pixmap( TileBtm ) ); + } + if ( h > _TBHEIGHT_ ) + { + p->drawTiledPixmap( 0, _TOFF_, _LOFF_, h - _TBHEIGHT_, *tile->pixmap( TileLeft ) ); + p->drawTiledPixmap( w - _ROFF_, _TOFF_, _ROFF_, h - _TBHEIGHT_, *tile->pixmap( TileRight ) ); + } + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + p->drawTiledPixmap( _LOFF_, _TOFF_, w - _LRWIDTH_, h - _TBHEIGHT_, *tile->pixmap( TileMiddle ) ); + // corners + p->drawPixmap( 0, 0, *tile->pixmap( TileTopLeft ) ); + p->drawPixmap( w - _ROFF_, 0, *tile->pixmap( TileTopRight ) ); + p->drawPixmap( 0, h - _BOFF_, *tile->pixmap( TileBtmLeft ) ); + p->drawPixmap( w - _ROFF_, h - _BOFF_, *tile->pixmap( TileBtmRight ) ); + + if (!isHTMLButton) + { + p->end(); + delete p; + painter->drawPixmap( x, y, *tmpBtnPix, 0, 0, w, h ); + } + else + p->setPen(oldPen); +} + + +void LiquidStyle::drawRectangularButton( QPainter *painter, + const QColorGroup &cg, const QColor &c, + int x, int y, int w, int h, + bool sunken, bool hover, bool isCombo, int position, bool isHTML) const +{ +#define _HEIGHT_ ptr->rectbutton->height() +#define _WIDTH_ ptr->rectbutton->width() + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + + QColor tmpColor; + tmpColor = isCombo && !(hover || sunken) ? optionHandler->InactiveButtonColor() : c; + + int xOffset, width; + int cw = 0; + + ButtonTile *tile = rectBtnDict.find( tmpColor.rgb() ); + if ( !tile ) + tile = createButtonTile( tmpColor, cg.background(), ptr->rectbutton, ((QImage*)0L), ((QImage*)0L), &(ptr->rectBtnDict), (QIntDict<ButtonTile>*)0L, (QIntDict<ButtonTile>*)0L, 33, 25, 10, 5, 13, 15, 0, 0, sunken); + + if ( !tile ) + { + qWarning( "Button tile is NULL!" ); + return ; + } + + switch (position) + { + case left: + xOffset = _LOFF_; + width = w - _LOFF_; + cw = 24; + break; + case center: + xOffset = 0; + width = w; + cw = 24; + break; + case right: + xOffset = 0; + width = w - _ROFF_; + cw = 24-_ROFF_; + break; + case full: + xOffset = _LOFF_; + width = w - _LRWIDTH_; + cw = 24-_ROFF_; + break; + } + + QPainter *p; + QPen oldPen = painter->pen(); + if (!isHTML) + { + if ( !tmpBtnPix ) + ptr->tmpBtnPix = new QPixmap( w, h ); + else if ( w > tmpBtnPix->width() || h > tmpBtnPix->height() ) + { + // make temp pixmap size == largest button + ptr->tmpBtnPix->resize(w,h); + } + p = new QPainter(tmpBtnPix); + + if (position != center && paintWidget && paintWidget->parentWidget()) + { + if (this->paintWidget->parentWidget()->paletteBackgroundPixmap ()) + p->drawTiledPixmap(QRect(0, 0, w, h), *this->paintWidget->parentWidget()->paletteBackgroundPixmap(), ((QWidget *)this->paintWidget)->backgroundOffset()); + else + p->fillRect( 0, 0, w, h, this->paintWidget->parentWidget()->paletteBackgroundColor()); + } + else + p->fillRect( 0, 0, w, h, cg.background() ); + } + else + { + p = painter; + } + + int tileH = 0; + QPixmap tmpPix(_LOFF_, 1); + + if (position == left || position == full) + { + p->drawPixmap( 0, 0, *tile->pixmap( TileTopLeft ) ); + p->drawPixmap( 0, h - _BOFF_, *tile->pixmap( TileBtmLeft ) ); + } + + if (!isCombo || hover || sunken) + { + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( xOffset, 0, width, _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( xOffset, h - _BOFF_, width, _BOFF_, *tile->pixmap( TileBtm ) ); + } + + if ( h > _TBHEIGHT_ ) + { + tileH = (int)((h-_HEIGHT_)/2); + if (position == left || position == full) + { + if (h > _HEIGHT_) + { + p->drawPixmap(0, _TOFF_+tileH, *tile->pixmap( TileLeft )); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileLeft), 0, 0, _LOFF_, 1 ); + p->drawTiledPixmap(0, _TOFF_, _LOFF_, tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileLeft), 0, _MHEIGHT_-1, _LOFF_, 1 ); + p->drawTiledPixmap(0, _TOFF_+tileH+_MHEIGHT_, _LOFF_, h-_HEIGHT_-tileH, tmpPix); + } + else //tileH is negative in this case + p->drawPixmap( 0, _TOFF_, *tile->pixmap( TileLeft ), 0, -tileH, _LOFF_, _MHEIGHT_+2*tileH+1); + } + if (position == right || position == full) + { + if (h > _HEIGHT_) + { + tmpPix.resize(_ROFF_, 1); + p->drawPixmap(w-_ROFF_, _TOFF_+tileH, *tile->pixmap( TileRight )); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileRight), 0, 0, _ROFF_, 1 ); + p->drawTiledPixmap(w-_ROFF_, _TOFF_, _ROFF_, tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileRight), 0, _MHEIGHT_-1, _ROFF_, 1 ); + p->drawTiledPixmap(w-_ROFF_, _TOFF_+tileH+_MHEIGHT_, _ROFF_, h-_HEIGHT_-tileH, tmpPix); + } + else + p->drawPixmap( w-_ROFF_, _TOFF_, *tile->pixmap(TileRight), 0, -tileH, _ROFF_, _MHEIGHT_+2*tileH+1 /*tileH is negative in this case*/ ); + } + } + + + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + { + if (h > _HEIGHT_) + { + tmpPix.resize(_MWIDTH_, 1); + p->drawTiledPixmap(xOffset, _TOFF_+tileH, width, _MHEIGHT_, *tile->pixmap(TileMiddle)); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileMiddle), 0, 0, _MWIDTH_, 1 ); + p->drawTiledPixmap(xOffset, _TOFF_, width, tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileMiddle), 0, _MHEIGHT_-1, _MWIDTH_, 1 ); + p->drawTiledPixmap(xOffset, _TOFF_+tileH+_MHEIGHT_, width, h-_HEIGHT_-tileH, tmpPix); + } + else //tileH is negative in this case + p->drawTiledPixmap( xOffset, _TOFF_, width, h-_TBHEIGHT_, *tile->pixmap(TileMiddle), 0, -tileH); + } + + + if (position == right || position == full) + { + p->drawPixmap( w - _ROFF_, 0, *tile->pixmap( TileTopRight ) ); + p->drawPixmap( w - _ROFF_, h - _BOFF_, *tile->pixmap( TileBtmRight ) ); + } + + } + else // split combo... + { + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( xOffset, 0, width-(24-_ROFF_), _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( xOffset, h - _BOFF_, width-(24-_ROFF_), _BOFF_, *tile->pixmap( TileBtm ) ); + } + if ( h > _TBHEIGHT_) + { + tileH = (int)((h-_HEIGHT_)/2); + if (position == left || position == full) + { + if (h > _HEIGHT_) + { + tmpPix.resize(_LOFF_, 1); + p->drawPixmap(0, _TOFF_+tileH, *tile->pixmap( TileLeft )); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileLeft), 0, 0, _LOFF_, 1 ); + p->drawTiledPixmap(0, _TOFF_, _LOFF_, tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileLeft), 0, _MHEIGHT_-1, _LOFF_, 1 ); + p->drawTiledPixmap(0, _TOFF_+tileH+_MHEIGHT_, _LOFF_, h-_HEIGHT_-tileH, tmpPix); + } + else //tileH is negative in this case + p->drawPixmap( 0, _TOFF_, *tile->pixmap( TileLeft ), 0, -tileH, _LOFF_, _MHEIGHT_+2*tileH+1); + } + } + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + { + if (h > _HEIGHT_) + { + tmpPix.resize(_MWIDTH_, 1); + p->drawTiledPixmap(xOffset, _TOFF_+tileH, width-(24-_ROFF_), _MHEIGHT_, *tile->pixmap(TileMiddle)); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileMiddle), 0, 0, _MWIDTH_, 1 ); + p->drawTiledPixmap(xOffset, _TOFF_, width-(24-_ROFF_), tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileMiddle), 0, _MHEIGHT_-1, _MWIDTH_, 1 ); + p->drawTiledPixmap(xOffset, _TOFF_+tileH+_MHEIGHT_, width-(24-_ROFF_), h-_HEIGHT_-tileH, tmpPix); + } + else //tileH is negative in this case + p->drawTiledPixmap( xOffset, _TOFF_, width-(24-_ROFF_), h-_TBHEIGHT_, *tile->pixmap(TileMiddle), 0, -tileH); + } + + // second part of combos if needed + tile = rectBtnDict.find( c.rgb() ); + if ( !tile ) + tile = createButtonTile( c, cg.background(), ptr->rectbutton, ((QImage*)0L), ((QImage*)0L), &(ptr->rectBtnDict), (QIntDict<ButtonTile>*)0L, (QIntDict<ButtonTile>*)0L, 33, 25, 10, 5, 13, 15, 0, 0, sunken); + if ( !tile ) + { + qWarning( "Button tile is NULL!" ); + return ; + } + + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( w-24, 0, cw, _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( w-24, h - _BOFF_, cw, _BOFF_, *tile->pixmap( TileBtm ) ); + } + + tileH = (int)((h-_HEIGHT_)/2); + if (position == right || position == full) + { + if (h > _HEIGHT_) + { + tileH = (int)((h-_HEIGHT_)/2); + tmpPix.resize(_ROFF_, 1); + p->drawPixmap(w-_ROFF_, _TOFF_+tileH, *tile->pixmap( TileRight )); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileRight), 0, 0, _ROFF_, 1 ); + p->drawTiledPixmap(w-_ROFF_, _TOFF_, _ROFF_, tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileRight), 0, _MHEIGHT_-1, _ROFF_, 1 ); + p->drawTiledPixmap(w-_ROFF_, _TOFF_+tileH+_MHEIGHT_, _ROFF_, h-_HEIGHT_-tileH, tmpPix); + } + else if ( h > _TBHEIGHT_)//tileH is negative in this case + { + tileH = (int)((h-_HEIGHT_)/2); + p->drawPixmap( w-_ROFF_, _TOFF_, *tile->pixmap( TileRight ), 0, -tileH, _ROFF_, _MHEIGHT_+2*tileH+1); + } + p->drawPixmap( w - _ROFF_, 0, *tile->pixmap( TileTopRight ) ); + p->drawPixmap( w - _ROFF_, h - _BOFF_, *tile->pixmap( TileBtmRight ) ); + } + + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + { + if (h > _HEIGHT_) + { + tmpPix.resize(_MWIDTH_, 1); + p->drawTiledPixmap(w-24, _TOFF_+tileH, cw, _MHEIGHT_, *tile->pixmap(TileMiddle)); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileMiddle), 0, 0, _MWIDTH_, 1 ); + p->drawTiledPixmap(w-24, _TOFF_, cw, tileH, tmpPix); + copyBlt( &tmpPix, 0, 0, tile->pixmap(TileMiddle), 0, _MHEIGHT_-1, _MWIDTH_, 1 ); + p->drawTiledPixmap(w-24, _TOFF_+tileH+_MHEIGHT_, cw, h-_HEIGHT_-tileH, tmpPix); + } + else //tileH is negative in this case + p->drawTiledPixmap( w-24, _TOFF_, cw, h-_TBHEIGHT_, *tile->pixmap(TileMiddle), 0, -tileH); + } + } + if (position == center) + { + p->setPen(c.dark(130)); + if (sunken || hover) p->drawLine(0,1,0,h-2); + p->drawLine(w-1,2,w-1,h-2); + } + else if (position == left) + { + p->setPen(c.dark(130)); + p->drawLine(w-1,2,w-1,h-2); + } + else if (position == right && (sunken || hover)) + { + p->setPen(c.dark(130)); + p->drawLine(0,2,0,h-2); + } + if (isCombo) + { + p->setPen(c); + p->drawLine(w-24,2,w-24,h-2); + + int ax = w - 15; + int ay = h/3 - 1; + + p->setPen(cg.text()); + p->setBrush( cg.text() ); + p->drawPixmap(ax, ay-1, *sbUp, 1, 0, 5, 4); + p->drawPixmap(ax, ay+6, *sbDown, 1, 2, 5, 4); + } + if (!isHTML) + { + p->end(); + delete p; + painter->drawPixmap( x, y, *tmpBtnPix, 0, 0, w, h ); + } + else + p->setPen(oldPen); +#undef _HEIGHT_ +#undef _WIDTH_ +} + + +void LiquidStyle::drawCombo( QPainter *painter, + const QColorGroup &cg, + const QColor &c, + int x, int y, int w, int h, + bool sunken, bool hover, bool isCombo, + int position, bool isHTML ) const +{ + + LiquidStyle *ptr = const_cast<LiquidStyle*>( this ); + + QColor myC =(isOOO && isCombo)?optionHandler->CustomButtonColor():c; + QColor tmpColor = isCombo && !(hover || sunken) ? optionHandler->InactiveButtonColor() : myC; + + ButtonTile *tile = sunken ? comboDict.find( tmpColor.rgb() ) : comboShadowedDict.find( tmpColor.rgb() ); + if ( !tile ) + { + if (optionHandler->buttonStyle() == Milk && sunken) + tile = createButtonTile( tmpColor, cg.background(), ptr->btnBorderImg, ptr->comboShadow, ((QImage*)0L), &(ptr->comboDict), &(ptr->comboShadowedDict), (QIntDict<ButtonTile>*)0L, 44, 21, 7, 9, 30, 1, 2, 0, true); + else + tile = createButtonTile( tmpColor, cg.background(), ptr->combo, ptr->comboShadow, ((QImage*)0L), &(ptr->comboDict), &(ptr->comboShadowedDict), (QIntDict<ButtonTile>*)0L, 44, 21, 7, 9, 30, 1, 2, 0, sunken); + } + + if ( !tile ) + { + qWarning( "Button tile is NULL!" ); + return ; + } + + int xOffset, width, cw; + + switch (position) + { + case full: + xOffset = _LOFF_; + width = w - _LRWIDTH_; + cw = 24 - _ROFF_; + break; + case left: + xOffset = _LOFF_; + width = w - _LOFF_; + cw = 24; + break; + case center: + xOffset = 0; + width = w; + cw = 24; + break; + case right: + xOffset = 0; + width = w - _ROFF_; + cw = 24 - _ROFF_; + break; + } + + QPainter *p; + QPen oldPen = painter->pen(); + if (!isHTML) + { + if ( !tmpBtnPix ) + ptr->tmpBtnPix = new QPixmap( w, h ); + else if ( w > tmpBtnPix->width() || h > tmpBtnPix->height() ) + { + // make temp pixmap size == largest button + ptr->tmpBtnPix->resize(w,h); + } + p = new QPainter(tmpBtnPix); + +#if 0 + QPixmap *stipple = cg.brush( QColorGroup::Background ).pixmap(); + if ( !stipple ) // button may have custom colorgroup + stipple = qApp->palette().active().brush( QColorGroup::Background ).pixmap(); + if ( stipple ) + p->drawTiledPixmap( 0, 0, w, h, *stipple); + else + p->fillRect( 0, 0, w, h, cg.background() ); +#endif + if (position != center && paintWidget && paintWidget->parentWidget()) + { + if (this->paintWidget->parentWidget()->paletteBackgroundPixmap ()) + p->drawTiledPixmap(QRect(0, 0, w, h), *this->paintWidget->parentWidget()->paletteBackgroundPixmap(), ((QWidget *)this->paintWidget)->backgroundOffset()); + else + p->fillRect( 0, 0, w, h, this->paintWidget->parentWidget()->paletteBackgroundColor()); + } + else + p->fillRect( 0, 0, w, h, cg.background() ); + } + else + { + p = painter; + } + + if (position == left || position == full) + { + p->drawPixmap( 0, 0, *tile->pixmap( TileTopLeft ) ); + p->drawPixmap( 0, h - _BOFF_, *tile->pixmap( TileBtmLeft ) ); + } + + if (!isCombo || hover || sunken) + { + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( xOffset, 0, width, _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( xOffset, h - _BOFF_, width, _BOFF_, *tile->pixmap( TileBtm ) ); + } + if ( h > _TBHEIGHT_ ) + { + if (position == left || position == full) + p->drawTiledPixmap( 0, _TOFF_, _LOFF_, h - _TBHEIGHT_, *tile->pixmap( TileLeft ) ); + if (position == right || position == full) + p->drawTiledPixmap( w - _ROFF_, _TOFF_, _ROFF_, h - _TBHEIGHT_, *tile->pixmap( TileRight ) ); + } + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + p->drawTiledPixmap( xOffset, _TOFF_, width, h - _TBHEIGHT_, *tile->pixmap( TileMiddle ) ); + if (position == right || position == full) + { + p->drawPixmap( w - _ROFF_, 0, *tile->pixmap( TileTopRight ) ); + p->drawPixmap( w - _ROFF_, h - _BOFF_, *tile->pixmap( TileBtmRight ) ); + } + } + else // split combo... + { + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( xOffset, 0, width-(24 - _ROFF_), _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( xOffset, h - _BOFF_, width-(24 - _ROFF_), _BOFF_, *tile->pixmap( TileBtm ) ); + } + if ( h > _TBHEIGHT_ && (position == left || position == full)) + p->drawTiledPixmap( 0, _TOFF_, _LOFF_, h - _TBHEIGHT_, *tile->pixmap( TileLeft ) ); + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + p->drawTiledPixmap( xOffset, _TOFF_, width-(24 - _ROFF_), h - _TBHEIGHT_, *tile->pixmap( TileMiddle ) ); + + // second part of combos if needed + tile = comboShadowedDict.find( myC.rgb() ); + if ( !tile ) + { + tile = createButtonTile( myC, cg.background(), ptr->combo, ptr->comboShadow, ((QImage*)0L), &(ptr->comboDict), &(ptr->comboShadowedDict), (QIntDict<ButtonTile>*)0L, 44, 21, 7, 9, 30, 1, 2, 0, sunken); + } + if ( !tile ) + { + qWarning( "Button tile is NULL!" ); + return ; + } + if ( w > _LRWIDTH_ ) + { + p->drawTiledPixmap( w-24, 0, cw, _TOFF_, *tile->pixmap( TileTop ) ); + p->drawTiledPixmap( w-24, h - _BOFF_, cw, _BOFF_, *tile->pixmap( TileBtm ) ); + } + if ( h > _TBHEIGHT_ ) + p->drawTiledPixmap( w - _ROFF_, _TOFF_, _ROFF_, h - _TBHEIGHT_, *tile->pixmap( TileRight ) ); + if ( w > _LRWIDTH_ && h > _TBHEIGHT_ ) + p->drawTiledPixmap( w-24, _TOFF_, cw, h - _TBHEIGHT_, *tile->pixmap( TileMiddle ) ); + if (position == right || position == full) + { + p->drawPixmap( w - _ROFF_, 0, *tile->pixmap( TileTopRight ) ); + p->drawPixmap( w - _ROFF_, h - _BOFF_, *tile->pixmap( TileBtmRight ) ); + } + } + + switch (position) + { + case left: + p->setPen(optionHandler->InactiveButtonColor().dark(130)); + p->drawLine(w-1,3,w-1,h-6); + break; + case center: + p->setPen(optionHandler->InactiveButtonColor().dark(130)); + if (sunken || hover) p->drawLine(0,3,0,h-6); + p->drawLine(w-1,3,w-1,h-6); + break; + case right: + if (sunken || hover) + { + p->setPen(optionHandler->InactiveButtonColor().dark(130)); + p->drawLine(0,3,0,h-6); + } + break; + default: + break; + } + + if (isCombo) + { + p->setPen(c); + p->drawLine(w-24,1,w-24,h-4); + + int ax = w - 15; + int ay = h/3 - 1; + + p->setPen(cg.text()); + p->setBrush( cg.text() ); + p->drawPixmap(ax, ay-1, *sbUp, 1, 0, 5, 4); + p->drawPixmap(ax, ay+6, *sbDown, 1, 2, 5, 4); + } + + if (!isHTML) + { + p->end(); + delete p; + painter->drawPixmap( x, y, *tmpBtnPix, 0, 0, w, h ); + } + else + p->setPen(oldPen); +} + +void LiquidStyle::drawRoundFrame( QPainter *p, const QRect &r, + const QColorGroup &cg, bool focused, QPoint offset ) const +{ + ButtonTile *tile = focused ? activeRoundFrame : inactiveRoundFrame; + if (!tile) tile = createRoundFrameTile(*roundFrame, focused ? cg.button() : optionHandler->InactiveButtonColor(), &cg.background(), cg.base() ); + + // first: fill background (tiled) + // outer + QPixmap *stipple = cg.brush( QColorGroup::Background ).pixmap(); + if (stipple) + { + p->drawTiledPixmap( r.x(),r.y(), 7, 8, *stipple, offset.x(), offset.y()); + p->drawTiledPixmap( r.right() - 7, r.y(), 8, 8, *stipple, offset.x()+r.width()-6, offset.y()); + p->drawTiledPixmap( r.x(), r.bottom()-7, 8, 8, *stipple, offset.x(), offset.y() + r.height()-6); + p->drawTiledPixmap( r.right() - 7, r.bottom()-7, 8, 8, *stipple, offset.x() + r.width() - 6, offset.y() + r.height()-6); + } + else + { + p->fillRect(r.x(),r.y(), 7, 8, cg.background()); + p->fillRect(r.right() - 7, r.y(), 8, 8, cg.background()); + p->fillRect(r.x(), r.bottom()-7, 8, 8, cg.background()); + p->fillRect(r.right() - 7, r.bottom()-7, 8, 8, cg.background()); + } + // inner + p->fillRect(r.x()+3,r.y()+4,r.width()-6,r.height()-7,cg.base()); + + // now draw frame + p->drawPixmap(0,0, *tile->pixmap( TileTopLeft )); + p->drawPixmap(r.right()-10,0, *tile->pixmap( TileTopRight )); + p->drawPixmap(0,r.bottom()-10, *tile->pixmap( TileBtmLeft )); + p->drawPixmap(r.right()-10,r.bottom()-10, *tile->pixmap( TileBtmRight )); + if (r.width() > 22) + { + p->drawTiledPixmap(11,0,r.width()-22,10, *tile->pixmap( TileTop )); + p->drawTiledPixmap(11,r.bottom()-10,r.width()-22,11, *tile->pixmap( TileBtm )); + } + if (r.height() > 21) + { + p->drawTiledPixmap(0,10,11,r.height()-21, *tile->pixmap( TileLeft )); + p->drawTiledPixmap(r.right()-10,10,11,r.height()-21, *tile->pixmap( TileRight )); + } + if (focused) + { + p->setPen(cg.button()); + p->drawLine(r.x()+8,r.bottom()-1,r.right()-8,r.bottom()-1); + } +} + +void LiquidStyle::drawEditFrame( QPainter *p, const QRect &r, + const QColorGroup &cg, bool isHTML, bool focused, bool inverse ) const +{ + QColor fill( cg.background().dark( 105 ) ); + QColor tmp(0,0,0); + QColor light1( 0, 0, 0 ); + QColor light2( 0, 0, 0 ); + + QColor dark1( 0, 0, 0 ); + QColor dark2( 0, 0, 0 ); + QColor dark3( 0, 0, 0 ); + + if ( !focused ) + { + if (optionHandler->style() == Brushed) + { + light1 = cg.background().light( 140 ); + light2 = cg.background().light( 120 ); + } + else + { + light1 = cg.background().dark( 115 ); + light2 = cg.background().dark( 120 ); + } + + dark1 = cg.background().dark( 140 ); + dark2 = cg.background().dark( 160 ); + dark3 = cg.background().dark( 200 ); + } + else + { + int h,s,v; + cg.button().getHsv( &h, &s, &v ); + tmp.setHsv(h, (int)(s/1.5) ,v); + light1 = tmp; + light2 = tmp.light( 120 ); + + dark1 = tmp.dark( 110 ); + dark2 = tmp.dark( 120 ); + dark3 = tmp.dark( 140 ); + } + + int x = r.x(); + int y = inverse ? r.bottom() - 1: r.y(); + int right = r.right(); + int bottom = inverse ? r.y() + 1 : r.bottom(); + + if ( !isHTML ) + { + p->setPen( fill ); + p->drawPoint( x, y ); + p->drawPoint( x, bottom ); + p->drawPoint( right, y ); + p->drawPoint( right, bottom ); + + // outer rect + // top + p->setPen( light1 ); + p->drawPoint( x + 1, y ); + p->drawPoint( right - 1, y ); + p->drawPoint( x, y + 1 ); + p->drawPoint( right, y + 1 ); + // bottom + p->drawPoint( x, bottom - 1 ); + p->drawPoint( right, bottom - 1 ); + p->drawPoint( x + 1, bottom ); + p->drawPoint( right - 1, bottom ); + // top + focused ? p->setPen( light2 ) : p->setPen( dark1 ); + p->drawLine( x + 2, y, right - 2, y ); + // bottom, left and right + if (!focused) p->setPen( light2 ); + p->drawLine( x, y + 2, x, bottom - 2 ); + p->drawLine( right, y + 2, right, bottom - 2 ); + if (!focused) p->setPen( light1 ); + p->drawLine( x + 2, bottom, right - 2, bottom ); + } + else + { + p->setPen( light2 ); + p->drawLine( x, y, right, y ); + p->drawLine( x, y, x, bottom ); + p->setPen( dark1 ); + p->drawLine( x, bottom, right, bottom ); + p->drawLine( right, y, right, bottom ); + } + // inner rect + p->setPen( dark1 ); + p->drawPoint( x + 1, y + 1 ); + p->drawPoint( x + 1, bottom - 1 ); + p->drawPoint( right - 1, y + 1 ); + p->drawPoint( right - 1, bottom - 1 ); + p->drawLine( x + 2, bottom - 1, right - 2, bottom - 1 ); + p->setPen( dark3 ); + p->drawLine( x + 2, y + 1, right - 2, y + 1 ); + p->setPen( dark2 ); + p->drawLine( x + 1, y + 2, x + 1, bottom - 2 ); + p->drawLine( right - 1, y + 2, right - 1, bottom - 2 ); +} + +bool LiquidStyle::isHTMLWidget( const QWidget *widget ) const +{ + const QObject * w = widget->parent(); + if ( w ) + { + if ( !w->inherits( "QClipperWidget" ) ) + return ( false ); + w = w->parent(); + if ( w ) + { + w = w->parent(); + if ( w && w->inherits( "KHTMLView" ) ) + return ( true ); + } + } + return ( false ); +} + +void LiquidStyle::drawHTMLCBBorder( const QPixmap &pix, const QColor &c ) const +{ + QPainter p; + p.begin( &pix ); + p.setPen( c.dark( 200 ) ); + p.drawRect( 0, 0, 16, 16 ); + p.end(); +} @@ -0,0 +1,11 @@ +bab +colorscheme +config +deco +icons +kickermenu +kickermenu-3.3 +sessionapplet +sidebar +starter +style |