Initial import of baghira 0.8

pull/1/head
Slávek Banko 8 years ago
commit 066aaaeb73

@ -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

@ -0,0 +1 @@
see readme

@ -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.

@ -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

707
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 @@

@ -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)

@ -0,0 +1,15 @@
2
2
1
2
1
1
-1
-1
-1
-1
-1
-1
-1
-1
0

@ -0,0 +1,14 @@
0
0
0
0
0
1
-1
-1
-1
-1
-1
-1
-1
-1

@ -0,0 +1,3 @@
lnkdir = $HOME/.baghira
lnk_DATA = Brushed Milk Jaguar Tiger Panther
EXTRA_DIST = $(lnk_DATA)

@ -0,0 +1,15 @@
4
4
4
4
1
0
-592138
-4930834
-1
-16777216
-13009982
-1
-16777216
-1116417
1

@ -0,0 +1,14 @@
1
1
1
1
1
1
-1
-1
-1
-1
-1
-1
-1
-1

@ -0,0 +1,14 @@
3
3
1
1
1
1
-1
-1
-1
-1
-1
-1
-1
-1

@ -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

@ -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_

@ -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

@ -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

@ -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"

@ -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>

@ -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

@ -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

@ -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

@ -0,0 +1,3 @@
lnkdir = $(kde_datadir)/kdisplay/color-schemes
lnk_DATA = AquaBlue.kcsrc AquaGraphite.kcsrc
EXTRA_DIST = $(lnk_DATA)

@ -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

@ -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

File diff suppressed because one or more lines are too long

@ -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 );
}

@ -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

@ -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();
}

@ -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

File diff suppressed because it is too large Load Diff

@ -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 \

@ -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>&lt;b&gt;"BAB"&lt;/b&gt; is a little Systray Application to give you more control about the look of your Baghiranced Desktop.&lt;br&gt;
You can start if from a shell or the KDE executor or by just simply clicking the button below.&lt;br&gt;
&lt;br&gt;
&lt;b&gt;How does it work?&lt;/b&gt;&lt;br&gt;
a) Simply leftclick the icon to switch between the different generations ( Blue:Jaguar, Black:Panther, Grey:Brushed Metal, Yellow:Tiger, White:Milk)&lt;br&gt;&lt;br&gt;
b) Righclick to get a config menu, providing direct acces to Baghiras config dialog&lt;br&gt;&lt;br&gt;
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>&lt;br&gt;&lt;b&gt;How to acces bab via DCOP&lt;/br&gt;
&lt;br&gt;Well, if you're a coder, i assume you know hot to access the dcop server from within your code
&lt;br&gt;If you're a user, the main way to acces dcop is the &lt;b&gt;dcop command line tool&lt;/b&gt;&lt;br&gt;&lt;br&gt;
To see, which functions are provided by bab (the list will probably grow), open a shell and enter&lt;br&gt;&lt;br&gt;
&lt;i&gt;&lt;b&gt;dcop bab default&lt;/b&gt;&lt;/i&gt;&lt;br&gt;
&lt;br&gt;
The most interesting function is&lt;br&gt;&lt;br&gt;
&lt;i&gt;&lt;b&gt;start(QString name,QString settings)&lt;/b&gt;&lt;/i&gt;&lt;br&gt;
&lt;br&gt;
use it like:&lt;br&gt;&lt;br&gt;
&lt;i&gt;&lt;b&gt;start &amp;lt;appName&amp;gt; &amp;lt;design&amp;gt;&lt;/b&gt;&lt;/i&gt;&lt;br&gt;&lt;br&gt;
where &lt;i&gt;&lt;b&gt;&amp;lt;appName&amp;gt;&lt;/b&gt;&lt;/i&gt; is the (KDE) application command (try "konqueror") you want to start and &lt;i&gt;&lt;b&gt;&amp;lt;design&amp;gt;&lt;/b&gt;&lt;/i&gt; 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 &lt;i&gt;"Aquarius"&lt;/i&gt; replaces the former "&lt;i&gt;icy&lt;/i&gt;" style.
&lt;br&gt;Though you can use any color, i suggest to avoid very high or very low saturated colors.
&lt;br&gt;- High saturation will lead to a flat look
&lt;br&gt;- Low saturation will look uncolored
&lt;br&gt;
&lt;br&gt;I suggest to use a button color like rgb = 84,140,242 as a starting Point and modify the color to yoour wishes
&lt;br&gt;&lt;b&gt;Notice&lt;/b&gt; that the coloring function is probably not fixed yet - especially not in the high saturated area
&lt;br&gt;So please do not complain if you worked hard to optimize the color and get a different result in one of the next versions.
&lt;br&gt;
&lt;br&gt;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>&lt;b&gt;Apple Computer, Inc.&lt;/b&gt;&lt;br&gt;For being such great Designers =)&lt;p&gt;
&lt;b&gt;Christian Lehmann&lt;/b&gt;&lt;br&gt;For the SuSE binaries and Supporting my Ego&lt;p&gt;
&lt;b&gt;Elias Probst&lt;/b&gt;&lt;br&gt;For the Gentoo ebuild&lt;p&gt;
&lt;b&gt;Mosfet&lt;/b&gt; (Of Course)&lt;br&gt;For the initial Liquid Code&lt;p&gt;
&lt;b&gt;Narcis Tesa&lt;/b&gt;&lt;br&gt;For the Mandrake binaries and being the worst nitpicker on this Planet&lt;p&gt;&lt;b&gt;Timur&lt;/b&gt;&lt;br&gt;For the cute icons&lt;p&gt;
Everyone else who supported me with suggestions, bug reports and Help on the fores.&lt;p&gt;
&lt;a href="http://www.kde-look.org/"&gt;KDE-Look&lt;/a&gt;&lt;br&gt;
and&lt;br&gt;
&lt;a href="http://www.sf.net/"&gt;Sourceforge&lt;/a&gt;&lt;br&gt;
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>

File diff suppressed because it is too large Load Diff

@ -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

@ -0,0 +1,5 @@
./admin/configure.in.min
configure.in.in
./kickermenu/configure.in.in
./sidebar/configure.in.in
./style/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

@ -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

@ -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

@ -0,0 +1,5 @@
# KDE Desktop Entry
[Desktop Entry]
Encoding=UTF-8
Name=Baghira
X-KDE-Library=kwin3_baghira

File diff suppressed because it is too large Load Diff

@ -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

@ -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

@ -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(){
// }

@ -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

@ -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"

@ -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"

@ -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

@ -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

@ -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();
}

@ -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

File diff suppressed because it is too large Load Diff

@ -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 &amp;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).&lt;br&gt;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 &lt;br&gt; Close Button must be most left or right element (also no spacers) &lt;br&gt; Closes on Mouse Button release (so you have the chance to move the mouse away and keep the Window) &lt;br&gt; The Window must be active and maximized &lt;br&gt; 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.&lt;br&gt;However, you can set a minmum value to extend the Titlebar if you prefer small fonts.&lt;br&gt;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>

@ -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>

@ -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

@ -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

@ -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 };

@ -0,0 +1 @@
KDE_ICON = AUTO

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

@ -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! ;)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 863 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -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

@ -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

@ -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"

@ -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

@ -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

@ -0,0 +1,2 @@
AM_CONDITIONAL( HAVE_3_4, test $(kde-config --version | grep "KDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 )

@ -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"

@ -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

@ -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

@ -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 &current )
{
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

@ -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

@ -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");
}
}

@ -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

@ -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

@ -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

@ -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

@ -0,0 +1 @@
../starter/baghiralinkdrag.cpp

@ -0,0 +1 @@
../starter/baghiralinkdrag.h

@ -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);
}
};

@ -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

@ -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

@ -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

@ -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

@ -0,0 +1,2 @@
AM_CONDITIONAL( HAVE_3_4, test $(kde-config --version | grep "KDE:" | cut -d" " -f2 | cut -d"." -f2) -gt 3 )

@ -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);
}
}

@ -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

@ -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 };

@ -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>&lt;b&gt;Title&lt;/b&gt;</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>&lt;b&gt;URL&lt;/b&gt;</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>&amp;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>&amp;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>

@ -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;
}

@ -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

@ -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);
}

@ -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

@ -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 };

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -0,0 +1 @@
Contributed by Arnaud

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

@ -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();
}

@ -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

@ -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>&amp;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>&amp;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>&amp;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>&lt;b&gt;Command&lt;/b&gt;</string>
</property>
</widget>
<widget class="QLabel" row="4" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>&lt;i&gt;Keywords&lt;/i&gt;</string>
</property>
</widget>
<widget class="QLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>&lt;i&gt;&lt;b&gt;Name&lt;/b&gt;&lt;/i&gt;</string>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>&lt;i&gt;&lt;b&gt;Category&lt;/b&gt;&lt;/i&gt;</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -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>&lt;p align="center"&gt;&lt;font size="+3"&gt;&lt;b&gt;Menu entry editor&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p align="center"&gt;----------------------------------------------------------------------------------&lt;/p&gt;
&lt;h3&gt;Introduction&lt;/h3&gt;
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.&lt;br&gt;&lt;br&gt;
&lt;b&gt;Bold options must be entered&lt;/b&gt; for a usefull entry, i&lt;i&gt;talic ones are respected by the search feature&lt;/i&gt;.
&lt;br&gt;&lt;br&gt;
&lt;h3&gt;Basic settings&lt;/h3&gt;
&lt;b&gt;Name:&lt;/b&gt;&lt;br&gt;
This is the visible name of your new entry and can be any string, e.g. "The Gimp".&lt;br&gt;
(Necessary, searchkey)
&lt;br&gt;&lt;br&gt;
&lt;b&gt;Is a:&lt;/b&gt;&lt;br&gt;
Describes the applications genre (generic name), e.g. "Image manipulation"&lt;br&gt;
(Optional, yet not searched - maybe later)
&lt;br&gt;&lt;br&gt;
&lt;b&gt;Category:&lt;/b&gt;&lt;br&gt;
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 ("\/")&lt;br&gt;
(Necessary, searchkey)
&lt;br&gt;&lt;br&gt;
&lt;b&gt;Command:&lt;/b&gt;&lt;br&gt;
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"&lt;br&gt;
(Necessary, not searched)
&lt;br&gt;&lt;br&gt;
&lt;b&gt;Keywords:&lt;/b&gt;&lt;br&gt;
Comma separated list of keywords that refer to this application during search, e.g. "image manipulation,pixel,photoshop".&lt;br&gt;
Please note:&lt;br&gt;
1. search is &lt;i&gt;not&lt;/i&gt; case sensitive&lt;br&gt;
2. search finds partial matches, so it's &lt;i&gt;not&lt;/i&gt; necessary to add e.g. "image,image manipulation"&lt;br&gt;
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" &lt;b&gt;you're wrong!&lt;/b&gt;&lt;br&gt;
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, ...)&lt;br&gt;
(Optional, searchkey)
&lt;br&gt;&lt;br&gt;
&lt;b&gt;Description:&lt;/b&gt;&lt;br&gt;
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.&lt;br&gt;
(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>

@ -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>&amp;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>&amp;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>&lt;b&gt;Title&lt;/b&gt;</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>&lt;b&gt;Command&lt;/b&gt;</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>

File diff suppressed because it is too large Load Diff

@ -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

@ -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

@ -0,0 +1 @@
POFILES = AUTO

@ -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..."

@ -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 ""

@ -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");
}
}

@ -0,0 +1,7 @@
[Desktop Entry]
Encoding=UTF-8
Name=Baghira Starter
Icon=bStarter
X-KDE-Library=libbaghirastarter
X-KDE-UniqueApplet=true

@ -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

@ -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>&lt;b&gt;Hover&lt;/b&gt;</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>&lt;b&gt;Base&lt;/b&gt;</string>
</property>
</widget>
<widget class="QLabel" row="2" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>&lt;b&gt;Down&lt;/b&gt;</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>&amp;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>&amp;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>&amp;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>

@ -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>&lt;qt&gt;The filterline provides several functions
&lt;ul&gt;
&lt;li&gt;It filters the below entry list&lt;/li&gt;
&lt;li&gt;It autocompletes to executable entries in $PATH&lt;/li&gt;
&lt;li&gt;The applied listbox lets you select the available categories&lt;/li&gt;
&lt;li&gt;You can navigate through the categories either by using the mousewheel or by holding &lt;b&gt;ctrl+up/down&lt;/b&gt;&lt;/li&gt;
&lt;li&gt;The category is also selected when calling the applied shortcut&lt;/li&gt;
&lt;li&gt;It supports all protocols you know from Konqueror, e.g. "gg:Baghira" will google for "Baghira" etc.&lt;/li&gt;
&lt;/ul&gt;
Pressing &lt;b&gt;Enter&lt;/b&gt; will execute the (autocompleted) binary in $PATH or the entered kfm protocol call&lt;br&gt;
Pressing &lt;b&gt;down&lt;/b&gt; will move the keyboard focus to the below entry list
&lt;/qt&gt;</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>&lt;qt&gt;The entry field shows up all your menu entries (filtered)&lt;br&gt;&lt;br&gt;
You can start an application by clicking the &lt;b&gt;left mouse button&lt;/b&gt; above the item (highlighted text) or by pressing &lt;b&gt;Enter&lt;/b&gt; if the entry has the keyboard focus (highlighted background).&lt;br&gt;&lt;br&gt;
You may navigate by either scrolling the &lt;b&gt;mousewheel&lt;/b&gt; or using the &lt;b&gt;up/down&lt;/b&gt; keys (this will also shift the keyboard focus)&lt;br&gt;&lt;br&gt;
Pressing the &lt;b&gt;left&lt;/b&gt; key will put focus on the filterline and select the whole text (i.e. start typing will change a complete new filter action)&lt;br&gt;&lt;br&gt;
Pressing the &lt;b&gt;up&lt;/b&gt; key on the topmost item will act as above.&lt;/qt&gt;</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>&lt;qt&gt;The panel allow you to store often used links, independent from the application links in the entry list&lt;br&gt;&lt;br&gt;
To &lt;b&gt;add a link&lt;/b&gt;, either:&lt;br&gt;
- rightclick the panel&lt;br&gt;
- drag and drop a link out of the entry list&lt;br&gt;
- 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)&lt;br&gt;
&lt;br&gt;
To &lt;b&gt;remove a link&lt;/b&gt;, 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)&lt;br&gt;
&lt;br&gt;
To &lt;b&gt;configure a link&lt;/b&gt;, simply rightclick it&lt;br&gt;&lt;br&gt;
To &lt;b&gt;move a link&lt;/b&gt;, just drag it and move i around.&lt;br&gt;&lt;br&gt;
Te panel is &lt;b&gt;scrollable (mousewheel)&lt;/b&gt; and you can configure &lt;b&gt;individual positions&lt;/b&gt; for the popup and the dialog&lt;br&gt;&lt;br&gt;
More poofs can be found e.g. here: &lt;a href="http://www.resexcellence.com/user_poofs.shtml"&gt;www.resexcellence.com/user_poofs.shtml&lt;/a&gt;
&lt;/qt&gt;</string>
</property>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -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

@ -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

File diff suppressed because it is too large Load Diff

@ -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

@ -0,0 +1,6 @@
[Misc]
Name=Baghira
Comment=The Big Black Cat
ConfigPage=kstyle_baghira_config
[KDE]
WidgetStyle=Baghira

@ -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

@ -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" )

@ -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;
}

@ -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

@ -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

@ -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
}

@ -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 );
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,11 @@
bab
colorscheme
config
deco
icons
kickermenu
kickermenu-3.3
sessionapplet
sidebar
starter
style
Loading…
Cancel
Save