Initial import of libqt-perl (not yet TQt compatible)

bug/266/move-to-usr
Timothy Pearson 13 years ago
commit bcc95cd92c

@ -0,0 +1,16 @@
PerlQt-3 is (c) Ashley Winters 2002, and (c) Germain Garand 2003
The project's homepage is at http://perlqt.sourceforge.net
Puic was derived from Pyuic(Phil Thompson et alii) and Uic(Trolltech As) by
Germain Garand.
The Smoke binding library was conceived by Ashley Winters.
It uses the Kalyptus Parser by Richard Dale, with a module implemented
by David Faure.
All code in this tree is released under the terms of the GNU Public License
v2.

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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,104 @@
2003-09-09 GG (v.3.008)
- improved garbage collection. No more leaks of Q*Items.
GC is now believed to be entirely sound.
- faster/cleaner build system (no more automake dependancy)
- speed optimizations (+50% gain)
- 9 new marshallers (Q*List are marshalled as a reference to a Perl array of Q*)
- tied marshallers for non-const QString/QByteArray
$ts = Qt::TextStream( $x, IO_WriteOnly );
$ts << "foo"; # will write to $x
- alternative Sig/Slot declaration syntax
sub a_signal : SIGNAL(int,QString);
sub a_slot : SLOT(int,QString) {
#do something
}
- perleditor plugin for Qt Designer (released separately as pqt-designer package)
- Perl syntax highlighting
- thorough code completion (static and instance methods, &Qt::enums...)
- Perl aware Object Browser ("Class Declarations" tab)
- run your PerlQt project straight from the designer
- STDIN/STDOUT output and Perl messages are redirected to the Output Window view,
with corrected line numbers pointing to syntax errors.
- global scope Qt functions (bitBlt, qCompress...) are now available.
- gathered in the Qt::GlobalSpace namespace
- import them to current namespace with "use Qt::GlobalSpace"
- global scope operators are available as well (e.g Qt::Point + Qt::point)
- bug fixes and other improvements.
=> see ChangeLog.CVS.delta and ChangeLog.CVS for details
2002-02-13 GG (v.3.006)
- "use bytes" pragma now changes the way QStrings are marshalled
back to Perl : within the scope, instead of all utf-8, QStrings are
marshalled to ISO-Latin1 by default, or to locale if "use locale" is
active.
- Operator overloading is now functional. 21 operators are available.
e.g:
$d = Qt::TextStream( $f );
$d << "Foo " << 12 << " Bar";
N.B: the copy constructor operator('=') isn't overloaded.
It clashes with the perl paradigm.
- fixed a bug in QCString Marshaller : plain ASCII was tagged as UTF-8
- raised priority of QString in case of ambiguous call
- allow runtime definition of signals and slots (via eval)
- added two development tools : pqtsh (a graphical PerlQt shell) and
pqtapi (a command line introspection tool)
- look also in super classes when dumping possible candidates (Qt::debug)
- updated french and english documentation
- module Qt::constants for on-demand loading of global Qt constants
(as of now, only concerns IO_* constants defined in qiodevice.h)
e.g:
use Qt::constants qw(:IO)
or
use Qt::constants qw( IO_ReadOnly IO_WriteOnly )
from an idea by Marek Rouchal
2002-12-16 GG (v.3.004-final)
- test suite ("make test" target)
- one more example (progress.pl)
- fixed a bug related to pointer mapping and Smoke's cf_virtual flag
(regeneration of Smoke isn't mandatory, but is recommended)
- fixed possible redefinition of a sub in isa.pm
- raised default test threshold to 10
- some code optimizations (object construction/destruction)
- added an undocumented but supported CAST function
e.g CAST $obj, "Qt::Application"; (it proved to be useful in some
situations)
2002-12-11 GG. (v.3.004-RC2)
- turnaround for segfaults with some KDE themes (KThemeStyles)
=>will work witth kdelibs compiled with --disable-fast-malloc and --enable-fast-malloc,
but not with --enable-fast-malloc=full
- Qt::version()
- updated documentation (marshallers, debugging, i18n)
- switch to Makefile.PL for driving ./configure
2002-12-07 GG. (v.3.004-RC1)
- better ISO C++ compliance and portability
-ansi -pedantic is now almost silent except for some Perl Macros
- speed improvements over 40%
ported memoïze-like cache to C++ ; various code optimizations
- Signal/Slots inheritance now works as expected
- proper handling of Qt modules stored in a hierarchy
- introduced SUPER->method() construct for accessing methods in the
superclass
- Internationalization
Perl strings are marshalled to QStrings either in utf8, iso-latin-1 or
current locale according to context (the rule is: if they are tagged as utf8, use
utf8 ; if not, use iso-latin by default or current locale if the "locale"
pragma is active) ; they are always marshalled back as utf8.
- You can now safely "eval" PerlQt code.
- New marshallers:
QCString /*/&, bool */&, QValueList<int> /*/&
- Debugging channels through "use Qt::debug"
You can now monitor specific parts of your application's behaviour.
Available channels are : ambiguous, calls, gc, autoload, virtual,
verbose, all.
- Updated documentation + french translation
many thanks to Stéphane Payrard for the accurate french translation !
- Subclassing Qt::Application is now possible
- Smoke can be built with Qt-3.1
- Various other bug fixes
2002-08-24 Germain Garand <germain@ebooksfrance.com> (v.3.001)
* initial release

File diff suppressed because it is too large Load Diff

@ -0,0 +1,696 @@
2003-09-13 00:39 germaingarand
* PerlQt/handlers.cpp:
- cache copy constructor && destructor lookups
- avoid looking twice in type hash for most common types
2003-09-13 00:37 germaingarand
* PerlQt/Qt.pm:
- fix line numbers && current file on error (no method to call...)
2003-09-12 15:43 germaingarand
* PerlQt/handlers.cpp:
- reworking the tied marshallers: let's allow readonly variables.
2003-09-12 15:24 germaingarand
* PerlQt/t/b_nogui.t:
- adding test for tied marshaller/TextStream
2003-09-12 13:13 germaingarand
* PerlQt/Qt.xs:
(see previous commit on handlers.cpp)
2003-09-12 13:12 germaingarand
* PerlQt/handlers.cpp:
- fix garbage collection: we need to register external objects as well, so that
widgets using e.g: the $mainWindow->menuBar() pointer as parent don't get GCed.
- do not look in real stash if call is for a Qt::enum
(emulation of the previous Legacy autoload behaviour)
2003-09-12 13:02 germaingarand
* PerlQt/Qt.pm:
- strict matching is too strict. We'll do that only for operators
2003-09-10 18:16 germaingarand
* PerlQt/Qt.pm:
- We don't want to check the type of every argument, but let's check at least Qt Objects.
Wrong casts are deadly and hard to debug.
- got rid of the legacy autoload. Fully qualified calls are much faster now.
2003-09-10 13:17 germaingarand
* puic/uic.cpp:
- 3.1 Actions were housed
2003-09-09 10:45 germaingarand
* ChangeLog.CVS, ChangeLog.CVS.delta, Makefile.am, cvs2cl.pl:
- updated ChangeLogs
2003-09-09 09:21 germaingarand
* PerlQt/: Qt.xs, handlers.cpp:
fix compile for 5.6.1
2003-09-09 07:32 germaingarand
* perleditor/: perlcompletion.cpp, perlcompletion.h:
- perlcompletion isn't at top speed until a first call has been made.
Put a singleShot timer to warm it up before the user come
2003-09-09 06:25 germaingarand
* PerlQt/Makefile.PL.in:
- add qt_libraries to RPATH too, otherwise Qt.so can pull a qt-mt library different from the one Smoke
would have picked up.
2003-09-08 18:13 germaingarand
* PerlQt/t/ca_i18n.t:
- one more test, monitoring "use bytes" pragma
2003-09-08 16:24 germaingarand
* PerlQt/: MANIFEST, Makefile.PL.in, Qt.pod:
- cleaning Makefile.PL.in
- install documentation in {datadir}/PerlQt-3
- install a short Qt.pod notice pointing to the real doc, for those
who are going to try "perldoc Qt" :-}
2003-09-08 15:38 germaingarand
* doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html:
- updated documentation (/en and /fr) to reflect 3.008 changes
2003-09-08 02:23 germaingarand
* perleditor/README.perleditor.quickstart:
- a bit of documentation never hurts...
2003-09-08 01:47 germaingarand
* perleditor/: objectbrowser.cpp, perlaction.cpp:
- fixing proper detection of PerlEditor modified state when Running Project
2003-09-07 15:32 germaingarand
* perleditor/: listeditor.h, mainfilesettings.h, preferences.h,
projectsettings.h, slotfuncdia.h:
removing auto-generated headers
2003-09-07 15:26 germaingarand
* PerlQt/lib/Qt/debug.pm:
- warn and display list of available debugging channels when asked for an unknown one
2003-09-07 15:18 germaingarand
* configure.in, PerlQt/Qt.pm:
- bumping version to 3.008
2003-09-07 14:35 germaingarand
* PerlQt/: Qt.xs, handlers.cpp:
- major bug fix: "use bytes" and "use locale" pragmata didn't apply to current scope.
They are held in the op_private of the context stack after compiling, no more in PL_hints.
Thanks to Ashley for pointing where to find them :)
Additionaly, there was a loss of context in AUTOLOAD due to the many hops.
So we need to fetch the old context in there.
2003-09-06 21:05 germaingarand
* puic/: Makefile.am, puic.1:
adding Lutz Badenheuer <Lutz.Badenheuer@t-online.de>'s man page
2003-09-06 19:03 germaingarand
* perleditor/yyindent.cpp:
- fix comment detection.
2003-09-06 16:51 germaingarand
* PerlQt/Qt.pm:
- be more strict when matching ambiguous methods
- fixed a bug regarding the priority of some types
2003-09-05 03:30 germaingarand
* PerlQt/: Qt.pm, Qt.xs, handlers.cpp:
- implemented QByteArray Marshaller (from/to Perl string, tied if needed)
Still needs some thought /wrt to Utf8 handling (think qCompress/qUncompress)
With QDataStream static operators and this, we get a nice object serializer :)
use Qt::constants;
$bytearray = "";
$a = Qt::DataStream( $bytearray, IO_WriteOnly );
# now magically serialize some objects in $bytearray
$a << $qdatetime << $qfont << $qpixmap;
2003-09-01 21:09 germaingarand
* PerlQt/: Qt.xs, handlers.cpp:
- real non-const QString&/* marshaller implemented via tied scalars
e.g:
use Qt;
use Qt::constants;
$str = "Foooooooooooooooo";
$ts = Qt::TextStream( $str, IO_WriteOnly );
$ts << "pi = " << 3.14;
# $str is now "pi = 3.14oooooooo"
The link is maintained until the scalar is destroyed, or until it is untied.
2003-08-31 16:35 germaingarand
* PerlQt/lib/Qt/GlobalSpace.pm, PerlQt/Qt.pm, PerlQt/t/b_nogui.t,
kalyptus/ChangeLog, kalyptus/Iter.pm, kalyptus/README,
kalyptus/kalyptus, kalyptus/kalyptusCxxToSmoke.pm,
kalyptus/kdocAstUtil.pm:
updating kalyptus/smoke (GlobSpace operator names no longer munged)
2003-08-31 14:38 germaingarand
* PerlQt/: Qt.pm, lib/Qt/slots.pm:
- more permissive syntax for new sig/slot declarations (white spaces, quotes)
- implement consistency check of old vs. new style slot declarations
allows one to say
use Qt::slots "foo" => ["int"];
then
sub foo : SLOT( int ) {} # OK. Same decl. Noop.
sub foo : SLOT( QString ) {} # triggers a warning:
# Slot declaration:
# foo(QString)
# will override previous declaration:
# foo(int)
2003-08-30 23:01 germaingarand
* PerlQt/Qt.pm:
Doing it the Right Way.
- make $SIG{__DIE__} local inside eval'ed ops
- added missing operators (unary minus, binary mul)
- GlobalSpace operators with assignment were returning wrong values
2003-08-28 02:10 germaingarand
* smoke/qt/generate.pl.in, smoke/qt/qt_smoke.h, kalyptus/kalyptus,
kalyptus/kalyptusCxxToSmoke.pm, kalyptus/kalyptusDataDict.pm,
kalyptus/kdocAstUtil.pm:
- GlobalSpace support + updates
2003-08-28 02:02 germaingarand
* smoke/qt/header_list:
-removing conflicting/useless headers
2003-08-28 01:28 germaingarand
* PerlQt/: Qt.pm, lib/Qt/GlobalSpace.pm, lib/Qt/constants.pm:
- adding support for the new Qt::GlobalSpace pseudo-class holding all global Qt functions.
Requires a recompilation of Smoke.
use Qt::GlobalSpace; # exports all symbols to the caller's namespace (not recommended)
use Qt::GlobalSpace qw( bitBlt qCompress qSysInfo ); # export listed symbols only
- when an operator call fails, forward the call to Qt::GlobalSpace which has a lot of static operators:
$aPoint = Qt::Point( 20, 20 );
$aPoint += Qt::Point( 10, 10); # this one calls Qt::Point->operator+()
$o = Qt::Point(10,10) + Qt::Point(30,30); # this is forwarded to Qt::GlobalSpace::+( QPoint, QPoint )
- made "use Qt::constant" export all symbols by default (IO_ReadOnly, ...).
2003-08-20 10:12 germaingarand
* PerlQt/handlers.cpp:
- construct_copy for const ref: update the macros, and oh, don't forget to
mark the resulting object as allocated. Caveat leakem.
2003-08-20 09:25 germaingarand
* PerlQt/handlers.cpp:
- fixed a severe bug in construct_copy
- when marshalling const QFoo&, construct a copy...
this ought to fix a lot of subtle bugs (mostly QShared related).
2003-08-14 20:52 germaingarand
* puic/: form.cpp, uic.cpp, uic.h:
- various fixes for when compiling with Qt < 3.1
2003-08-14 18:44 germaingarand
* PerlQt/Makefile.PL.in, admin/acinclude.m4.in,
smoke/qt/qtguess.pl.in:
- nice patch by Marek Rouchal<marek.rouchal@infineon.com>. Improves Solaris
compatibility and static builds. Many thanks to him!
- fix the sometimes incorrect rpath for Smoke (kde_libraries=>libdir)
2003-08-14 18:35 germaingarand
* puic/: form.cpp, main.cpp, object.cpp, uic.cpp, uic.h,
widgetdatabase.cpp:
- end of uic 3.2 merging at last. Pheeeew.
2003-08-14 18:22 germaingarand
* perleditor/perlaction.cpp:
- prevent random crash when destroying qprocesses too early
2003-07-18 03:14 germaingarand
* puic/object.cpp:
- compile fix by David Hugh-Jones <hughjonesd@yahoo.co.uk>
2003-06-14 04:52 germaingarand
* smoke/qt/Makefile.am, smoke/qt/header_list,
kalyptus/kalyptusCxxToSmoke.pm:
- fix Smoke generation for Qt-3.2b1
2003-06-14 04:47 germaingarand
* PerlQt/: Qt.pm, Qt.xs, handlers.cpp, perlqt.h:
- speed optimizations again. cachegrind rocks
2003-06-09 17:17 germaingarand
* PerlQt/lib/Qt/attributes.pm:
- do not redefine attributes if they have already been defined in base class.
2003-06-09 17:15 germaingarand
* PerlQt/: Qt.pm, Qt.xs:
- Some polishing on Q*Items garbage collection. setAllocated() is now correct.
- Speed, speed, speed. Moved object destruction routine to XS. Object creation/deletion
is now 50% faster than in 5.006
2003-06-08 02:01 germaingarand
* puic/: domtool.cpp, domtool.h, form.cpp, main.cpp, object.cpp,
subclassing.cpp, uic.cpp, uic.h, widgetdatabase.cpp:
- big merges from uic. Regressions expected. Needs testing
2003-06-06 21:30 germaingarand
* PerlQt/: Qt.pm, Qt.xs:
- sig/slot defined via sub attributes are now created upon metaObject() request if needed.
Much better this way, since it allows runtime evaluation:
eval "sub foo : SLOT() {}"
2003-06-06 02:51 germaingarand
* PerlQt/Qt.pm:
for now: slot/signal/dcop => SLOT/SIGNAL/DCOP
2003-06-06 01:53 germaingarand
* PerlQt/Qt.pm:
- moved the sig/slot attributes handling from Qt::base to the Qt::Object package,
where it obviously belongs
- silenced a 5.6.0 warning /wrt Qt::debug
2003-06-05 22:07 germaingarand
* PerlQt/: Qt.pm, lib/Qt/signals.pm, lib/Qt/slots.pm:
- implemented Ashley's great syntax proposal for sig/slots definition via sub attributes
sub mySlot : slot( int, const QString& ) { ... }
sub mySig : signal( bool );
Of course, the old/alternative syntax is still valid.
2003-06-05 15:22 germaingarand
* PerlQt/: Qt.pm, Qt.xs:
- fixed the garbage collection for Q*Items.
Use list->takeItem( foo ) when available to safely remove an Item from a list (then undef it to delete).
- as a consequence, could remove the dreadful obj->isa("Q*Item") test. Gives a nice 30% speed up in
Object creation.
2003-05-30 03:22 germaingarand
* puic/puic.pro:
- added a qmake project file, for easy building of puic when checked out separately
( export QTDIR, then:
$QTDIR/bin/qmake -makefile puic.pro && make && make install )
2003-05-30 01:36 germaingarand
* perleditor/: listeditor.ui.h, objectbrowser.cpp, objectbrowser.h,
perlaction.cpp, perlaction.h, perlcompletion.cpp, perleditor.cpp:
- fixed a bug in function arguments completion
- turnaround for a Designer bug (it wouldn't mark current form as modified in some circumstances)
- small bugfixes and code cleanup
2003-05-28 22:17 germaingarand
* perleditor/: preferenceinterfaceimpl.cpp, syntaxhighliter_perl.h:
- gcc-2.9x fixes
2003-05-28 18:30 germaingarand
* perleditor/: mainfilesettings.ui.h, perlaction.cpp,
projectsettings.ui.h, projectsettingsinterfaceimpl.cpp,
yyindent.cpp:
- rewrote the project settings saving code (had overlooked the nice customSetting interface)
2003-05-28 04:58 germaingarand
* perleditor/: README, actioninterfaceimpl.cpp,
actioninterfaceimpl.h, common.cpp, common.h,
editorinterfaceimpl.cpp, editorinterfaceimpl.h,
languageinterfaceimpl.cpp, listeditor.h, mainfilesettings.h,
mainfilesettings.ui, mainfilesettings.ui.h, objectbrowser.cpp,
objectbrowser.h, perlaction.cpp, perlaction.h, perlcompletion.cpp,
perlcompletion.h, perleditor.cpp, perleditor.h, perleditor.pro,
perlmainprojectfile.cpp, perlmainprojectfile.h, pqtapiprocess.cpp,
pqtapiprocess.h, preferences.h, projectsettings.h,
projectsettings.ui, projectsettings.ui.h,
projectsettingsinterfaceimpl.cpp, slotfuncdia.h,
sourcetemplateinterfaceimpl.cpp:
- implemented "Build and run project". One can now fully develop/test/run a PerlQt program without ever using
a console. This is VB on steroids :)
- added an application template
- project settings looks OK. Would need some testing usability wise though
- lot of bugfixes
2003-05-26 21:28 germaingarand
* puic/main.cpp:
- bumping version to 0.6main.cpp
2003-05-26 21:25 germaingarand
* puic/form.cpp:
- adding "# line" directive to ui.pm
2003-05-26 19:41 germaingarand
* perleditor/: actioninterfaceimpl.cpp, actioninterfaceimpl.h,
common.cpp, common.h, imagefactory.h, languageinterfaceimpl.cpp,
listeditor.h, mainfilesettings.h, perlaction.cpp, perlaction.h,
perleditor.cpp, perleditor.h, perleditor.pro, preferences.h,
projectsettings.h, slotfuncdia.h, images/perlqt.png,
images/perlqtblue.png, images/perlqtblue2.png:
- added PerlQt Menu/toolbar ("Run form/run project" triggers puic->perl)
- "run project" not yet implemented
- "Run Form" can be accessed also with RMB on source code
- When Form is run through Perl, STDOUT/STDERR are captured and redirected to the Designer's
Output Window
- Perl syntax errors and warnings show up with correct line number/ FormFile name, thanks to
'# line \d+ "foo"' magic :-)
- some icons
2003-05-26 00:57 germaingarand
* perleditor/: languageinterfaceimpl.cpp, objectbrowser.cpp,
perlcompletion.cpp, perleditor.cpp, perleditor.h,
pqtapiprocess.cpp, designer_3.1_patches/resource.cpp.diff:
- added "Build and Run this form with perl" RMB option
- code cleanup
2003-05-25 15:31 germaingarand
* perleditor/: README, imagefactory.h, languageinterfaceimpl.cpp,
objectbrowser.cpp, perlcompletion.cpp, images/editcut.png:
README
2003-05-25 15:30 germaingarand
* perleditor/designer_3.1_patches/: designerappiface.cpp.diff,
mainwindowactions.cpp.diff, resource.cpp.diff:
- needed Designer 3.1 patches
(hopefully not for long, as discussion with Marius B. Monsen from Trolltech could lead to having
those issues fixed in 3.2)
2003-05-25 15:27 germaingarand
* perleditor/images/filenew.png:
images/editcut.png
2003-05-23 23:35 germaingarand
* perleditor/: completion.cpp, listeditor.h, perlcompletion.cpp,
perlcompletion.h, pqtapiprocess.cpp, projectsettings.h,
slotfuncdia.h, slotfuncdia.ui, slotfuncdia.ui.h:
- invalidate "function" radio if user input obviously describes a slot.
- better auto-completion: methods, statics and enums are all in. Yay!
(might need some optims, I'm on a 2400+ box now ;-P)
2003-05-23 16:23 germaingarand
* PerlQt/bin/pqtapi:
- added option 'p' for including inherited methods of 'class' in results
- option 'm' is for communication with the Designer Plugin (for code completion)
2003-05-23 09:39 germaingarand
* perleditor/: listeditor.cpp, mainfilesettings.cpp,
preferences.cpp, projectsettings.cpp, slotfuncdia.cpp:
those are auto-generated
2003-05-22 21:34 germaingarand
* perleditor/: completion.cpp, editor.h, parenmatcher.cpp,
parenmatcher.h, perlindent.h, preferences.ui.h, arghintwidget.h,
globaldefs.h, markerwidget.cpp, objectbrowser.h, projectsettings.h,
projectsettings.ui.h, slotfuncdia.ui, viewmanager.cpp,
completion.h, languageinterfaceimpl.h, listeditor.h,
mainfilesettings.cpp, pqtapiprocess.h, preferences.ui,
syntaxhighliter_perl.h, classbrowserinterfaceimpl.cpp, common.h,
conf.cpp, conf.h, editorinterfaceimpl.cpp, listeditor.ui,
listeditor.ui.h, mainfilesettings.ui, mainfilesettings.ui.h,
paragdata.h, perlbrowser.cpp, perlbrowser.h, perlcompletion.h,
perleditor.h, perlindent.cpp, perlqt.cpp,
preferenceinterfaceimpl.cpp, projectsettings.ui, slotfuncdia.ui.h,
syntaxhighliter_perl.cpp, viewmanager.h, yyindent.cpp, yyreg.cpp,
yyreg.h, arghintwidget.cpp, classbrowserinterfaceimpl.h,
editor.cpp, editorinterfaceimpl.h, hierarchyview.cpp,
imagefactory.h, languageinterfaceimpl.cpp, objectbrowser.cpp,
perlcompletion.cpp, preferenceinterfaceimpl.h, preferences.cpp,
preferences.h, projectsettings.cpp, slotfuncdia.cpp, slotfuncdia.h,
sourcetemplateinterfaceimpl.cpp, sourcetemplateinterfaceimpl.h,
browser.cpp, browser.h, common.cpp, defdialog.ui, hierarchyview.h,
listeditor.cpp, mainfilesettings.h, markerwidget.h, perleditor.cpp,
perleditor.pro, pqtapiprocess.cpp,
projectsettingsinterfaceimpl.cpp, projectsettingsinterfaceimpl.h,
variabledialog.ui, images/editslots.png, images/folder.png,
interfaces/actioninterface.h, interfaces/classbrowserinterface.h,
interfaces/designerinterface.h, interfaces/editorinterface.h,
interfaces/filterinterface.h, interfaces/interpreterinterface.h,
interfaces/languageinterface.h, interfaces/preferenceinterface.h,
interfaces/programinterface.h, interfaces/projectsettingsiface.h,
interfaces/sourcetemplateiface.h, interfaces/templatewizardiface.h,
interfaces/widgetinterface.h:
Initial import of the PerlQt plugin for Qt Designer
2003-05-22 21:34 germaingarand
* perleditor/: completion.cpp, editor.h, parenmatcher.cpp,
parenmatcher.h, perlindent.h, preferences.ui.h, arghintwidget.h,
globaldefs.h, markerwidget.cpp, objectbrowser.h, projectsettings.h,
projectsettings.ui.h, slotfuncdia.ui, viewmanager.cpp,
completion.h, languageinterfaceimpl.h, listeditor.h,
mainfilesettings.cpp, pqtapiprocess.h, preferences.ui,
syntaxhighliter_perl.h, classbrowserinterfaceimpl.cpp, common.h,
conf.cpp, conf.h, editorinterfaceimpl.cpp, listeditor.ui,
listeditor.ui.h, mainfilesettings.ui, mainfilesettings.ui.h,
paragdata.h, perlbrowser.cpp, perlbrowser.h, perlcompletion.h,
perleditor.h, perlindent.cpp, perlqt.cpp,
preferenceinterfaceimpl.cpp, projectsettings.ui, slotfuncdia.ui.h,
syntaxhighliter_perl.cpp, viewmanager.h, yyindent.cpp, yyreg.cpp,
yyreg.h, arghintwidget.cpp, classbrowserinterfaceimpl.h,
editor.cpp, editorinterfaceimpl.h, hierarchyview.cpp,
imagefactory.h, languageinterfaceimpl.cpp, objectbrowser.cpp,
perlcompletion.cpp, preferenceinterfaceimpl.h, preferences.cpp,
preferences.h, projectsettings.cpp, slotfuncdia.cpp, slotfuncdia.h,
sourcetemplateinterfaceimpl.cpp, sourcetemplateinterfaceimpl.h,
browser.cpp, browser.h, common.cpp, defdialog.ui, hierarchyview.h,
listeditor.cpp, mainfilesettings.h, markerwidget.h, perleditor.cpp,
perleditor.pro, pqtapiprocess.cpp,
projectsettingsinterfaceimpl.cpp, projectsettingsinterfaceimpl.h,
variabledialog.ui, images/editslots.png, images/folder.png,
interfaces/actioninterface.h, interfaces/classbrowserinterface.h,
interfaces/designerinterface.h, interfaces/editorinterface.h,
interfaces/filterinterface.h, interfaces/interpreterinterface.h,
interfaces/languageinterface.h, interfaces/preferenceinterface.h,
interfaces/programinterface.h, interfaces/projectsettingsiface.h,
interfaces/sourcetemplateiface.h, interfaces/templatewizardiface.h,
interfaces/widgetinterface.h:
Initial revision
2003-05-22 04:58 germaingarand
* puic/: form.cpp, subclassing.cpp:
- support for the Designer's PerlQt plugin
- patch by Terrence (Terry) Fleury <tfleury@ncsa.uiuc.edu>
for incluson of "Use" directives (also supported by the plugin, and stored
in the same structure)
- DESTROY really ought to call SUPER->DESTROY
2003-05-11 01:41 germaingarand
* puic/: widgetdatabase.cpp, widgetdatabase.h:
-updated the widget database (fix for #731881)
2003-04-15 23:03 germaingarand
* doc/: en/PerlQt.pod, en/index.html, fr/PerlQt.pod, fr/index.html:
-documenting new marshallers
2003-04-15 22:43 germaingarand
* configure.in, PerlQt/Qt.pm:
bumping version number to 3.007
2003-04-15 16:07 germaingarand
* PerlQt/: handlers.cpp, Qt.pm, smokeperl.h:
- added 8 marshallers for Q*List classes:
QWidgetList, QCanvasItemList, QObjectList, QPtrList<QTab>, QPtrList<QToolBar>,
QPtrList<QDockWindow>, QPtrList<QNetworkOperation>, QFileInfoList
2003-04-15 16:04 germaingarand
* smoke/qt/Makefile.am:
bumping revision number
2003-04-15 16:02 germaingarand
* kalyptus/kalyptusCxxToSmoke.pm:
disabling 3 template derived classes, now handled by marshallers
2003-04-06 16:40 germaingarand
* admin/: Doxyfile.am, Doxyfile.global, acinclude.m4.in, am_edit,
cvs.sh, debianrules, detect-autoconf.sh, Makefile.common,
libtool.m4.in, nmcheck:
updating admin dir
2003-03-08 19:03 germaingarand
* PerlQt/bin/pqtsh:
disable strict in eval
2003-03-03 14:37 germaingarand
* puic/: main.cpp, object.cpp:
skip 'database' property (doesn't exist anymore), thanks to Michael Traxler for pointing that one
2003-02-22 13:43 germaingarand
* puic/object.cpp:
temporary font objects where incorrect
2003-02-22 13:05 germaingarand
* puic/uic.cpp:
+ else if ( attrib == "resizeable" || attrib == "resizable" )
2003-02-19 17:14 germaingarand
* Makefile.PL:
getting rid of Automake dependancy
2003-02-19 17:01 germaingarand
* PerlQt/bin/pqtsh:
- redirect STDOUT/STDERR to shell window (patch by Stéphane Payrard<stef@payrard.net>)
- fixed troubles with line breaks and Qt-3.1
- discard empty lines on save
2003-02-19 13:44 germaingarand
* smoke/qt/Makefile.am, smoke/qt/generate.pl.in,
smoke/qt/qtguess.pl.in, kalyptus/kalyptus,
kalyptus/kalyptusCxxToSmoke.pm:
getting rid of GNU toolchain dependancy at last :)

@ -0,0 +1,44 @@
Though this package uses GNU's Autoconf framework,
it is recommended to use the Makefile.PL wrapper
to drive the ./configure script.
perl Makefile.PL [options]
make
make test
su -c 'make install'
=====
Custom important options :
--prefix=<path to KDE3 root directory, or final install prefix>
--with-qt-dir=<path to QT3 root directory>
--without-Mesa : when detecting OpenGL support, check for a proprietary GL
library (e.g NVidia) and not for the MesaGL library.
--disable-GL : do not compile OpenGL classes into the Smoke interface
library
--enable-smoke : force generation and compilation of the Smoke library,
even if it has been detected on your system
--with-threshold=<0..15> : set the lever of standardness of your Qt
library. Default is 10, which is reasonable.
If your Qt library is very customized, and you
experience missing symbols in libsmokeqt.so,
set this to zero (paranoid level).
====
See doc/en/index.html for installation procedure, requirements and
detailed tutorial.
See also PerlQt/tutorials and PerlQt/examples to get started.

@ -0,0 +1,139 @@
#!/usr/bin/perl -w
#
# This Makefile.PL is an interface to ./configure intended to be used
# by automatic CPAN builds. It just checks that some needed environment
# variables are set and eventually tries to guess their value...
#
# You should use it instead of the ./configure program ;
# it accepts the same options.
#
use strict;
my $libname = "libqt-mt.so";
my @prefix = ('/usr', '/usr/local');
my $res="";
my %p;
my @alt;
exec "./configure --help" if grep /^-?-h(elp)?$/, @ARGV;
unless ($ENV{'QTDIR'} or grep /--with-qt-dir/, @ARGV)
{
print "\n!!!!!!!!!!!! WARNING !!!!!!!!!!!!\n".
" Your QTDIR environment variable is not set and you\n".
"did not use the '--with-qt-dir=' commandline option.\n".
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n";
print "Nevermind, I'll try to guess Qt's location.\n";
sleep(6);
for(@prefix)
{
my $stdpath = $_."/lib/qt3/lib";
if(-s $stdpath."/$libname")
{
push @alt, glob($stdpath."/$libname*");
print "Found what looks like a Qt-3 tree in $_/lib/qt3\n";
sleep(1);
}
}
unless (@alt)
{
@alt=`locate $libname 2>/dev/null`;
if(!check_exit_status($?) || !@alt)
{
print "mmh... locate did not help. We'll try a find then.\n";
sleep(2);
print "Scanning local file system (ctrl-c to abort)...\n";
@alt=`find / -name "$libname*" 2>/dev/null`;
}
}
if(!check_exit_status($?) || !@alt)
{
print "Still no luck... I'll give up and let ./configure work it out\n";
}
elsif(@alt>1)
{
print "We have several answers. I'll try to discriminate a bit...\n";
sleep(3);
for(@alt) { /(.*)\/lib\// and $p{$1}++ }
if(keys %p == 1)
{
$res = each %p;
}
else
{
my ($ver,$tmp)=(0,0);
for(@alt)
{
/$libname(?:\.(\d+))?(?:\.(\d+))?(?:\.(\d+))?$/o;
$tmp = (($1?$1:0)*100)+(($2?$2:0)*10)+($3?$3:0);
if($tmp>=$ver)
{
$ver = $tmp;
$res = (/(.*)\/lib\//)[0]
}
}
$res = each %p if keys %p ==1;
}
print $res?"OK. We can try --with-qt-dir=$res.\n":"No, that's too fuzzy. I'll give up and let ./configure decide.\n";
}
else
{
($res=$alt[0])=~s|(.*)/lib/.*|$1|;
print "Fine. We'll try with --with-qt-dir=$res.\n";
}
sleep(3);
}
unshift(@ARGV, "--with-qt-dir=$res") if $res;
unless ($ENV{'KDEDIR'} or grep /--prefix/, @ARGV)
{
print "\n!!!!!!!!!!!! WARNING !!!!!!!!!!!!\n".
" Your KDEDIR environment variable is not set and you\n".
"did not use the '--prefix=' commandline option.\n";
print "KDE-3 isn't required at all. However, if it's installed on your system,\n".
"it is much better to specify it's location since PerlQt uses (or build, if\n".
"it can't find it) a KDE library named smokeqt.\n";
print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n";
sleep(5);
}
print "\nNow starting ./configure ...\n\n";
exec join " ", "./configure", @ARGV;
#--------------------------------------------------------------#
sub check_exit_status
{
my $a = 0xFFFF & shift;
if( !$a )
{
return 1;
}
elsif( $a == 0xFF00 )
{
#die "\nSystem call failed: $!\n";
}
elsif( $a > 0x80 )
{
# non-zero status.
}
else
{
if( $a & 0x80 )
{
#die "\nProgram coredumped with signal ". ($a & ~0x80);
}
die "\nProgram interrupted by signal $a\n";
}
return 0;
}

@ -0,0 +1,33 @@
SUBDIRS = $(TOPSUBDIRS)
EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO Makefile.cvs test.pl Makefile.PL inst-apps smoke/smoke.h smoke/Makefile.in smoke/Makefile.am smoke/qt/qtguess.pl.in smoke/qt/generate.pl.in smoke/qt/qt_smoke.h smoke/qt/generate_makefile_am.pl smoke/qt/Makefile.am smoke/qt/Makefile.in smoke/qt/header_list kalyptus/Ast.pm kalyptus/kalyptus kalyptus/kalyptusDataDict.pm kalyptus/kdocParseDoc.pm kalyptus/Version kalyptus/ChangeLog kalyptus/kdocUtil.pm kalyptus/kdocAstUtil.pm kalyptus/README kalyptus/Iter.pm kalyptus/kalyptusCxxToSmoke.pm kalyptus/kdocLib.pm kalyptus/TODO doc/en/index.html doc/en/Makefile doc/en/PerlQt.pod doc/fr/index.html doc/fr/Makefile doc/fr/PerlQt.pod doc/css/pod.css doc/images/ex1.png doc/images/ex2.png doc/images/pqtsh.png
# not a GNU package. You can remove this line, if
# have all needed files, that a GNU package needs
AUTOMAKE_OPTIONS = foreign
# $(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 = subdirs configure.in acinclude.m4 configure.files
package-messages:
$(MAKE) -f admin/Makefile.common package-messages
$(MAKE) -C po merge
dist-hook:
cd $(top_distdir) && perl admin/am_edit -padmin
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
test:
cd $(top_distdir) && LD_LIBRARY_PATH="../../smoke/qt/.libs:@qt_libraries@" PERL_DL_NONLAZY=1 perl test.pl
ChangeLog:
perl cvs2cl.pl -P -S --no-wrap -f ChangeLog.CVS

@ -0,0 +1,14 @@
all:
@echo "This Makefile is only for the CVS repository"
@echo "This will be deleted before making the distribution"
@echo ""
@if test ! -d admin; then \
echo "Please recheckout this module!" ;\
echo "for cvs: use checkout once and after that update again" ;\
echo "for cvsup: checkout kde-common from cvsup and" ;\
echo " link kde-common/admin to ./admin" ;\
exit 1 ;\
fi
$(MAKE) -f admin/Makefile.common cvs
.SILENT:

@ -0,0 +1,709 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision: 1.3 $
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTODIRS = @AUTODIRS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONF_FILES = @CONF_FILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@
KDE_HAVE_GL = @KDE_HAVE_GL@
KDE_INCLUDES = @KDE_INCLUDES@
KDE_LDFLAGS = @KDE_LDFLAGS@
KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@
KDE_MT_LIBS = @KDE_MT_LIBS@
KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@
KDE_PLUGIN = @KDE_PLUGIN@
KDE_RPATH = @KDE_RPATH@
KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@
KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@
KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@
KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@
KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@
KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@
LDFLAGS = @LDFLAGS@
LIBCOMPAT = @LIBCOMPAT@
LIBCRYPT = @LIBCRYPT@
LIBDL = @LIBDL@
LIBJPEG = @LIBJPEG@
LIBOBJS = @LIBOBJS@
LIBPNG = @LIBPNG@
LIBPTHREAD = @LIBPTHREAD@
LIBRESOLV = @LIBRESOLV@
LIBS = @LIBS@
LIBSM = @LIBSM@
LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LIBUCB = @LIBUCB@
LIBUTIL = @LIBUTIL@
LIBZ = @LIBZ@
LIB_POLL = @LIB_POLL@
LIB_QPE = @LIB_QPE@
LIB_QT = @LIB_QT@
LIB_X11 = @LIB_X11@
LIB_XEXT = @LIB_XEXT@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MOC = @MOC@
NOOPT_CFLAGS = @NOOPT_CFLAGS@
NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
QTE_NORTTI = @QTE_NORTTI@
QT_INCLUDES = @QT_INCLUDES@
QT_LDFLAGS = @QT_LDFLAGS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TOPSUBDIRS = @TOPSUBDIRS@
UIC = @UIC@
UIC_TR = @UIC_TR@
USER_INCLUDES = @USER_INCLUDES@
USER_LDFLAGS = @USER_LDFLAGS@
USE_EXCEPTIONS = @USE_EXCEPTIONS@
USE_RPATH = @USE_RPATH@
USE_RTTI = @USE_RTTI@
USE_THREADS = @USE_THREADS@
VERSION = @VERSION@
WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_INCLUDES = @X_INCLUDES@
X_LDFLAGS = @X_LDFLAGS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
kde_includes = @kde_includes@
kde_libraries = @kde_libraries@
kde_qtver = @kde_qtver@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
qt_includes = @qt_includes@
qt_libraries = @qt_libraries@
qt_test_threshold = @qt_test_threshold@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
x_includes = @x_includes@
x_libraries = @x_libraries@
SUBDIRS = $(TOPSUBDIRS)
EXTRA_DIST = admin AUTHORS COPYING ChangeLog INSTALL README TODO Makefile.cvs test.pl Makefile.PL inst-apps smoke/smoke.h smoke/Makefile.in smoke/Makefile.am smoke/qt/qtguess.pl.in smoke/qt/generate.pl.in smoke/qt/qt_smoke.h smoke/qt/generate_makefile_am.pl smoke/qt/Makefile.am smoke/qt/Makefile.in smoke/qt/header_list kalyptus/Ast.pm kalyptus/kalyptus kalyptus/kalyptusDataDict.pm kalyptus/kdocParseDoc.pm kalyptus/Version kalyptus/ChangeLog kalyptus/kdocUtil.pm kalyptus/kdocAstUtil.pm kalyptus/README kalyptus/Iter.pm kalyptus/kalyptusCxxToSmoke.pm kalyptus/kdocLib.pm kalyptus/TODO doc/en/index.html doc/en/Makefile doc/en/PerlQt.pod doc/fr/index.html doc/fr/Makefile doc/fr/PerlQt.pod doc/css/pod.css doc/images/ex1.png doc/images/ex2.png doc/images/pqtsh.png
# not a GNU package. You can remove this line, if
# have all needed files, that a GNU package needs
AUTOMAKE_OPTIONS = foreign
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = PerlQt/Makefile.PL
DIST_SOURCES =
#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
#>- ps-recursive install-info-recursive uninstall-info-recursive \
#>- all-recursive install-data-recursive install-exec-recursive \
#>- installdirs-recursive install-recursive uninstall-recursive \
#>- check-recursive installcheck-recursive
#>+ 5
#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
#>- ps-recursive install-info-recursive uninstall-info-recursive \
#>- all-recursive install-data-recursive install-exec-recursive \
#>- installdirs-recursive install-recursive uninstall-recursive \
#>- check-recursive installcheck-recursive nmcheck-recursive
#>+ 5
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive nmcheck-recursive bcheck-recursive
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
Makefile.in TODO acinclude.m4 aclocal.m4 admin/ChangeLog \
admin/compile admin/config.guess admin/config.sub admin/depcomp \
admin/install-sh admin/ltmain.sh admin/missing \
admin/mkinstalldirs admin/ylwrap config.h.in configure \
configure.in
DIST_SUBDIRS = $(SUBDIRS)
#>- all: config.h
#>+ 1
all: docs-am config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && \
#>- $(AUTOMAKE) --foreign Makefile
#>+ 3
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): configure.in acinclude.m4
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOHEADER)
touch $(srcdir)/config.h.in
distclean-hdr:
-rm -f config.h stamp-h1
PerlQt/Makefile.PL: $(top_builddir)/config.status $(top_srcdir)/PerlQt/Makefile.PL.in
cd $(top_builddir) && $(SHELL) ./config.status $@
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
#>+ 4
KDE_DIST=cvs2cl.pl stamp-h.in subdirs ChangeLog.CVS.delta ChangeLog.CVS
DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)
top_distdir = .
distdir = $(PACKAGE)-$(VERSION)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
distdir: $(DISTFILES)
$(am__remove_distdir)
mkdir $(distdir)
$(mkinstalldirs) $(distdir)/PerlQt $(distdir)/admin $(distdir)/doc/css $(distdir)/doc/en $(distdir)/doc/fr $(distdir)/doc/images $(distdir)/kalyptus $(distdir)/smoke $(distdir)/smoke/qt
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all: distdir
$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
$(am__remove_distdir)
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && $(mkinstalldirs) "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
&& rm -f $(distdir).tar.gz \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@echo "$(distdir).tar.gz is ready for distribution" | \
sed 'h;s/./=/g;p;x;p;x'
distuninstallcheck:
cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
#>- clean: clean-recursive
#>+ 1
clean: kde-rpo-clean clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am:
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf autom4te.cache
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive ctags \
ctags-recursive dist dist-all dist-gzip distcheck distclean \
distclean-generic distclean-hdr distclean-libtool \
distclean-recursive distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am dvi-recursive info info-am \
info-recursive install install-am install-data install-data-am \
install-data-recursive install-exec install-exec-am \
install-exec-recursive install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
tags-recursive uninstall uninstall-am uninstall-info-am \
uninstall-info-recursive uninstall-recursive
# $(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
package-messages:
$(MAKE) -f admin/Makefile.common package-messages
$(MAKE) -C po merge
dist-hook:
cd $(top_distdir) && perl admin/am_edit -padmin
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
test:
cd $(top_distdir) && LD_LIBRARY_PATH="../../smoke/qt/.libs:@qt_libraries@" PERL_DL_NONLAZY=1 perl test.pl
ChangeLog:
perl cvs2cl.pl -P -S --no-wrap -f ChangeLog.CVS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#>+ 2
docs-am:
#>+ 6
force-reedit:
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/Makefile.in
#>+ 5
bcheck: bcheck-recursive
bcheck-am:
#>+ 2
final:
$(MAKE) all-am
#>+ 2
final-install:
$(MAKE) install-am
#>+ 2
no-final:
$(MAKE) all-am
#>+ 2
no-final-install:
$(MAKE) install-am
#>+ 3
cvs-clean:
$(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean
#>+ 3
kde-rpo-clean:
-rm -f *.rpo
#>+ 3
nmcheck:
nmcheck-am: nmcheck

@ -0,0 +1,82 @@
PerlQt is distributed under the GPL. Development is coordinated on the
kde-perl@mail.kde.org mailing-list. To subscribe, visit
http://mail.kde.org/mailman/listinfo/kde-perl or send a subscribe message
to kde-perl-request@mail.kde.org. Please send patches and bug reports
to the mailing-list.
This file contains instructions for downloading and building the SmokeQt
library and PerlQt. PerlQt is not a direct Perl interface to the Qt
library, but is rather an interface to the SmokeQt library generated by
Kalyptus.
The programs+version I use, but not necessarily required:
Linux (oddly enough, most of the developers use Mandrake)
Perl-5.6.0 or above (tested up to 5.8.0-RC1)
Qt-3.0.1 or above (untested with 3.0.0, should work though)
automake-1.5 (KDE requires recent automake)
autoconf-2.53 (KDE requires recent autoconf)
Make sure your $QTDIR environment-variable is set.
I'm sorry for all the requirements, but you *are* getting this from
CVS. Release versions will be much easier and more independant.
First, you need to download the development environment for smokeqt.
Please use compression for cvs downloads ('cvs -z4' in .cvsrc).
$ export CVSROOT=:pserver:anonymous@anoncvs.kde.org:/home/kde
$ cvs login # no password
$ cvs co -l kdebindings # downloads configure/makefile stubs
$ cvs co kdebindings/kalyptus # for generating smoke files from scratch
$ cvs co kdebindings/smoke # pre-generated smoke library
$ cd kdebindings # kdebindings/
$ cvs co admin # get kde build tools
At this point, you now have the full smokeqt environment. The
pre-generated smoke library is based off KDE's copy of Qt-3.0.4. I have
Qt-3.0.1, so I have to re-generate the files to match my installed
version of Qt. Here's how to do it.
$ cd smoke/qt # kdebindings/smoke/qt/
$ perl ./qtguess.pl # simple script to find disabled Qt features
$ perl ./generate.pl # calls kalyptus which generates code
Now you have the SmokeQt source-code generated for your personal Qt
configuration. Here's how to compile.
$ cd ../.. # kdebindings/
$ make -f Makefile.cvs # create ./configure, will croak but succeed
$ ./configure # use --prefix or whatever options you want
$ cd smoke # kdebindings/smoke/
$ make # this should succeed
$ make install # will install to --prefix from configure
Okay, you now have libsmokeqt installed on your system. You can now
compile PerlQt. First, get the latest version of PerlQt-3.
$ export CVSROOT=:pserver:anonymous@cvs.perlqt.sf.net:/cvsroot/perlqt
$ cvs login # no password
$ cvs co PerlQt-3
$ cd PerlQt-3 # PerlQt-3/
If you installed libsmokeqt in a non-standard library path, you will
need to edit Makefile.PL and add -L/your/lib/path to the LIBS
parameter. If any of the other options in Makefile.PL need changing for
your system, you will need to change it now.
$ perl Makefile.PL
$ make
Now PerlQt is built on your system. To test it out:
$ cd tutorials # PerlQt-3/tutorials/
$ perl runall.pl
All 14 tutorials should run in order. As you close one program out by
clicking Quit or the window close button, the next should start. If all 14
tutorials run without error and work like the C++ version, PerlQt is built
correctly and you can make install if you wish. If an error occurs which
you can't fix, contact the kde-perl mailing list and make a bug report.
Good luck,
Ashley Winters <qaqortog@nwlink.com>

@ -0,0 +1,82 @@
INSTALL
MANIFEST
Makefile.PL.in
Qt.pm
Qt.xs
Qt.pod
bin/pqtapi
bin/pqtsh
examples/aclock/AnalogClock.pm
examples/aclock/aclock.pl
examples/buttongroups/ButtonsGroups.pm
examples/buttongroups/buttongroups.pl
examples/dclock/DigitalClock.pm
examples/dclock/dclock.pl
examples/drawdemo/drawdemo.pl
examples/drawlines/drawlines.pl
examples/forever/forever.pl
examples/network/httpd/httpd.pl
examples/opengl/README
examples/opengl/box/GLBox.pm
examples/opengl/box/glbox
examples/opengl/gear/gear
examples/progress/progress.pl
examples/richedit/imageCollection.pm
examples/richedit/richedit.pl
handlers.cpp
lib/Qt/attributes.pm
lib/Qt/debug.pm
lib/Qt/enumerations.pm
lib/Qt/isa.pm
lib/Qt/constants.pm
lib/Qt/properties.pm
lib/Qt/signals.pm
lib/Qt/slots.pm
lib/Qt/GlobalSpace.pm
marshall.h
perlqt.h
smokeperl.cpp
smokeperl.h
t/My/Codec.pm
t/My/SubCodec.pm
t/Foo/SubCodec.pm
t/a_loading.t
t/b_nogui.t
t/c_qapp.t
t/ca_i18n.t
t/d_sigslot.t
t/e_sigslot_inherit.t
t/f_import.t
t/g_gui.t
tutorials/runall.pl
tutorials/t1/t1.pl
tutorials/t10/CannonField.pm
tutorials/t10/LCDRange.pm
tutorials/t10/t10.pl
tutorials/t11/CannonField.pm
tutorials/t11/LCDRange.pm
tutorials/t11/t11.pl
tutorials/t12/CannonField.pm
tutorials/t12/LCDRange.pm
tutorials/t12/t12.pl
tutorials/t13/CannonField.pm
tutorials/t13/GameBoard.pm
tutorials/t13/LCDRange.pm
tutorials/t13/t13.pl
tutorials/t14/CannonField.pm
tutorials/t14/GameBoard.pm
tutorials/t14/LCDRange.pm
tutorials/t14/t14.pl
tutorials/t2/t2.pl
tutorials/t3/t3.pl
tutorials/t4/t4.pl
tutorials/t5/t5.pl
tutorials/t6/t6.pl
tutorials/t7/LCDRange.pm
tutorials/t7/t7.pl
tutorials/t8/CannonField.pm
tutorials/t8/LCDRange.pm
tutorials/t8/t8.pl
tutorials/t9/CannonField.pm
tutorials/t9/LCDRange.pm
tutorials/t9/t9.pl

@ -0,0 +1,223 @@
### do not edit Makefile.PL, edit Makefile.PL.in
use Config;
use File::Spec;
use strict;
my %x;
$x{'prefix'} = '@prefix@';
$x{'exec_prefix'}='@exec_prefix@';
$x{'libdir'} = '@libdir@';
$x{'datadir'} = '@datadir@';
$x{'qt_libraries'} = '@qt_libraries@';
$x{'LIBPNG'} = '@LIBPNG@';
$x{'LIBJPEG'} = '@LIBJPEG@';
$x{'LIBSM'} = '@LIBSM@';
$x{'LIBSOCKET'} = '@LIBSOCKET@';
$x{'LIBRESOLV'} = '@LIBRESOLV@';
$x{'LIB_X11'} = '@LIB_X11@';
$x{'X_PRE_LIBS'} = '@X_PRE_LIBS@';
interpolate('LIB_X11', 'exec_prefix', 'libdir', 'datadir');
my $objects='Qt$(OBJ_EXT) handlers$(OBJ_EXT)';
my $qtlib ='@LIB_QT@';
interpolate(\$qtlib);
my $rpath='@USE_RPATH@';
my $cxx = '@CXX@';
my $sh= '@SHELL@';
my $topdir= '@top_builddir@';
if($^O =~ /solaris/i && $cxx eq 'CC') {
# we have Forte/Sunworkshop on Solaris
# do we build only static libs?
my $only_static = 0;
foreach(`$topdir/libtool --config 2>&1`) {
/^build_libtool_libs=no/ && $only_static++;
/^build_old_libs=yes/ && $only_static++;
}
# ...then add the C++ runtime lib
$qtlib .= ' -lCrun' if($only_static == 2);
}
my $libtool = File::Spec->catfile( $topdir, "libtool" );
my $devnull = File::Spec->devnull();
my $libtool_rpath = `$libtool --mode=link $cxx -o foo.so foo.o -R $x{'libdir'} -R $x{'qt_libraries'} 2>${devnull}`;
$libtool_rpath = "" unless $libtool_rpath =~ s/.*foo.so foo.o//s;
chomp $libtool_rpath;
$rpath = $rpath eq "yes" ?
($libtool_rpath ?
$libtool_rpath :
('@CXX@' eq 'g++' ?
"-Wl,--rpath -Wl,$x{'libdir'} -Wl,--rpath -Wl,$x{'qt_libraries'}" : ""
)
) : "";
my @scripts = ("bin/pqtsh", "bin/pqtapi");
my $cxxflags = '@CXXFLAGS@';
$cxxflags =~ s/ -pedantic / /g;
$cxxflags =~ s/ -Wwrite-strings / /g;
$cxxflags =~ s/ -Wall / /g;
my $doc_dir_glob;
###
use ExtUtils::MakeMaker;
use Cwd;
my $pwd = getcwd;
my @pwd = File::Spec->splitdir( $pwd );
pop @pwd;
my $abs_topdir = File::Spec->catdir(@pwd);
my $localsmoke = File::Spec->catdir($abs_topdir,"smoke","qt",".libs");
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'Qt',
'VERSION_FROM' => 'Qt.pm', # finds $VERSION
'PREREQ_PM' => {}, # e.g., Module::Name => 1.1,
'INC' => '@all_includes@ -I. -I../smoke',
'LIBS' => ['@all_libraries@'." -L$localsmoke -lsmokeqt ".'@LIBCRYPT@'." $qtlib"],
# 'XS' => {'Qt.xs' => 'Qt.cpp'}, # does not work ... still expects Qt.c
'XSOPT' => "-C++",
'OBJECT' => "$objects", # Object files
'CC' => '@CXX@',
# use the CC/g++ utility to link if linking is done with cc/gcc
($Config{ld} =~ /cc/ ? (
'LD' => '@CXX@'
) : ()),
'INST_BIN' => './bin',
'DEFINE' => $cxxflags,
'H' => ["marshall.h", "perlqt.h", "smokeperl.h"],
'ABSTRACT' => "An OO interface to Trolltech's Qt toolkit",
'dynamic_lib' => {'OTHERLDFLAGS' => $rpath},
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(
AUTHOR => 'Ashley Winters <qaqortog@nwlink.com>') : ()),
);
sub MY::clean {
package MY;
my $i = shift->SUPER::clean(@_);
my $pl = '$(PERL) Makefile.PL';
$i =~ s/\n+$/\n\t$pl$&/s;
$i;
}
sub MY::const_loadlibs {
package MY;
my $i = shift->SUPER::const_loadlibs(@_);
# hacks for linking against a non-yet-installed smoke
$i =~ s/((?:EXTRALIBS|LDLOADLIBS).*?)\n/$1 -L$localsmoke -lsmokeqt\n/gs unless $i =~/-lsmokeqt/;
$i =~ s#(LD_RUN_PATH.*?)(${localsmoke})?\n#"$1".($2?"":":")."$x{'libdir'}\n"#se;
$i;
}
sub MY::dist {
package MY;
my $i = shift->SUPER::dist(@_);
$i =~ s#(DISTVNAME =).*?\n#$1 \$(distdir)\n#s;
$i;
}
sub MY::install {
package MY;
my $i = shift->SUPER::install(@_);
my $lng = $ENV{LANG};
my $doc_dir = "/usr/share/doc/libqt-perl/tutorial";
my $src= File::Spec->catdir(File::Spec->updir, "doc");
my $found = 0;
# for my $l( split(":", $lng) )
# {
# $l =~ s/^(.*?)_.*$/$1/;
# $l = lc($l);
# if( $l and -d File::Spec->catdir( $src, $l ) )
# {
# $src = File::Spec->catdir( $src, $l);
# $found++;
# last;
# }
# }
$i =~ s/^install\s+::\s+all.*$/$& install_my_perlqt_doc/m;
# $src = File::Spec->catdir( $src, "en" ) unless $found;
$i .= "\ninstall_my_perlqt_doc:\n".
"\t\@echo Installing documentation in ${doc_dir}\n".
"\t\@$^X -MExtUtils::Install -MConfig -e \\\n".
"\t\t'install({ \"$src\" => \"\$(PREFIX)/share/doc/libqt-perl/tutorial\" },0,0)' \$(DEV_NULL)\n";
$doc_dir_glob = $doc_dir;
$i;
}
sub interpolate
{
for( @_ )
{
my $r = ref( $_ ) ? $_ : \$x{"$_"};
$$r =~ s/\$\(\s*(.*?)\s*\)/$x{$1}/g;
$$r =~ s/\$\{\s*(.*?)\s*\}/$x{$1}/g;
}
}
#########
for my $s( @scripts )
{
MY->fixin( $s );
chmod 0755, $s;
}
open(IN, ">Qt.pod") or die "couldn't write Qt.pod: $!\n";
print IN <<STOP;
=head1 NAME
PerlQt - Perl interface to the Qt GUI Widget toolkit
=head1 Qt
Given the huge size of the Qt module
(more than 400 classes and 13000 methods)
it doesn't have any formal documentation.
Instead, it provides two introspection tools
=over 4
=item * pqtapi:
a command line PerlQt API introspector
=item * pqtsh:
a graphical PerlQt shell
=back
and a detailed B<tutorial> with comprehensive
explanations.
This is where anyone new to PerlQt
should start.
The tutorial has been originally installed
on this system in C<$doc_dir_glob>, in both B<POD> and
B<HTML> format.
For a complete IDE allowing RAD and visual programming,
check the pqt-designer package.
--- The PerlQt team
http://perlqt.sf.net - PerlQt Project Homepage
=cut
STOP
close IN;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,42 @@
=head1 NAME
PerlQt - Perl interface to the Qt GUI Widget toolkit
=head1 Qt
Given the huge size of the Qt module
(more than 400 classes and 13000 methods)
it doesn't have any formal documentation.
Instead, it provides two introspection tools
=over 4
=item * pqtapi:
a command line PerlQt API introspector
=item * pqtsh:
a graphical PerlQt shell
=back
and a detailed B<tutorial> with comprehensive
explanations.
This is where anyone new to PerlQt
should start.
The tutorial has been originally installed
on this system in C</usr/share/doc/libqt-perl/tutorial>, in both B<POD> and
B<HTML> format.
For a complete IDE allowing RAD and visual programming,
check the pqt-designer package.
--- The PerlQt team
http://perlqt.sf.net - PerlQt Project Homepage
=cut

File diff suppressed because it is too large Load Diff

@ -0,0 +1,82 @@
#!/usr/bin/perl
# Note: this program is part of PerlQt and makes use of its internal functions.
# You should not rely on those in your own programs.
use Getopt::Std;
use strict 'vars';
our (%o, @x, $h);
getopts('r:hvimp', \%o);
package Qt::_internal;
use Qt;
exists $o{'v'} and do{ print "PerlQt-$Qt::VERSION using Qt-".&Qt::version."\n" and exit 0 };
exists $o{'h'} and do{ print $h and exit 0 };
exists $o{'m'} and do{ # interactive mode for driving the Qt Designer Plugin
select(STDOUT); $| = 1; # unbuffered
while(<STDIN>)
{
chomp;
s/^Q(?=[A-Z])/Qt::/;
my $i = find_pclassid( $_ );
print "__START__\n";
if ($i)
{
my $a = findAllMethods( $i );
my $t = dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] );
getAllParents($i, \my @sup);
for my $s(@sup)
{
$a = findAllMethods( $s );
$t.= dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] );
}
$t =~ s/\t//gs;
print $t;
}
print "__END__\n";
}
};
(my $c = $ARGV[0]) =~ s/^Q(?=[A-Z])/Qt::/;
my $i = $c ? find_pclassid( $c ) : 1;
my $r = exists $o{'r'} ? (exists $o{'i'} ? qr|$o{'r'}|i : qr|$o{'r'}|) : 0;
my $d = "";
while ($i)
{
my $a=findAllMethods($i);
last unless keys %$a;
@x=map {@{ $$a{$_} }} sort keys %$a;
$d = dumpCandidates(\@x);
if($c and $i and exists $o{'p'})
{
getAllParents($i, \my @sup);
for my $s(@sup)
{
$a = findAllMethods( $s );
$d.= dumpCandidates( [map {@{ $$a{$_} }} sort keys %$a] );
}
}
if($r)
{
map { print "$_\n" if $_=~$r } split("\n", $d);
}
else
{
print $d
}
$c and last;
$i++
}
BEGIN {
$h = "pqtapi - a PerlQt introspection tool\t(c) Germain Garand 2003 <germain\@ebooksfrance.org>\n\n".
"usage: pqtapi [-r <re>] [<class>]\n\n".
"options:\n".
"\t-r <re> : find all functions matching regular expression/keyword <re>\n".
"\t-i : together with -r, performs a case insensitive search\n".
"\t-p : display also inherited methods for <class>.\n".
"\t-v : print PerlQt and Qt versions\n".
"\t-h : print this help message\n";
}

@ -0,0 +1,675 @@
#!/usr/bin/perl
# pqtsh : a graphical shell for PerlQt.
#
# author: Germain Garand <germain@ebooksfrance.org>
# license: GNU Public License v2
#
use utf8;
use strict 'vars';
package QtShellControl;
use Qt;
use Qt::isa qw(Qt::MainWindow);
use Qt::slots
fileOpen => [],
fileSave => [],
fileSaveAs => [],
filePrint => [],
fileExit => [],
helpExample => [];
use Qt::signals
fileNeedsEval => [QString];
use Qt::attributes qw(
menubar
fileMenu
helpMenu
toolBar
fileName
fileOpenAction
fileSaveAction
fileSaveAsAction
filePrintAction
fileExitAction
helpExampleAction
comboBox
sessionLog
executedLines
printer
);
our $image0_data =
["22 22 7 1",
". c None",
"# c #000000",
"b c #292c29",
"c c #5a5d5a",
"d c #838583",
"e c #c5c2c5",
"a c #ffffff",
"......................",
"....##########........",
"....#aaaaaaa#b#.......",
"....#aaaaaaa#cb#......",
"....#aaaaaaa#dcb#.....",
"....#aaaaaaa#edcb#....",
"....#aaaaaaa#aedcb#...",
"....#aaaaaaa#######...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....#aaaaaaaaaaaaa#...",
"....###############...",
"......................",
"......................"];
our $image1_data =
["22 22 5 1",
". c None",
"# c #000000",
"c c #838100",
"a c #ffff00",
"b c #ffffff",
"......................",
"......................",
"......................",
"............####....#.",
"...........#....##.##.",
"..................###.",
".................####.",
".####...........#####.",
"#abab##########.......",
"#babababababab#.......",
"#ababababababa#.......",
"#babababababab#.......",
"#ababab###############",
"#babab##cccccccccccc##",
"#abab##cccccccccccc##.",
"#bab##cccccccccccc##..",
"#ab##cccccccccccc##...",
"#b##cccccccccccc##....",
"###cccccccccccc##.....",
"##cccccccccccc##......",
"###############.......",
"......................"];
our $image2_data =
["22 22 5 1",
". c None",
"# c #000000",
"a c #838100",
"b c #c5c2c5",
"c c #cdb6d5",
"......................",
".####################.",
".#aa#bbbbbbbbbbbb#bb#.",
".#aa#bbbbbbbbbbbb#bb#.",
".#aa#bbbbbbbbbcbb####.",
".#aa#bbbccbbbbbbb#aa#.",
".#aa#bbbccbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aa#bbbbbbbbbbbb#aa#.",
".#aaa############aaa#.",
".#aaaaaaaaaaaaaaaaaa#.",
".#aaaaaaaaaaaaaaaaaa#.",
".#aaa#############aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
".#aaa#########bbb#aa#.",
"..##################..",
"......................"];
our $image3_data =
["22 22 88 2",
"Qt c None",
".2 c #000000",
".S c #08ff08",
"#v c #100810",
".U c #101010",
"#c c #101018",
".M c #181018",
"#e c #181818",
".A c #181820",
".L c #201820",
"#l c #202020",
".z c #202029",
"#m c #292029",
"#u c #292829",
"#n c #292831",
".R c #29ff29",
"#o c #312831",
".T c #313031",
"#p c #313039",
".Z c #31ff31",
"#q c #393039",
"#t c #393839",
".y c #393841",
"#s c #413841",
".o c #414041",
"#h c #4a4852",
".n c #5a505a",
"#r c #5a5962",
".I c #5ace5a",
"#b c #6a616a",
".p c #6a696a",
".x c #6a6973",
".Y c #6aff62",
".l c #736973",
".t c #7b717b",
".s c #7b7183",
".0 c #7bff7b",
".r c #837983",
".u c #83798b",
"#g c #83858b",
".v c #8b7994",
"#i c #8b858b",
".w c #8b8594",
"#j c #8b8d8b",
".8 c #8b8d94",
".m c #948d94",
"#k c #948d9c",
"#f c #949594",
".q c #94959c",
".J c #94c694",
"#d c #9c959c",
"#a c #9c95a4",
".k c #9c9d9c",
".N c #9c9da4",
".H c #9ccea4",
".K c #a49da4",
"#. c #a49dac",
".i c #a4a5a4",
".3 c #a4a5ac",
"## c #ac9dac",
".V c #aca5ac",
".d c #acaeac",
".j c #acaeb4",
".9 c #b4aeb4",
".# c #b4b6b4",
".a c #bdbebd",
".7 c #bdd6bd",
".c c #c5c6c5",
".5 c #cdc6cd",
".b c #cdcecd",
".4 c #cdced5",
".F c #d5ced5",
".G c #d5cede",
".h c #d5d6d5",
".E c #d5d6de",
".Q c #d5ffd5",
".B c #ded6de",
".1 c #ded6e6",
".g c #dedede",
".D c #dedee6",
".6 c #e6dee6",
".f c #e6e6e6",
".C c #e6e6ee",
".X c #e6ffe6",
".O c #eee6ee",
".e c #eeeeee",
".W c #f6f6f6",
".P c #ffffff",
"QtQtQtQtQtQt.#.a.b.b.b.b.c.c.a.a.d.aQtQtQtQt",
"QtQtQtQtQtQt.a.e.f.f.f.f.f.e.e.e.g.aQtQtQtQt",
"QtQtQtQtQtQt.a.c.c.c.b.b.c.c.c.c.a.cQtQtQtQt",
"QtQtQtQtQtQt.#.a.a.a.a.#.a.a.#.#.d.aQtQtQtQt",
"QtQtQtQtQt.c.d.c.a.c.c.c.a.a.a.c.#QtQtQtQtQt",
"QtQtQtQtQt.a.a.#.a.a.a.a.a.a.c.c.#QtQtQtQtQt",
"QtQtQtQtQt.a.#.c.a.a.a.a.a.c.a.c.dQtQtQtQtQt",
"QtQtQtQtQt.c.a.a.a.a.a.a.a.a.a.a.#QtQtQtQtQt",
"QtQtQtQtQt.d.b.f.g.g.g.g.g.g.h.g.i.i.jQtQtQt",
"QtQtQt.a.k.l.#.h.b.h.b.h.b.h.g.g.m.n.o.p.#Qt",
"QtQt.a.q.r.s.t.t.t.t.t.t.t.u.v.w.x.y.z.A.o.i",
"Qt.a.k.B.C.D.B.E.E.E.E.F.G.H.I.J.K.o.L.L.M.y",
".a.N.O.P.P.P.P.P.P.P.P.P.Q.R.S.R.b.v.T.A.U.L",
".V.W.P.P.P.P.P.P.P.P.P.P.X.Y.Z.0.P.1.t.A.2.L",
".3.E.4.5.4.h.E.E.g.6.D.B.D.E.7.F.4.5.8.M.2.A",
".m.9.j.V.3#..3.K#.#..i#..K#.###a.q.8#b#c.2.L",
".m.j.j#..3.K.K.K.N.K.N.N.N.N#a#d#d.w#b#c.2#e",
"#f#.#..K.N.K.N.N.N#a.k#a#d#d#d#a.m#g#b.M.2#h",
".m.3.K.K#a.k#a#d#a.k#a#d#a#d.q.m.8#i.x#c#e.d",
"#f#g#i.w#j.w#i.8.w#i.8.8.m.8.m#k.8.w#b#e#fQt",
".#.l.z.A#l.z#m#m#m#n#o#o#p#p#q#q#p#o#p#fQtQt",
"QtQt.d#r#s#s#t#p.T.T.T#u#u.z#e#e#v.o.kQtQtQt"];
sub NEW
{
shift->SUPER::NEW(@_);
my $image0 = Qt::Pixmap($image0_data);
my $image1 = Qt::Pixmap($image1_data);
my $image2 = Qt::Pixmap($image2_data);
my $image3 = Qt::Pixmap($image3_data);
my $box = VBox(this);
sessionLog = TextEdit($box, "sessionLog");
sessionLog->setTextFormat(Qt::RichText());
sessionLog->setReadOnly(1);
comboBox = ComboBox($box, "comboBox");
comboBox->setEditable(1);
comboBox->setAutoCompletion(1);
this->setCentralWidget($box);
comboBox->setFocus;
this->resize(500,300);
setCaption("PerlQt Shell");
# fileNewAction= Qt::Action(this, "fileNewAction");
# fileNewAction->setIconSet(Qt::IconSet($image0));
# fileNewAction->setText(trUtf8("New"));
# fileNewAction->setMenuText(trUtf8("&New"));
# fileNewAction->setAccel(KeySequence(trUtf8("Ctrl+N")));
fileOpenAction= Qt::Action(this, "fileOpenAction");
fileOpenAction->setIconSet(Qt::IconSet($image1));
fileOpenAction->setText(trUtf8("Open"));
fileOpenAction->setMenuText(trUtf8("&Open..."));
fileOpenAction->setAccel(KeySequence(trUtf8("Ctrl+O")));
fileSaveAction= Qt::Action(this, "fileSaveAction");
fileSaveAction->setIconSet(Qt::IconSet($image2));
fileSaveAction->setText(trUtf8("Save"));
fileSaveAction->setMenuText(trUtf8("&Save"));
fileSaveAction->setAccel(KeySequence(trUtf8("Ctrl+S")));
fileSaveAsAction= Qt::Action(this, "fileSaveAsAction");
fileSaveAsAction->setText(trUtf8("Save As"));
fileSaveAsAction->setMenuText(trUtf8("Save &As..."));
fileSaveAsAction->setAccel(KeySequence(trUtf8("Ctrl+A")));
filePrintAction= Qt::Action(this, "filePrintAction");
filePrintAction->setIconSet(Qt::IconSet($image3));
filePrintAction->setText(trUtf8("Print"));
filePrintAction->setMenuText(trUtf8("&Print..."));
filePrintAction->setAccel(KeySequence(trUtf8("Ctrl+P")));
fileExitAction= Qt::Action(this, "fileExitAction");
fileExitAction->setText(trUtf8("Exit"));
fileExitAction->setMenuText(trUtf8("E&xit"));
fileExitAction->setAccel(KeySequence(trUtf8("Ctrl+E")));
helpExampleAction= Qt::Action(this, "helpExampleAction");
helpExampleAction->setText(trUtf8("Example"));
helpExampleAction->setMenuText(trUtf8("Examp&le"));
helpExampleAction->setAccel(KeySequence(trUtf8("Ctrl+L")));
toolBar = Qt::ToolBar("", this, DockTop());
toolBar->setLabel(trUtf8("Tools"));
fileOpenAction->addTo(toolBar);
fileSaveAction->addTo(toolBar);
filePrintAction->addTo(toolBar);
menubar= Qt::MenuBar( this, "menubar");
fileMenu= Qt::PopupMenu(this);
# fileNewAction->addTo(fileMenu);
fileOpenAction->addTo(fileMenu);
fileSaveAction->addTo(fileMenu);
fileSaveAsAction->addTo(fileMenu);
fileMenu->insertSeparator;
filePrintAction->addTo(fileMenu);
fileMenu->insertSeparator;
fileExitAction->addTo(fileMenu);
menubar->insertItem(trUtf8("&File"), fileMenu);
menubar->insertSeparator;
helpMenu= Qt::PopupMenu(this);
helpExampleAction->addTo(helpMenu);
menubar->insertItem(trUtf8("&Help"), helpMenu);
# Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()");
Qt::Object::connect(fileOpenAction, SIGNAL "activated()", this, SLOT "fileOpen()");
Qt::Object::connect(fileSaveAction, SIGNAL "activated()", this, SLOT "fileSave()");
Qt::Object::connect(fileSaveAsAction, SIGNAL "activated()", this, SLOT "fileSaveAs()");
Qt::Object::connect(filePrintAction, SIGNAL "activated()", this, SLOT "filePrint()");
Qt::Object::connect(fileExitAction, SIGNAL "activated()", this, SLOT "fileExit()");
Qt::Object::connect(helpExampleAction, SIGNAL "activated()", this, SLOT "helpExample()");
executedLines = [];
}
#sub fileNew
#{
# print "Form1->fileNew(): Not implemented yet.\n";
#}
sub fileOpen
{
my $fn = Qt::FileDialog::getOpenFileName(
".",
"Pqtsh Session (*.pqts)",
this,
"open session",
"Choose a file to open" );
$fn or return;
emit fileNeedsEval($fn);
}
sub getFileName
{
fileName = Qt::FileDialog::getSaveFileName(
".",
"Pqtsh Session (*.pqts)",
this,
"save session",
"Choose a filename" );
fileName !~ /\.pqts$/ and fileName = fileName . ".pqts";
return fileName;
}
sub save
{
my $fn = shift;
open( OUT, ">$fn") or do {
Qt::MessageBox::critical(
this,
"Error" ,
"Couldn't open $fn for writing: $!",
&Qt::MessageBox::Ok,
&Qt::MessageBox::NoButton );
return
};
for (@{ &executedLines })
{
next if /^\s*$/;
chomp;
$_ .= ";" unless /;\s*$/;
print OUT $_, "\n"
}
close OUT
}
sub fileSave
{
emptySession() and return;
my $fn = fileName || getFileName();
$fn or return;
save($fn)
}
sub fileSaveAs
{
emptySession() and return;
my $fn;
my ($cond, $doit);
AGAIN:
{
$fn = getFileName();
$fn or return;
if( -e $fn )
{
$cond++;
$doit = Qt::MessageBox::warning(
this,
"Warning" ,
"File exists, overwrite ?",
&Qt::MessageBox::Yes,
&Qt::MessageBox::No );
}
else
{ $cond = 0 }
}
goto AGAIN if $cond and $doit == &Qt::MessageBox::No;
save($fn)
}
sub filePrint
{
my $Margin = 10;
my $pageNo = 1;
emptySession() and return;
printer = Qt::Printer unless printer;
if ( printer->setup(this) ) {
statusBar()->message( "Printing..." );
my $p = Qt::Painter;
if( !$p->begin( printer ) )
{
statusBar()->message( "An error occured..." );
return
}
$p->setFont( sessionLog->font() );
my $yPos = 0;
my $fm = $p->fontMetrics;
my $metrics = Qt::PaintDeviceMetrics( printer );
for( my $i = 0 ; $i < @{ &executedLines } ; $i++ ) {
if ( $Margin + $yPos > $metrics->height() - $Margin ) {
my $msg ="Printing (page ". ++$pageNo . ")...";
statusBar()->message( $msg );
printer->newPage();
$yPos = 0;
}
$p->drawText( $Margin, $Margin + $yPos,
$metrics->width(), $fm->lineSpacing(),
&ExpandTabs | &DontClip,
${ &executedLines }[ $i ] );
$yPos = $yPos + $fm->lineSpacing();
}
$p->end();
statusBar()->message( "Printing completed", 3000 );
} else {
statusBar()->message( "Printing aborted", 3000 );
}
}
sub fileExit
{
emit Qt::app()->quit() if confirmExit();
}
sub closeEvent
{
my $e = shift;
if(confirmExit())
{
$e->accept
}
else
{
$e->ignore
}
}
sub confirmExit
{
my $doit;
if(@{ &executedLines })
{
$doit = Qt::MessageBox::warning(
this,
"Warning" ,
"A session is opened, quit anyway ?",
&Qt::MessageBox::Yes,
&Qt::MessageBox::No );
}
else
{ return 1 }
return (($doit == &Qt::MessageBox::No) ? 0 : 1);
}
sub emptySession
{
unless (@{ &executedLines })
{
statusBar()->message("Session is empty...", 3000);
return 1;
}
0
}
sub helpExample
{
emit fileNeedsEval("__DATA__")
}
1;
package QtShell;
use Qt;
use Qt::isa qw(Qt::MainWindow);
use Qt::slots
evalInput=>[],
evalFile=>[QString];
use Qt::attributes qw(
shellWindow
);
use QtShellControl;
sub NEW
{
shift->SUPER::NEW(@_);
shellWindow = QtShellControl(undef, "shellWindow");
this->resize(350,350);
this->move(Point(10,10));
shellWindow->move(Point(300,200));
this->show;
shellWindow->show;
this->connect(shellWindow->comboBox->lineEdit, SIGNAL 'returnPressed()', SLOT 'evalInput()');
this->{'prompt'} = '<b><font color="blue">$&gt;</font></b>';
setCaption("MainWindow - this");
shellWindow->sessionLog->setText("Ready.<br>");
Qt::Object::connect(shellWindow, SIGNAL 'fileNeedsEval(QString)', this, SLOT 'evalFile(QString)');
}
sub logAppend
{
shellWindow->sessionLog->setText( shellWindow->sessionLog->text . shift )
}
sub evalInput
{
evalOneLine( shellWindow->comboBox->currentText );
}
sub evalOneLine
{
my $prot = my $ln = shift;
$prot =~ s/</&lt;/gs;
$prot =~ s/>/&gt;/gs;
logAppend( this->{'prompt'}. "$prot<br>" );
{
no strict;
eval $ln;
}
if($@)
{
my $prot = $@ ;
$prot =~ s/</&lt;/gs;
$prot =~ s/>/&gt;/gs;
my $c = shellWindow->sessionLog->color;
$prot =~ s/\n/<br>/gs;
logAppend('<font color="red">'.$prot.'</font><br>');
shellWindow->sessionLog->setColor( $c );
}
else
{
push @{ shellWindow()->{'executedLines'} }, $ln;
shellWindow->comboBox->clearEdit;
shellWindow->comboBox->setFocus;
}
shellWindow->sessionLog->scrollToBottom
}
sub evalFile
{
my $fn = shift;
my $fh;
if($fn eq "__DATA__")
{
$fh = \*::DATA
}
else
{
open($fh, $fn) or do {
Qt::MessageBox::warning (
this,
"Error" ,
"Couldn't open $fn: $!",
&Qt::MessageBox::Ok,
&Qt::MessageBox::NoButton );
return
};
}
while(<$fh>)
{
evalOneLine($_)
}
close $fh
}
1;
package Qt::TextHandle;
sub TIEHANDLE { my ( $classnm, $widg, $color) = @_;
my $h = { widg => $widg, color => $color};
bless $h, $classnm;
}
sub PRINT {
my $me = shift;
my $color = $me->{color};
my $printed = join $/, @_;
$printed =~ s/</&lt;/gs;
$printed =~ s/>/&gt;/gs;
$printed =~ s/\n/<br>/gs;
$me->{widg}->setText( $me->{widg}->text . "<font color=\"$color\">$printed</font>" );
}
sub PRINTF { shift->PRINT(sprintf shift, @_); }
sub CLOSE { shift->UNTIE; }
sub UNTIE { }
1;
package main;
use strict;
use Qt;
use QtShell;
use Qt::debug;
my $app = Qt::Application(\@ARGV);
my $w = QtShell(undef, "mainWindow");
my $shw = $w->shellWindow;
$app->setMainWidget($shw);
tie *STDOUT, 'Qt::TextHandle', $shw->sessionLog, 'black';
tie *STDERR, 'Qt::TextHandle', $shw->sessionLog, 'red';
exit $app->exec;
__DATA__
statusBar()->message("Hello World !");
use Qt::attributes qw|datetime button textedit sample vbox| ;
vbox = VBox(this);
datetime = DateTimeEdit(vbox);
textedit = Qt::TextEdit(vbox);
button = PushButton("Hello World!", vbox) ;
this->setCentralWidget(vbox);
resize(220,240);
vbox->show;
sample = Qt::PopupMenu( this );
use Qt::slots 'there' => [];
sample->insertItem("&There", this, SLOT 'there()');
menuBar()->insertItem("&Here", sample);
sub there { statusBar()->message("There...", 2000) };

@ -0,0 +1,137 @@
package AnalogClock;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
setTime => ['const QTime&'],
drawClock => ['QPainter*'],
timeout => [];
use Qt::attributes qw(
clickPos
_time
);
#
# Constructs an analog clock widget that uses an internal QTimer
#
sub NEW {
shift->SUPER::NEW(@_);
_time = Qt::Time::currentTime(); # get current time
my $internalTimer = Qt::Timer(this); # create internal timer
this->connect($internalTimer, SIGNAL('timeout()'), SLOT('timeout()'));
$internalTimer->start(5000); # emit signal every 5 seconds
}
sub mousePressEvent {
my $e = shift;
if(isTopLevel()) {
# Lack of operators is really noticable here
my $topLeft = Qt::Point(
geometry()->topLeft->x - frameGeometry()->topLeft->x,
geometry()->topLeft->y - frameGeometry()->topLeft->y
);
clickPos = Qt::Point($e->pos->x + $topLeft->x,
$e->pos->y + $topLeft->y);
}
}
sub mouseMoveEvent {
my $e = shift;
if(isTopLevel()) {
move(Qt::Point($e->globalPos->x - clickPos->x,
$e->globalPos->y - clickPos->y));
}
}
sub setTime {
my $t = shift;
timeout();
}
#
# The QTimer::timeout() signal is received by this slot.
#
sub timeout {
my $new_time = Qt::Time::currentTime(); # get the current time
_time = _time->addSecs(5);
if($new_time->minute != _time->minute) { # minute has changed
if(autoMask()) {
updateMask();
} else {
update();
}
}
}
sub paintEvent {
return if autoMask();
my $paint = Qt::Painter(this);
$paint->setBrush(colorGroup()->foreground);
drawClock($paint);
}
# If clock is transparent, we use updateMask()
# instead of paintEvent()
sub updateMask { # paint clock mask
my $bm = Qt::Bitmap(size());
$bm->fill(&color0); # transparent
my $paint = Qt::Painter;
$paint->begin($bm, this);
$paint->setBrush(&color1); # use non-transparent color
$paint->setPen(&color1);
drawClock($paint);
$paint->end;
setMask($bm);
}
#
# The clock is painted using a 1000x1000 square coordinate system, in
# the centered square, as big as possible. The painter's pen and
# brush colors are used.
#
sub drawClock {
my $paint = shift;
$paint->save;
$paint->setWindow(-500,-500, 1000,1000);
my $v = $paint->viewport;
my $d = min($v->width, $v->height);
$paint->setViewport($v->left + ($v->width-$d)/2,
$v->top - ($v->height-$d)/2, $d, $d);
# _time = Qt::Time::currentTime();
my $pts = Qt::PointArray();
$paint->save;
$paint->rotate(30*(_time->hour%12-3) + _time->minute/2);
$pts->setPoints([-20,0, 0,-20, 300,0, 0,20]);
$paint->drawConvexPolygon($pts);
$paint->restore;
$paint->save;
$paint->rotate((_time->minute-15)*6);
$pts->setPoints([-10,0, 0,-10, 400,0, 0,10]);
$paint->drawConvexPolygon($pts);
$paint->restore;
for(1 .. 12) {
$paint->drawLine(440,0, 460,0);
$paint->rotate(30);
}
$paint->restore;
}
sub setAutoMask {
my $b = shift;
setBackgroundMode($b ? &PaletteForeground : &PaletteBackground);
Qt::Widget::setAutoMask($b);
}
1;

@ -0,0 +1,13 @@
#!/usr/bin/perl -w
use strict;
use Qt;
use AnalogClock;
my $a = Qt::Application(\@ARGV);
my $clock = AnalogClock;
$clock->setAutoMask(1) if @ARGV and $ARGV[0] eq '-transparent';
$clock->resize(100, 100);
$a->setMainWidget($clock);
$clock->setCaption("PerlQt example - Analog Clock");
$clock->show;
exit $a->exec;

@ -0,0 +1,104 @@
package ButtonsGroups;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
slotChangeGrp3State => [];
use Qt::attributes qw(
state
rb21
rb22
rb23
);
#
# Constructor
#
# Creates all child widgets of the ButtonGroups window
#
sub NEW {
shift->SUPER::NEW(@_);
# Create Widgets which allow easy layouting
my $vbox = Qt::VBoxLayout(this);
my $box1 = Qt::HBoxLayout($vbox);
my $box2 = Qt::HBoxLayout($vbox);
# ------- first group
# Create an exclusive button group
my $bgrp1 = Qt::ButtonGroup(1, &Horizontal, "Button Group &1 (exclusive)", this);
$box1->addWidget($bgrp1);
$bgrp1->setExclusive(1);
# insert 3 radiobuttons
Qt::RadioButton("R&adiobutton 2", $bgrp1);
Qt::RadioButton("Ra&diobutton 3", $bgrp1);
# ------- second group
# Create a non-exclusive buttongroup
my $bgrp2 = Qt::ButtonGroup(1, &Horizontal, "Button Group &2 (non-exclusive)", this);
$box1->addWidget($bgrp2);
$bgrp2->setExclusive(0);
# insert 3 checkboxes
Qt::CheckBox("&Checkbox 1", $bgrp2);
my $cb12 = Qt::CheckBox("C&heckbox 2", $bgrp2);
$cb12->setChecked(1);
my $cb13 = Qt::CheckBox("Triple &State Button", $bgrp2);
$cb13->setTristate(1);
$cb13->setChecked(1);
# ----------- third group
# create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons
my $bgrp3 = Qt::ButtonGroup(1, &Horizontal, "Button Group &3 (Radiobutton-exclusive)", this);
$box2->addWidget($bgrp3);
$bgrp3->setRadioButtonExclusive(1);
# insert three radiobuttons
rb21 = Qt::RadioButton("Rad&iobutton 1", $bgrp3);
rb22 = Qt::RadioButton("Radi&obutton 2", $bgrp3);
rb23 = Qt::RadioButton("Radio&button 3", $bgrp3);
rb23->setChecked(1);
# insert a checkbox
state = Qt::CheckBox("E&nable Radiobuttons", $bgrp3);
state->setChecked(1);
# ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State()
this->connect(state, SIGNAL('clicked()'), SLOT('slotChangeGrp3State()'));
# ----------- fourth group
# create a groupbox which layouts its childs in a columns
my $bgrp4 = Qt::ButtonGroup(1, &Horizontal, "Groupbox with &normal buttons", this);
$box2->addWidget($bgrp4);
# insert three pushbuttons...
Qt::PushButton("&Push Button", $bgrp4);
my $tb2 = Qt::PushButton("&Toggle Button", $bgrp4);
my $tb3 = Qt::PushButton("&Flat Button", $bgrp4);
# ... and make the second one a toggle button
$tb2->setToggleButton(1);
$tb2->setOn(1);
# ... and make the third one a flat button
$tb3->setFlat(1);
}
#
# SLOT slotChangeGrp3State()
#
# enables/disables the radiobuttons of the third buttongroup
#
sub slotChangeGrp3State {
rb21->setEnabled(state->isChecked);
rb22->setEnabled(state->isChecked);
rb23->setEnabled(state->isChecked);
}
1;

@ -0,0 +1,13 @@
#!/usr/bin/perl -w
use strict;
use Qt;
use ButtonsGroups;
my $a = Qt::Application(\@ARGV);
my $buttonsgroups = ButtonsGroups;
$buttonsgroups->resize(500, 250);
$buttonsgroups->setCaption("PerlQt Example - Buttongroups");
$a->setMainWidget($buttonsgroups);
$buttonsgroups->show;
exit $a->exec;

@ -0,0 +1,88 @@
package DigitalClock;
use strict;
use Qt;
use Qt::isa qw(Qt::LCDNumber);
use Qt::slots
stopDate => [],
showTime => [];
use Qt::attributes qw(
showingColon
normalTimer
showDateTimer
);
#
# Constructs a DigitalClock widget
#
sub NEW {
shift->SUPER::NEW(@_);
showingColon = 0;
setFrameStyle(&Panel | &Raised);
setLineWidth(2);
showTime();
normalTimer = startTimer(500);
showDateTimer = -1;
}
#
# Handles timer events and the digital clock widget.
# There are two different timers; one timer for updating the clock
# and another one for switching back from date mode to time mode
#
sub timerEvent {
my $e = shift;
if($e->timerId == showDateTimer) { # stop showing date
stopDate();
} elsif(showDateTimer == -1) { # normal timer
showTime();
}
}
#
# Enters date mode when the left mouse button is pressed
#
sub mousePressEvent {
my $e = shift;
showDate() if $e->button == &LeftButton;
}
#
# Shows the durrent date in the internal lcd widget.
# Fires a timer to stop showing the date.
#
sub showDate {
return if showDateTimer != -1; # already showing date
my $date = Qt::Date::currentDate();
my $s = sprintf("%2d %2d", $date->month, $date->day);
display($s); # sets the LCD number/text
showDateTimer = startTimer(2000); # keep this state for 2 secs
}
#
# Stops showing the date.
#
sub stopDate {
killTimer(showDateTimer);
showDateTimer = -1;
showTime();
}
#
# Shows the current time in the internal lcd widget.
#
sub showTime {
showingColon = !showingColon;
my $s = substr(Qt::Time::currentTime()->toString, 0, 5);
$s =~ s/^0/ /;
$s =~ s/:/ / unless showingColon;
display($s);
}
1;

@ -0,0 +1,12 @@
#!/usr/bin/perl -w
use strict;
use Qt;
use DigitalClock;
my $a = Qt::Application(\@ARGV);
my $clock = DigitalClock;
$clock->resize(170, 80);
$a->setMainWidget($clock);
$clock->setCaption("PerlQt Example - Digital Clock");
$clock->show;
exit $a->exec;

@ -0,0 +1,198 @@
#!/usr/bin/perl -w
use strict;
package DrawView;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
updateIt => ['int'],
printIt => [];
use Qt::attributes qw(
printer
bgroup
_print
drawindex
maxindex
);
#
# First we define the functionality our demo should present
# to the user. You might add different demo-modes if you wish so
#
#
# This function draws a color wheel.
# The coordinate system x=(0..500), y=(0..500) spans the paint device.
#
sub drawColorWheel {
my $p = shift;
my $f = Qt::Font("times", 18, &Qt::Font::Bold);
$p->setFont($f);
$p->setPen(&black);
$p->setWindow(0, 0, 500, 500); # defines coordinate system
for my $i (0..35) {
my $matrix = Qt::WMatrix;
$matrix->translate(250.0, 250.0); # move to center
$matrix->shear(0.0, 0.3); # twist it
$matrix->rotate($i*10.0); # rotate 0,10,20,.. degrees
$p->setWorldMatrix($matrix); # use this world matrix
my $c = Qt::Color;
$c->setHsv($i*10, 255, 255); # rainbow effect
$p->setBrush($c); # solid fill with color $c
$p->drawRect(70, -10, 80, 10); # draw the rectangle
my $n = sprintf "H=%d", $i*10;
$p->drawText(80+70+5, 0, $n); # draw the hue number
}
}
#
# This function draws a few lines of text using different fonts.
#
sub drawFonts {
my $p = shift;
my @fonts = qw(Helvetica Courier Times);
my @sizes = (10, 12, 18, 24, 36);
my $y = 0;
for my $f (@fonts) {
for my $s (@sizes) {
my $font = Qt::Font($f, $s);
$p->setFont($font);
my $fm = $p->fontMetrics;
$y += $fm->ascent;
$p->drawText(10, $y, "Quartz Glyph Job Vex'd Cwm Finks");
$y += $fm->descent;
}
}
}
#
# This function draws some shapes
#
sub drawShapes {
my $p = shift;
my $b1 = Qt::Brush(&blue);
my $b2 = Qt::Brush(&green, &Dense6Pattern); # green 12% fill
my $b3 = Qt::Brush(&NoBrush); # void brush
my $b4 = Qt::Brush(&CrossPattern); # black cross pattern
$p->setPen(&red);
$p->setBrush($b1);
$p->drawRect(10, 10, 200, 100);
$p->setBrush($b2);
$p->drawRoundRect(10, 150, 200, 100, 20, 20);
$p->setBrush($b3);
$p->drawEllipse(250, 10, 200, 100);
$p->setBrush($b4);
$p->drawPie(250, 150, 200, 100, 45*16, 90*16);
}
our @drawFunctions = (
# title presented to user, reference to the function
{ name => "Draw color wheel", f => \&drawColorWheel },
{ name => "Draw fonts" , f => \&drawFonts },
{ name => "Draw shapes" , f => \&drawShapes },
);
#
# Construct the DrawView with buttons.
#
sub NEW {
shift->SUPER::NEW(@_);
setCaption("PerlQt Draw Demo Application");
setBackgroundColor(&white);
# Create a button group to contain all buttons
bgroup = Qt::ButtonGroup(this);
bgroup->resize(200, 200);
this->connect(bgroup, SIGNAL('clicked(int)'), SLOT('updateIt(int)'));
# Calculate the size for the radio buttons
my $maxwidth = 80;
my $maxheight = 10;
my $fm = bgroup->fontMetrics;
for my $i (0 .. $#drawFunctions) {
my $n = $drawFunctions[$i]{name};
my $w = $fm->width($n);
$maxwidth = max($w, $maxwidth);
}
$maxwidth += 30;
for my $i (0 .. $#drawFunctions) {
my $n = $drawFunctions[$i]{name};
my $rb = Qt::RadioButton($n, bgroup);
$rb->setGeometry(10, $i*30+10, $maxwidth, 30);
$maxheight += 30;
$rb->setChecked(1) unless $i;
$i++;
}
$maxheight += 10;
drawindex = 0;
maxindex = scalar @drawFunctions;
$maxwidth += 20;
bgroup->resize($maxwidth, $maxheight);
printer = Qt::Printer;
_print = Qt::PushButton("Print...", bgroup);
_print->resize(80, 30);
_print->move($maxwidth/2 - _print->width/2, maxindex*30+20);
this->connect(_print, SIGNAL('clicked()'), SLOT('printIt()'));
bgroup->resize($maxwidth, _print->y+_print->height+10);
resize(640,300);
}
sub updateIt {
my $index = shift;
if($index < maxindex) {
drawindex = $index;
update();
}
}
sub drawIt {
my $p = shift;
$drawFunctions[drawindex]{f}->($p);
}
sub printIt {
if(printer->setup(this)) {
my $paint = Qt::Painter(printer);
drawIt($paint);
}
}
sub paintEvent {
my $paint = Qt::Painter(this);
drawIt($paint);
}
sub resizeEvent {
bgroup->move(int(width() - bgroup->width), int(0));
}
package main;
use Qt;
use DrawView;
my $app = Qt::Application(\@ARGV);
my $draw = DrawView;
$app->setMainWidget($draw);
$draw->setCaption("PerlQt Example - Drawdemo");
$draw->show;
exit $app->exec;

@ -0,0 +1,74 @@
#!/usr/bin/perl -w
use strict;
package ConnectWidget;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::attributes qw(
points
colors
count
down
);
use constant MAXPOINTS => 2000;
use constant MAXCOLORS => 40;
#
# Constructs a ConnectWidget.
#
sub NEW {
shift->SUPER::NEW(@_[0,1], &WStaticContents);
setBackgroundColor(&white);
count = 0;
down = 0;
points = [];
my @colors;
for(1 .. MAXCOLORS) {
push @colors, Qt::Color(rand(255), rand(255), rand(255));
}
colors = \@colors;
}
sub paintEvent {
my $paint = Qt::Painter(this);
for(my $i = 0; $i < count-1; $i++) {
for(my $j = $i+1; $j < count; $j++) {
$paint->setPen(colors->[rand(MAXCOLORS)]);
$paint->drawLine(points->[$i], points->[$j]);
}
}
}
sub mousePressEvent {
down = 1;
count = 0;
points = [];
erase();
}
sub mouseReleaseEvent {
down = 0;
update();
}
sub mouseMoveEvent {
my $e = shift;
if(down && count < MAXPOINTS) {
my $paint = Qt::Painter(this);
push @{this->points}, Qt::Point($e->pos);
count++;
$paint->drawPoint($e->pos);
}
}
package main;
use Qt;
use ConnectWidget;
my $a = Qt::Application(\@ARGV);
my $connect = ConnectWidget;
$connect->setCaption("PerlQt Example - Draw lines");
$a->setMainWidget($connect);
$connect->show;
exit $a->exec;

@ -0,0 +1,59 @@
#!/usr/bin/perl -w
use strict;
package Forever;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
updateCaption => [];
use Qt::attributes qw(
rectangles
colors
);
use constant numColors => 120;
sub NEW {
shift->SUPER::NEW(@_);
colors = \my @colors;
for(my $a = 0; $a < numColors; $a++) {
push @colors, Qt::Color(rand(255), rand(255), rand(255));
}
rectangles = 0;
startTimer(0);
my $counter = Qt::Timer(this);
this->connect($counter, SIGNAL('timeout()'), SLOT('updateCaption()'));
$counter->start(1000);
}
sub updateCaption {
my $s = sprintf "PerlQt Example - Forever - %d rectangles/second", rectangles;
rectangles = 0;
setCaption($s);
}
sub paintEvent {
my $paint = Qt::Painter(this);
my $w = width();
my $h = height();
return if $w <= 0 || $h <= 0;
$paint->setPen(&NoPen);
$paint->setBrush(colors->[rand(numColors)]);
$paint->drawRect(rand($w), rand($h), rand($w), rand($h));
}
sub timerEvent {
for(my $i = 0; $i < 100; $i++) {
repaint(0);
rectangles++;
}
}
package main;
use Qt;
use Forever;
my $a = Qt::Application(\@ARGV);
my $always = Forever;
$a->setMainWidget($always);
$always->setCaption("PerlQt Example - Forever");
$always->show;
exit $a->exec;

@ -0,0 +1,140 @@
#!/usr/bin/perl -w
## This program is based on an example program for Qt. It
## may be used, distributed and modified without limitation.
##
## Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
# When a new client connects, the server constructs a Qt::Socket and all
# communication with the client is done over this Socket object. Qt::Socket
# works asynchronously - this means that all the communication is done
# through the two slots readClient() and discardClient().
package HttpDaemon;
use Qt;
use Qt::isa qw(Qt::ServerSocket);
use Qt::signals
newConnect => [],
endConnect => [],
wroteToClient => [];
use Qt::slots
readClient => [],
discardClient => [];
use Qt::attributes qw(
sockets
);
sub NEW
{
shift->SUPER::NEW(8080, 1, $_[0]);
if( !this->ok() )
{
die "Failed to bind to port 8080\n";
}
sockets = {};
}
sub newConnection
{
my $s = Qt::Socket( this );
this->connect( $s, SIGNAL 'readyRead()', this, SLOT 'readClient()' );
this->connect( $s, SIGNAL 'delayedCloseFinished()', this, SLOT 'discardClient()' );
$s->setSocket( shift );
sockets->{ $s } = $s;
emit newConnect();
}
sub readClient
{
# This slot is called when the client sent data to the server. The
# server looks if it was a get request and sends a very simple HTML
# document back.
my $s = sender();
if ( $s->canReadLine() )
{
my @tokens = split( /\s\s*/, $s->readLine() );
if ( $tokens[0] eq "GET" )
{
my $string = "HTTP/1.0 200 Ok\n\rContent-Type: text/html; charset=\"utf-8\"\n\r".
"\n\r<h1>Nothing to see here</h1>\n";
$s->writeBlock($string, length($string));
$s->close();
emit wroteToClient();
}
}
}
sub discardClient
{
my $s = sender();
sockets->{$s} = 0;
emit endConnect();
}
1;
# HttpInfo provides a simple graphical user interface to the server and shows
# the actions of the server.
package HttpInfo;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots
newConnect => [],
endConnect => [],
wroteToClient => [];
use Qt::attributes qw(
httpd
infoText
);
use HttpDaemon;
sub NEW
{
shift->SUPER::NEW(@_);
httpd = HttpDaemon( this );
my $port = httpd->port();
my $itext = "This is a small httpd example.\n".
"You can connect with your\n".
"web browser to port $port\n";
my $lb = Label( $itext, this );
$lb->setAlignment( &AlignHCenter );
infoText = TextView( this );
my $quit = PushButton( "quit" , this );
this->connect( httpd, SIGNAL 'newConnect()', SLOT 'newConnect()' );
this->connect( httpd, SIGNAL 'endConnect()', SLOT 'endConnect()' );
this->connect( httpd, SIGNAL 'wroteToClient()', SLOT 'wroteToClient()' );
this->connect( $quit, SIGNAL 'pressed()', Qt::app(), SLOT 'quit()' );
}
sub newConnect
{
infoText->append( "New connection" );
}
sub endConnect
{
infoText->append( "Connection closed\n\n" );
}
sub wroteToClient
{
infoText->append( "Wrote to client" );
}
1;
package main;
use Qt;
use HttpInfo;
my $app = Qt::Application(\@ARGV);
my $info = HttpInfo;
$app->setMainWidget($info);
$info->show;
exit $app->exec;

@ -0,0 +1,12 @@
Before you can run the OpenGL examples, you need to install
the OpenGL module available on CPAN (http://www.cpan.org)
Latest version is 0.54, as of 09/11/02
Both Smoke and Qt must also have been compiled with OpenGL support.
If your Qt library has OpenGL support but PerlQt complains about lacking
methods or classes, check ./configure's config.log file for any
error that might have occured while detecting your OpenGL settings.
You might also want to check if OpenGL is properly installed on your system.

@ -0,0 +1,149 @@
package GLBox;
use OpenGL qw(:all);
use strict;
use Qt;
use Qt::isa qw(Qt::GLWidget);
use Qt::slots
setXRotation => ['int'],
setYRotation => ['int'],
setZRotation => ['int'];
use Qt::attributes qw(
xRot
yRot
zRot
scale
object
list
);
sub NEW {
shift->SUPER::NEW(@_);
xRot = yRot = zRot = 0.0;
scale = 1.25;
object = undef;
}
sub paintGL
{
glClear( GL_COLOR_BUFFER_BIT );
glClear( GL_DEPTH_BUFFER_BIT );
glLoadIdentity();
glTranslatef( 0.0, 0.0, -10.0 );
glScalef( scale, scale, scale );
glRotatef( xRot, 1.0, 0.0, 0.0 );
glRotatef( yRot, 0.0, 1.0, 0.0 );
glRotatef( zRot, 0.0, 0.0, 1.0 );
glCallList( object );
}
sub initializeGL
{
qglClearColor( &black ); # Let OpenGL clear to black
object = makeObject(); # Generate an OpenGL display list
glShadeModel( GL_FLAT );
glEnable( GL_DEPTH_TEST );
}
# Set up the OpenGL view port, matrix mode, etc.
sub resizeGL
{
my $w = shift;
my $h = shift;
glViewport( 0, 0, $w, $h );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( -1.0, 1.0, -1.0, 1.0, 5.0, 15.0 );
glMatrixMode( GL_MODELVIEW );
}
# Generate an OpenGL display list for the object to be shown, i.e. the box
sub makeObject
{
my $list = glGenLists( 1 );
glNewList( $list, GL_COMPILE );
qglColor( &darkGreen ); # Shorthand for glColor3f or glIndex
glLineWidth( 2.0 );
glBegin( GL_QUADS );
glVertex3f( 1.0, 0.5, -0.4 );
glVertex3f( 1.0, -0.5, -0.4 );
glVertex3f( -1.0, -0.5, -0.4 );
glVertex3f( -1.0, 0.5, -0.4 );
glEnd();
qglColor( &blue );
glBegin( GL_QUADS );
glVertex3f( 1.0, 0.5, 0.4 );
glVertex3f( 1.0, -0.5, 0.4 );
glVertex3f( -1.0, -0.5, 0.4 );
glVertex3f( -1.0, 0.5, 0.4 );
glEnd();
qglColor( &darkRed );
glBegin( GL_QUAD_STRIP );
glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 );
glVertex3f( 1.0, -0.5, -0.4 ); glVertex3f( 1.0, -0.5, 0.4 );
qglColor( &yellow );
glVertex3f( -1.0, -0.5, -0.4 ); glVertex3f( -1.0, -0.5, 0.4 );
qglColor( &green );
glVertex3f( -1.0, 0.5, -0.4 ); glVertex3f( -1.0, 0.5, 0.4 );
qglColor( &lightGray );
glVertex3f( 1.0, 0.5, -0.4 ); glVertex3f( 1.0, 0.5, 0.4 );
glEnd();
glEndList();
return $list;
}
# Set the rotation angle of the object to \e degrees around the X axis.
sub setXRotation
{
my $deg = shift;
xRot = $deg % 360;
updateGL();
}
# Set the rotation angle of the object to \e degrees around the Y axis.
sub setYRotation
{
my $deg = shift;
yRot = $deg % 360;
updateGL();
}
# Set the rotation angle of the object to \e degrees around the Z axis.
sub setZRotation
{
my $deg = shift;
zRot = $deg % 360;
updateGL();
}
sub DESTROY
{
# makeCurrent();
glDeleteLists( object, 1 );
}
1;

@ -0,0 +1,90 @@
package GLObjectWindow;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::attributes qw(
file
frame
menu
box
xpos
ypos
zpos
);
use GLBox;
sub NEW
{
shift->SUPER::NEW(@_);
# Create a menu
file = Qt::PopupMenu( this );
file->insertItem( "Exit", Qt::app(), SLOT 'quit()', Qt::KeySequence(int &CTRL + &Key_Q ));
# Create a menu bar
menu = Qt::MenuBar( this );
menu->setSeparator( &Qt::MenuBar::InWindowsStyle );
menu->insertItem("&File", file );
# Create a nice frame to put around the OpenGL widget
frame = Qt::Frame( this, "frame" );
frame->setFrameStyle( &Qt::Frame::Sunken | &Qt::Frame::Panel );
frame->setLineWidth( 2 );
# Create our OpenGL widget
box = GLBox( frame, "glbox");
# Create the three sliders; one for each rotation axis
xpos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "xsl" );
xpos->setTickmarks( &Qt::Slider::Left );
Qt::Object::connect( xpos, SIGNAL 'valueChanged(int)', box, SLOT 'setXRotation(int)' );
ypos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "ysl" );
ypos->setTickmarks( &Qt::Slider::Left );
Qt::Object::connect( ypos, SIGNAL 'valueChanged(int)', box, SLOT 'setYRotation(int)' );
zpos = Qt::Slider ( 0, 360, 60, 0, &Qt::Slider::Vertical, this, "zsl" );
zpos->setTickmarks( &Qt::Slider::Left );
Qt::Object::connect( zpos, SIGNAL 'valueChanged(int)', box, SLOT 'setZRotation(int)' );
# Now that we have all the widgets, put them into a nice layout
# Put the sliders on top of each other
my $vlayout = Qt::VBoxLayout( 20, "vlayout");
$vlayout->addWidget( xpos );
$vlayout->addWidget( ypos );
$vlayout->addWidget( zpos );
# Put the GL widget inside the frame
my $flayout = Qt::HBoxLayout( frame, 2, 2, "flayout");
$flayout->addWidget( box, 1 );
# Top level layout, puts the sliders to the left of the frame/GL widget
my $hlayout = Qt::HBoxLayout( this, 20, 20, "hlayout");
$hlayout->setMenuBar( menu );
$hlayout->addLayout( $vlayout );
$hlayout->addWidget( frame, 1 );
}
1;
package main;
use Qt;
use GLObjectWindow;
my $a = Qt::Application(\@ARGV);
my $w = GLObjectWindow;
$w->resize(350,350);
$w->show;
$a->setMainWidget( $w);
exit $a->exec;

@ -0,0 +1,267 @@
#!/usr/bin/perl -w
#
# Draws a gear.
#
# This code is originally from Qt-1.44, by Troll Tech
#
# Portions of this code have been borrowed from Brian Paul's Mesa
# distribution.
#
package GearWidget;
use OpenGL qw(:all);
use Qt;
use Qt::attributes qw(
gear1
gear2
gear3
view_rotx
view_roty
view_rotz
angle
);
use Qt::isa qw(Qt::GLWidget);
#
# Draw a gear wheel. You'll probably want to call this function when
# building a display list since we do a lot of trig here.
#
# Input: inner_radius - radius of hole at center
# outer_radius - radius at center of teeth
# width - width of gear
# teeth - number of teeth
# tooth_depth - depth of tooth
#
sub gear {
my($inner_radius, $outer_radius, $width, $teeth, $tooth_depth) = @_;
my $i;
my($r0, $r1, $r2);
my($angle, $da);
my($u, $v, $len);
$r0 = $inner_radius;
$r1 = $outer_radius - $tooth_depth/2.0;
$r2 = $outer_radius + $tooth_depth/2.0;
my $pi = 3.141592654;
$da = 2.0*$pi / $teeth / 4.0;
glShadeModel(GL_FLAT);
glNormal3f(0.0, 0.0, 1.0);
# draw front face
glBegin(GL_QUAD_STRIP);
for $i (0 .. $teeth) {
$angle = $i * 2.0*$pi / $teeth;
glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5);
glVertex3f($r1*cos($angle), $r1*sin($angle), $width*0.5);
glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5);
glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), $width*0.5);
}
glEnd();
# draw front sides of teeth
glBegin(GL_QUADS);
$da = 2.0*$pi / $teeth / 4.0;
for $i (0 .. $teeth-1) {
$angle = $i * 2.0*$pi / $teeth;
glVertex3f($r1*cos($angle), $r1*sin($angle), $width*0.5);
glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), $width*0.5);
glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), $width*0.5);
glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), $width*0.5);
}
glEnd();
glNormal3f(0.0, 0.0, -1.0);
# draw back face
glBegin(GL_QUAD_STRIP);
for $i (0 .. $teeth) {
$angle = $i * 2.0*$pi / $teeth;
glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5);
glVertex3f($r0*cos($angle), $r0*sin($angle), -$width*0.5);
glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), -$width*0.5);
glVertex3f($r0*cos($angle), $r0*sin($angle), -$width*0.5);
}
glEnd();
# draw back sides of teeth
glBegin(GL_QUADS);
$da = 2.0*$pi / $teeth / 4.0;
for $i (0 .. $teeth-1) {
$angle = $i * 2.0*$pi / $teeth;
glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), -$width*0.5);
glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), -$width*0.5);
glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), -$width*0.5);
glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5);
}
glEnd();
# draw outward faces of teeth
glBegin(GL_QUAD_STRIP);
for $i (0 .. $teeth-1) {
$angle = $i * 2.0*$pi / $teeth;
glVertex3f($r1*cos($angle), $r1*sin($angle), $width*0.5);
glVertex3f($r1*cos($angle), $r1*sin($angle), -$width*0.5);
$u = $r2*cos($angle+$da) - $r1*cos($angle);
$v = $r2*sin($angle+$da) - $r1*sin($angle);
$len = sqrt($u*$u + $v*$v);
$u /= $len;
$v /= $len;
glNormal3f($v, -$u, 0.0);
glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), $width*0.5);
glVertex3f($r2*cos($angle+$da), $r2*sin($angle+$da), -$width*0.5);
glNormal3f(cos($angle), sin($angle), 0.0);
glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), $width*0.5);
glVertex3f($r2*cos($angle+2*$da), $r2*sin($angle+2*$da), -$width*0.5);
$u = $r1*cos($angle+3*$da) - $r2*cos($angle+2*$da);
$v = $r1*sin($angle+3*$da) - $r2*sin($angle+2*$da);
glNormal3f($v, -$u, 0.0);
glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), $width*0.5);
glVertex3f($r1*cos($angle+3*$da), $r1*sin($angle+3*$da), -$width*0.5);
glNormal3f(cos($angle), sin($angle), 0.0);
}
glVertex3f($r1*cos(0.0), $r1*sin(0.0), $width*0.5);
glVertex3f($r1*cos(0.0), $r1*sin(0.0), -$width*0.5);
glEnd();
glShadeModel(GL_SMOOTH);
# draw inside radius cylinder
glBegin(GL_QUAD_STRIP);
for $i (0 .. $teeth) {
$angle = $i * 2.0*$pi / $teeth;
glNormal3f(-cos($angle), -sin($angle), 0.0);
glVertex3f($r0*cos($angle), $r0*sin($angle), -$width*0.5);
glVertex3f($r0*cos($angle), $r0*sin($angle), $width*0.5);
}
glEnd();
}
sub draw {
angle += 2.0;
view_roty += 1.0;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
glRotatef(view_rotx, 1.0, 0.0, 0.0);
glRotatef(view_roty, 0.0, 1.0, 0.0);
glRotatef(view_rotz, 0.0, 0.0, 1.0);
glPushMatrix();
glTranslatef(-3.0, -2.0, 0.0);
glRotatef(angle, 0.0, 0.0, 1.0);
glCallList(gear1);
glPopMatrix();
glPushMatrix();
glTranslatef(3.1, -2.0, 0.0);
glRotatef(-2.0*angle-9.0, 0.0, 0.0, 1.0);
glCallList(gear2);
glPopMatrix();
glPushMatrix();
glTranslatef(-3.1, 2.2, -1.8);
glRotatef(90.0, 1.0, 0.0, 0.0);
glRotatef(2.0*angle-2.0, 0.0, 0.0, 1.0);
glCallList(gear3);
glPopMatrix();
glPopMatrix();
}
sub NEW {
shift->SUPER::NEW(@_);
this->startTimer(10);
view_rotx = 20.0;
view_roty = 30.0;
view_rotz = 0.0;
angle = 0.0;
}
sub initializeGL {
my $pos = [ 5.0, 5.0, 10.0, 1.0 ];
my $red = [ 0.8, 0.1, 0.0, 1.0 ];
my $green = [ 0.0, 0.8, 0.2, 1.0 ];
my $blue = [ 0.2, 0.2, 1.0, 1.0 ];
glLightfv_p(GL_LIGHT0, GL_POSITION, @$pos);
glEnable(GL_CULL_FACE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
# make the gears
gear1 = glGenLists(1);
glNewList(gear1, GL_COMPILE);
glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @$red);
gear(1.0, 4.0, 1.0, 20, 0.7);
glEndList();
gear2 = glGenLists(1);
glNewList(gear2, GL_COMPILE);
glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @$green);
gear(0.5, 2.0, 2.0, 10, 0.7);
glEndList();
gear3 = glGenLists(1);
glNewList(gear3, GL_COMPILE);
glMaterialfv_p(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, @$blue);
gear(1.3, 2.0, 0.5, 10, 0.7);
glEndList();
glEnable(GL_NORMALIZE);
}
sub resizeGL {
my($width, $height) = @_;
my $w = $width / $height;
my $h = 1.0;
glViewport(0, 0, $width, $height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-$w, $w, -$h, $h, 5.0, 60.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0.0, 0.0, -40.0);
}
sub paintGL {
draw();
}
sub timerEvent {
updateGL();
}
package main;
use Qt;
use GearWidget;
$app = Qt::Application(\@ARGV);
if(!Qt::GLFormat::hasOpenGL()) {
warn("This system has no OpenGL support. Exiting.");
exit -1;
}
$w = GearWidget;
$app->setMainWidget($w);
$w->show;
exit $app->exec;

@ -0,0 +1,348 @@
#!/usr/bin/perl -w
use strict;
package AnimatedThingy;
use Qt;
use Qt::isa "Qt::Label";
use Qt::attributes qw[
label
step
ox oy
x0 x1
y0 y1
dx0 dx1
dy0 dy1
];
use constant nqix => 10;
sub NEW
{
shift->SUPER::NEW($_[0]);
label= $_[1]."\n... and wasting CPU\nwith this animation!\n";
ox = [];
oy = [];
step = 0;
for (my $i=0; $i<nqix; $i++)
{ ox->[0][$i] = oy->[0][$i] = ox->[1][$i] = oy->[1][$i] = 0 }
x0 = y0 = x1 = y1 = 0;
dx0 = rand(8)+2;
dy0 = rand(8)+2;
dx1 = rand(8)+2;
dy1 = rand(8)+2;
setBackgroundColor(&black);
}
sub show
{
startTimer(150) unless isVisible();
SUPER->show;
}
sub hide
{
SUPER->hide;
killTimers()
}
sub sizeHint
{
Qt::Size(120,100)
}
sub timerEvent
{
my $p = Qt::Painter(this);
my $pn= $p->pen;
$pn->setWidth(2);
$pn->setColor(backgroundColor());
$p->setPen($pn);
step = (step + 1) % nqix;
$p->drawLine(ox->[0][step], oy->[0][step], ox->[1][step], oy->[1][step]);
(x0, dx0) = inc(x0, dx0, width());
(y0, dy0) = inc(y0, dy0, height());
(x1, dx1) = inc(x1, dx1, width());
(y1, dy1) = inc(y1, dy1, height());
ox->[0][step] = x0;
oy->[0][step] = y0;
ox->[1][step] = x1;
oy->[1][step] = y1;
my $c = Qt::Color;
$c->setHsv( (step*255)/nqix, 255, 255 ); # rainbow effect
$pn->setColor($c);
$pn->setWidth(2);
$p->setPen($pn);
$p->drawLine(ox->[0][step], oy->[0][step], ox->[1][step], oy->[1][step]);
$p->setPen(&white);
$p->drawText(rect(), &AlignCenter, label);
}
sub paintEvent
{
my $ev = shift;
my $p = Qt::Painter(this);
my $pn= $p->pen;
$pn->setWidth(2);
$p->setPen($pn);
$p->setClipRect($ev->rect);
for (my $i=0; $i<nqix; $i++) {
my $c = Qt::Color;
$c->setHsv( ($i*255)/nqix, 255, 255 ); # rainbow effect
$pn->setColor($c);
$p->setPen($pn);
$p->drawLine(ox->[0][$i], oy->[0][$i], ox->[1][$i], oy->[1][$i]);
}
$p->setPen(&white);
$p->drawText(rect(), &AlignCenter, label);
}
sub inc
{
my ($x, $dx, $b)= @_;
$x += $dx;
if ($x<0) { $x=0; $dx=rand(8)+2; }
elsif ($x>=$b) { $x=$b-1; $dx=-(rand(8)+2); }
return ($x, $dx)
}
1;
package CPUWaster;
use Qt;
use Qt::isa "Qt::Widget";
use Qt::attributes qw[
menubar
file
options
rects
pb
td_id
ld_id
dl_id
cl_id
md_id
got_stop
timer_driven
default_label
];
use Qt::slots
drawItemRects => ['int'],
doMenuItem => ['int'],
stopDrawing => [ ],
timerDriven => [ ],
loopDriven => [ ],
defaultLabel => [ ],
customLabel => [ ],
toggleMinimumDuration
=> [ ];
use AnimatedThingy;
use constant first_draw_item => 1000;
use constant last_draw_item => 1006;
sub NEW
{
shift->SUPER::NEW(@_);
menubar = MenuBar( this, "menu" );
pb = 0;
file = Qt::PopupMenu;
menubar->insertItem( "&File", file );
for (my $i=first_draw_item; $i<=last_draw_item; $i++)
{ file->insertItem( drawItemRects($i)." Rectangles", $i) }
Qt::Object::connect( menubar, SIGNAL "activated(int)", this, SLOT "doMenuItem(int)" );
file->insertSeparator;
file->insertItem( "Quit", Qt::app(), SLOT "quit()" );
options = Qt::PopupMenu;
menubar->insertItem( "&Options", options );
td_id = options->insertItem( "Timer driven", this, SLOT "timerDriven()" );
ld_id = options->insertItem( "Loop driven", this, SLOT "loopDriven()" );
options->insertSeparator;
dl_id = options->insertItem( "Default label", this, SLOT "defaultLabel()" );
cl_id = options->insertItem( "Custom label", this, SLOT "customLabel()" );
options->insertSeparator;
md_id = options->insertItem( "No minimum duration", this, SLOT "toggleMinimumDuration()" );
options->setCheckable( 1 );
loopDriven();
customLabel();
setFixedSize( 400, 300 );
setBackgroundColor( &black );
}
sub drawItemRects
{
my $id = shift;
my $n = $id - first_draw_item;
my $r = 100;
while($n--)
{ $r *= $n%3 ? 5:4 }
return $r
}
sub doMenuItem
{
my $id = shift;
draw(drawItemRects($id)) if ($id >= first_draw_item && $id <= last_draw_item)
}
sub stopDrawing
{ got_stop = 1 }
sub timerDriven()
{
timer_driven = 1;
options->setItemChecked( td_id, 1 );
options->setItemChecked( ld_id, 0 );
}
sub loopDriven
{
timer_driven = 0;
options->setItemChecked( ld_id, 1 );
options->setItemChecked( td_id, 0 );
}
sub defaultLabel
{
default_label = 1;
options->setItemChecked( dl_id, 1 );
options->setItemChecked( cl_id, 0 );
}
sub customLabel
{
default_label = 0;
options->setItemChecked( dl_id, 0 );
options->setItemChecked( cl_id, 1 );
}
sub toggleMinimumDuration
{
options->setItemChecked( md_id,
!options->isItemChecked( md_id ) );
}
sub timerEvent
{
pb->setProgress( pb->totalSteps - rects ) if(!(rects%100));
rects--;
{
my $p = Qt::Painter(this);
my $ww = width();
my $wh = height();
if ( $ww > 8 && $wh > 8 )
{
my $c = Qt::Color(rand(255), rand(255), rand(255));
my $x = rand($ww-8);
my $y = rand($wh-8);
my $w = rand($ww-$x);
my $h = rand($wh-$y);
$p->fillRect( $x, $y, $w, $h, Brush($c) );
}
}
if (!rects || got_stop)
{
pb->setProgress( pb->totalSteps );
my $p = Qt::Painter(this);
$p->fillRect(0, 0, width(), height(), Brush(backgroundColor()));
enableDrawingItems(1);
killTimers();
pb = 0;
}
}
sub newProgressDialog
{
my($label, $steps, $modal) = @_;
my $d = ProgressDialog($label, "Cancel", $steps, this,
"progress", $modal);
if ( options->isItemChecked( md_id ) )
{ $d->setMinimumDuration(0) }
if ( !default_label )
{ $d->setLabel( AnimatedThingy($d,$label) ) }
return $d;
}
sub enableDrawingItems
{
my $yes = shift;
for (my $i=first_draw_item; $i<=last_draw_item; $i++)
{
menubar->setItemEnabled($i, $yes);
}
}
sub draw
{
my $n = shift;
if ( timer_driven )
{
if ( pb ) {
warn("This cannot happen!");
return;
}
rects = $n;
pb = newProgressDialog("Drawing rectangles.\n".
"Using timer event.", $n, 0);
pb->setCaption("Please Wait");
Qt::Object::connect(pb, SIGNAL "cancelled()", this, SLOT "stopDrawing()");
enableDrawingItems(0);
startTimer(0);
got_stop = 0;
}
else
{
my $lpb = newProgressDialog("Drawing rectangles.\n".
"Using loop.", $n, 1);
$lpb->setCaption("Please Wait");
my $p = Qt::Painter(this);
for (my $i=0; $i<$n; $i++)
{
if(!($i%100))
{
$lpb->setProgress($i);
last if ( $lpb->wasCancelled );
}
my ($cw, $ch) = (width(), height());
my $c = Qt::Color(rand(255), rand(255), rand(255));
my $x = rand($cw-8);
my $y = rand($cw-8);
my $w = rand($cw-$x);
my $h = rand($cw-$y);
$p->fillRect($x, $y, $w, $h, Brush($c));
}
$lpb->cancel;
$p->fillRect(0, 0, width(), height(), Brush(backgroundColor()));
}
}
1;
package main;
use Qt;
use CPUWaster;
my $a=Qt::Application(\@ARGV);
my $w=CPUWaster;
$w->show;
$a->setMainWidget($w);
exit $a->exec;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,376 @@
# Form implementation generated from reading ui file 'richedit.ui'
#
# Created: jeu jun 13 20:02:56 2002
# by: The PerlQt User Interface Compiler (puic)
#
use strict;
# the below is a manual addition...
# maybe puic should do that.
# Allows to run a modular application from anywhere
use FindBin;
use lib "$FindBin::Bin";
package EditorForm;
use Qt;
use Qt::isa qw(Qt::MainWindow);
use Qt::slots
init => [],
fileExit => [],
fileNew => [],
fileOpen => [],
fileSave => [],
fileSaveAs => [],
helpAbout => [],
helpContents => [],
helpIndex => [],
changeAlignment => ['QAction*'],
saveAndContinue => ['const QString&'];
use Qt::attributes qw(
textEdit
fontComboBox
SpinBox2
menubar
fileMenu
editMenu
PopupMenu_2
helpMenu
toolBar
Toolbar
fileNewAction
fileOpenAction
fileSaveAction
fileSaveAsAction
fileExitAction
editUndoAction
editRedoAction
editCutAction
editCopyAction
editPasteAction
helpContentsAction
helpIndexAction
helpAboutAction
boldAction
italicAction
underlineAction
alignActionGroup
leftAlignAction
rightAlignAction
centerAlignAction
);
sub uic_load_pixmap_EditorForm
{
my $pix = Qt::Pixmap();
my $m = Qt::MimeSourceFactory::defaultFactory()->data(shift);
if($m)
{
Qt::ImageDrag::decode($m, $pix);
}
return $pix;
}
sub NEW
{
shift->SUPER::NEW(@_[0..2]);
this->statusBar();
if( this->name() eq "unnamed" )
{
this->setName("EditorForm");
}
this->resize(646,436);
this->setCaption(this->trUtf8("Rich Edit"));
this->setCentralWidget(Qt::Widget(this, "qt_central_widget"));
my $EditorFormLayout = Qt::HBoxLayout(this->centralWidget(), 11, 6, '$EditorFormLayout');
textEdit = Qt::TextEdit(this->centralWidget(), "textEdit");
textEdit->setSizePolicy(Qt::SizePolicy(7, 7, 0, 0, textEdit->sizePolicy()->hasHeightForWidth()));
textEdit->setTextFormat(&Qt::TextEdit::RichText);
$EditorFormLayout->addWidget(textEdit);
fileNewAction= Qt::Action(this,"fileNewAction");
fileNewAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("filenew")));
fileNewAction->setText(this->trUtf8("New"));
fileNewAction->setMenuText(this->trUtf8("&New"));
fileNewAction->setAccel(Qt::KeySequence(int(4194382)));
fileOpenAction= Qt::Action(this,"fileOpenAction");
fileOpenAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("fileopen")));
fileOpenAction->setText(this->trUtf8("Open"));
fileOpenAction->setMenuText(this->trUtf8("&Open..."));
fileOpenAction->setAccel(Qt::KeySequence(int(4194383)));
fileSaveAction= Qt::Action(this,"fileSaveAction");
fileSaveAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("filesave")));
fileSaveAction->setText(this->trUtf8("Save"));
fileSaveAction->setMenuText(this->trUtf8("&Save"));
fileSaveAction->setAccel(Qt::KeySequence(int(4194387)));
fileSaveAsAction= Qt::Action(this,"fileSaveAsAction");
fileSaveAsAction->setText(this->trUtf8("Save As"));
fileSaveAsAction->setMenuText(this->trUtf8("Save &As..."));
fileSaveAsAction->setAccel(Qt::KeySequence(int(0)));
fileExitAction= Qt::Action(this,"fileExitAction");
fileExitAction->setText(this->trUtf8("Exit"));
fileExitAction->setMenuText(this->trUtf8("E&xit"));
fileExitAction->setAccel(Qt::KeySequence(int(0)));
editUndoAction= Qt::Action(this,"editUndoAction");
editUndoAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("undo")));
editUndoAction->setText(this->trUtf8("Undo"));
editUndoAction->setMenuText(this->trUtf8("&Undo"));
editUndoAction->setAccel(Qt::KeySequence(int(4194394)));
editRedoAction= Qt::Action(this,"editRedoAction");
editRedoAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("redo")));
editRedoAction->setText(this->trUtf8("Redo"));
editRedoAction->setMenuText(this->trUtf8("&Redo"));
editRedoAction->setAccel(Qt::KeySequence(int(4194393)));
editCutAction= Qt::Action(this,"editCutAction");
editCutAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("editcut")));
editCutAction->setText(this->trUtf8("Cut"));
editCutAction->setMenuText(this->trUtf8("&Cut"));
editCutAction->setAccel(Qt::KeySequence(int(4194392)));
editCopyAction= Qt::Action(this,"editCopyAction");
editCopyAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("editcopy")));
editCopyAction->setText(this->trUtf8("Copy"));
editCopyAction->setMenuText(this->trUtf8("C&opy"));
editCopyAction->setAccel(Qt::KeySequence(int(4194371)));
editPasteAction= Qt::Action(this,"editPasteAction");
editPasteAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("editpaste")));
editPasteAction->setText(this->trUtf8("Paste"));
editPasteAction->setMenuText(this->trUtf8("&Paste"));
editPasteAction->setAccel(Qt::KeySequence(int(4194390)));
helpContentsAction= Qt::Action(this,"helpContentsAction");
helpContentsAction->setText(this->trUtf8("Contents"));
helpContentsAction->setMenuText(this->trUtf8("&Contents..."));
helpContentsAction->setAccel(Qt::KeySequence(int(0)));
helpIndexAction= Qt::Action(this,"helpIndexAction");
helpIndexAction->setText(this->trUtf8("Index"));
helpIndexAction->setMenuText(this->trUtf8("&Index..."));
helpIndexAction->setAccel(Qt::KeySequence(int(0)));
helpAboutAction= Qt::Action(this,"helpAboutAction");
helpAboutAction->setText(this->trUtf8("About"));
helpAboutAction->setMenuText(this->trUtf8("&About..."));
helpAboutAction->setAccel(Qt::KeySequence(int(0)));
boldAction= Qt::Action(this,"boldAction");
boldAction->setToggleAction(1);
boldAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textbold")));
boldAction->setText(this->trUtf8("bold"));
boldAction->setMenuText(this->trUtf8("&Bold"));
boldAction->setAccel(Qt::KeySequence(int(272629826)));
italicAction= Qt::Action(this,"italicAction");
italicAction->setToggleAction(1);
italicAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textitalic")));
italicAction->setText(this->trUtf8("italic"));
italicAction->setMenuText(this->trUtf8("&Italic"));
italicAction->setAccel(Qt::KeySequence(int(272629833)));
underlineAction= Qt::Action(this,"underlineAction");
underlineAction->setToggleAction(1);
underlineAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textunder")));
underlineAction->setText(this->trUtf8("underline"));
underlineAction->setMenuText(this->trUtf8("&Underline"));
underlineAction->setAccel(Qt::KeySequence(int(272629845)));
alignActionGroup= Qt::ActionGroup(this,"alignActionGroup");
alignActionGroup->setText(this->trUtf8("align"));
alignActionGroup->setUsesDropDown(0);
leftAlignAction= Qt::Action(alignActionGroup,"leftAlignAction");
leftAlignAction->setToggleAction(1);
leftAlignAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textleft")));
leftAlignAction->setText(this->trUtf8("left"));
leftAlignAction->setMenuText(this->trUtf8("&Left"));
leftAlignAction->setAccel(Qt::KeySequence(int(272629836)));
rightAlignAction= Qt::Action(alignActionGroup,"rightAlignAction");
rightAlignAction->setToggleAction(1);
rightAlignAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textright")));
rightAlignAction->setText(this->trUtf8("right"));
rightAlignAction->setMenuText(this->trUtf8("&Right"));
rightAlignAction->setAccel(Qt::KeySequence(int(272629842)));
centerAlignAction= Qt::Action(alignActionGroup,"centerAlignAction");
centerAlignAction->setToggleAction(1);
centerAlignAction->setIconSet(Qt::IconSet(uic_load_pixmap_EditorForm("textcenter")));
centerAlignAction->setText(this->trUtf8("center"));
centerAlignAction->setMenuText(this->trUtf8("&Center"));
toolBar = Qt::ToolBar("", this, &DockTop);
toolBar->setLabel(this->trUtf8("Tools"));
fileNewAction->addTo(toolBar);
fileOpenAction->addTo(toolBar);
fileSaveAction->addTo(toolBar);
toolBar->addSeparator;
editUndoAction->addTo(toolBar);
editRedoAction->addTo(toolBar);
editCutAction->addTo(toolBar);
editCopyAction->addTo(toolBar);
editPasteAction->addTo(toolBar);
Toolbar = Qt::ToolBar("", this, &DockTop);
Toolbar->setLabel(this->trUtf8("Toolbar"));
leftAlignAction->addTo(Toolbar);
centerAlignAction->addTo(Toolbar);
rightAlignAction->addTo(Toolbar);
Toolbar->addSeparator;
boldAction->addTo(Toolbar);
italicAction->addTo(Toolbar);
underlineAction->addTo(Toolbar);
Toolbar->addSeparator;
fontComboBox = Qt::ComboBox(0, Toolbar, "fontComboBox");
SpinBox2 = Qt::SpinBox(Toolbar, "SpinBox2");
SpinBox2->setMinValue(int(6));
SpinBox2->setValue(int(10));
menubar= Qt::MenuBar( this, "menubar");
fileMenu= Qt::PopupMenu(this);
fileNewAction->addTo(fileMenu);
fileOpenAction->addTo(fileMenu);
fileSaveAction->addTo(fileMenu);
fileSaveAsAction->addTo(fileMenu);
fileMenu->insertSeparator;
fileExitAction->addTo(fileMenu);
menubar->insertItem(this->trUtf8("&File"), fileMenu);
editMenu= Qt::PopupMenu(this);
editUndoAction->addTo(editMenu);
editRedoAction->addTo(editMenu);
editMenu->insertSeparator;
editCutAction->addTo(editMenu);
editCopyAction->addTo(editMenu);
editPasteAction->addTo(editMenu);
menubar->insertItem(this->trUtf8("&Edit"), editMenu);
PopupMenu_2= Qt::PopupMenu(this);
leftAlignAction->addTo(PopupMenu_2);
rightAlignAction->addTo(PopupMenu_2);
centerAlignAction->addTo(PopupMenu_2);
PopupMenu_2->insertSeparator;
boldAction->addTo(PopupMenu_2);
italicAction->addTo(PopupMenu_2);
underlineAction->addTo(PopupMenu_2);
menubar->insertItem(this->trUtf8("F&ormat"), PopupMenu_2);
helpMenu= Qt::PopupMenu(this);
helpContentsAction->addTo(helpMenu);
helpIndexAction->addTo(helpMenu);
helpMenu->insertSeparator;
helpAboutAction->addTo(helpMenu);
menubar->insertItem(this->trUtf8("&Help"), helpMenu);
Qt::Object::connect(fileNewAction, SIGNAL "activated()", this, SLOT "fileNew()");
Qt::Object::connect(fileOpenAction, SIGNAL "activated()", this, SLOT "fileOpen()");
Qt::Object::connect(fileSaveAction, SIGNAL "activated()", this, SLOT "fileSave()");
Qt::Object::connect(fileSaveAsAction, SIGNAL "activated()", this, SLOT "fileSaveAs()");
Qt::Object::connect(fileExitAction, SIGNAL "activated()", this, SLOT "fileExit()");
Qt::Object::connect(helpIndexAction, SIGNAL "activated()", this, SLOT "helpIndex()");
Qt::Object::connect(helpContentsAction, SIGNAL "activated()", this, SLOT "helpContents()");
Qt::Object::connect(helpAboutAction, SIGNAL "activated()", this, SLOT "helpAbout()");
Qt::Object::connect(SpinBox2, SIGNAL "valueChanged(int)", textEdit, SLOT "setPointSize(int)");
Qt::Object::connect(editCutAction, SIGNAL "activated()", textEdit, SLOT "cut()");
Qt::Object::connect(editPasteAction, SIGNAL "activated()", textEdit, SLOT "paste()");
Qt::Object::connect(editCopyAction, SIGNAL "activated()", textEdit, SLOT "copy()");
Qt::Object::connect(editRedoAction, SIGNAL "activated()", textEdit, SLOT "redo()");
Qt::Object::connect(editUndoAction, SIGNAL "activated()", textEdit, SLOT "undo()");
Qt::Object::connect(alignActionGroup, SIGNAL "selected(QAction*)", this, SLOT "changeAlignment(QAction*)");
Qt::Object::connect(underlineAction, SIGNAL "toggled(bool)", textEdit, SLOT "setUnderline(bool)");
Qt::Object::connect(italicAction, SIGNAL "toggled(bool)", textEdit, SLOT "setItalic(bool)");
Qt::Object::connect(boldAction, SIGNAL "toggled(bool)", textEdit, SLOT "setBold(bool)");
Qt::Object::connect(fontComboBox, SIGNAL "activated(const QString&)", textEdit, SLOT "setFamily(const QString&)");
Qt::Object::connect(fontComboBox, SIGNAL "activated(const QString&)", textEdit, SLOT "setFocus()");
init();
}
sub init
{
textEdit->setFocus;
my $fonts = Qt::FontDatabase;
fontComboBox->insertStringList($fonts->families);
my $font = lc textEdit->family;
for(my $i = 0; $i < fontComboBox->count; $i++) {
if($font eq fontComboBox->text($i)) {
fontComboBox->setCurrentItem($i);
last;
}
}
}
sub fileExit
{
print "EditorForm->fileExit(): Not implemented yet.\n";
}
sub fileNew
{
print "EditorForm->fileNew(): Not implemented yet.\n";
}
sub fileOpen
{
print "EditorForm->fileOpen(): Not implemented yet.\n";
}
sub fileSave
{
print "EditorForm->fileSave(): Not implemented yet.\n";
}
sub fileSaveAs
{
print "EditorForm->fileSaveAs(): Not implemented yet.\n";
}
sub helpAbout
{
print "EditorForm->helpAbout(): Not implemented yet.\n";
}
sub helpContents
{
print "EditorForm->helpContents(): Not implemented yet.\n";
}
sub helpIndex
{
print "EditorForm->helpIndex(): Not implemented yet.\n";
}
sub changeAlignment
{
print "EditorForm->changeAlignment(QAction*): Not implemented yet.\n";
}
sub saveAndContinue
{
print "EditorForm->saveAndContinue(const QString&): Not implemented yet.\n";
}
1;
package main;
use Qt;
use EditorForm;
use imageCollection;
my $a = Qt::Application(\@ARGV);
Qt::Object::connect($a, SIGNAL("lastWindowClosed()"), $a, SLOT("quit()"));
my $w = EditorForm;
$a->setMainWidget($w);
$w->show;
exit $a->exec;

File diff suppressed because it is too large Load Diff

@ -0,0 +1,25 @@
package Qt::GlobalSpace;
use strict;
require Qt;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT;
our $allMeth = Qt::_internal::findAllMethods( Qt::_internal::idClass("QGlobalSpace") );
no strict 'refs';
for my $proto( keys %$allMeth )
{
next if $proto =~ /operator\W/; # skip operators
$proto =~ s/[\#\$\?]+$//;
*{ $proto } = sub
{
$Qt::_internal::autoload::AUTOLOAD = "Qt::GlobalSpace\::$proto";
goto &Qt::GlobalSpace::AUTOLOAD
} unless defined &$proto;
push @EXPORT, $proto;
}
our %EXPORT_TAGS = ( "all" => [@EXPORT] );
1;

@ -0,0 +1,51 @@
package Qt::attributes;
#
# I plan to support public/protected/private attributes. here goes.
# Attributes default to protected.
#
# package MyBase;
# use Qt::attributes qw(
# private:
# foo
# protected:
# bar
# public:
# baz
# );
#
# package MyDerived;
# use Qt::isa qw(MyBase);
#
# sub foo {
# # 1 way to access private attributes from derived class
# #
# # this->{$class} contains private attributes for $class
# # I specify it to always work that way,
# # so feel free to use it in code.
# this->{MyBase}{foo} = 10;
#
# # 2 ways to access protected attributes
# bar = 10;
# this->{bar} = 10;
#
# # 3 ways to access public attributes
# baz = 10;
# this->{baz} = 10;
# this->baz = 10;
# }
#
# Attributes override any method with the same name, so you may want
# to prefix them with _ to prevent conflicts.
#
sub import {
my $class = shift;
my $caller = (caller)[0];
for my $attribute (@_) {
exists ${ ${$caller . '::META'}{'attributes'} }{$attribute} and next;
Qt::_internal::installattribute($caller, $attribute);
${ ${$caller . '::META'}{'attributes'} }{$attribute} = 1;
}
}
1;

@ -0,0 +1,62 @@
package Qt::constants;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
IO_Direct
IO_Sequential
IO_Combined
IO_TypeMask
IO_Raw
IO_Async
IO_ReadOnly
IO_WriteOnly
IO_ReadWrite
IO_Append
IO_Truncate
IO_Translate
IO_ModeMask
IO_Open
IO_StateMask
IO_Ok
IO_ReadError
IO_WriteError
IO_FatalError
IO_ResourceError
IO_OpenError
IO_ConnectError
IO_AbortError
IO_TimeOutError
IO_UnspecifiedError
);
our %EXPORT_TAGS = ( 'IO' => [ @EXPORT ] );
sub IO_Direct () { 0x0100 }
sub IO_Sequential () { 0x0200 }
sub IO_Combined () { 0x0300 }
sub IO_TypeMask () { 0x0f00 }
sub IO_Raw () { 0x0040 }
sub IO_Async () { 0x0080 }
sub IO_ReadOnly () { 0x0001 }
sub IO_WriteOnly () { 0x0002 }
sub IO_ReadWrite () { 0x0003 }
sub IO_Append () { 0x0004 }
sub IO_Truncate () { 0x0008 }
sub IO_Translate () { 0x0010 }
sub IO_ModeMask () { 0x00ff }
sub IO_Open () { 0x1000 }
sub IO_StateMask () { 0xf000 }
sub IO_Ok () { 0 }
sub IO_ReadError () { 1 }
sub IO_WriteError () { 2 }
sub IO_FatalError () { 3 }
sub IO_ResourceError () { 4 }
sub IO_OpenError () { 5 }
sub IO_ConnectError () { 5 }
sub IO_AbortError () { 6 }
sub IO_TimeOutError () { 7 }
sub IO_UnspecifiedError() { 8 }
1;

@ -0,0 +1,36 @@
package Qt::debug;
use Qt;
our %channel = (
'ambiguous' => 0x01,
'autoload' => 0x02,
'calls' => 0x04,
'gc' => 0x08,
'virtual' => 0x10,
'verbose' => 0x20,
'all' => 0xffff
);
sub import {
shift;
my $db = (@_)? 0x0000 : (0x01|0x20);
my $usage = 0;
for my $ch(@_) {
if( exists $channel{$ch}) {
$db |= $channel{$ch};
} else {
warn "Unknown debugging channel: $ch\n";
$usage++;
}
}
Qt::_internal::setDebug($db);
print "Available channels: \n\t".
join("\n\t", sort keys %channel).
"\n" if $usage;
}
sub unimport {
Qt::_internal::setDebug(0);
}
1;

@ -0,0 +1,15 @@
package Qt::enumerations;
#
# Proposed usage:
#
# package MyWidget;
#
# use Qt::enumerations MyInfo => {
# Foo => 1,
# Bar => 10,
# Baz => 64
# };
#
# use Qt::enumerations MyInfo => [qw(Foo Bar Baz)];
#
1;

@ -0,0 +1,81 @@
package Qt::isa;
use strict;
sub import {
no strict 'refs';
my $class = shift;
my $caller = (caller)[0];
# Trick 'use' into believing the file for this class has been read
my $pm = $caller . ".pm";
$pm =~ s!::!/!g;
unless(exists $::INC{$pm}) {
$::INC{$pm} = $::INC{"Qt/isa.pm"};
}
for my $super (@_) {
push @{ $caller . '::ISA' }, $super;
push @{ ${$caller . '::META'}{'superClass'} }, $super; # if isa(QObject)?
}
*{ $caller . '::className' } = sub { # closure on $caller
return $caller;
};
${ $caller. '::_INTERNAL_STATIC_'}{'SUPER'} = bless {}, " $caller";
Qt::_internal::installsuper($caller) unless defined &{ $caller.'::SUPER' };
*{ $caller . '::metaObject' } = sub {
Qt::_internal::getMetaObject($caller);
};
*{ $caller . '::import' } = sub {
my $name = shift; # classname = function-name
my $incaller = (caller)[0];
$incaller = (caller(1))[0] if $incaller eq 'if'; # work-around bug in package 'if' pre 0.02
(my $cname = $name) =~ s/.*::// and do
{
*{ "$name" } = sub {
$name->new(@_);
} unless defined &{ "$name" };
};
my $p = defined $&? $&:'';
$p eq ($incaller=~/.*::/?($p?$&:''):'') and
*{ "$incaller\::$cname" } = sub {
$name->new(@_);
};
if(defined @{ ${$caller.'::META'}{'superClass'} } &&
@{ ${$caller.'::META'}{'superClass'} } )
{
# attributes inheritance
for my $attribute( keys %{ ${$caller.'::META'}{'attributes'} } )
{
if(! defined &{$incaller.'::'.$attribute })
{
Qt::_internal::installattribute($incaller, $attribute);
${ ${$incaller .'::META'}{'attributes'} }{$attribute} = 1;
}
}
}
};
Qt::_internal::installautoload(" $caller");
Qt::_internal::installautoload(" $caller");
Qt::_internal::installautoload($caller);
{
package Qt::AutoLoad;
my $autosub = \&{ " $caller\::_UTOLOAD" };
*{ " $caller\::AUTOLOAD" } = sub { &$autosub };
$autosub = \&{ " $caller\::_UTOLOAD" };
*{ " $caller\::AUTOLOAD" } = sub { &$autosub };
$autosub = \&{ "$caller\::_UTOLOAD" };
*{ "$caller\::AUTOLOAD" } = sub { &$autosub };
}
Qt::_internal::installthis($caller);
# operator overloading
*{ " $caller\::ISA" } = ["Qt::base::_overload"];
}
1;

@ -0,0 +1,14 @@
package Qt::properties;
#
# Proposed usage:
#
# use Qt::properties foo => {
# TYPE => 'bool',
# READ => 'getFoo',
# WRITE => 'setFoo',
# STORED => 0,
# RESET => 'unsetFoo',
# DESIGNABLE => 0
# };
#
1;

@ -0,0 +1,77 @@
package Qt::signals;
use Carp;
#
# Proposed usage:
#
# use Qt::signals fooActivated => ['int'];
#
# use Qt::signals fooActivated => {
# name => 'fooActivated(int)',
# args => ['int']
# };
#
# sub whatever { emit fooActivated(10); }
#
sub import {
no strict 'refs';
my $self = shift;
my $caller = $self eq "Qt::signals" ? (caller)[0] : $self;
my $parent = ${ $caller . '::ISA' }[0];
my $parent_qt_emit = $parent . '::qt_emit';
Qt::_internal::installqt_invoke($caller . '::qt_emit') unless defined &{ $caller. '::qt_emit' };
# *{ $caller . '::qt_emit' } = sub {
# my $meta = \%{ $caller . '::META' };
# die unless $meta->{object};
# my $offset = $_[0] - $meta->{object}->signalOffset;
# if($offset >= 0) {
# Qt::_internal::invoke(Qt::this(), $meta->{signals}[$offset], $_[1]);
# return 1;
# } else {
# Qt::this()->$parent_qt_emit(@_);
# }
# } unless defined &{ $caller . '::qt_emit' };
my $meta = \%{ $caller . '::META' };
croak "Odd number of arguments in signal declaration" if @_%2;
my(%signals) = @_;
for my $signalname (keys %signals) {
my $signal = { name => $signalname };
my $args = $signals{$signalname};
$signal->{arguments} = [map { s/\s(?=[*&])//; { type => $_, name => "" } } @$args];
my $arglist = join ',', @$args;
$signal->{prototype} = $signalname . "($arglist)";
$signal->{returns} = 'void';
$signal->{method} = $signalname;
push @{$meta->{signals}}, $signal;
my $signal_index = $#{ $meta->{signals} };
my $argcnt = scalar @$args;
my $mocargs = Qt::_internal::allocateMocArguments($argcnt);
my $i = 0;
for my $arg (@$args) {
my $a = $arg;
$a =~ s/^const\s+//;
if($a =~ /^(bool|int|double|char\*|QString)&?$/) {
$a = $1;
} else {
$a = 'ptr';
}
my $valid = Qt::_internal::setMocType($mocargs, $i, $arg, $a);
die "Invalid type for signal argument ($arg)\n" unless $valid;
$i++;
}
$meta->{signal}{$signalname} = $signal;
$signal->{index} = $signal_index;
$signal->{mocargs} = $mocargs;
$signal->{argcnt} = $argcnt;
Qt::_internal::installsignal("$caller\::$signalname");
}
@_ and $meta->{changed} = 1;
}
1;

@ -0,0 +1,84 @@
package Qt::slots;
use Carp;
#
# Proposed usage:
#
# use Qt::slots changeSomething => ['int'];
#
# use Qt::slots 'changeSomething(int)' => {
# args => ['int'],
# call => 'changeSomething'
# };
#
sub import {
no strict 'refs';
my $self = shift;
my $caller = $self eq "Qt::slots" ? (caller)[0] : $self;
my $parent = ${ $caller . '::ISA' }[0];
my $parent_qt_invoke = $parent . '::qt_invoke';
Qt::_internal::installqt_invoke($caller . '::qt_invoke') unless defined &{ $caller. '::qt_invoke' };
# *{ $caller . '::qt_invoke' } = sub {
# my $meta = \%{ $caller . '::META' };
# die unless $meta->{object};
# my $offset = $_[0] - $meta->{object}->slotOffset;
# if($offset >= 0) {
# Qt::_internal::invoke(Qt::this(), $meta->{slots}[$offset], $_[1]);
# return 1;
# } else {
# Qt::this()->$parent_qt_invoke(@_);
# }
# } unless defined &{ $caller . '::qt_invoke' };
my $meta = \%{ $caller . '::META' };
croak "Odd number of arguments in slot declaration" if @_%2;
my(%slots) = @_;
for my $slotname (keys %slots) {
my $slot = { name => $slotname };
my $args = $slots{$slotname};
$slot->{arguments} = [map { s/\s(?=[*&])//; { type => $_, name => "" } } @$args];
my $arglist = join ',', @$args;
$slot->{prototype} = $slotname . "($arglist)";
if ( exists $meta->{slot}{$slotname} ) {
(my $s1 = $slot->{prototype}) =~ s/\s+//g;
(my $s2 = $meta->{slot}{$slotname}{prototype}) =~ s/\s+//g;
if( $s1 ne $s2 ) {
warn( "Slot declaration:\n\t$slot->{prototype}\nwill override ".
"previous declaration:\n\t$meta->{slot}{$slotname}{prototype}");
} else {
next;
}
}
$slot->{returns} = 'void';
$slot->{method} = $slotname;
push @{$meta->{slots}}, $slot;
my $slot_index = $#{ $meta->{slots} };
my $argcnt = scalar @$args;
my $mocargs = Qt::_internal::allocateMocArguments($argcnt);
my $i = 0;
for my $arg (@$args) {
my $a = $arg;
$a =~ s/^const\s+//;
if($a =~ /^(bool|int|double|char\*|QString)&?$/) {
$a = $1;
} else {
$a = 'ptr';
}
my $valid = Qt::_internal::setMocType($mocargs, $i, $arg, $a);
die "Invalid type for slot argument ($arg)\n" unless $valid;
$i++;
}
$meta->{slot}{$slotname} = $slot;
$slot->{index} = $slot_index;
$slot->{mocargs} = $mocargs;
$slot->{argcnt} = $argcnt;
}
@_ and $meta->{changed} = 1;
}
1;

@ -0,0 +1,44 @@
#ifndef MARSHALL_H
#define MARSHALL_H
#include "smoke.h"
class SmokeType;
class Marshall {
public:
/**
* FromSV is used for virtual function return values and regular
* method arguments.
*
* ToSV is used for method return-values and virtual function
* arguments.
*/
typedef void (*HandlerFn)(Marshall *);
enum Action { FromSV, ToSV };
virtual SmokeType type() = 0;
virtual Action action() = 0;
virtual Smoke::StackItem &item() = 0;
virtual SV* var() = 0;
virtual void unsupported() = 0;
virtual Smoke *smoke() = 0;
/**
* For return-values, next() does nothing.
* For FromSV, next() calls the method and returns.
* For ToSV, next() calls the virtual function and returns.
*
* Required to reset Marshall object to the state it was
* before being called when it returns.
*/
virtual void next() = 0;
/**
* For FromSV, cleanup() returns false when the handler should free
* any allocated memory after next().
*
* For ToSV, cleanup() returns true when the handler should delete
* the pointer passed to it.
*/
virtual bool cleanup() = 0;
virtual ~Marshall() {}
};
#endif

@ -0,0 +1,54 @@
#ifndef PERLQT_H
#define PERLQT_H
#include "marshall.h"
struct smokeperl_object {
bool allocated;
Smoke *smoke;
int classId;
void *ptr;
};
struct TypeHandler {
const char *name;
Marshall::HandlerFn fn;
};
extern int do_debug; // evil
extern SV *sv_qapp;
extern int object_count;
// keep this enum in sync with lib/Qt/debug.pm
enum QtDebugChannel {
qtdb_none = 0x00,
qtdb_ambiguous = 0x01,
qtdb_autoload = 0x02,
qtdb_calls = 0x04,
qtdb_gc = 0x08,
qtdb_virtual = 0x10,
qtdb_verbose = 0x20
};
void unmapPointer(smokeperl_object *, Smoke::Index, void*);
SV *getPointerObject(void *ptr);
void mapPointer(SV *, smokeperl_object *, HV *, Smoke::Index, void *);
extern struct mgvtbl vtbl_smoke;
inline smokeperl_object *sv_obj_info(SV *sv) { // ptr on success, null on fail
if(!sv || !SvROK(sv) || SvTYPE(SvRV(sv)) != SVt_PVHV)
return 0;
SV *obj = SvRV(sv);
MAGIC *mg = mg_find(obj, '~');
if(!mg || mg->mg_virtual != &vtbl_smoke) {
// FIXME: die or something?
return 0;
}
smokeperl_object *o = (smokeperl_object*)mg->mg_ptr;
return o;
}
#endif // PERLQT_H

@ -0,0 +1,426 @@
#include "smokeperl.h"
class SmokePerlQt : public SmokePerl {
public:
SmokePerlQt();
virtual ~SmokePerlQt();
void registerSmoke(const char *name, Smoke *smoke);
Smoke *getSmoke(const char *name);
void registerHandlers(TypeHandler *h);
SmokeObject newObject(void *p, const SmokeClass &c);
SmokeObject wrapObject(void *p, const SmokeClass &c);
SmokeObject getObject(void *p);
SmokeObject getObject(SV *sv);
private:
HV *_registered_smoke;
HV *_registered_handlers;
HV *_remembered_pointers;
void rememberPointer(SmokeObject &o, const SmokeClass &c, bool remember, void *lastptr = 0);
void rememberPointer(SmokeObject &o);
void forgetPointer(SmokeObject &o);
SmokeObject createObject(void *p, const SmokeClass &c);
const char *getSmokeName(Smoke *smoke) {
static const char none[] = "";
HE *he;
hv_iterinit(_registered_smoke);
while(he = hv_iternext(_registered_smoke)) {
SV *sv = hv_iterval(_registered_smoke, he);
if((Smoke*)SvIV(sv) == smoke) {
I32 toss;
return hv_iterkey(he, &toss);
}
}
return none;
}
HV *package(const SmokeClass &c) {
// for now, we cheat on the class names by assuming they're all Qt::
if(!strcmp(c.className(), "Qt"))
return gv_stashpv(c.className(), TRUE);
SV *name = newSVpv("Qt::", 0);
sv_catpv(name, c.className() + 1);
HV *stash = gv_stashpv(SvPV_nolen(name), TRUE);
SvREFCNT_dec(name);
return stash;
}
};
Marshall::HandlerFn getMarshallFn(const SmokeType &type);
class VirtualMethodReturnValue : public Marshall {
Smoke *_smoke;
Smoke::Index _method;
Smoke::Stack _stack;
SmokeType _st;
SV *_retval;
public:
const Smoke::Method &method() { return _smoke->methods[_method]; }
SmokeType type() { return _st; }
Marshall::Action action() { return Marshall::FromSV; }
Smoke::StackItem &item() { return _stack[0]; }
SV *var() { return _retval; }
void unsupported() {
croak("Cannot handle '%s' as return-type of virtual method %s::%s",
type().name(),
_smoke->className(method().classId),
_smoke->methodNames[method().name]);
}
Smoke *smoke() { return _smoke; }
void next() {}
bool cleanup() { return false; }
VirtualMethodReturnValue(Smoke *smoke, Smoke::Index meth, Smoke::Stack stack, SV *retval) :
_smoke(smoke), _method(meth), _stack(stack), _retval(retval) {
_st.set(_smoke, method().ret);
Marshall::HandlerFn fn = getMarshallFn(type());
(*fn)(this);
}
};
extern SV *sv_this;
extern void *_current_object;
extern Smoke::Index _current_object_class;
extern int object_count;
extern bool temporary_virtual_function_success;
extern struct mgvtbl vtbl_smoke;
class VirtualMethodCall : public Marshall {
Smoke *_smoke;
Smoke::Index _method;
Smoke::Stack _stack;
GV *_gv;
int _cur;
Smoke::Index *_args;
SV **_sp;
bool _called;
SV *_savethis;
public:
SmokeType type() { return SmokeType(_smoke, _args[_cur]); }
Marshall::Action action() { return Marshall::ToSV; }
Smoke::StackItem &item() { return _stack[_cur + 1]; }
SV *var() { return _sp[_cur]; }
const Smoke::Method &method() { return _smoke->methods[_method]; }
void unsupported() {
croak("Cannot handle '%s' as argument of virtual method %s::%s",
type().name(),
_smoke->className(method().classId),
_smoke->methodNames[method().name]);
}
Smoke *smoke() { return _smoke; }
void callMethod() {
dSP;
if(_called) return;
_called = true;
SP = _sp + method().numArgs - 1;
PUTBACK;
int count = call_sv((SV*)_gv, G_SCALAR);
SPAGAIN;
VirtualMethodReturnValue r(_smoke, _method, _stack, POPs);
PUTBACK;
FREETMPS;
LEAVE;
}
void next() {
int oldcur = _cur;
_cur++;
while(!_called && _cur < method().numArgs) {
Marshall::HandlerFn fn = getMarshallFn(type());
_sp[_cur] = sv_newmortal();
(*fn)(this);
_cur++;
}
callMethod();
_cur = oldcur;
}
bool cleanup() { return false; } // is this right?
VirtualMethodCall(Smoke *smoke, Smoke::Index meth, Smoke::Stack stack, SV *obj, GV *gv) :
_smoke(smoke), _method(meth), _stack(stack), _gv(gv), _cur(-1), _sp(0), _called(false) {
dSP;
ENTER;
SAVETMPS;
PUSHMARK(SP);
EXTEND(SP, method().numArgs);
_savethis = sv_this;
sv_this = newSVsv(obj);
_sp = SP + 1;
for(int i = 0; i < method().numArgs; i++)
_sp[i] = sv_newmortal();
_args = _smoke->argumentList + method().args;
}
~VirtualMethodCall() {
SvREFCNT_dec(sv_this);
sv_this = _savethis;
}
};
class MethodReturnValue : public Marshall {
Smoke *_smoke;
Smoke::Index _method;
SV *_retval;
Smoke::Stack _stack;
public:
MethodReturnValue(Smoke *smoke, Smoke::Index method, Smoke::Stack stack, SV *retval) :
_smoke(smoke), _method(method), _retval(retval), _stack(stack) {
Marshall::HandlerFn fn = getMarshallFn(type());
(*fn)(this);
}
const Smoke::Method &method() { return _smoke->methods[_method]; }
SmokeType type() { return SmokeType(_smoke, method().ret); }
Marshall::Action action() { return Marshall::ToSV; }
Smoke::StackItem &item() { return _stack[0]; }
SV *var() { return _retval; }
void unsupported() {
croak("Cannot handle '%s' as return-type of %s::%s",
type().name(),
_smoke->className(method().classId),
_smoke->methodNames[method().name]);
}
Smoke *smoke() { return _smoke; }
void next() {}
bool cleanup() { return false; }
};
class MethodCall : public Marshall {
int _cur;
Smoke *_smoke;
Smoke::Stack _stack;
Smoke::Index _method;
Smoke::Index *_args;
SV **_sp;
int _items;
SV *_retval;
bool _called;
public:
MethodCall(Smoke *smoke, Smoke::Index method, SV **sp, int items) :
_smoke(smoke), _method(method), _sp(sp), _items(items), _cur(-1), _called(false) {
_args = _smoke->argumentList + _smoke->methods[_method].args;
_items = _smoke->methods[_method].numArgs;
_stack = new Smoke::StackItem[items + 1];
_retval = newSV(0);
}
~MethodCall() {
delete[] _stack;
SvREFCNT_dec(_retval);
}
SmokeType type() { return SmokeType(_smoke, _args[_cur]); }
Marshall::Action action() { return Marshall::FromSV; }
Smoke::StackItem &item() { return _stack[_cur + 1]; }
SV *var() {
if(_cur < 0) return _retval;
SvGETMAGIC(*(_sp + _cur));
return *(_sp + _cur);
}
inline const Smoke::Method &method() { return _smoke->methods[_method]; }
void unsupported() {
croak("Cannot handle '%s' as argument to %s::%s",
type().name(),
_smoke->className(method().classId),
_smoke->methodNames[method().name]);
}
Smoke *smoke() { return _smoke; }
inline void callMethod() {
if(_called) return;
_called = true;
Smoke::ClassFn fn = _smoke->classes[method().classId].classFn;
void *ptr = _smoke->cast(
_current_object,
_current_object_class,
method().classId
);
_items = -1;
(*fn)(method().method, ptr, _stack);
MethodReturnValue r(_smoke, _method, _stack, _retval);
}
void next() {
int oldcur = _cur;
_cur++;
while(!_called && _cur < _items) {
Marshall::HandlerFn fn = getMarshallFn(type());
(*fn)(this);
_cur++;
}
callMethod();
_cur = oldcur;
}
bool cleanup() { return true; }
};
class SmokeBindingQt : public SmokeBinding {
SmokePerlQt *_smokeperl;
public:
SmokeBindingQt(Smoke *s, SmokePerlQt *smokeperl) :
SmokeBinding(s), _smokeperl(smokeperl) {}
void deleted(Smoke::Index classId, void *ptr) {
if(do_debug) printf("%p->~%s()\n", ptr, smoke->className(classId));
object_count--;
if(do_debug) printf("Remaining objects: %d\n", object_count);
SV *obj = getPointerObject(ptr);
smokeperl_object *o = sv_obj_info(obj);
if(!o || !o->ptr) {
return;
}
unmapPointer(o, o->classId, 0);
o->ptr = 0;
}
bool callMethod(Smoke::Index method, void *ptr, Smoke::Stack args, bool isAbstract) {
SV *obj = getPointerObject(ptr);
smokeperl_object *o = sv_obj_info(obj);
if(do_debug) printf("virtual %p->%s::%s() called\n", ptr,
smoke->classes[smoke->methods[method].classId].className,
smoke->methodNames[smoke->methods[method].name]
);
if(!o) {
if(!PL_dirty) // if not in global destruction
warn("Cannot find object for virtual method");
return false;
}
HV *stash = SvSTASH(SvRV(obj));
if(*HvNAME(stash) == ' ')
stash = gv_stashpv(HvNAME(stash) + 1, TRUE);
const char *methodName = smoke->methodNames[smoke->methods[method].name];
GV *gv = gv_fetchmethod_autoload(stash, methodName, 0);
if(!gv) return false;
VirtualMethodCall c(smoke, method, args, obj, gv);
// exception variable, just temporary
temporary_virtual_function_success = true;
c.next();
bool ret = temporary_virtual_function_success;
temporary_virtual_function_success = true;
return ret;
}
char *className(Smoke::Index classId) {
const char *className = smoke->className(classId);
char *buf = new char[strlen(className) + 6];
strcpy(buf, " Qt::");
strcat(buf, className + 1);
return buf;
}
};
SmokePerlQt::SmokePerlQt() {
_registered_smoke = newHV();
_registered_handlers = newHV();
_remembered_pointers = newHV();
}
SmokePerlQt::~SmokePerlQt() {
SvREFCNT_dec((SV*)_registered_smoke);
SvREFCNT_dec((SV*)_registered_handlers);
SvREFCNT_dec((SV*)_remembered_pointers);
}
void SmokePerlQt::registerSmoke(const char *name, Smoke *smoke) {
hv_store(_registered_smoke, name, strlen(name), newSViv((IV)smoke), 0);
// This will also need to handle the per-class initialization
smoke->binding = new SmokeBindingQt(smoke, this);
}
Smoke *SmokePerlQt::getSmoke(const char *name) {
SV **svp = hv_fetch(_registered_smoke, name, strlen(name), 0);
if(svp && SvOK(*svp))
return (Smoke*)SvIV(*svp);
return 0;
}
void SmokePerlQt::registerHandlers(TypeHandler *h) {
while(h->name) {
hv_store(_registered_handlers, h->name, strlen(h->name), newSViv((IV)h->fn), 0);
h++;
}
}
SmokeObject SmokePerlQt::createObject(void *p, const SmokeClass &c) {
HV *hv = newHV();
SV *obj = newRV_noinc((SV*)hv);
Smoke_MAGIC m(p, c);
sv_magic((SV*)hv, (SV*)newAV(), '~', (char*)&m, sizeof(m));
MAGIC *mg = mg_find((SV*)hv, '~');
mg->mg_virtual = &vtbl_smoke;
sv_bless(obj, package(c));
SmokeObject o(obj, (Smoke_MAGIC*)mg->mg_ptr);
SvREFCNT_dec(obj);
if(c.hasVirtual())
rememberPointer(o);
return o;
}
SmokeObject SmokePerlQt::newObject(void *p, const SmokeClass &c) {
SmokeObject o = createObject(p, c);
if(c.isVirtual())
rememberPointer(o);
o.setAllocated(true);
return o;
}
SmokeObject SmokePerlQt::wrapObject(void *p, const SmokeClass &c) {
SmokeObject o = createObject(p, c);
return o;
}
void SmokePerlQt::rememberPointer(SmokeObject &o, const SmokeClass &c, bool remember, void *lastptr) {
void *ptr = o.cast(c);
if(ptr != lastptr) {
SV *keysv = newSViv((IV)o.ptr());
STRLEN klen;
char *key = SvPV(keysv, klen);
if(remember)
hv_store(_remembered_pointers, key, klen,
sv_rvweaken(newSVsv(o.var())), 0);
else
hv_delete(_remembered_pointers, key, klen, G_DISCARD);
SvREFCNT_dec(keysv);
}
for(Smoke::Index *i = c.smoke()->inheritanceList + c.c().parents;
*i;
i++)
rememberPointer(o, SmokeClass(c.smoke(), *i), remember, ptr);
}
void SmokePerlQt::rememberPointer(SmokeObject &o) {
rememberPointer(o, o.c(), true);
}
void SmokePerlQt::forgetPointer(SmokeObject &o) {
rememberPointer(o, o.c(), false);
}
SmokeObject SmokePerlQt::getObject(SV *sv) {
MAGIC *mg = mg_find(SvRV(sv), '~');
Smoke_MAGIC *m = (Smoke_MAGIC*)mg->mg_ptr;
return SmokeObject(sv, m);
}
SmokeObject SmokePerlQt::getObject(void *p) {
SV *keysv = newSViv((IV)p);
STRLEN klen;
char *key = SvPV(keysv, klen);
SV **svp = hv_fetch(_remembered_pointers, key, klen, 0);
if(svp && SvROK(*svp))
return getObject(sv_2mortal(newRV(SvRV(*svp)))); // paranoid copy of a weak ref
return SmokeObject(&PL_sv_undef, 0);
}

@ -0,0 +1,281 @@
#ifndef SMOKEPERL_H
#define SMOKEPERL_H
#include "smoke.h"
#undef DEBUG
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#ifndef __USE_POSIX
#define __USE_POSIX
#endif
#ifndef __USE_XOPEN
#define __USE_XOPEN
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include "perlqt.h"
#include "marshall.h"
class SmokePerl;
class SmokeType {
Smoke::Type *_t; // derived from _smoke and _id, but cached
Smoke *_smoke;
Smoke::Index _id;
public:
SmokeType() : _t(0), _smoke(0), _id(0) {}
SmokeType(Smoke *s, Smoke::Index i) : _smoke(s), _id(i) {
if(_id < 0 || _id > _smoke->numTypes) _id = 0;
_t = _smoke->types + _id;
}
// default copy constructors are fine, this is a constant structure
// mutators
void set(Smoke *s, Smoke::Index i) {
_smoke = s;
_id = i;
_t = _smoke->types + _id;
}
// accessors
Smoke *smoke() const { return _smoke; }
Smoke::Index typeId() const { return _id; }
const Smoke::Type &type() const { return *_t; }
unsigned short flags() const { return _t->flags; }
unsigned short elem() const { return _t->flags & Smoke::tf_elem; }
const char *name() const { return _t->name; }
Smoke::Index classId() const { return _t->classId; }
// tests
bool isStack() const { return ((flags() & Smoke::tf_ref) == Smoke::tf_stack); }
bool isPtr() const { return ((flags() & Smoke::tf_ref) == Smoke::tf_ptr); }
bool isRef() const { return ((flags() & Smoke::tf_ref) == Smoke::tf_ref); }
bool isConst() const { return (flags() & Smoke::tf_const); }
bool isClass() const {
if(elem() == Smoke::t_class)
return classId() ? true : false;
return false;
}
bool operator ==(const SmokeType &b) const {
const SmokeType &a = *this;
if(a.name() == b.name()) return true;
if(a.name() && b.name() && !strcmp(a.name(), b.name()))
return true;
return false;
}
bool operator !=(const SmokeType &b) const {
const SmokeType &a = *this;
return !(a == b);
}
};
class SmokeClass {
Smoke::Class *_c;
Smoke *_smoke;
Smoke::Index _id;
public:
SmokeClass(const SmokeType &t) {
_smoke = t.smoke();
_id = t.classId();
_c = _smoke->classes + _id;
}
SmokeClass(Smoke *smoke, Smoke::Index id) : _smoke(smoke), _id(id) {
_c = _smoke->classes + _id;
}
Smoke *smoke() const { return _smoke; }
const Smoke::Class &c() const { return *_c; }
Smoke::Index classId() const { return _id; }
const char *className() const { return _c->className; }
Smoke::ClassFn classFn() const { return _c->classFn; }
Smoke::EnumFn enumFn() const { return _c->enumFn; }
bool operator ==(const SmokeClass &b) const {
const SmokeClass &a = *this;
if(a.className() == b.className()) return true;
if(a.className() && b.className() && !strcmp(a.className(), b.className()))
return true;
return false;
}
bool operator !=(const SmokeClass &b) const {
const SmokeClass &a = *this;
return !(a == b);
}
bool isa(const SmokeClass &sc) const {
// This is a sick function, if I do say so myself
if(*this == sc) return true;
Smoke::Index *parents = _smoke->inheritanceList + _c->parents;
for(int i = 0; parents[i]; i++) {
if(SmokeClass(_smoke, parents[i]).isa(sc)) return true;
}
return false;
}
unsigned short flags() const { return _c->flags; }
bool hasConstructor() const { return flags() & Smoke::cf_constructor; }
bool hasCopy() const { return flags() & Smoke::cf_deepcopy; }
bool hasVirtual() const { return flags() & Smoke::cf_virtual; }
bool hasFire() const { return !(flags() & Smoke::cf_undefined); }
};
class SmokeMethod {
Smoke::Method *_m;
Smoke *_smoke;
Smoke::Index _id;
public:
SmokeMethod(Smoke *smoke, Smoke::Index id) : _smoke(smoke), _id(id) {
_m = _smoke->methods + _id;
}
Smoke *smoke() const { return _smoke; }
const Smoke::Method &m() const { return *_m; }
SmokeClass c() const { return SmokeClass(_smoke, _m->classId); }
const char *name() const { return _smoke->methodNames[_m->name]; }
int numArgs() const { return _m->numArgs; }
unsigned short flags() const { return _m->flags; }
SmokeType arg(int i) const {
if(i >= numArgs()) return SmokeType();
return SmokeType(_smoke, _smoke->argumentList[_m->args + i]);
}
SmokeType ret() const { return SmokeType(_smoke, _m->ret); }
Smoke::Index methodId() const { return _id; }
Smoke::Index method() const { return _m->method; }
bool isStatic() const { return flags() & Smoke::mf_static; }
bool isConst() const { return flags() & Smoke::mf_const; }
void call(Smoke::Stack args, void *ptr = 0) const {
Smoke::ClassFn fn = c().classFn();
(*fn)(method(), ptr, args);
}
};
class Smoke_MAGIC { // to be rewritten
SmokeClass _c;
void *_ptr;
bool _isAllocated;
public:
Smoke_MAGIC(void *p, const SmokeClass &c) :
_c(c), _ptr(p), _isAllocated(false) {}
const SmokeClass &c() const { return _c; }
void *ptr() const { return _ptr; }
bool isAllocated() const { return _isAllocated; }
void setAllocated(bool isAllocated) { _isAllocated = isAllocated; }
};
/**
* SmokeObject is a thin wrapper around SV* objects. Each SmokeObject instance
* increments the refcount of its SV* for the duration of its existance.
*
* SmokeObject instances are only returned from SmokePerl, since the method
* of binding data to the scalar must be consistent across all modules.
*/
class SmokeObject {
SV *sv;
Smoke_MAGIC *m;
public:
SmokeObject(SV *obj, Smoke_MAGIC *mag) : sv(obj), m(mag) {
SvREFCNT_inc(sv);
}
~SmokeObject() {
SvREFCNT_dec(sv);
}
SmokeObject(const SmokeObject &other) {
sv = other.sv;
m = other.m;
SvREFCNT_inc(sv);
}
SmokeObject &operator =(const SmokeObject &other) {
sv = other.sv;
m = other.m;
SvREFCNT_inc(sv);
return *this;
}
const SmokeClass &c() { return m->c(); }
Smoke *smoke() { return c().smoke(); }
SV *var() { return sv; }
void *ptr() { return m->ptr(); }
Smoke::Index classId() { return c().classId(); }
void *cast(const SmokeClass &toc) {
return smoke()->cast(
ptr(),
classId(),
smoke()->idClass(toc.className())
);
}
const char *className() { return c().className(); }
bool isValid() const { return SvOK(sv) ? true : false; }
bool isAllocated() const { return m->isAllocated(); }
void setAllocated(bool i) { m->setAllocated(i); }
};
/**
* Since it's not easy to share functions between Perl modules, the common
* interface between all Smoked libraries and Perl will be defined in this
* class. There will be only one SmokePerl instance loaded for an entire Perl
* process. It has no data members here -- this is only an abstract interface.
*/
class SmokePerl {
void *future_extension;
public:
SmokePerl() : future_extension(0) {}
// don't need this, we're only defining an interface
virtual ~SmokePerl() = 0;
/**
* Registers a Smoke object
*/
virtual void registerSmoke(const char *name, Smoke *smoke) = 0;
/**
* Gets a smoke object from its name
*/
virtual Smoke *getSmoke(const char *name) = 0;
/**
* Determines if the named smoke is registered.
*/
bool isSmokeRegistered(const char *name) { return getSmoke(name) ? true : false; }
virtual void registerHandlers(TypeHandler *handlers) = 0;
/**
* Returns a new blessed SV referring to the pointer passed.
* Use sv_2mortal() before passing it around.
*
* @param p pointer to the C++ object. The pointer isn't automatically deleted by SmokePerl.
* @param c class of the pointer
* @see #getObject
* @see #deleteObject
*/
virtual SmokeObject newObject(void *p, const SmokeClass &c) = 0;
/**
* Same as newObject(), except it doesn't treat p as owned by Perl
*/
virtual SmokeObject wrapObject(void *p, const SmokeClass &c) = 0;
/**
* Any SV* created with newObject() on a class with virtual methods can be
* retrieved again.
*/
virtual SmokeObject getObject(void *p) = 0;
/**
* Create a SmokeObject from the given SV
*/
virtual SmokeObject getObject(SV *sv) = 0;
};
#endif // SMOKEPERL_H

@ -0,0 +1,14 @@
package Foo::SubCodec;
use Qt;
use My::Codec;
use Qt::isa qw( My::Codec );
sub NEW
{
shift->SUPER::NEW(@_);
}
sub foo {}
1;

@ -0,0 +1,10 @@
package My::Codec;
use Qt;
use Qt::isa qw( Qt::TextCodec );
sub NEW
{
shift->SUPER::NEW(@_);
}
1;

@ -0,0 +1,15 @@
package My::SubCodec;
use Qt;
use My::Codec;
use Qt::isa qw( My::Codec );
sub NEW
{
shift->SUPER::NEW(@_);
}
sub bar {}
1;

@ -0,0 +1,6 @@
BEGIN { print "1..1\n" }
use Qt;
print "ok 1\n"

@ -0,0 +1,48 @@
BEGIN { print "1..6\n" }
use Qt;
use Qt::constants;
eval {my $c = Qt::TextCodec::codecForLocale()};
print +$@ ? "not ok\n" : "ok 1\n";
eval {my $s = Qt::Variant( Qt::DateTime::currentDateTime() ) };
print +$@ ? "not ok\n" : "ok 2\n";
my $ret;
eval {$ret = Qt::Point(20,20); $ret += Qt::Point(10,10); $ret *= 2 ; $ret /= 3 };
print +$@ ? "not ok\n" : "ok 3\n";
eval { $ret = ($ret->x != 20 or $ret->y != 20) ? 1 : 0 };
print +($@ || $ret) ? "not ok\n" : "ok 4\n";
eval { my $z = Qt::GlobalSpace::qVersion() };
if( $@ )
{
print "ok 5 # skip Smoke version too old\n";
print "ok 6 # skip Smoke version too old\n";
}
else
{
eval{ my $p = Qt::Point( 20, 20 );
my $p2 = Qt::Point( 30, 30 );
$p = $p + $p2 + $p;
$p2 = $p * 2;
$p2 = -$p2;
$ret = ($p2->x != -140 or $p2->y != -140) ? 1 : 0
};
print +($@ || $ret) ? "not ok\n" : "ok 5\n";
eval {
$str = "Fooooooooooo";
$ts = Qt::TextStream( $str, IO_WriteOnly );
$ts << "pi = " << 3.14;
};
print +($str eq "pi = 3.14ooo") ? "ok 6\n":"not ok\n";
}

@ -0,0 +1,23 @@
BEGIN { print "1..3\n" }
use Qt;
$a=0;
# testing if the Qt::Application ctor works
eval { $a=Qt::Application(\@ARGV) };
print +$@ ? "not ok\n" : "ok 1\n";
# testing wether the global object is properly setup
eval { Qt::app()->libraryPaths() };
print +$@ ? "not ok\n" : "ok 2\n";
# one second test of the event loop
Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" );
print Qt::app()->exec ? "not ok\n" : "ok 3\n";

@ -0,0 +1,23 @@
BEGIN { print "1..1\n" }
use Qt;
$a = Qt::Application();
$pb=Qt::PushButton("Foooo", undef);
{
use bytes;
$pb->setText( "élégant" );
$b = $pb->text();
$b2 = Qt::Widget::tr("élégant");
}
$c = $pb->text();
$c2= Qt::Widget::tr("élégant");
{
use bytes;
print +($b ne $c and $b2 ne $c2) ? "ok 1\n":"not ok\n";
}

@ -0,0 +1,49 @@
BEGIN { print "1..3\n" }
package MyApp;
use Qt;
use Qt::isa qw(Qt::Application);
use Qt::slots
foo => ['int'],
baz => [];
use Qt::signals
bar => ['int'];
sub NEW {
shift->SUPER::NEW(@_);
# 1) testing correct subclassing of Qt::Application and this pointer
print +(ref(this) eq " MyApp")? "ok 1\n" : "not ok\n";
this->connect(this, SIGNAL 'bar(int)', SLOT 'foo(int)');
# 3) automatic quitting will test Qt sig to custom slot
this->connect(this, SIGNAL 'aboutToQuit()', SLOT 'baz()');
# 2) testing custom sig to custom slot
emit bar(3);
}
sub foo
{
print +($_[0] == 3) ? "ok 2\n" : "not ok\n";
}
sub baz
{
print "ok 3\n";
}
1;
package main;
use Qt;
use MyApp;
$a = 0;
$a = MyApp(\@ARGV);
Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" );
exit Qt::app()->exec;

@ -0,0 +1,72 @@
BEGIN { print "1..6\n" }
package MyApp;
use Qt;
use Qt::isa('Qt::Application');
use Qt::slots
foo => ['int'],
baz => [];
use Qt::signals
bar => ['int'];
sub NEW
{
shift->SUPER::NEW(@_);
this->connect(this, SIGNAL 'bar(int)', SLOT 'foo(int)');
this->connect(this, SIGNAL 'aboutToQuit()', SLOT 'baz()');
}
sub foo
{
# 1) testing correct inheritance of sig/slots
print +($_[0] == 3) ? "ok 1\n" : "not ok\n";
}
sub baz
{
print "ok 3\n";
}
sub coincoin
{
print +(@_ == 2) ? "ok 5\n":"not ok\n";
print +(ref(this) eq " MySubApp") ? "ok 6\n":"not ok\n";
}
1;
package MySubApp;
use Qt;
use Qt::isa('MyApp');
sub NEW
{
shift->SUPER::NEW(@_);
emit foo(3);
}
sub baz
{
# 2) testing further inheritance of sig/slots
print "ok 2\n";
# 3) testing Perl to Perl SUPER
SUPER->baz();
# 4) 5) 6) testing non-qualified enum calls vs. Perl method/static calls
eval { &blue }; print !$@ ? "ok 4\n":"not ok\n";
coincoin("a","b");
}
1;
package main;
use Qt;
use MySubApp;
$a = 0;
$a = MySubApp(\@ARGV);
Qt::Timer::singleShot( 300, Qt::app(), SLOT "quit()" );
exit Qt::app()->exec;

@ -0,0 +1,19 @@
BEGIN { push @INC, "./t" ; print "1..1\n" }
package main;
use Qt;
use My::SubCodec;
use Foo::SubCodec;
$tc1 = My::SubCodec();
$tc2 = Foo::SubCodec();
$tc1->bar();
$tc2->foo();
$tc2->deleteAllCodecs;
# all imports OK
print "ok 1\n";

@ -0,0 +1,127 @@
BEGIN { print "1..1\n" }
package ButtonsGroups;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
slotChangeGrp3State => [];
use Qt::attributes qw(
state
rb21
rb22
rb23
);
#
# Constructor
#
# Creates all child widgets of the ButtonGroups window
#
sub NEW {
shift->SUPER::NEW(@_);
# Create Widgets which allow easy layouting
my $vbox = Qt::VBoxLayout(this);
my $box1 = Qt::HBoxLayout($vbox);
my $box2 = Qt::HBoxLayout($vbox);
# ------- first group
# Create an exclusive button group
my $bgrp1 = Qt::ButtonGroup(1, &Horizontal, "Button Group &1 (exclusive)", this);
$box1->addWidget($bgrp1);
$bgrp1->setExclusive(1);
# insert 3 radiobuttons
Qt::RadioButton("R&adiobutton 2", $bgrp1);
Qt::RadioButton("Ra&diobutton 3", $bgrp1);
# ------- second group
# Create a non-exclusive buttongroup
my $bgrp2 = Qt::ButtonGroup(1, &Horizontal, "Button Group &2 (non-exclusive)", this);
$box1->addWidget($bgrp2);
$bgrp2->setExclusive(0);
# insert 3 checkboxes
Qt::CheckBox("&Checkbox 1", $bgrp2);
my $cb12 = Qt::CheckBox("C&heckbox 2", $bgrp2);
$cb12->setChecked(1);
my $cb13 = Qt::CheckBox("Triple &State Button", $bgrp2);
$cb13->setTristate(1);
$cb13->setChecked(1);
# ----------- third group
# create a buttongroup which is exclusive for radiobuttons and non-exclusive for all other buttons
my $bgrp3 = Qt::ButtonGroup(1, &Horizontal, "Button Group &3 (Radiobutton-exclusive)", this);
$box2->addWidget($bgrp3);
$bgrp3->setRadioButtonExclusive(1);
# insert three radiobuttons
rb21 = Qt::RadioButton("Rad&iobutton 1", $bgrp3);
rb22 = Qt::RadioButton("Radi&obutton 2", $bgrp3);
rb23 = Qt::RadioButton("Radio&button 3", $bgrp3);
rb23->setChecked(1);
# insert a checkbox
state = Qt::CheckBox("E&nable Radiobuttons", $bgrp3);
state->setChecked(1);
# ...and connect its SIGNAL clicked() with the SLOT slotChangeGrp3State()
this->connect(state, SIGNAL('clicked()'), SLOT('slotChangeGrp3State()'));
# ----------- fourth group
# create a groupbox which layouts its childs in a columns
my $bgrp4 = Qt::ButtonGroup(1, &Horizontal, "Groupbox with &normal buttons", this);
$box2->addWidget($bgrp4);
# insert three pushbuttons...
Qt::PushButton("&Push Button", $bgrp4);
my $tb2 = Qt::PushButton("&Toggle Button", $bgrp4);
my $tb3 = Qt::PushButton("&Flat Button", $bgrp4);
# ... and make the second one a toggle button
$tb2->setToggleButton(1);
$tb2->setOn(1);
# ... and make the third one a flat button
$tb3->setFlat(1);
}
#
# SLOT slotChangeGrp3State()
#
# enables/disables the radiobuttons of the third buttongroup
#
sub slotChangeGrp3State {
rb21->setEnabled(state->isChecked);
rb22->setEnabled(state->isChecked);
rb23->setEnabled(state->isChecked);
}
1;
package main;
use Qt;
use ButtonsGroups;
Qt::StyleFactory::keys(); # disable style plugins (hacky)
my $a = Qt::Application(\@ARGV);
my $buttonsgroups = ButtonsGroups;
$buttonsgroups->resize(500, 250);
$buttonsgroups->setCaption("PerlQt Test - Please wait");
$a->setMainWidget($buttonsgroups);
$buttonsgroups->show;
Qt::Timer::singleShot( 2000, Qt::app(), SLOT "quit()" );
my $r = $a->exec;
print +$r?"not ok\n" : "ok 1\n";
exit $r;

@ -0,0 +1,8 @@
#!/usr/bin/perl -w
# Use the tutorials as a test suite
@tutorials = (sort(glob("t?")), sort(glob("t??")));
for $tutorial (@tutorials) {
chdir($tutorial) || next;
system("$^X -w $tutorial.pl");
chdir("..");
}

@ -0,0 +1,13 @@
#!/usr/bin/perl -w
use strict;
use blib;
use Qt;
my $a = Qt::Application(\@ARGV);
my $hello = Qt::PushButton("Hello World!", undef);
$hello->resize(100, 30);
$a->setMainWidget($hello);
$hello->show;
exit $a->exec;

@ -0,0 +1,76 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
angleChanged => ['int'],
forceChanged => ['int'];
use Qt::slots
setAngle => ['int'],
setForce => ['int'];
use Qt::attributes qw(
ang
f
);
use POSIX qw(atan);
sub angle () { ang }
sub force () { f }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
f = 0;
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint(cannonRect(), 0);
emit angleChanged(ang);
}
sub setForce {
my $newton = shift;
$newton = 0 if $newton < 0;
return if f == $newton;
f = $newton;
emit forceChanged(f);
}
sub paintEvent {
my $e = shift;
return unless $e->rect->intersects(cannonRect());
my $cr = cannonRect();
my $pix = Qt::Pixmap($cr->size);
$pix->fill(this, $cr->topLeft);
my $p = Qt::Painter($pix);
$p->setBrush(&blue);
$p->setPen(&NoPen);
$p->translate(0, $pix->height - 1);
$p->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
$p->rotate(- ang);
$p->drawRect(Qt::Rect(33, -4, 15, 8));
$p->end;
$p->begin(this);
$p->drawPixmap($cr->topLeft, $pix);
}
sub cannonRect {
my $r = Qt::Rect(0, 0, 50, 50);
$r->moveBottomLeft(rect()->bottomLeft);
return $r;
}
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,43 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
);
sub NEW {
shift->SUPER::NEW(@_);
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
}
sub value { slider->value }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
1;

@ -0,0 +1,61 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("&Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange(this, "angle");
$angle->setRange(5, 70);
my $force = LCDRange(this, "force");
$force->setRange(10, 50);
my $cannonField = CannonField(this, "cannonField");
$cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
$cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)'));
$force->connect($cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)'));
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget($cannonField, 1, 1);
$grid->setColStretch(1, 10);
my $leftBox = Qt::VBoxLayout;
$grid->addLayout($leftBox, 1, 0);
$leftBox->addWidget($angle);
$leftBox->addWidget($force);
$angle->setValue(60);
$force->setValue(25);
$angle->setFocus();
}
package main;
use Qt;
use MyWidget;
Qt::Application::setColorSpec(&Qt::Application::CustomColor);
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$w->setGeometry(100, 100, 500, 355);
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,146 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
angleChanged => ['int'],
forceChanged => ['int'];
use Qt::slots
setAngle => ['int'],
setForce => ['int'],
shoot => [],
moveShot => [];
use Qt::attributes qw(
ang
f
timerCount
autoShootTimer
shoot_ang
shoot_f
);
use POSIX qw(atan);
sub angle () { ang }
sub force () { f }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
f = 0;
timerCount = 0;
autoShootTimer = Qt::Timer(this, "movement handler");
this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()'));
shoot_ang = 0;
shoot_f = 0;
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint(cannonRect(), 0);
emit angleChanged(ang);
}
sub setForce {
my $newton = shift;
$newton = 0 if $newton < 0;
return if f == $newton;
f = $newton;
emit forceChanged(f);
}
sub shoot {
return if autoShootTimer->isActive;
timerCount = 0;
shoot_ang = ang;
shoot_f = f;
autoShootTimer->start(50);
}
sub moveShot {
my $r = Qt::Region(shotRect());
timerCount++;
my $shotR = shotRect();
if($shotR->x > width() || $shotR->y > height()) {
autoShootTimer->stop;
} else {
$r = $r->unite(Qt::Region($shotR));
}
repaint($r);
}
sub paintEvent {
my $e = shift;
my $updateR = $e->rect;
my $p = Qt::Painter(this);
paintCannon($p) if $updateR->intersects(cannonRect());
paintShot($p) if autoShootTimer->isActive and $updateR->intersects(shotRect());
}
sub paintShot {
my $p = shift;
$p->setBrush(&black);
$p->setPen(&NoPen);
$p->drawRect(shotRect());
}
my $barrelRect = Qt::Rect(33, -4, 15, 8);
sub paintCannon {
my $p = shift;
my $cr = cannonRect();
my $pix = Qt::Pixmap($cr->size);
$pix->fill(this, $cr->topLeft);
my $tmp = Qt::Painter($pix);
$tmp->setBrush(&blue);
$tmp->setPen(&NoPen);
$tmp->translate(0, $pix->height - 1);
$tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
$tmp->rotate(- ang);
$tmp->drawRect($barrelRect);
$tmp->end;
$p->drawPixmap($cr->topLeft, $pix);
}
sub cannonRect {
my $r = Qt::Rect(0, 0, 50, 50);
$r->moveBottomLeft(rect()->bottomLeft);
return $r;
}
sub shotRect {
my $gravity = 4;
my $time = timerCount / 4.0;
my $velocity = shoot_f;
my $radians = shoot_ang*3.14159265/180;
my $velx = $velocity*cos($radians);
my $vely = $velocity*sin($radians);
my $x0 = ($barrelRect->right + 5)*cos($radians);
my $y0 = ($barrelRect->right + 5)*sin($radians);
my $x = $x0 + $velx*$time;
my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2;
my $r = Qt::Rect(0, 0, 6, 6);
$r->moveCenter(Qt::Point(int($x), height() - 1 - int($y)));
return $r;
}
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,43 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
);
sub NEW {
shift->SUPER::NEW(@_);
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
}
sub value { slider->value }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
1;

@ -0,0 +1,71 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("&Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange(this, "angle");
$angle->setRange(5, 70);
my $force = LCDRange(this, "force");
$force->setRange(10, 50);
my $cannonField = CannonField(this, "cannonField");
$cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
$cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)'));
$force->connect($cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)'));
my $shoot = Qt::PushButton('&Shoot', this, "shoot");
$shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
$cannonField->connect($shoot, SIGNAL('clicked()'), SLOT('shoot()'));
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget($cannonField, 1, 1);
$grid->setColStretch(1, 10);
my $leftBox = Qt::VBoxLayout;
$grid->addLayout($leftBox, 1, 0);
$leftBox->addWidget($angle);
$leftBox->addWidget($force);
my $topBox = Qt::HBoxLayout;
$grid->addLayout($topBox, 0, 1);
$topBox->addWidget($shoot);
$topBox->addStretch(1);
$angle->setValue(60);
$force->setValue(25);
$angle->setFocus();
}
package main;
use Qt;
use MyWidget;
Qt::Application::setColorSpec(&Qt::Application::CustomColor);
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$w->setGeometry(100, 100, 500, 355);
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,177 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
hit => [],
missed => [],
angleChanged => ['int'],
forceChanged => ['int'];
use Qt::slots
setAngle => ['int'],
setForce => ['int'],
shoot => [],
moveShot => [];
use Qt::attributes qw(
ang
f
timerCount
autoShootTimer
shoot_ang
shoot_f
target
);
use POSIX qw(atan);
sub angle () { ang }
sub force () { f }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
f = 0;
timerCount = 0;
autoShootTimer = Qt::Timer(this, "movement handler");
this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()'));
shoot_ang = 0;
shoot_f = 0;
target = Qt::Point(0, 0);
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
newTarget();
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint(cannonRect(), 0);
emit angleChanged(ang);
}
sub setForce {
my $newton = shift;
$newton = 0 if $newton < 0;
return if f == $newton;
f = $newton;
emit forceChanged(f);
}
sub shoot {
return if autoShootTimer->isActive;
timerCount = 0;
shoot_ang = ang;
shoot_f = f;
autoShootTimer->start(50);
}
sub newTarget {
my $r = Qt::Region(targetRect());
target = Qt::Point(200 + int(rand(190)),
10 + int(rand(255)));
repaint($r->unite(Qt::Region(targetRect())));
}
sub moveShot {
my $r = Qt::Region(shotRect());
timerCount++;
my $shotR = shotRect();
if($shotR->intersects(targetRect())) {
autoShootTimer->stop;
emit hit();
} elsif($shotR->x > width() || $shotR->y > height()) {
autoShootTimer->stop;
emit missed();
} else {
$r = $r->unite(Qt::Region($shotR));
}
repaint($r);
}
sub paintEvent {
my $e = shift;
my $updateR = $e->rect;
my $p = Qt::Painter(this);
paintCannon($p) if $updateR->intersects(cannonRect());
paintShot($p) if autoShootTimer->isActive and $updateR->intersects(shotRect());
paintTarget($p) if $updateR->intersects(targetRect());
}
sub paintShot {
my $p = shift;
$p->setBrush(&black);
$p->setPen(&NoPen);
$p->drawRect(shotRect());
}
sub paintTarget {
my $p = shift;
$p->setBrush(&red);
$p->setPen(&black);
$p->drawRect(targetRect());
}
my $barrelRect = Qt::Rect(33, -4, 15, 8);
sub paintCannon {
my $p = shift;
my $cr = cannonRect();
my $pix = Qt::Pixmap($cr->size);
$pix->fill(this, $cr->topLeft);
my $tmp = Qt::Painter($pix);
$tmp->setBrush(&blue);
$tmp->setPen(&NoPen);
$tmp->translate(0, $pix->height - 1);
$tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
$tmp->rotate(- ang);
$tmp->drawRect($barrelRect);
$tmp->end;
$p->drawPixmap($cr->topLeft, $pix);
}
sub cannonRect {
my $r = Qt::Rect(0, 0, 50, 50);
$r->moveBottomLeft(rect()->bottomLeft);
return $r;
}
sub shotRect {
my $gravity = 4;
my $time = timerCount / 4.0;
my $velocity = shoot_f;
my $radians = shoot_ang*3.14159265/180;
my $velx = $velocity*cos($radians);
my $vely = $velocity*sin($radians);
my $x0 = ($barrelRect->right + 5)*cos($radians);
my $y0 = ($barrelRect->right + 5)*sin($radians);
my $x = $x0 + $velx*$time;
my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2;
my $r = Qt::Rect(0, 0, 6, 6);
$r->moveCenter(Qt::Point(int($x), height() - 1 - int($y)));
return $r;
}
sub targetRect {
my $r = Qt::Rect(0, 0, 20, 10);
$r->moveCenter(Qt::Point(target->x, height() - 1 - target->y));
return $r;
}
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,62 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'],
setText => ['const char*'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
label
);
sub NEW {
my $class = shift;
my $s;
$s = shift if $_[0] and not ref $_[0];
$class->SUPER::NEW(@_);
init();
setText($s) if $s;
}
sub init {
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
label = Qt::Label(" ", this, "label");
label->setAlignment(&AlignCenter);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
}
sub value { slider->value }
sub text { label->text }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
sub setText { label->setText(shift) }
1;

@ -0,0 +1,71 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("&Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange("ANGLE", this, "angle");
$angle->setRange(5, 70);
my $force = LCDRange("FORCE", this, "force");
$force->setRange(10, 50);
my $cannonField = CannonField(this, "cannonField");
$cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
$cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)'));
$force->connect($cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)'));
my $shoot = Qt::PushButton('&Shoot', this, "shoot");
$shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
$cannonField->connect($shoot, SIGNAL('clicked()'), SLOT('shoot()'));
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget($cannonField, 1, 1);
$grid->setColStretch(1, 10);
my $leftBox = Qt::VBoxLayout;
$grid->addLayout($leftBox, 1, 0);
$leftBox->addWidget($angle);
$leftBox->addWidget($force);
my $topBox = Qt::HBoxLayout;
$grid->addLayout($topBox, 0, 1);
$topBox->addWidget($shoot);
$topBox->addStretch(1);
$angle->setValue(60);
$force->setValue(25);
$angle->setFocus();
}
package main;
use Qt;
use MyWidget;
Qt::Application::setColorSpec(&Qt::Application::CustomColor);
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$w->setGeometry(100, 100, 500, 355);
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,207 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
hit => [],
missed => [],
angleChanged => ['int'],
forceChanged => ['int'],
canShoot => ['bool'];
use Qt::slots
setAngle => ['int'],
setForce => ['int'],
shoot => [],
moveShot => [],
newTarget => [];
use Qt::attributes qw(
ang
f
timerCount
autoShootTimer
shoot_ang
shoot_f
target
gameEnded
);
use POSIX qw(atan);
sub angle () { ang }
sub force () { f }
sub gameOver () { gameEnded }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
f = 0;
timerCount = 0;
autoShootTimer = Qt::Timer(this, "movement handler");
this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()'));
shoot_ang = 0;
shoot_f = 0;
target = Qt::Point(0, 0);
gameEnded = 0;
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
newTarget();
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint(cannonRect(), 0);
emit angleChanged(ang);
}
sub setForce {
my $newton = shift;
$newton = 0 if $newton < 0;
return if f == $newton;
f = $newton;
emit forceChanged(f);
}
sub shoot {
return if isShooting();
timerCount = 0;
shoot_ang = ang;
shoot_f = f;
autoShootTimer->start(50);
emit canShoot(0);
}
sub newTarget {
my $r = Qt::Region(targetRect());
target = Qt::Point(200 + int(rand(190)),
10 + int(rand(255)));
repaint($r->unite(Qt::Region(targetRect())));
}
sub setGameOver {
return if gameEnded;
autoShootTimer->stop if isShooting();
gameEnded = 1;
repaint();
}
sub restartGame {
autoShootTimer->stop if isShooting();
gameEnded = 0;
repaint();
emit canShoot(1);
}
sub moveShot {
my $r = Qt::Region(shotRect());
timerCount++;
my $shotR = shotRect();
if($shotR->intersects(targetRect())) {
autoShootTimer->stop;
emit hit();
emit canShoot(1);
} elsif($shotR->x > width() || $shotR->y > height()) {
autoShootTimer->stop;
emit missed();
emit canShoot(1);
} else {
$r = $r->unite(Qt::Region($shotR));
}
repaint($r);
}
sub paintEvent {
my $e = shift;
my $updateR = $e->rect;
my $p = Qt::Painter(this);
if(gameEnded) {
$p->setPen(&black);
$p->setFont(Qt::Font("Courier", 48, &Qt::Font::Bold));
$p->drawText(rect(), &AlignCenter, "Game Over");
}
paintCannon($p) if $updateR->intersects(cannonRect());
paintShot($p) if isShooting() and $updateR->intersects(shotRect());
paintTarget($p) if !gameEnded and $updateR->intersects(targetRect());
}
sub paintShot {
my $p = shift;
$p->setBrush(&black);
$p->setPen(&NoPen);
$p->drawRect(shotRect());
}
sub paintTarget {
my $p = shift;
$p->setBrush(&red);
$p->setPen(&black);
$p->drawRect(targetRect());
}
my $barrelRect = Qt::Rect(33, -4, 15, 8);
sub paintCannon {
my $p = shift;
my $cr = cannonRect();
my $pix = Qt::Pixmap($cr->size);
$pix->fill(this, $cr->topLeft);
my $tmp = Qt::Painter($pix);
$tmp->setBrush(&blue);
$tmp->setPen(&NoPen);
$tmp->translate(0, $pix->height - 1);
$tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
$tmp->rotate(- ang);
$tmp->drawRect($barrelRect);
$tmp->end;
$p->drawPixmap($cr->topLeft, $pix);
}
sub cannonRect {
my $r = Qt::Rect(0, 0, 50, 50);
$r->moveBottomLeft(rect()->bottomLeft);
return $r;
}
sub shotRect {
my $gravity = 4;
my $time = timerCount / 4.0;
my $velocity = shoot_f;
my $radians = shoot_ang*3.14159265/180;
my $velx = $velocity*cos($radians);
my $vely = $velocity*sin($radians);
my $x0 = ($barrelRect->right + 5)*cos($radians);
my $y0 = ($barrelRect->right + 5)*sin($radians);
my $x = $x0 + $velx*$time;
my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2;
my $r = Qt::Rect(0, 0, 6, 6);
$r->moveCenter(Qt::Point(int($x), height() - 1 - int($y)));
return $r;
}
sub targetRect {
my $r = Qt::Rect(0, 0, 20, 10);
$r->moveCenter(Qt::Point(target->x, height() - 1 - target->y));
return $r;
}
sub isShooting { autoShootTimer->isActive }
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,114 @@
package GameBoard;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
fire => [],
hit => [],
missed => [],
newGame => [];
use Qt::attributes qw(
hits
shotsLeft
cannonField
);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("&Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange("ANGLE", this, "angle");
$angle->setRange(5, 70);
my $force = LCDRange("FORCE", this, "force");
$force->setRange(10, 50);
cannonField = CannonField(this, "cannonField");
cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect(cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)'));
$force->connect(cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)'));
this->connect(cannonField, SIGNAL('hit()'), SLOT('hit()'));
this->connect(cannonField, SIGNAL('missed()'), SLOT('missed()'));
my $shoot = Qt::PushButton('&Shoot', this, "shoot");
$shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
this->connect($shoot, SIGNAL('clicked()'), SLOT('fire()'));
$shoot->connect(cannonField, SIGNAL('canShoot(bool)'), SLOT('setEnabled(bool)'));
my $restart = Qt::PushButton('&New Game', this, "newgame");
$restart->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
this->connect($restart, SIGNAL('clicked()'), SLOT('newGame()'));
hits = Qt::LCDNumber(2, this, "hits");
shotsLeft = Qt::LCDNumber(2, this, "shotsleft");
my $hitsL = Qt::Label("HITS", this, "hitsLabel");
my $shotsLeftL = Qt::Label("SHOTS LEFT", this, "shotsLeftLabel");
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget(cannonField, 1, 1);
$grid->setColStretch(1, 10);
my $leftBox = Qt::VBoxLayout;
$grid->addLayout($leftBox, 1, 0);
$leftBox->addWidget($angle);
$leftBox->addWidget($force);
my $topBox = Qt::HBoxLayout;
$grid->addLayout($topBox, 0, 1);
$topBox->addWidget($shoot);
$topBox->addWidget(hits);
$topBox->addWidget($hitsL);
$topBox->addWidget(shotsLeft);
$topBox->addWidget($shotsLeftL);
$topBox->addStretch(1);
$topBox->addWidget($restart);
$angle->setValue(60);
$force->setValue(25);
$angle->setFocus();
newGame();
}
sub fire {
return if cannonField->gameOver or cannonField->isShooting;
shotsLeft->display(int(shotsLeft->intValue - 1));
cannonField->shoot;
}
sub hit {
hits->display(int(hits->intValue + 1));
if(shotsLeft->intValue == 0) {
cannonField->setGameOver;
} else {
cannonField->newTarget;
}
}
sub missed {
cannonField->setGameOver if shotsLeft->intValue == 0;
}
sub newGame {
shotsLeft->display(int(15));
hits->display(0);
cannonField->restartGame;
cannonField->newTarget;
}
1;

@ -0,0 +1,67 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'],
setText => ['const char*'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
label
);
sub NEW {
my $class = shift;
my $s;
$s = shift if $_[0] and not ref $_[0];
$class->SUPER::NEW(@_);
init();
setText($s) if $s;
}
sub init {
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
label = Qt::Label(" ", this, "label");
label->setAlignment(&AlignCenter);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
my $l = Qt::VBoxLayout(this);
$l->addWidget($lcd, 1);
$l->addWidget(slider);
$l->addWidget(label);
}
sub value { slider->value }
sub text { label->text }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
sub setText { label->setText(shift) }
1;

@ -0,0 +1,14 @@
#!/usr/bin/perl -w
use strict;
use blib;
use Qt;
use GameBoard;
Qt::Application::setColorSpec(&Qt::Application::CustomColor);
my $a = Qt::Application(\@ARGV);
my $gb = GameBoard;
$gb->setGeometry(100, 100, 500, 355);
$a->setMainWidget($gb);
$gb->show;
exit $a->exec;

@ -0,0 +1,256 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
hit => [],
missed => [],
angleChanged => ['int'],
forceChanged => ['int'],
canShoot => ['bool'];
use Qt::slots
setAngle => ['int'],
setForce => ['int'],
shoot => [],
moveShot => [],
newTarget => [],
setGameOver => [],
restartGame => [];
use Qt::attributes qw(
ang
f
timerCount
autoShootTimer
shoot_ang
shoot_f
target
gameEnded
barrelPressed
);
use POSIX qw(atan);
sub angle () { ang }
sub force () { f }
sub gameOver () { gameEnded }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
f = 0;
timerCount = 0;
autoShootTimer = Qt::Timer(this, "movement handler");
this->connect(autoShootTimer, SIGNAL('timeout()'), SLOT('moveShot()'));
shoot_ang = 0;
shoot_f = 0;
target = Qt::Point(0, 0);
gameEnded = 0;
barrelPressed = 0;
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
newTarget();
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint(cannonRect(), 0);
emit angleChanged(ang);
}
sub setForce {
my $newton = shift;
$newton = 0 if $newton < 0;
return if f == $newton;
f = $newton;
emit forceChanged(f);
}
sub shoot {
return if isShooting();
timerCount = 0;
shoot_ang = ang;
shoot_f = f;
autoShootTimer->start(50);
emit canShoot(0);
}
sub newTarget {
my $r = Qt::Region(targetRect());
target = Qt::Point(200 + int(rand(190)),
10 + int(rand(255)));
repaint($r->unite(Qt::Region(targetRect())));
}
sub setGameOver {
return if gameEnded;
autoShootTimer->stop if isShooting();
gameEnded = 1;
repaint();
}
sub restartGame {
autoShootTimer->stop if isShooting();
gameEnded = 0;
repaint();
emit canShoot(1);
}
sub moveShot {
my $r = Qt::Region(shotRect());
timerCount++;
my $shotR = shotRect();
if($shotR->intersects(targetRect())) {
autoShootTimer->stop;
emit hit();
emit canShoot(1);
} elsif($shotR->x > width() || $shotR->y > height() ||
$shotR->intersects(barrierRect())) {
autoShootTimer->stop;
emit missed();
emit canShoot(1);
} else {
$r = $r->unite(Qt::Region($shotR));
}
repaint($r);
}
sub mousePressEvent {
my $e = shift;
return if $e->button != &LeftButton;
barrelPressed = 1 if barrelHit($e->pos);
}
sub mouseMoveEvent {
my $e = shift;
return unless barrelPressed;
my $pnt = $e->pos;
$pnt->setX(1) if $pnt->x <= 0;
$pnt->setY(height() - 1) if $pnt->y >= height();
my $rad = atan((rect()->bottom - $pnt->y) / $pnt->x);
setAngle(int($rad*180/3.14159265));
}
sub mouseReleaseEvent {
my $e = shift;
barrelPressed = 0 if $e->button == &LeftButton;
}
sub paintEvent {
my $e = shift;
my $updateR = $e->rect;
my $p = Qt::Painter(this);
if(gameEnded) {
$p->setPen(&black);
$p->setFont(Qt::Font("Courier", 48, &Qt::Font::Bold));
$p->drawText(rect(), &AlignCenter, "Game Over");
}
paintCannon($p) if $updateR->intersects(cannonRect());
paintBarrier($p) if $updateR->intersects(barrierRect());
paintShot($p) if isShooting() and $updateR->intersects(shotRect());
paintTarget($p) if !gameEnded and $updateR->intersects(targetRect());
}
sub paintShot {
my $p = shift;
$p->setBrush(&black);
$p->setPen(&NoPen);
$p->drawRect(shotRect());
}
sub paintTarget {
my $p = shift;
$p->setBrush(&red);
$p->setPen(&black);
$p->drawRect(targetRect());
}
sub paintBarrier {
my $p = shift;
$p->setBrush(&yellow);
$p->setPen(&black);
$p->drawRect(barrierRect());
}
my $barrelRect = Qt::Rect(33, -4, 15, 8);
sub paintCannon {
my $p = shift;
my $cr = cannonRect();
my $pix = Qt::Pixmap($cr->size);
$pix->fill(this, $cr->topLeft);
my $tmp = Qt::Painter($pix);
$tmp->setBrush(&blue);
$tmp->setPen(&NoPen);
$tmp->translate(0, $pix->height - 1);
$tmp->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
$tmp->rotate(- ang);
$tmp->drawRect($barrelRect);
$tmp->end;
$p->drawPixmap($cr->topLeft, $pix);
}
sub cannonRect {
my $r = Qt::Rect(0, 0, 50, 50);
$r->moveBottomLeft(rect()->bottomLeft);
return $r;
}
sub shotRect {
my $gravity = 4;
my $time = timerCount / 4.0;
my $velocity = shoot_f;
my $radians = shoot_ang*3.14159265/180;
my $velx = $velocity*cos($radians);
my $vely = $velocity*sin($radians);
my $x0 = ($barrelRect->right + 5)*cos($radians);
my $y0 = ($barrelRect->right + 5)*sin($radians);
my $x = $x0 + $velx*$time;
my $y = $y0 + $vely*$time - 0.5*$gravity*$time**2;
my $r = Qt::Rect(0, 0, 6, 6);
$r->moveCenter(Qt::Point(int($x), height() - 1 - int($y)));
return $r;
}
sub targetRect {
my $r = Qt::Rect(0, 0, 20, 10);
$r->moveCenter(Qt::Point(target->x, height() - 1 - target->y));
return $r;
}
sub barrierRect {
return Qt::Rect(145, height() - 100, 15, 100);
}
sub barrelHit {
my $p = shift;
my $mtx = Qt::WMatrix;
$mtx->translate(0, height() - 1);
$mtx->rotate(- ang);
$mtx = $mtx->invert;
return $barrelRect->contains($mtx->map($p));
}
sub isShooting { autoShootTimer->isActive }
sub sizeHint { Qt::Size(400, 300) }
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,125 @@
package GameBoard;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
fire => [],
hit => [],
missed => [],
newGame => [];
use Qt::attributes qw(
hits
shotsLeft
cannonField
);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("&Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange("ANGLE", this, "angle");
$angle->setRange(5, 70);
my $force = LCDRange("FORCE", this, "force");
$force->setRange(10, 50);
my $box = Qt::VBox(this, "cannonFrame");
$box->setFrameStyle($box->WinPanel | $box->Sunken);
cannonField = CannonField($box, "cannonField");
cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect(cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
cannonField->connect($force, SIGNAL('valueChanged(int)'), SLOT('setForce(int)'));
$force->connect(cannonField, SIGNAL('forceChanged(int)'), SLOT('setValue(int)'));
this->connect(cannonField, SIGNAL('hit()'), SLOT('hit()'));
this->connect(cannonField, SIGNAL('missed()'), SLOT('missed()'));
my $shoot = Qt::PushButton('&Shoot', this, "shoot");
$shoot->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
this->connect($shoot, SIGNAL('clicked()'), SLOT('fire()'));
$shoot->connect(cannonField, SIGNAL('canShoot(bool)'), SLOT('setEnabled(bool)'));
my $restart = Qt::PushButton('&New Game', this, "newgame");
$restart->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
this->connect($restart, SIGNAL('clicked()'), SLOT('newGame()'));
hits = Qt::LCDNumber(2, this, "hits");
shotsLeft = Qt::LCDNumber(2, this, "shotsleft");
my $hitsL = Qt::Label("HITS", this, "hitsLabel");
my $shotsLeftL = Qt::Label("SHOTS LEFT", this, "shotsLeftLabel");
my $accel = Qt::Accel(this);
$accel->connectItem($accel->insertItem(Qt::KeySequence(int &Key_Enter)),
this, SLOT('fire()'));
$accel->connectItem($accel->insertItem(Qt::KeySequence(int &Key_Return)),
this, SLOT('fire()'));
$accel->connectItem($accel->insertItem(Qt::KeySequence(int &CTRL+&Key_Q)),
Qt::app, SLOT('quit()'));
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget($box, 1, 1);
$grid->setColStretch(1, 10);
my $leftBox = Qt::VBoxLayout;
$grid->addLayout($leftBox, 1, 0);
$leftBox->addWidget($angle);
$leftBox->addWidget($force);
my $topBox = Qt::HBoxLayout;
$grid->addLayout($topBox, 0, 1);
$topBox->addWidget($shoot);
$topBox->addWidget(hits);
$topBox->addWidget($hitsL);
$topBox->addWidget(shotsLeft);
$topBox->addWidget($shotsLeftL);
$topBox->addStretch(1);
$topBox->addWidget($restart);
$angle->setValue(60);
$force->setValue(25);
$angle->setFocus();
newGame();
}
sub fire {
return if cannonField->gameOver or cannonField->isShooting;
shotsLeft->display(int(shotsLeft->intValue - 1));
cannonField->shoot;
}
sub hit {
hits->display(int(hits->intValue + 1));
if(shotsLeft->intValue == 0) {
cannonField->setGameOver;
} else {
cannonField->newTarget;
}
}
sub missed {
cannonField->setGameOver if shotsLeft->intValue == 0;
}
sub newGame {
shotsLeft->display(int(15));
hits->display(0);
cannonField->restartGame;
cannonField->newTarget;
}
1;

@ -0,0 +1,67 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'],
setText => ['const char*'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
label
);
sub NEW {
my $class = shift;
my $s;
$s = shift if $_[0] and not ref $_[0];
$class->SUPER::NEW(@_);
init();
setText($s) if $s;
}
sub init {
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
label = Qt::Label(" ", this, "label");
label->setAlignment(&AlignCenter);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
my $l = Qt::VBoxLayout(this);
$l->addWidget($lcd, 1);
$l->addWidget(slider);
$l->addWidget(label);
}
sub value { slider->value }
sub text { label->text }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
sub setText { label->setText(shift) }
1;

@ -0,0 +1,14 @@
#!/usr/bin/perl -w
use strict;
use blib;
use Qt;
use GameBoard;
Qt::Application::setColorSpec(&Qt::Application::CustomColor);
my $a = Qt::Application(\@ARGV);
my $gb = GameBoard;
$gb->setGeometry(100, 100, 500, 355);
$a->setMainWidget($gb);
$gb->show;
exit $a->exec;

@ -0,0 +1,16 @@
#!/usr/bin/perl -w
use strict;
use blib;
use Qt;
my $a = Qt::Application(\@ARGV);
my $quit = Qt::PushButton("Quit", undef);
$quit->resize(75, 30);
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
$a->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
$a->setMainWidget($quit);
$quit->show;
exit $a->exec;

@ -0,0 +1,19 @@
#!/usr/bin/perl -w
use strict;
use blib;
use Qt;
my $a = Qt::Application(\@ARGV);
my $box = Qt::VBox;
$box->resize(200, 120);
my $quit = Qt::PushButton("Quit", $box);
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
$a->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
$a->setMainWidget($box);
$box->show;
exit $a->exec;

@ -0,0 +1,31 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use Qt;
use Qt::isa qw(Qt::Widget);
sub NEW {
shift->SUPER::NEW(@_);
setMinimumSize(200, 120);
setMaximumSize(200, 120);
my $quit = Qt::PushButton("Quit", this, "quit");
$quit->setGeometry(62, 40, 75, 30);
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
}
package main;
use MyWidget;
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$w->setGeometry(100, 100, 200, 120);
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,34 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use Qt;
use Qt::isa qw(Qt::VBox);
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $lcd = Qt::LCDNumber(2, this, "lcd");
my $slider = Qt::Slider(&Horizontal, this, "slider");
$slider->setRange(0, 99);
$slider->setValue(0);
$lcd->connect($slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
}
package main;
use MyWidget;
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,49 @@
#!/usr/bin/perl -w
use strict;
use blib;
package LCDRange;
use Qt;
use Qt::isa qw(Qt::VBox);
sub NEW {
shift->SUPER::NEW(@_);
my $lcd = Qt::LCDNumber(2, this, "lcd");
my $slider = Qt::Slider(&Horizontal, this, "slider");
$slider->setRange(0, 99);
$slider->setValue(0);
$lcd->connect($slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
}
package MyWidget;
use Qt;
use Qt::isa qw(Qt::VBox);
use LCDRange;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $grid = Qt::Grid(4, this);
for(0..3) {
for(0..3) {
LCDRange($grid);
}
}
}
package main;
use MyWidget;
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,29 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots setValue => ['int'];
use Qt::signals valueChanged => ['int'];
use Qt::attributes qw(slider);
sub NEW {
shift->SUPER::NEW(@_);
my $lcd = Qt::LCDNumber(2, this, "lcd");
my $slider = Qt::Slider(&Horizontal, this, "slider");
slider = $slider;
slider->setRange(0, 99);
slider->setValue(0);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
}
sub value { slider->value }
sub setValue {
my $value = shift;
slider->setValue($value);
}
1;

@ -0,0 +1,40 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use Qt;
use Qt::isa qw(Qt::VBox);
use LCDRange;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $grid = Qt::Grid(4, this);
my $previous;
for my $r (0..3) {
for my $c (0..3) {
my $lr = LCDRange($grid);
$previous->connect(
$lr, SIGNAL('valueChanged(int)'),
SLOT('setValue(int)')) if $previous;
$previous = $lr;
}
}
}
package main;
use MyWidget;
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,43 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
angleChanged => ['int'];
use Qt::slots
setAngle => ['int'];
use Qt::attributes qw(
ang
);
use POSIX qw(atan);
sub angle () { ang }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint();
emit angleChanged(ang);
}
sub paintEvent {
my $s = "Angle = " . ang;
my $p = Qt::Painter(this);
$p->drawText(200, 200, $s);
}
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,43 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
);
sub NEW {
shift->SUPER::NEW(@_);
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
}
sub value { slider->value }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
1;

@ -0,0 +1,49 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange(this, "angle");
$angle->setRange(5, 70);
my $cannonField = CannonField(this, "cannonField");
$cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget($angle, 1, 0, &AlignTop);
$grid->addWidget($cannonField, 1, 1);
$grid->setColStretch(1, 10);
$angle->setValue(60);
$angle->setFocus();
}
package main;
use Qt;
use MyWidget;
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$w->setGeometry(100, 100, 500, 355);
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,48 @@
package CannonField;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::signals
angleChanged => ['int'];
use Qt::slots
setAngle => ['int'];
use Qt::attributes qw(
ang
);
use POSIX qw(atan);
sub angle () { ang }
sub NEW {
shift->SUPER::NEW(@_);
ang = 45;
setPalette(Qt::Palette(Qt::Color(250, 250, 200)));
}
sub setAngle {
my $degrees = shift;
$degrees = 5 if $degrees < 5;
$degrees = 70 if $degrees > 70;
return if ang == $degrees;
ang = $degrees;
repaint();
emit angleChanged(ang);
}
sub paintEvent {
my $p = Qt::Painter(this);
$p->setBrush(&blue);
$p->setPen(&NoPen);
$p->translate(0, rect()->bottom);
$p->drawPie(Qt::Rect(-35, -35, 70, 70), 0, 90*16);
$p->rotate(- ang);
$p->drawRect(Qt::Rect(33, -4, 15, 8));
}
sub sizePolicy {
Qt::SizePolicy(&Qt::SizePolicy::Expanding, &Qt::SizePolicy::Expanding);
}
1;

@ -0,0 +1,43 @@
package LCDRange;
use strict;
use Qt;
use Qt::isa qw(Qt::VBox);
use Qt::slots
setValue => ['int'],
setRange => ['int', 'int'];
use Qt::signals
valueChanged => ['int'];
use Qt::attributes qw(
slider
);
sub NEW {
shift->SUPER::NEW(@_);
my $lcd = Qt::LCDNumber(2, this, "lcd");
slider = Qt::Slider(&Horizontal, this, "slider");
slider->setRange(0, 99);
slider->setValue(0);
$lcd->connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'));
this->connect(slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'));
setFocusProxy(slider);
}
sub value { slider->value }
sub setValue { slider->setValue(shift) }
sub setRange {
my($minVal, $maxVal) = @_;
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
warn "LCDRange::setRange($minVal,$maxVal)\n" .
"\tRange must be 0..99\n" .
"\tand minVal must not be greater than maxVal\n";
return;
}
slider->setRange($minVal, $maxVal);
}
1;

@ -0,0 +1,50 @@
#!/usr/bin/perl -w
use strict;
use blib;
package MyWidget;
use strict;
use Qt;
use Qt::isa qw(Qt::Widget);
use LCDRange;
use CannonField;
sub NEW {
shift->SUPER::NEW(@_);
my $quit = Qt::PushButton("&Quit", this, "quit");
$quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));
Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));
my $angle = LCDRange(this, "angle");
$angle->setRange(5, 70);
my $cannonField = CannonField(this, "cannonField");
$cannonField->connect($angle, SIGNAL('valueChanged(int)'), SLOT('setAngle(int)'));
$angle->connect($cannonField, SIGNAL('angleChanged(int)'), SLOT('setValue(int)'));
my $grid = Qt::GridLayout(this, 2, 2, 10);
$grid->addWidget($quit, 0, 0);
$grid->addWidget($angle, 1, 0, &AlignTop);
$grid->addWidget($cannonField, 1, 1);
$grid->setColStretch(1, 10);
$angle->setValue(60);
$angle->setFocus();
}
package main;
use Qt;
use MyWidget;
Qt::Application::setColorSpec(&Qt::Application::CustomColor);
my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$w->setGeometry(100, 100, 500, 355);
$a->setMainWidget($w);
$w->show;
exit $a->exec;

@ -0,0 +1,23 @@
PerlQt is a Perl Object Oriented interface to Trolltech's Qt v3.x - a well known
C++ GUI toolkit.
See INSTALL for quick installation instructions
See doc/en/index.html or doc/fr/index.html for installation procedure and detailed
documentation.
See also PerlQt/tutorials and PerlQt/examples to get started.
Requirements :
------------
- Perl >= 5.6
- Qt >= 3.0
- GNU tools : automake(>=1.5), autoconf (>=2.13), aclocal...

@ -0,0 +1,3 @@
- support templated classes
- PerlKDE

File diff suppressed because it is too large Load Diff

11632
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,199 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* 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 to 1 if you have the <pthread/linuxthreads/pthread.h> header file.
*/
#undef HAVE_PTHREAD_LINUXTHREADS_PTHREAD_H
/* Define if you have the res_init function */
#undef HAVE_RES_INIT
/* 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/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
/* Suffix for lib directories */
#undef KDELIBSUFF
/* 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 `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
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/*
* 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_STRLCAT_PROTO)
#ifdef __cplusplus
extern "C"
#endif
unsigned long strlcat(char*, const char*, unsigned long);
#endif
#if !defined(HAVE_STRLCPY_PROTO)
#ifdef __cplusplus
extern "C"
#endif
unsigned long strlcpy(char*, const char*, unsigned long);
#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
/* Compatibility define */
#undef ksize_t
/* Define the real type of socklen_t */
#undef socklen_t

@ -0,0 +1,525 @@
dnl This file is part of the KDE libraries/packages
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
dnl This file is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl You should have received a copy of the GNU Library General Public License
dnl along with this library; see the file COPYING.LIB. If not, write to
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
dnl Boston, MA 02111-1307, USA.
# Original Author was Kalle@kde.org
# I lifted it in some mater. (Stephan Kulow)
# I used much code from Janos Farkas
dnl Process this file with autoconf to produce a configure script.
AC_INIT(acinclude.m4) dnl a source file from your sub dir
AC_PREREQ(2.50)
dnl This is so we can use kde-common
AC_CONFIG_AUX_DIR(admin)
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
unset CDPATH
dnl Checking host/target/build systems, for make, install etc.
AC_CANONICAL_BUILD
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(PerlQt, 3.008) dnl searches for some needed programs
KDE_SET_PREFIX
dnl generate the config header
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
dnl Checks for programs.
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL
dnl for NLS support. Call them in this order!
dnl WITH_NLS is for the po files
dnl AM_KDE_WITH_NLS
KDE_USE_QT(3.0)
dnl ------------------------------------------------------------------------
dnl Reimplementation of AC_BASE_PATH_KDE avoiding the need for
dnl a prefix pointing to KDEDIR.
dnl $(KDE_LDFLAGS) will be the kdeliblocation (if any)
dnl and $(kde_includes) will be the kdehdrlocation (if any)
dnl ------------------------------------------------------------------------
dnl
AC_DEFUN(AC_BASE_PATH_INSTALL,
[
AC_PREREQ([2.13])
AC_REQUIRE([AC_PATH_QT])dnl
AC_REQUIRE([KDE_CHECK_LIB64])
AC_CHECK_RPATH
dnl PQT
AC_MSG_CHECKING([for KDE or an Install directory])
dnl /PQT
if test "${prefix}" != NONE; then
kde_includes=${prefix}/include
ac_kde_includes=$prefix/include
if test "${exec_prefix}" != NONE; then
kde_libraries=${libdir}
ac_kde_libraries=$libdir
if test "$ac_kde_libraries" = '${exec_prefix}/lib'${kdelibsuff}; then
ac_kde_libraries=$exec_prefix/lib${kdelibsuff}
fi
else
kde_libraries=${prefix}/lib${kdelibsuff}
ac_kde_libraries=$prefix/lib${kdelibsuff}
fi
else
ac_kde_includes=
ac_kde_libraries=
kde_libraries=""
kde_includes=""
fi
AC_CACHE_VAL(ac_cv_have_kde,
[#try to guess kde locations
dnl PQT
kde_check_header="kdeversion.h"
kde_check_lib="libkdefx.la"
dnl /PQT
if test -z "$1"; then
kde_incdirs="/usr/lib/kde/include /usr/local/kde/include /usr/local/include /usr/kde/include /usr/include/kde /usr/include /opt/kde3/include /opt/kde/include $x_includes $qt_includes"
test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR/include/kde $KDEDIR $kde_incdirs"
kde_incdirs="$ac_kde_includes $kde_incdirs"
AC_FIND_FILE($kde_check_header, $kde_incdirs, kde_incdir)
ac_kde_includes="$kde_incdir"
if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/$kde_check_header"; then
dnl PQT
AC_MSG_WARN([
in the prefix, you've chosen, are no KDE headers installed.])
dnl /PQT
fi
kde_libdirs="/usr/lib/kde/lib${kdelibsuff} /usr/local/kde/lib${kdelibsuff} /usr/kde/lib${kdelibsuff} /usr/lib${kdelibsuff}/kde /usr/lib${kdelibsuff}/kde3 /usr/lib${kdelibsuff} /usr/X11R6/lib${kdelibsuff} /usr/local/lib${kdelibsuff} /opt/kde3/lib${kdelibsuff} /opt/kde/lib${kdelibsuff} /usr/X11R6/kde/lib${kdelibsuff}"
test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib${kdelibsuff} $KDEDIR $kde_libdirs"
kde_libdirs="$ac_kde_libraries $libdir $kde_libdirs"
AC_FIND_FILE($kde_check_lib, $kde_libdirs, kde_libdir)
ac_kde_libraries="$kde_libdir"
kde_widgetdir=NO
dnl this might be somewhere else
AC_FIND_FILE("kde3/plugins/designer/kdewidgets.la", $kde_libdirs, kde_widgetdir)
if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/$kde_check_lib"; then
dnl PQT
AC_MSG_WARN([
in the prefix, you've chosen, are no KDE libraries installed.])
dnl /PQT
fi
dnl PQT
dnl if test -n "$kde_widgetdir" && test ! -r "$kde_widgetdir/kde3/plugins/designer/kdewidgets.la"; then
dnl AC_MSG_ERROR([
dnl I can't find the designer plugins. These are required and should have been installed
dnl by kdelibs])
dnl fi
dnl /PQT
if test -n "$kde_widgetdir"; then
kde_widgetdir="$kde_widgetdir/kde3/plugins/designer"
fi
if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO || test "$kde_widgetdir" = NO; then
ac_cv_have_kde="have_kde=no"
else
ac_cv_have_kde="have_kde=yes \
ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
fi
else dnl test -z $1
ac_cv_have_kde="have_kde=no"
fi
])dnl
eval "$ac_cv_have_kde"
if test "$have_kde" != "yes"; then
if test "${prefix}" = NONE; then
ac_kde_prefix="$ac_default_prefix"
else
ac_kde_prefix="$prefix"
fi
if test "$exec_prefix" = NONE; then
ac_kde_exec_prefix="$ac_kde_prefix"
dnl PQT
AC_MSG_RESULT([will use $ac_kde_prefix])
else
ac_kde_exec_prefix="$exec_prefix"
AC_MSG_RESULT([will use $ac_kde_prefix and $ac_kde_exec_prefix])
dnl /PQT
fi
kde_libraries="${libdir}"
kde_includes=${ac_kde_prefix}/include
else
ac_cv_have_kde="have_kde=yes \
ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
kde_libraries="$ac_kde_libraries"
kde_includes="$ac_kde_includes"
fi
AC_SUBST(kde_libraries)
AC_SUBST(kde_includes)
if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" || test "$kde_includes" = "/usr/include"; then
KDE_INCLUDES=""
else
KDE_INCLUDES="-I$kde_includes"
all_includes="$KDE_INCLUDES $all_includes"
fi
KDE_LDFLAGS="-L$kde_libraries"
dnl PQT
if test "$kde_libraries" != "$x_libraries" && test "$kde_libraries" != "$qt_libraries" ; then
all_libraries="$all_libraries $KDE_LDFLAGS"
fi
dnl /PQT
AC_SUBST(KDE_LDFLAGS)
AC_SUBST(KDE_INCLUDES)
AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
all_libraries="$all_libraries $USER_LDFLAGS"
all_includes="$all_includes $USER_INCLUDES"
AC_SUBST(all_includes)
AC_SUBST(all_libraries)
AC_SUBST(AUTODIRS)
])
dnl-------------------------------
dnl
dnl Check for the SMOKE Library
dnl
dnl-------------------------------
AC_DEFUN(KDE_CHECK_SMOKE,
[
AC_MSG_CHECKING(for SmokeQt)
AC_CACHE_VAL(kde_have_smokeqt,
[
kde_ldflags_safe="$LDFLAGS"
kde_libs_safe="$LIBS"
kde_cxxflags_safe="$CXXFLAGS"
kde_ldpath_save="$LD_LIBRARY_PATH"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
LIBS="-lsmokeqt"
CXXFLAGS="$CXXFLAGS -I$prefix/include -I$prefix/include/kde $all_includes"
LDFLAGS="$LDFLAGS $all_libraries $USER_LDFLAGS"
LD_LIBRARY_PATH="$qt_libraries"
AC_TRY_LINK([
#include <smoke.h>
],
[
Smoke::Index i;
],
kde_have_smokeqt=yes,
kde_have_smokeqt=no
)
LDFLAGS=$kde_ldflags_safe
LIBS=$kde_libs_safe
CXXFLAGS=$kde_cxxflags_safe
LD_LIBRARY_PATH=$kde_ldpath_save
])
AC_LANG_RESTORE
AC_MSG_RESULT($kde_have_smokeqt)
$1=$kde_have_smokeqt
])
dnl @synopsis MDL_HAVE_OPENGL
dnl
dnl Search for OpenGL. We search first for Mesa (a GPL'ed version of
dnl OpenGL) before a vendor's version of OpenGL, unless we were
dnl specifically asked not to with `--with-Mesa=no' or `--without-Mesa'.
dnl
dnl The four "standard" OpenGL libraries are searched for: "-lGL",
dnl "-lGLU", "-lGLX" (or "-lMesaGL", "-lMesaGLU" as the case may be) and
dnl "-lglut".
dnl
dnl All of the libraries that are found (since "-lglut" or "-lGLX" might
dnl be missing) are added to the shell output variable "GL_LIBS", along
dnl with any other libraries that are necessary to successfully link an
dnl OpenGL application (e.g. the X11 libraries). Care has been taken to
dnl make sure that all of the libraries in "GL_LIBS" are listed in the
dnl proper order.
dnl
dnl Additionally, the shell output variable "GL_CFLAGS" is set to any
dnl flags (e.g. "-I" flags) that are necessary to successfully compile
dnl an OpenGL application.
dnl
dnl The following shell variable (which are not output variables) are
dnl also set to either "yes" or "no" (depending on which libraries were
dnl found) to help you determine exactly what was found.
dnl
dnl have_GL
dnl have_GLU
dnl have_GLX
dnl have_glut
dnl
dnl A complete little toy "Automake `make distcheck'" package of how to
dnl use this macro is available at:
dnl
dnl ftp://ftp.slac.stanford.edu/users/langston/autoconf/ac_opengl-0.01.tar.gz
dnl
dnl Please note that as the ac_opengl macro and the toy example evolves,
dnl the version number increases, so you may have to adjust the above
dnl URL accordingly.
dnl
dnl @version 0.01 $Id: configure.in,v 1.18 2003/09/07 14:18:50 germaingarand Exp $
dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU>
AC_DEFUN(MDL_HAVE_OPENGL,
[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PATH_X])
AC_REQUIRE([AC_PATH_XTRA])
AC_REQUIRE([MDL_CHECK_LIBM])
AC_CACHE_CHECK([for OpenGL], mdl_cv_have_OpenGL,
[
dnl Check for Mesa first, unless we were asked not to.
AC_HELP_STRING()
AC_ARG_ENABLE(Mesa, [ --with-Mesa Prefer the Mesa library over a vendors native OpenGL library (default=yes)],
, use_Mesa=$enableval
, use_Mesa=yes)
if test x"$use_Mesa" = xyes; then
GL_search_list="MesaGL GL"
GLU_search_list="MesaGLU GLU"
GLX_search_list="MesaGLX GLX"
else
GL_search_list="GL MesaGL"
GLU_search_list="GLU MesaGLU"
GLX_search_list="GLX MesaGLX"
fi
AC_LANG_SAVE
AC_LANG_C
dnl If we are running under X11 then add in the appropriate libraries.
if test x"$no_x" != xyes; then
dnl Add everything we need to compile and link X programs to GL_CFLAGS
dnl and GL_X_LIBS.
GL_CFLAGS="$X_CFLAGS"
GL_X_LIBS="$X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS $LIBM"
fi
GL_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$GL_CFLAGS"
GL_save_LIBS="$LIBS"
LIBS="$GL_X_LIBS"
# Save the "AC_MSG_RESULT file descriptor" to FD 8.
exec 8>&AC_FD_MSG
# Temporarily turn off AC_MSG_RESULT so that the user gets pretty
# messages.
exec AC_FD_MSG>/dev/null
AC_SEARCH_LIBS(glAccum, $GL_search_list, have_GL=yes, have_GL=no)
AC_SEARCH_LIBS(gluBeginCurve, $GLU_search_list, have_GLU=yes, have_GLU=no)
AC_SEARCH_LIBS(glXChooseVisual, $GLX_search_list, have_GLX=yes, have_GLX=no)
AC_SEARCH_LIBS(glutInit, glut, have_glut=yes, have_glut=no)
# Restore pretty messages.
exec AC_FD_MSG>&8
if test -n "$LIBS"; then
mdl_cv_have_OpenGL=yes
GL_LIBS="$LIBS"
AC_SUBST(GL_CFLAGS)
AC_SUBST(GL_LIBS)
else
mdl_cv_have_OpenGL=no
GL_CFLAGS=
fi
dnl Reset GL_X_LIBS regardless, since it was just a temporary variable
dnl and we don't want to be global namespace polluters.
GL_X_LIBS=
LIBS="$GL_save_LIBS"
CPPFLAGS="$GL_save_CPPFLAGS"
AC_LANG_RESTORE
])
])
dnl ####################### -*- Mode: M4 -*- ###########################
dnl Copyright (C) 98, 1999 Matthew D. Langston <langston@SLAC.Stanford.EDU>
dnl
dnl This file is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This file is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this file; if not, write to:
dnl
dnl Free Software Foundation, Inc.
dnl Suite 330
dnl 59 Temple Place
dnl Boston, MA 02111-1307, USA.
dnl ####################################################################
dnl @synopsis MDL_CHECK_LIBM
dnl
dnl Search for math library (typically -lm).
dnl
dnl The variable LIBM (which is not an output variable by default) is
dnl set to a value which is suitable for use in a Makefile (for example,
dnl in make's LOADLIBES macro) provided you AC_SUBST it first.
dnl
dnl @version 0.01 $Id: configure.in,v 1.18 2003/09/07 14:18:50 germaingarand Exp $
dnl @author Matthew D. Langston <langston@SLAC.Stanford.EDU>
# AC_CHECK_LIBM - check for math library
AC_DEFUN(MDL_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case "$host" in
*-*-beos* | *-*-cygwin*)
# These system don't have libm
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, main, LIBM="-lm")
;;
esac
])
dnl PACKAGE set before
AC_BASE_PATH_INSTALL
#MIN_CONFIG(3)
HAVE_SMOKE="no"
KDE_CHECK_SMOKE(HAVE_SMOKE)
AC_ARG_ENABLE(
smoke,
[ --enable-smoke generate libsmoke, even if it has been found on your system],
kde_force_smoke=$enableval,
kde_force_smoke=no
)
AC_ARG_ENABLE(
GL,
[ --disable-GL do not try to compile Qt's OpenGL module in smoke],
kde_enable_GL=$enableval,
kde_enable_GL=yes
)
KDE_HAVE_GL="no"
if test "$HAVE_SMOKE" = "yes" && test "$kde_force_smoke" = "no"; then
DO_NOT_COMPILE="$DO_NOT_COMPILE smoke"
else
if test "X$kde_enable_GL" = "Xyes"; then
dnl check for OpenGL
MDL_HAVE_OPENGL
have_gl_headers="no"
AC_CHECK_HEADER([GL/gl.h],
[ AC_CHECK_HEADER([GL/glu.h], [have_gl_headers="yes"])])
if test "X$have_GL" = "Xyes" && test "X$have_GLU" = "Xyes" && test "X$have_gl_headers" = "Xyes"; then
KDE_HAVE_GL="yes"
fi
fi
fi
AC_SUBST(KDE_HAVE_GL)
KDE_CREATE_SUBDIRSLIST
AC_SUBST(USE_RPATH)
AC_CONFIG_FILES(PerlQt/Makefile.PL, [cd PerlQt && perl Makefile.PL INSTALLDIRS=vendor && cd ..])
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([puic/Makefile])
AC_ARG_WITH(
threshold,
[ --with-threshold[=ARG] Qt tests threshold ARG=[0..15] Default:14 Lower=more tests],
[ qt_test_threshold="$withval" ],
[ qt_test_threshold=14 ]
)
AC_SUBST(qt_test_threshold)
if test "$HAVE_SMOKE" = "no" || test "$kde_force_smoke" != "no"; then
AC_CONFIG_FILES(smoke/qt/qtguess.pl, [cd smoke/qt && perl qtguess.pl && cd ../..] )
AC_CONFIG_FILES(smoke/qt/generate.pl, [cd smoke/qt && perl generate.pl && cd ../..])
AC_CONFIG_FILES([smoke/Makefile])
AC_CONFIG_FILES([smoke/qt/Makefile])
fi
AC_OUTPUT
all_tests=fine
dnl
dnl latest tests goes here
dnl
if test "$all_tests" = "fine"; then
echo ""
echo "Good - your configure finished. Start make now"
echo ""
fi

File diff suppressed because it is too large Load Diff

@ -0,0 +1,132 @@
/* standard elements */
body
{
background: #FFFFFF;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
}
p
{
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
}
blockquote
{
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
}
ul
{
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
list-style-type: disc;
}
ol
{
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: normal;
}
h1
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
color: #2660C9;
}
h2
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #2660C9;
background-color: #EAE2BB;
}
h3
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #000000;
}
h4
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #2660C9;
}
pre
{
font-size: 120%;
padding-bottom: 5px;
}
tt
{
font-size: 120%;
}
code
{
font-size: 120%;
}
kbd
{
font-size: 120%;
}
/* documentation link formatting */
a:link
{
color: #2660C9;
text-decoration: underline;
}
a:visited
{
color: #2660C9;
text-decoration: underline;
}
a:hover
{
color: #000000;
text-decoration: underline;
}
a:active
{
color: #2660C9;
text-decoration: underline;
}
.docsubheading
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #B82619;
background-color: #EAE2BB;
}
.docsubheadinggrey
{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #B82619;
background-color: #cccccc;
}
.error
{
color: #B82619;
}
.err
{
color: #B82619;
}
/* unordered list without bullets */
ul.sans
{
list-style-type: none;
}

@ -0,0 +1,7 @@
index.html: PerlQt.pod
pod2html --css ../css/pod.css PerlQt.pod > index.html
perl -pi -e 's/cgibin/cgi-bin/' index.html
perl -pi -e 's/#http/http/g' index.html
rm -f pod2*~~

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
index.html: PerlQt.pod
pod2html --css ../css/pod.css PerlQt.pod > index.html
perl -pi -e 's/cgibin/cgi-bin/' index.html
perl -pi -e 's/#http/http/g' index.html
rm -f pod2*~~

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

@ -0,0 +1,3 @@
smoke
PerlQt
puic

@ -0,0 +1,91 @@
package Ast;
use strict;
use vars qw/ $this $pack @endCodes /;
#-----------------------------------------------------------------------------
# This package is used to create a simple Abstract Syntax tree. Each node
# in the AST is an associative array and supports two kinds of properties -
# scalars and lists of scalars.
# See SchemParser.pm for an example of usage.
# ... Sriram
#-----------------------------------------------------------------------------
# Constructor
# e.g AST::New ("personnel")
# Stores the argument in a property called astNodeName whose sole purpose
# is to support Print()
sub New {
my ($this) = {"astNodeName" => $_[0]};
bless ($this);
return $this;
}
# Add a property to this object
# $astNode->AddProp("className", "Employee");
sub AddProp {
my ($this) = $_[0];
$this->{$_[1]} = $_[2];
}
# Equivalent to AddProp, except the property name is associated
# with a list of values
# $classAstNode->AddProp("attrList", $attrAstNode);
sub AddPropList {
my ($this) = $_[0];
if (! exists $this->{$_[1]}) {
$this->{$_[1]} = [];
}
push (@{$this->{$_[1]}}, $_[2]);
}
# Returns a list of all the property names of this object
sub GetProps {
my ($this) = $_[0];
return keys %{$this};
}
sub Visit {
# Converts each of this AstNode's properties into global variables.
# The global variables are introduced into package "main"
# At the same time, a piece of code is formed to undo this work above -
# $endCode essentially contains the values of these global variables
# before they are mangled. endCode gets pushed into a stack (endCodes),
# which is unwound by UnVisit().
local ($this, $pack) = @_;
my $code = "";
my $endCode = "";
foreach my $k (keys %{$this}) {
my $glob = $pack."::".$k;
if ( defined $$glob ) {
if ( ${$glob} ne "" ) {
$$glob =~ s/\'/\\\'/g;
}
$endCode .= '$'.$pack.'::'.$k. " = '".$$glob."';";
} else {
$endCode .= '$'.$pack . "::". $k . ' = "";';
}
$code .= '$'.$pack . "::" . $k . "= \$this->{\"$k\"};";
}
push (@endCodes, $endCode);
eval($code) if $code;
}
sub UnVisit {
my $code = pop(@endCodes);
eval($code) if ($code);
}
1;

@ -0,0 +1,82 @@
2003-08-30 Richard Dale <Richard_Dale@tipitina.demon.co.uk>
* Applied Germain Garand's patch to no longer rename operator methods
in the QGlobalSpace pseudo class
2003-08-21 Alexander Kellett <lypanov@kde.org>
* Added .kidl generation option (dcopidl replacement)
* Handled of several new constructs in the parsing:
* k_dcop: / k_dcop_signals: / K_DCOP:
* Use STDERR not STDOUT thus removing need for temporary file
2003-08-21 Richard Dale <Richard_Dale@tipitina.demon.co.uk>
* Added missing getClassLoader() call to Proxy constructor
2003-08-21 Richard Dale <Richard_Dale@tipitina.demon.co.uk>
* Rewritten java code generation for a Dynamic Proxy based SMOKE adaptor version of QtJava.
* Based on David Faure's SMOKE generation code in the '-fsmoke' option.
2003-08-11 Richard Dale <Richard_Dale@tipitina.demon.co.uk>
* Removed old SWIG style ruby generation option
2003-08-09 Alexander Kellett <lypanov@kde.org>
* Parse static friend operator methods and place into a pseudo class (for smoke)
2002-06-03 David Faure <faure@kde.org>
* The Smoke generation is in good shape. Removed old PerlPig and PerlQK
modules.
2002-04-23 Richard Dale <duke@tipitina.demon.co.uk>
* Added patch from David Faure to correctly handle nested struct
or class names in perl .pig generation
2002-03-15 Richard Dale <duke@tipitina.demon.co.uk>
* Added C# P/Invoke bindings generation option from Adam Treat
2002-02-10 Richard Dale <duke@tipitina.demon.co.uk>
* Improved C destructor code generation
* QCanvasItemList mapped onto java.util.ArrayList
* 'bool *' type converted to java 'boolean[]' type.
2002-02-03 Richard Dale <duke@tipitina.demon.co.uk>
* More fixes to .pig generation from Germain. Perl porting now
motoring 24*7...
2002-02-02 Richard Dale <duke@tipitina.demon.co.uk>
* Various improvements to Perl .pig generation from Germain Garand
2002-01-31 Richard Dale <duke@tipitina.demon.co.uk>
* Fixed bug in code generation for NULL default arguments
* Added some new KDE 3 types
2002-01-26 Richard Dale <duke@tipitina.demon.co.uk>
* Perl .pig generation improved
2002-01-25 Richard Dale <duke@tipitina.demon.co.uk>
* Added '-fperl' option to autogenerate .pig (Perl Interface
Generator) files, suitable for generating Ashley Winters' PerlQt/KDEQt
bindings
2002-01-23 Richard Dale <duke@tipitina.demon.co.uk>
* Made dispose() public, added isDisposed() after SWT.
2002-01-23 Richard Dale <duke@tipitina.demon.co.uk>
* Added generation of dispose() methods, to allow large resources,
such as pixmaps, to be freed before finalize() is called.
2002-01-20 Richard Dale <duke@tipitina.demon.co.uk>
* Ruby bindings generation - initial checkin.
2002-01-04 Richard Dale <duke@tipitina.demon.co.uk>
* Fixed bug in parsing decimal point in default argument values
2001-12-29 Richard Dale <duke@tipitina.demon.co.uk
* JNI event handling methods are now generated.
* Some additions for KDevelop types.
* Removed assumption that a class ending in '..Interface' should always
be a java interface.
2001-12-17 Richard Dale <duke@tipitina.demon.co.uk
* Improved code generation for String f'ns with default arguments.
* An implementation is no longer generated for classes which are
just interfaces.
2001-12-03 Richard Dale <duke@tipitina.demon.co.uk
* Added new KDE 3 data types
* Improved code generation for classes defined within namespaces

@ -0,0 +1,532 @@
package Iter;
=head1 Iterator Module
A set of iterator functions for traversing the various trees and indexes.
Each iterator expects closures that operate on the elements in the iterated
data structure.
=head2 Generic
Params: $node, &$loopsub, &$skipsub, &$applysub, &$recursesub
Iterate over $node\'s children. For each iteration:
If loopsub( $node, $kid ) returns false, the loop is terminated.
If skipsub( $node, $kid ) returns true, the element is skipped.
Applysub( $node, $kid ) is called
If recursesub( $node, $kid ) returns true, the function recurses into
the current node.
=cut
sub Generic
{
my ( $root, $loopcond, $skipcond, $applysub, $recursecond ) = @_;
return sub {
foreach my $node ( @{$root->{Kids}} ) {
if ( defined $loopcond ) {
return 0 unless $loopcond->( $root, $node );
}
if ( defined $skipcond ) {
next if $skipcond->( $root, $node );
}
my $ret = $applysub->( $root, $node );
return $ret if defined $ret && $ret;
if ( defined $recursecond
&& $recursecond->( $root, $node ) ) {
$ret = Generic( $node, $loopcond, $skipcond,
$applysub, $recursecond)->();
if ( $ret ) {
return $ret;
}
}
}
return 0;
};
}
sub Class
{
my ( $root, $applysub, $recurse ) = @_;
return Generic( $root, undef,
sub {
return !( $node->{NodeType} eq "class"
|| $node->{NodeType} eq "struct" );
},
$applysub, $recurse );
}
=head2 Tree
Params: $root, $recurse?, $commonsub, $compoundsub, $membersub,
$skipsub
Traverse the ast tree starting at $root, skipping if skipsub returns true.
Applying $commonsub( $node, $kid),
then $compoundsub( $node, $kid ) or $membersub( $node, $kid ) depending on
the Compound flag of the node.
=cut
sub Tree
{
my ( $rootnode, $recurse, $commonsub, $compoundsub, $membersub,
$skipsub ) = @_;
my $recsub = $recurse ? sub { return 1 if $_[1]->{Compound}; }
: undef;
Generic( $rootnode, undef, $skipsub,
sub { # apply
my ( $root, $node ) = @_;
my $ret;
if ( defined $commonsub ) {
$ret = $commonsub->( $root, $node );
return $ret if defined $ret;
}
if ( $node->{Compound} && defined $compoundsub ) {
$ret = $compoundsub->( $root, $node );
return $ret if defined $ret;
}
if( !$node->{Compound} && defined $membersub ) {
$ret = $membersub->( $root, $node );
return $ret if defined $ret;
}
return;
},
$recsub # skip
)->();
}
=head2 LocalCompounds
Apply $compoundsub( $node ) to all locally defined compound nodes
(ie nodes that are not external to the library being processed).
=cut
sub LocalCompounds
{
my ( $rootnode, $compoundsub ) = @_;
return unless defined $rootnode && defined $rootnode->{Kids};
foreach my $kid ( sort { $a->{astNodeName} cmp $b->{astNodeName} }
@{$rootnode->{Kids}} ) {
next if !defined $kid->{Compound};
$compoundsub->( $kid ) unless defined $kid->{ExtSource};
LocalCompounds( $kid, $compoundsub );
}
}
=head2 Hierarchy
Params: $node, $levelDownSub, $printSub, $levelUpSub
This allows easy hierarchy traversal and printing.
Traverses the inheritance hierarchy starting at $node, calling printsub
for each node. When recursing downward into the tree, $levelDownSub($node) is
called, the recursion takes place, and $levelUpSub is called when the
recursion call is completed.
=cut
sub Hierarchy
{
my ( $node, $ldownsub, $printsub, $lupsub, $nokidssub ) = @_;
return if defined $node->{ExtSource}
&& (!defined $node->{InBy}
|| !kdocAstUtil::hasLocalInheritor( $node ));
$printsub->( $node );
if ( defined $node->{InBy} ) {
$ldownsub->( $node );
foreach my $kid (
sort {$a->{astNodeName} cmp $b->{astNodeName}}
@{ $node->{InBy} } ) {
Hierarchy( $kid, $ldownsub, $printsub, $lupsub );
}
$lupsub->( $node );
}
elsif ( defined $nokidssub ) {
$nokidssub->( $node );
}
return;
}
=head2
Call $printsub for each *direct* ancestor of $node.
Only multiple inheritance can lead to $printsub being called more than once.
=cut
sub Ancestors
{
my ( $node, $rootnode, $noancessub, $startsub, $printsub,
$endsub ) = @_;
my @anlist = ();
return if $node eq $rootnode;
if ( !exists $node->{InList} ) {
$noancessub->( $node ) unless !defined $noancessub;
return;
}
foreach my $innode ( @{ $node->{InList} } ) {
my $nref = $innode->{Node}; # real ancestor
next if defined $nref && $nref == $rootnode;
push @anlist, $innode;
}
if ( $#anlist < 0 ) {
$noancessub->( $node ) unless !defined $noancessub;
return;
}
$startsub->( $node ) unless !defined $startsub;
foreach my $innode ( sort { $a->{astNodeName} cmp $b->{astNodeName} }
@anlist ) {
# print
$printsub->( $innode->{Node}, $innode->{astNodeName},
$innode->{Type}, $innode->{TmplType} )
unless !defined $printsub;
}
$endsub->( $node ) unless !defined $endsub;
return;
}
sub Descendants
{
my ( $node, $nodescsub, $startsub, $printsub, $endsub ) = @_;
if ( !exists $node->{InBy} ) {
$nodescsub->( $node ) unless !defined $nodescsub;
return;
}
my @desclist = ();
DescendantList( \@desclist, $node );
if ( $#desclist < 0 ) {
$nodescsub->( $node ) unless !defined $nodescsub;
return;
}
$startsub->( $node ) unless !defined $startsub;
foreach my $innode ( sort { $a->{astNodeName} cmp $b->{astNodeName} }
@desclist ) {
$printsub->( $innode)
unless !defined $printsub;
}
$endsub->( $node ) unless !defined $endsub;
return;
}
sub DescendantList
{
my ( $list, $node ) = @_;
return unless exists $node->{InBy};
foreach my $kid ( @{ $node->{InBy} } ) {
push @$list, $kid;
DescendantList( $list, $kid );
}
}
=head2 DocTree
=cut
sub DocTree
{
my ( $rootnode, $allowforward, $recurse,
$commonsub, $compoundsub, $membersub ) = @_;
Generic( $rootnode, undef,
sub { # skip
my( $node, $kid ) = @_;
unless (!(defined $kid->{ExtSource})
&& ($allowforward || $kid->{NodeType} ne "Forward")
&& ($main::doPrivate || !($kid->{Access} =~ /private/))
&& exists $kid->{DocNode} ) {
return 1;
}
return;
},
sub { # apply
my ( $root, $node ) = @_;
my $ret;
if ( defined $commonsub ) {
$ret = $commonsub->( $root, $node );
return $ret if defined $ret;
}
if ( $node->{Compound} && defined $compoundsub ) {
$ret = $compoundsub->( $root, $node );
return $ret if defined $ret;
}
elsif( defined $membersub ) {
$ret = $membersub->( $root, $node );
return $ret if defined $ret;
}
return;
},
sub { return 1 if $recurse; return; } # recurse
)->();
}
sub MembersByType
{
my ( $node, $startgrpsub, $methodsub, $endgrpsub, $nokidssub ) = @_;
# public
# types
# data
# methods
# signals
# slots
# static
# protected
# private (if enabled)
if ( !defined $node->{Kids} ) {
$nokidssub->( $node ) if defined $nokidssub;
return;
}
foreach my $acc ( qw/public protected private/ ) {
next if $acc eq "private" && !$main::doPrivate;
$access = $acc;
my @types = ();
my @data = ();
my @signals = ();
my @k_dcops = ();
my @k_dcop_signals = ();
my @k_dcop_hiddens = ();
my @slots =();
my @methods = ();
my @static = ();
my @modules = ();
my @interfaces = ();
# Build lists
foreach my $kid ( @{$node->{Kids}} ) {
next unless ( $kid->{Access} =~ /$access/
&& !$kid->{ExtSource})
|| ( $access eq "public"
&& ( $kid->{Access} eq "signals"
|| $kid->{Access} =~ "k_dcop" # note the =~
|| $kid->{Access} eq "K_DCOP"));
my $type = $kid->{NodeType};
if ( $type eq "method" ) {
if ( $kid->{Flags} =~ "s" ) {
push @static, $kid;
}
elsif ( $kid->{Flags} =~ "l" ) {
push @slots, $kid;
}
elsif ( $kid->{Flags} =~ "n" ) {
push @signals, $kid;
}
elsif ( $kid->{Flags} =~ "d" ) {
push @k_dcops, $kid;
}
elsif ( $kid->{Flags} =~ "z" ) {
push @k_dcop_signals, $kid;
}
elsif ( $kid->{Flags} =~ "y" ) {
push @k_dcop_hiddens, $kid;
}
else {
push @methods, $kid; }
}
elsif ( $kid->{Compound} ) {
if ( $type eq "module" ) {
push @modules, $kid;
}
elsif ( $type eq "interface" ) {
push @interfaces, $kid;
}
else {
push @types, $kid;
}
}
elsif ( $type eq "typedef" || $type eq "enum" ) {
push @types, $kid;
}
else {
push @data, $kid;
}
}
# apply
$uc_access = ucfirst( $access );
doGroup( "$uc_access Types", $node, \@types, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "Modules", $node, \@modules, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "Interfaces", $node, \@interfaces, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "$uc_access Methods", $node, \@methods, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "$uc_access Slots", $node, \@slots, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "Signals", $node, \@signals, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "k_dcop", $node, \@k_dcops, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "k_dcop_signals", $node, \@k_dcop_signals, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "k_dcop_hiddens", $node, \@k_dcop_hiddens, $startgrpsub,
$methodsub, $endgrpsub);
doGroup( "$uc_access Static Methods", $node, \@static,
$startgrpsub, $methodsub, $endgrpsub);
doGroup( "$uc_access Members", $node, \@data, $startgrpsub,
$methodsub, $endgrpsub);
}
}
sub doGroup
{
my ( $name, $node, $list, $startgrpsub, $methodsub, $endgrpsub ) = @_;
my ( $hasMembers ) = 0;
foreach my $kid ( @$list ) {
if ( !exists $kid->{DocNode}->{Reimplemented} ) {
$hasMembers = 1;
break;
}
}
return if !$hasMembers;
if ( defined $methodsub ) {
foreach my $kid ( @$list ) {
if ( !exists $kid->{DocNode}->{Reimplemented} ) {
$methodsub->( $node, $kid );
}
}
}
$endgrpsub->( $name ) if defined $endgrpsub;
}
sub ByGroupLogical
{
my ( $root, $startgrpsub, $itemsub, $endgrpsub ) = @_;
return 0 unless defined $root->{Groups};
foreach my $groupname ( sort keys %{$root->{Groups}} ) {
next if $groupname eq "astNodeName"||$groupname eq "NodeType";
my $group = $root->{Groups}->{ $group };
next unless $group->{Kids};
$startgrpsub->( $group->{astNodeName}, $group->{Desc} );
foreach my $kid (sort {$a->{astNodeName} cmp $b->{astNodeName}}
@group->{Kids} ) {
$itemsub->( $root, $kid );
}
$endgrpsub->( $group->{Desc} );
}
return 1;
}
sub SeeAlso
{
my ( $node, $nonesub, $startsub, $printsub, $endsub ) = @_;
if( !defined $node ) {
$nonesub->();
return;
}
my $doc = $node;
if ( $node->{NodeType} ne "DocNode" ) {
$doc = $node->{DocNode};
if ( !defined $doc ) {
$nonesub->() if defined $nonesub;
return;
}
}
if ( !defined $doc->{See} ) {
$nonesub->() if defined $nonesub;
return;
}
my $see = $doc->{See};
my $ref = $doc->{SeeRef};
if ( $#$see < 1 ) {
$nonesub->() if defined $nonesub;
return;
}
$startsub->( $node ) if defined $startsub;
for my $i ( 0..$#$see ) {
my $seelabel = $see->[ $i ];
my $seenode = undef;
if ( defined $ref ) {
$seenode = $ref->[ $i ];
}
$printsub->( $seelabel, $seenode ) if defined $printsub;
}
$endsub->( $node ) if defined $endsub;
return;
}
1;

@ -0,0 +1,92 @@
KALYPTUS -- C, Objective-C and Java bindings generator
Version 0.9
KALYPTUS creates language bindings for Qt and KDE C++ libraries
directly from the headers. Documentation embedded in special doc
comments in the source is translated to an appropriate format for
the target language.
REQUIREMENTS
You need perl 5.005 or greater to run kalyptus.
HOWTO
If you are running this straight from CVS, you will need to run
make -f Makefile.cvs
before building.
This should install kalyptus:
./configure; make; make install
CREDITS
-------
Richard Dale - kdoc adaption, C/Objective-C/Java code generation.
Sirtaj Singh Kang for writing the original kdoc utility (kalyptus was
derived from kdoc).
Copyright(C) 2001, Lost Highway Ltd
------
Copyright(C) 1999, Sirtaj Singh Kang <taj@kde.org>
Distributed under the GPL.
NOTES ON USING THE CONVERTER
----------------------------
JAVA
----
Here are some of the shell commands that were used in the conversion process:
Remove any Q_OVERRIDE macros from the Qt headers, and remove EXPORT_DOCKCLASS from the
KDE headers
# Generate Java and C++ sources. Copy all the target headers to directory 'test/tmp'
kalyptus -fjava test/tmp/*.h test/tmp/dom/*.h test/tmp/kio/*.h test/tmp/kdeprint/*.h \
test/tmp/kjs/*.h test/tmp/kparts/*.h test/tmp/kdesu/*.h test/ktextedit/*.h test/tmp/libkmid/*.h
# Shorten generated filenames
mv DOM__Node.cpp DOMNode.cpp
mv DOM__Node.java DOMNode.java
mv DOM__Document.cpp DOMDocument.cpp
mv DOM__Document.java DOMDocument.java
for FILE in *__* ; do
NAME=`echo $FILE | sed -e 's/^.*__//'`;
echo $NAME;
mv $FILE $NAME;
done
mv SlaveInterface.cpp Slave.cpp
mv SlaveInterface.java Slave.java
# Edit and Compile the generated java
cd kdejava/koala/org/kde/koala
make
# Build C++ JNI .h header files
cd qtjava/javalib/org/kde/qt
for FILE in *.class ; do NAME=`echo $FILE | sed 's/.class//'`; echo $NAME; javah -classpath '../../..' org.kde.qt.$NAME ; done
for FILE in org_kde* ; do NAME=`echo $FILE | sed -e 's/org_kde_qt_//'`; echo $NAME; mv $FILE $NAME; done
cd kdejava/koala/org/kde/koala
for FILE in *.class ; do NAME=`echo $FILE | sed 's/.class//'`; echo $NAME; javah -classpath '../../..:../../../../../qtjava/javalib/qtjava.jar' org.kde.koala.$NAME ; done
for FILE in org_kde* ; do NAME=`echo $FILE | sed -e 's/org_kde_koala_//'`; echo $NAME; mv $FILE $NAME; done
# Copy headers to kdejava/koala/kdejava
# Check that the JNI .h function names match the .cpp ones
cd kdejava/koala/org/kde/koala
grep ^Java_ *.cpp | sed -e 's/^[^:]*:\([^(]*\).*/\1/' | grep -v '[/]' | sort | uniq > cpp.fns
grep Java_ *.h | awk '{ print $4 }' | grep -v '[/]' | sort | uniq > h.fns
kompare h.fns cpp.fns
# Reconcile and fix any differences
# Edit and compile the generated .cpp and .h files with KDevelop

@ -0,0 +1,7 @@
Add more target languages, such as PHP and Pascal
Use a perl parser generator to define the grammar for
C++ method arguments.
Write documentation for a how to on bindings generation.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,762 @@
=head1 kdocAstUtil
Utilities for syntax trees.
=cut
package kdocAstUtil;
use Ast;
use Carp;
use File::Basename;
use kdocUtil;
use Iter;
use strict;
use vars qw/ $depth $refcalls $refiters @noreflist %noref /;
sub BEGIN {
# statistics for findRef
$depth = 0;
$refcalls = 0;
$refiters = 0;
# findRef will ignore these words
@noreflist = qw( const int char long double template
unsigned signed float void bool true false uint
uint32 uint64 extern static inline virtual operator );
foreach my $r ( @noreflist ) {
$noref{ $r } = 1;
}
}
=head2 findNodes
Parameters: outlist ref, full list ref, key, value
Find all nodes in full list that have property "key=value".
All resulting nodes are stored in outlist.
=cut
sub findNodes
{
my( $rOutList, $rInList, $key, $value ) = @_;
my $node;
foreach $node ( @{$rInList} ) {
next if !exists $node->{ $key };
if ( $node->{ $key } eq $value ) {
push @$rOutList, $node;
}
}
}
=head2 allTypes
Parameters: node list ref
returns: list
Returns a sorted list of all distinct "NodeType"s in the nodes
in the list.
=cut
sub allTypes
{
my ( $lref ) = @_;
my %types = ();
foreach my $node ( @{$lref} ) {
$types{ $node->{NodeType} } = 1;
}
return sort keys %types;
}
=head2 findRef
Parameters: root, ident, report-on-fail
Returns: node, or undef
Given a root node and a fully qualified identifier (:: separated),
this function will try to find a child of the root node that matches
the identifier.
=cut
sub findRef
{
my( $root, $name, $r ) = @_;
confess "findRef: no name" if !defined $name || $name eq "";
$name =~ s/\s+//g;
return undef if exists $noref{ $name };
$name =~ s/^#//g;
my ($iter, @tree) = split /(?:\:\:|#)/, $name;
my $kid;
$refcalls++;
# Upward search for the first token
return undef if !defined $iter;
while ( !defined findIn( $root, $iter ) ) {
return undef if !defined $root->{Parent};
$root = $root->{Parent};
}
$root = $root->{KidHash}->{$iter};
carp if !defined $root;
# first token found, resolve the rest of the tree downwards
foreach $iter ( @tree ) {
confess "iter in $name is undefined\n" if !defined $iter;
next if $iter =~ /^\s*$/;
unless ( defined findIn( $root, $iter ) ) {
confess "findRef: failed on '$name' at '$iter'\n"
if defined $r;
return undef;
}
$root = $root->{KidHash}->{ $iter };
carp if !defined $root;
}
return $root;
}
=head2 findIn
node, name: search for a child
=cut
sub findIn
{
return undef unless defined $_[0]->{KidHash};
my $ret = $_[0]->{KidHash}->{ $_[1] };
return $ret;
}
=head2 linkReferences
Parameters: root, node
Recursively links references in the documentation for each node
to real nodes if they can be found. This should be called once
the entire parse tree is filled.
=cut
sub linkReferences
{
my( $root, $node ) = @_;
if ( exists $node->{DocNode} ) {
linkDocRefs( $root, $node, $node->{DocNode} );
if( exists $node->{Compound} ) {
linkSee( $root, $node, $node->{DocNode} );
}
}
my $kids = $node->{Kids};
return unless defined $kids;
foreach my $kid ( @$kids ) {
# only continue in a leaf node if it has documentation.
next if !exists $kid->{Kids} && !exists $kid->{DocNode};
if( !exists $kid->{Compound} ) {
linkSee( $root, $node, $kid->{DocNode} );
}
linkReferences( $root, $kid );
}
}
sub linkNamespaces
{
my ( $node ) = @_;
if ( defined $node->{ImpNames} ) {
foreach my $space ( @{$node->{ImpNames}} ) {
my $spnode = findRef( $node, $space );
if( defined $spnode ) {
$node->AddPropList( "ExtNames", $spnode );
}
else {
warn "namespace not found: $space\n";
}
}
}
return unless defined $node->{Compound} || !defined $node->{Kids};
foreach my $kid ( @{$node->{Kids}} ) {
next unless localComp( $kid );
linkNamespaces( $kid );
}
}
sub calcStats
{
my ( $stats, $root, $node ) = @_;
# stats:
# num types
# num nested
# num global funcs
# num methods
my $type = $node->{NodeType};
if ( $node eq $root ) {
# global methods
if ( defined $node->{Kids} ) {
foreach my $kid ( @{$node->{Kids}} ) {
$stats->{Global}++ if $kid->{NodeType} eq "method";
}
}
$node->AddProp( "Stats", $stats );
}
elsif ( kdocAstUtil::localComp( $node )
|| $type eq "enum" || $type eq "typedef" ) {
$stats->{Types}++;
$stats->{Nested}++ if $node->{Parent} ne $root;
}
elsif( $type eq "method" ) {
$stats->{Methods}++;
}
return unless defined $node->{Compound} || !defined $node->{Kids};
foreach my $kid ( @{$node->{Kids}} ) {
next if defined $kid->{ExtSource};
calcStats( $stats, $root, $kid );
}
}
=head2 linkDocRefs
Parameters: root, node, docnode
Link references in the docs if they can be found. This should
be called once the entire parse tree is filled.
=cut
sub linkDocRefs
{
my ( $root, $node, $docNode ) = @_;
return unless exists $docNode->{Text};
my ($text, $ref, $item, $tosearch);
foreach $item ( @{$docNode->{Text}} ) {
next if $item->{NodeType} ne 'Ref';
$text = $item->{astNodeName};
if ( $text =~ /^(?:#|::)/ ) {
$text = $';
$tosearch = $node;
}
else {
$tosearch = $root;
}
$ref = findRef( $tosearch, $text );
$item->AddProp( 'Ref', $ref ) if defined $ref;
confess "Ref failed for ", $item->{astNodeName},
"\n" unless defined $ref;
}
}
sub linkSee
{
my ( $root, $node, $docNode ) = @_;
return unless exists $docNode->{See};
my ( $text, $tosearch, $ref );
foreach $text ( @{$docNode->{See}} ) {
if ( $text =~ /^\s*(?:#|::)/ ) {
$text = $';
$tosearch = $node;
}
else {
$tosearch = $root;
}
$ref = findRef( $tosearch, $text );
$docNode->AddPropList( 'SeeRef', $ref )
if defined $ref;
}
}
#
# Inheritance utilities
#
=head2 makeInherit
Parameter: $rootnode, $parentnode
Make an inheritance graph from the parse tree that begins
at rootnode. parentnode is the node that is the parent of
all base class nodes.
=cut
sub makeInherit
{
my( $rnode, $parent ) = @_;
foreach my $node ( @{ $rnode->{Kids} } ) {
next if !defined $node->{Compound};
# set parent to root if no inheritance
if ( !exists $node->{InList} ) {
newInherit( $node, "Global", $parent );
$parent->AddPropList( 'InBy', $node );
makeInherit( $node, $parent );
next;
}
# link each ancestor
my $acount = 0;
ANITER:
foreach my $in ( @{ $node->{InList} } ) {
unless ( defined $in ) {
Carp::cluck "warning: $node->{astNodeName} "
." has undef in InList.";
next ANITER;
}
my $ref = kdocAstUtil::findRef( $rnode,
$in->{astNodeName} );
if( !defined $ref ) {
# ancestor undefined
warn "warning: ", $node->{astNodeName},
" inherits unknown class '",
$in->{astNodeName},"'\n";
$parent->AddPropList( 'InBy', $node );
}
else {
# found ancestor
$in->AddProp( "Node", $ref );
$ref->AddPropList( 'InBy', $node );
$acount++;
}
}
if ( $acount == 0 ) {
# inherits no known class: just parent it to global
newInherit( $node, "Global", $parent );
$parent->AddPropList( 'InBy', $node );
}
makeInherit( $node, $parent );
}
}
=head2 newInherit
p: $node, $name, $lnode?
Add a new ancestor to $node with raw name = $name and
node = lnode.
=cut
sub newInherit
{
my ( $node, $name, $link ) = @_;
my $n = Ast::New( $name );
$n->AddProp( "Node", $link ) unless !defined $link;
$node->AddPropList( "InList", $n );
return $n;
}
=head2 inheritName
pr: $inheritance node.
Returns the name of the inherited node. This checks for existence
of a linked node and will use the "raw" name if it is not found.
=cut
sub inheritName
{
my ( $innode ) = @_;
return defined $innode->{Node} ?
$innode->{Node}->{astNodeName}
: $innode->{astNodeName};
}
=head2 inheritedBy
Parameters: out listref, node
Recursively searches for nodes that inherit from this one, returning
a list of inheriting nodes in the list ref.
=cut
sub inheritedBy
{
my ( $list, $node ) = @_;
return unless exists $node->{InBy};
foreach my $kid ( @{ $node->{InBy} } ) {
push @$list, $kid;
inheritedBy( $list, $kid );
}
}
=head2 hasLocalInheritor
Parameter: node
Returns: 0 on fail
Checks if the node has an inheritor that is defined within the
current library. This is useful for drawing the class hierarchy,
since you don't want to display classes that have no relationship
with classes within this library.
NOTE: perhaps we should cache the value to reduce recursion on
subsequent calls.
=cut
sub hasLocalInheritor
{
my $node = shift;
return 0 if !exists $node->{InBy};
my $in;
foreach $in ( @{$node->{InBy}} ) {
return 1 if !exists $in->{ExtSource}
|| hasLocalInheritor( $in );
}
return 0;
}
=head2 allMembers
Parameters: hashref outlist, node, $type
Fills the outlist hashref with all the methods of outlist,
recursively traversing the inheritance tree.
If type is not specified, it is assumed to be "method"
=cut
sub allMembers
{
my ( $outlist, $n, $type ) = @_;
my $in;
$type = "method" if !defined $type;
if ( exists $n->{InList} ) {
foreach $in ( @{$n->{InList}} ) {
next if !defined $in->{Node};
my $i = $in->{Node};
allMembers( $outlist, $i )
unless $i == $main::rootNode;
}
}
return unless exists $n->{Kids};
foreach $in ( @{$n->{Kids}} ) {
next if $in->{NodeType} ne $type;
$outlist->{ $in->{astNodeName} } = $in;
}
}
=head2 findOverride
Parameters: root, node, name
Looks for nodes of the same name as the parameter, in its parent
and the parent's ancestors. It returns a node if it finds one.
=cut
sub findOverride
{
my ( $root, $node, $name ) = @_;
return undef if !exists $node->{InList};
foreach my $in ( @{$node->{InList}} ) {
my $n = $in->{Node};
next unless defined $n && $n != $root && exists $n->{KidHash};
my $ref = $n->{KidHash}->{ $name };
return $n if defined $ref && $ref->{NodeType} eq "method";
if ( exists $n->{InList} ) {
$ref = findOverride( $root, $n, $name );
return $ref if defined $ref;
}
}
return undef;
}
=head2 attachChild
Parameters: parent, child
Attaches child to the parent, setting Access, Kids
and KidHash of respective nodes.
=cut
sub attachChild
{
my ( $parent, $child ) = @_;
confess "Attempt to attach ".$child->{astNodeName}." to an ".
"undefined parent\n" if !defined $parent;
$child->AddProp( "Access", $parent->{KidAccess} );
$child->AddProp( "Parent", $parent );
$parent->AddPropList( "Kids", $child );
if( !exists $parent->{KidHash} ) {
my $kh = Ast::New( "LookupTable" );
$parent->AddProp( "KidHash", $kh );
}
$parent->{KidHash}->AddProp( $child->{astNodeName},
$child );
}
=head2 makeClassList
Parameters: node, outlist ref
fills outlist with a sorted list of all direct, non-external
compound children of node.
=cut
sub makeClassList
{
my ( $rootnode, $list ) = @_;
@$list = ();
Iter::LocalCompounds( $rootnode,
sub {
my $node = shift;
my $her = join ( "::", heritage( $node ) );
$node->AddProp( "FullName", $her );
if ( !exists $node->{DocNode}->{Internal} ||
!$main::skipInternal ) {
push @$list, $node;
}
} );
@$list = sort { $a->{FullName} cmp $b->{FullName} } @$list;
}
#
# Debugging utilities
#
=head2 dumpAst
Parameters: node, deep
Returns: none
Does a recursive dump of the node and its children.
If deep is set, it is used as the recursion property, otherwise
"Kids" is used.
=cut
sub dumpAst
{
my ( $node, $deep ) = @_;
$deep = "Kids" if !defined $deep;
print "\t" x $depth, $node->{astNodeName},
" (", $node->{NodeType}, ")\n";
my $kid;
foreach $kid ( $node->GetProps() ) {
print "\t" x $depth, " -\t", $kid, " -> ", $node->{$kid},"\n"
unless $kid =~ /^(astNodeName|NodeType|$deep)$/;
}
if ( exists $node->{InList} ) {
print "\t" x $depth, " -\tAncestors -> ";
foreach my $innode ( @{$node->{InList}} ) {
print $innode->{astNodeName} . ",";
}
print "\n";
}
print "\t" x $depth, " -\n" if (defined $node->{ $deep } && scalar(@{$node->{ $deep }}) != 0);
$depth++;
foreach $kid ( @{$node->{ $deep }} ) {
dumpAst( $kid );
}
print "\t" x $depth, "Documentation nodes:\n" if defined
@{ $node->{Doc}->{ "Text" }};
foreach $kid ( @{ $node->{Doc}->{ "Text" }} ) {
dumpAst( $kid );
}
$depth--;
}
=head2 testRef
Parameters: rootnode
Interactive testing of referencing system. Calling this
will use the readline library to allow interactive entering of
identifiers. If a matching node is found, its node name will be
printed.
=cut
sub testRef {
require Term::ReadLine;
my $rootNode = $_[ 0 ];
my $term = new Term::ReadLine 'Testing findRef';
my $OUT = $term->OUT || *STDOUT{IO};
my $prompt = "Identifier: ";
while( defined ($_ = $term->readline($prompt)) ) {
my $node = kdocAstUtil::findRef( $rootNode, $_ );
if( defined $node ) {
print $OUT "Reference: '", $node->{astNodeName},
"', Type: '", $node->{NodeType},"'\n";
}
else {
print $OUT "No reference found.\n";
}
$term->addhistory( $_ ) if /\S/;
}
}
sub printDebugStats
{
print "findRef: ", $refcalls, " calls, ",
$refiters, " iterations.\n";
}
sub External
{
return defined $_[0]->{ExtSource};
}
sub Compound
{
return defined $_[0]->{Compound};
}
sub localComp
{
my ( $node ) = $_[0];
return defined $node->{Compound}
&& !defined $node->{ExtSource}
&& $node->{NodeType} ne "Forward";
}
sub hasDoc
{
return defined $_[0]->{DocNode};
}
### Warning: this returns the list of parents, e.g. the 3 words in KParts::ReadOnlyPart::SomeEnum
### It has nothing do to with inheritance.
sub heritage
{
my $node = shift;
my @heritage;
while( 1 ) {
push @heritage, $node->{astNodeName};
last unless defined $node->{Parent};
$node = $node->{Parent};
last unless defined $node->{Parent};
}
return reverse @heritage;
}
sub refHeritage
{
my $node = shift;
my @heritage;
while( 1 ) {
push @heritage, $node;
last unless defined $node->{Parent};
$node = $node->{Parent};
last unless defined $node->{Parent};
}
return reverse @heritage;
}
1;

@ -0,0 +1,245 @@
=head1 kdocLib
Writes out a library file.
NOTES ON THE NEW FORMAT
Stores: class name, members, hierarchy
node types are not stored
File Format Spec
----------------
header
zero or more members, each of
method
member
class, each of
inheritance
zero or more members
Unrecognized lines ignored.
Sample
------
<! KDOC Library HTML Reference File>
<VERSION="2.0">
<BASE URL="http://www.kde.org/API/kdecore/">
<C NAME="KApplication" REF="KApplication.html">
<IN NAME="QObject">
<ME NAME="getConfig" REF="KApplication.html#getConfig">
<M NAME="" REF="">
</C>
=cut
package kdocLib;
use strict;
use Carp;
use File::Path;
use File::Basename;
use Ast;
use kdocAstUtil;
use kdocUtil;
use vars qw/ $exe $lib $root $plang $outputdir $docpath $url $compress /;
BEGIN {
$exe = basename $0;
}
sub writeDoc
{
( $lib, $root, $plang, $outputdir, $docpath, $url,
$compress ) = @_;
my $outfile = "$outputdir/$lib.kalyptus";
$url = $docpath unless defined $url;
mkpath( $outputdir ) unless -f $outputdir;
if( $compress ) {
open( LIB, "| gzip -9 > \"$outfile.gz\"" )
|| die "$exe: couldn't write to $outfile.gz\n";
}
else {
open( LIB, ">$outfile" )
|| die "$exe: couldn't write to $outfile\n";
}
my $libdesc = "";
if ( defined $root->{LibDoc} ) {
$libdesc="<LIBDESC>".$root->{LibDoc}->{astNodeName}."</LIBDESC>";
}
print LIB<<LTEXT;
<! KDOC Library HTML Reference File>
<VERSION="$main::Version">
<BASE URL="$url">
<PLANG="$plang">
<LIBNAME>$lib</LIBNAME>
$libdesc
LTEXT
writeNode( $root, "" );
close LIB;
}
sub writeNode
{
my ( $n, $prefix ) = @_;
return if !exists $n->{Compound};
return if exists $n->{Forward} && !exists $n->{KidAccess};
if( $n != $root ) {
$prefix .= $n->{astNodeName};
print LIB "<C NAME=\"", $n->{astNodeName},
"\" REF=\"$prefix.html\">\n";
}
else {
print LIB "<STATS>\n";
my $stats = $root->{Stats};
foreach my $stat ( keys %$stats ) {
print LIB "<STAT NAME=\"$stat\">",
$stats->{$stat},"</STAT>\n";
}
print LIB "</STATS>\n";
}
if( exists $n->{Ancestors} ) {
my $in;
foreach $in ( @{$n->{Ancestors}} ) {
$in =~ s/\s+//g;
print LIB "<IN NAME=\"",$in,"\">\n";
}
}
return if !exists $n->{Kids};
my $kid;
my $type;
foreach $kid ( @{$n->{Kids}} ) {
next if exists $kid->{ExtSource}
|| $kid->{Access} eq "private";
if ( exists $kid->{Compound} ) {
if( $n != $root ) {
writeNode( $kid, $prefix."::" );
}
else {
writeNode( $kid, "" );
}
next;
}
$type = $kid->{NodeType} eq "method" ?
"ME" : "M";
print LIB "<$type NAME=\"", $kid->{astNodeName},
"\" REF=\"$prefix.html#", $kid->{astNodeName}, "\">\n";
}
if( $n != $root ) {
print LIB "</C>\n";
}
}
sub readLibrary
{
my( $rootsub, $name, $path, $relurl ) = @_;
$path = "." unless defined $path;
my $real = $path."/".$name.".kalyptus";
my $url = ".";
my @stack = ();
my $version = "2.0";
my $new;
my $root = undef;
my $n = undef;
my $havecomp = -r "$real.gz";
my $haveuncomp = -r "$real";
if ( $haveuncomp ) {
open( LIB, "$real" ) || die "Can't read lib $real\n";
}
if( $havecomp ) {
if ( $haveuncomp ) {
warn "$exe: two libs exist: $real and $real.gz. "
."Using $real\n";
}
else {
open( LIB, "gunzip < \"$real.gz\"|" )
|| die "Can't read pipe gunzip < \"$real.gz\": $?\n";
}
}
while( <LIB> ) {
next if /^\s*$/;
if ( !/^\s*</ ) {
close LIB;
#readOldLibrary( $root, $name, $path );
return;
}
if( /<VER\w+\s+([\d\.]+)>/ ) {
# TODO: what do we do with the version number?
$version = $1;
}
elsif ( /<BASE\s*URL\s*=\s*"(.*?)"/ ) {
$url = $1;
$url .= "/" unless $url =~ m:/$:;
my $test = kdocUtil::makeRelativePath( $relurl, $url );
$url = $test;
}
elsif( /<PLANG\s*=\s*"(.*?)">/ ) {
$root = $rootsub->( $1 );
$n = $root;
}
elsif ( /<C\s*NAME="(.*?)"\s*REF="(.*?)"\s*>/ ) {
# class
$new = Ast::New( $1 );
$new->AddProp( "NodeType", "class" );
$new->AddProp( "Compound", 1 );
$new->AddProp( "ExtSource", $name );
# already escaped at this point!
$new->AddProp( "Ref", $url.$2 );
$root = $n = $rootsub->( "CXX" ) unless defined $root;
kdocAstUtil::attachChild( $n, $new );
push @stack, $n;
$n = $new;
}
elsif ( m#<IN\s*NAME\s*=\s*"(.*?)"\s*># ) {
# ancestor
kdocAstUtil::newInherit( $n, $1 );
}
elsif ( m#</C># ) {
# end class
$n = pop @stack;
}
elsif ( m#<(M\w*)\s+NAME="(.*?)"\s+REF="(.*?)"\s*># ) {
# member
$new = Ast::New( $2 );
$new->AddProp( "NodeType", $1 eq "ME" ? "method" : "var" );
$new->AddProp( "ExtSource", $name );
$new->AddProp( "Flags", "" );
$new->AddProp( "Ref", $url.$3 );
kdocAstUtil::attachChild( $n, $new );
}
}
}
1;

@ -0,0 +1,419 @@
package kdocParseDoc;
use Ast;
use strict;
use vars qw/ $buffer $docNode %extraprops $currentProp $propType /;
=head1 kdocParseDoc
Routines for parsing of javadoc comments.
=head2 newDocComment
Parameters: begin (starting line of declaration)
Reads a doc comment to the end and creates a new doc node.
Read a line
check if it changes the current context
yes
flush old context
check if it is a non-text tag
(ie internal/deprecated etc)
yes
reset context to text
set associated property
no
set the new context
assign text to new buffer
no add to text buffer
continue
at end
flush anything pending.
=cut
sub newDocComment
{
my( $text ) = @_;
return undef unless $text =~ m#/\*\*+#;
setType( "DocText", 2 );
$text =~ m#/\*#; # need to do the match again, otherwise /***/ doesn't parse
### TODO update this method from kdoc
$buffer = $'; # everything after the first \*
$docNode = undef;
%extraprops = (); # used for textprops when flushing.
my $finished = 0;
my $inbounded = 0;
if ( $buffer =~ m#\*/# ) {
$buffer = $`;
$finished = 1;
}
PARSELOOP:
while ( defined $text && !$finished ) {
# read text and remove leading junk
$text = main::readSourceLine();
next if !defined $text;
$text =~ s#^\s*\*(?!\/)##;
# if ( $text =~ /^\s*<\/pre>/i ) {
# flushProp();
# $inbounded = 0;
# }
if( $inbounded ) {
if ( $text =~ m#\*/# ) {
$finished = 1;
$text = $`;
}
$buffer .= $text;
next PARSELOOP;
}
# elsif ( $text =~ /^\s*<pre>/i ) {
# textProp( "Pre" );
# $inbounded = 1;
# }
elsif ( $text =~ /^\s*$/ ) {
textProp( "ParaBreak", "\n" );
}
elsif ( $text =~ /^\s*\@internal\s*/ ) {
codeProp( "Internal", 1 );
}
elsif ( $text =~ /^\s*\@deprecated\s*/ ) {
codeProp( "Deprecated", 1 );
}
elsif ( $text =~ /^\s*\@reimplemented\s*/ ) {
codeProp( "Reimplemented", 1 );
}
elsif ( $text =~ /^\s*\@group\s*/ ) {
# logical group tag in which this node belongs
# multiples allowed
my $groups = $';
$groups =~ s/^\s*(.*?)\s*$/$1/;
if ( $groups ne "" ) {
foreach my $g ( split( /[^_\w]+/, $groups) ) {
codeProp( "InGroup", $g );
}
}
}
elsif ( $text =~ /^\s*\@defgroup\s+(\w+)\s*/ ) {
# parse group tag and description
my $grptag = $1;
my $grpdesc = $' eq "" ? $grptag : $';
# create group node
my $grpnode = Ast::New( $grptag );
$grpnode->AddProp( "Desc", $grpdesc );
$grpnode->AddProp( "NodeType", "GroupDef" );
# attach
codeProp( "Groups", $grpnode );
}
elsif ( $text =~ /^\s*\@see\s*/ ) {
docListProp( "See" );
}
elsif( $text =~ /^\s*\@short\s*/ ) {
docProp( "ClassShort" );
}
elsif( $text =~ /^\s*\@author\s*/ ) {
docProp( "Author" );
}
elsif( $text =~ /^\s*\@version\s*/ ) {
docProp( "Version" );
}
elsif( $text =~ /^\s*\@id\s*/ ) {
docProp( "Id" );
}
elsif( $text =~ /^\s*\@since\s*/ ) {
docProp( "Since" );
}
elsif( $text =~ /^\s*\@returns?\s*/ ) {
docProp( "Returns" );
}
elsif( $text =~ /^\s*\@(?:throws|exception|raises)\s*/ ) {
docListProp( "Throws" );
}
elsif( $text =~ /^\s*\@image\s+([^\s]+)\s*/ ) {
textProp( "Image" );
$extraprops{ "Path" } = $1;
}
elsif( $text =~ /^\s*\@param\s+(\w+)\s*/ ) {
textProp( "Param" );
$extraprops{ "Name" } = $1;
}
elsif( $text =~ /^\s*\@sect\s+/ ) {
textProp( "DocSection" );
}
elsif( $text =~ /^\s*\@li\s+/ ) {
textProp( "ListItem" );
}
elsif ( $text =~ /^\s*\@libdoc\s+/ ) {
# Defines the text for the entire library
docProp( "LibDoc" );
}
else {
if ( $text =~ m#\*/# ) {
$finished = 1;
$text = $`;
}
$buffer .= $text;
}
}
flushProp();
return undef if !defined $docNode;
# postprocess docnode
# add a . to the end of the short if required.
my $short = $docNode->{ClassShort};
if ( defined $short ) {
if ( !($short =~ /\.\s*$/) ) {
$docNode->{ClassShort} =~ s/\s*$/./;
}
}
else {
# use first line of normal text as short name.
if ( defined $docNode->{Text} ) {
my $node;
foreach $node ( @{$docNode->{Text}} ) {
next if $node->{NodeType} ne "DocText";
$short = $node->{astNodeName};
$short = $`."." if $short =~ /\./;
$docNode->{ClassShort} = $short;
goto shortdone;
}
}
}
shortdone:
# Join and break all word list props so that they are one string per list
# node, ie remove all commas and spaces.
recombineOnWords( $docNode, "See" );
recombineOnWords( $docNode, "Throws" );
return $docNode;
}
=head3 setType
Parameters: propname, proptype ( 0 = single, 1 = list, 2 = text )
Set the name and type of the pending property.
=cut
sub setType
{
( $currentProp, $propType ) = @_;
}
=head3 flushProp
Flush any pending item and reset the buffer. type is set to DocText.
=cut
sub flushProp
{
return if $buffer eq "";
initDocNode() unless defined $docNode;
if( $propType == 1 ) {
# list prop
$docNode->AddPropList( $currentProp, $buffer );
}
elsif ( $propType == 2 ) {
# text prop
my $textnode = Ast::New( $buffer );
$textnode->AddProp( 'NodeType', $currentProp );
$docNode->AddPropList( 'Text', $textnode );
foreach my $prop ( keys %extraprops ) {
$textnode->AddProp( $prop,
$extraprops{ $prop } );
}
%extraprops = ();
}
else {
# one-off prop
$docNode->AddProp( $currentProp, $buffer );
}
# reset buffer
$buffer = "";
setType( "DocText", 2 );
}
=head3 codeProp
Flush the last node, add a new property and reset type to DocText.
=cut
sub codeProp
{
my( $prop, $val ) = @_;
flushProp();
initDocNode() unless defined $docNode;
$docNode->AddPropList( $prop, $val );
setType( "DocText", 2 );
}
=head3 docListProp
The next item is a list property of docNode.
=cut
sub docListProp
{
my( $prop ) = @_;
flushProp();
$buffer = $';
setType( $prop, 1 );
}
=head3 docProp
The next item is a simple property of docNode.
=cut
sub docProp
{
my( $prop ) = @_;
flushProp();
$buffer = $';
setType( $prop, 0 );
}
=head3 textProp
Parameters: prop, val
Set next item to be a 'Text' list node. if val is assigned, the
new node is assigned that text and flushed immediately. If this
is the case, the next item is given the 'DocText' text property.
=cut
sub textProp
{
my( $prop, $val ) = @_;
flushProp();
if ( defined $val ) {
$buffer = $val;
setType( $prop, 2 );
flushProp();
$prop = "DocText";
}
setType( $prop, 2 );
$buffer = $';
}
=head3 initDocNode
Creates docNode if it is not defined.
=cut
sub initDocNode
{
$docNode = Ast::New( "Doc" );
$docNode->AddProp( "NodeType", "DocNode" );
}
sub recombineOnWords
{
my ( $docNode, $prop ) = @_;
if ( exists $docNode->{$prop} ) {
my @oldsee = @{$docNode->{$prop}};
@{$docNode->{$prop}} = split (/[\s,]+/, join( " ", @oldsee ));
}
}
###############
=head2 attachDoc
Connects a docnode to a code node, setting any other properties
if required, such as groups, internal/deprecated flags etc.
=cut
sub attachDoc
{
my ( $node, $doc, $rootnode ) = @_;
$node->AddProp( "DocNode", $doc );
$node->AddProp( "Internal", 1 ) if defined $doc->{Internal};
$node->AddProp( "Deprecated", 1 ) if defined $doc->{Deprecated};
# attach group definitions if they exist
if ( defined $doc->{Groups} ) {
my $groupdef = $rootnode->{Groups};
if( !defined $groupdef ) {
$groupdef = Ast::New( "Groups" );
$rootnode->AddProp( "Groups", $groupdef );
}
foreach my $grp ( @{$doc->{Groups}} ) {
if ( defined $groupdef->{ $grp->{astNodeName} } ) {
$groupdef->{ $grp->{ astNodeName}
}->AddProp( "Desc", $grp->{Desc} );
}
else {
$groupdef->AddProp( $grp->{astNodeName}, $grp );
}
}
}
# attach node to group index(es)
# create groups if not found, they may be parsed later.
if ( defined $doc->{InGroup} ) {
my $groupdef = $rootnode->{Groups};
foreach my $grp ( @{$doc->{InGroup}} ) {
if ( !exists $groupdef->{$grp} ) {
my $newgrp = Ast::New( $grp );
$newgrp->AddProp( "Desc", $grp );
$newgrp->AddProp( "NodeType", "GroupDef" );
$groupdef->AddProp( $grp, $newgrp );
}
$groupdef->{$grp}->AddPropList( "Kids", $node );
}
}
}
1;

@ -0,0 +1,189 @@
package kdocUtil;
use strict;
=head1 kdocUtil
General utilities.
=head2 countReg
Parameters: string, regexp
Returns the number of times of regexp occurs in string.
=cut
sub countReg
{
my( $str, $regexp ) = @_;
my( $count ) = 0;
while( $str =~ /$regexp/s ) {
$count++;
$str =~ s/$regexp//s;
}
return $count;
}
=head2 findCommonPrefix
Parameters: string, string
Returns the prefix common to both strings. An empty string
is returned if the strings have no common prefix.
=cut
sub findCommonPrefix
{
my @s1 = split( "/", $_[0] );
my @s2 = split( "/", $_[1] );
my $accum = "";
my $len = ($#s2 > $#s1 ) ? $#s1 : $#s2;
for my $i ( 0..$len ) {
# print "Compare: $i '$s1[$i]', '$s2[$i]'\n";
last if $s1[ $i ] ne $s2[ $i ];
$accum .= $s1[ $i ]."/";
}
return $accum;
}
=head2 makeRelativePath
Parameters: localpath, destpath
Returns a relative path to the destination from the local path,
after removal of any common prefix.
=cut
sub makeRelativePath
{
my ( $from, $to ) = @_;
# remove prefix
$from .= '/' unless $from =~ m#/$#;
$to .= '/' unless $to =~ m#/$#;
my $pfx = findCommonPrefix( $from, $to );
if ( $pfx ne "" ) {
$from =~ s/^$pfx//g;
$to =~ s/^$pfx//g;
}
# print "Prefix is '$pfx'\n";
$from =~ s#/+#/#g;
$to =~ s#/+#/#g;
$pfx = countReg( $from, '\/' );
my $rel = "../" x $pfx;
$rel .= $to;
return $rel;
}
sub hostName
{
my $host = "";
my @hostenvs = qw( HOST HOSTNAME COMPUTERNAME );
# Host name
foreach my $evar ( @hostenvs ) {
next unless defined $ENV{ $evar };
$host = $ENV{ $evar };
last;
}
if( $host eq "" ) {
$host = `uname -n`;
chop $host;
}
return $host;
}
sub userName
{
my $who = "";
my @userenvs = qw( USERNAME USER LOGNAME );
# User name
foreach my $evar ( @userenvs ) {
next unless defined $ENV{ $evar };
$who = $ENV{ $evar };
last;
}
if( $who eq "" ) {
if ( $who = `whoami` ) {
chop $who;
}
elsif ( $who - `who am i` ) {
$who = ( split (/ /, $who ) )[0];
}
}
return $who;
}
=head2 splitUnnested
Helper to split a list using a delimiter, but looking for
nesting with (), {}, [] and <>.
Example: splitting int a, QPair<c,b> d, e=","
on ',' will give 3 items in the list.
Parameter: delimiter, string
Returns: array, after splitting the string
Thanks to Ashley Winters
=cut
sub splitUnnested($$) {
my $delim = shift;
my $string = shift;
my(%open) = (
'[' => ']',
'(' => ')',
'<' => '>',
'{' => '}',
);
my(%close) = reverse %open;
my @ret;
my $depth = 0;
my $start = 0;
my $indoublequotes = 0;
while($string =~ /($delim|<<|>>|[][}{)(><\"])/g) {
my $c = $1;
if(!$depth and !$indoublequotes and $c eq $delim) {
my $len = pos($string) - $start - 1;
push @ret, substr($string, $start, $len);
$start = pos($string);
} elsif($open{$c}) {
$depth++;
} elsif($close{$c}) {
$depth--;
} elsif($c eq '"') {
if ($indoublequotes) {
$indoublequotes = 0;
} else {
$indoublequotes = 1;
}
}
}
my $subs = substr($string, $start);
push @ret, $subs if ($subs);
return @ret;
}
1;

@ -0,0 +1,280 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, 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,33 @@
AM_CPPFLAGS = -DUIC -DQT_INTERNAL_XML
AM_CXXFLAGS= $(KDE_CXXFLAGS)
bin_PROGRAMS = puic
puic_SOURCES = widgetdatabase.cpp uic.cpp subclassing.cpp parser.cpp object.cpp main.cpp form.cpp embed.cpp domtool.cpp
puic_LDADD = $(LIB_QT) $(LIBZ)
man_MANS = puic.1
EXTRA_DIST = domtool.cpp domtool.h embed.cpp form.cpp globaldefs.h main.cpp object.cpp parser.cpp parser.h subclassing.cpp uic.cpp uic.h widgetdatabase.cpp widgetdatabase.h widgetinterface.h puic.1
# These paths are KDE specific :
# kde_bindir Where executables should go to. Use bin_PROGRAMS or bin_SCRIPTS.
# kde_libdir Where shared libraries should go to. Use lib_LTLIBRARIES.
# kde_moduledir Where modules (e.g. parts) should go to. Use kde_module_LTLIBRARIES.
# kde_styledir Where Qt/KDE widget styles should go to (new in KDE 3).
# kde_designerdir Where Qt Designer plugins should go to (new in KDE 3).
# set the include path for X, qt and KDE
INCLUDES= $(all_includes)
METASOURCES = AUTO
# the library search path.
puic_LDFLAGS = $(all_libraries) $(KDE_RPATH)
messages:
LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
if test -n "$$LIST"; then \
$(XGETTEXT) $$LIST -o $(podir)/puic.pot; \
fi

@ -0,0 +1,699 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision: 1.3 $
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTODIRS = @AUTODIRS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONF_FILES = @CONF_FILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@
KDE_HAVE_GL = @KDE_HAVE_GL@
KDE_INCLUDES = @KDE_INCLUDES@
KDE_LDFLAGS = @KDE_LDFLAGS@
KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@
KDE_MT_LIBS = @KDE_MT_LIBS@
KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@
KDE_PLUGIN = @KDE_PLUGIN@
KDE_RPATH = @KDE_RPATH@
KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@
KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@
KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@
KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@
KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@
KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@
LDFLAGS = @LDFLAGS@
LIBCOMPAT = @LIBCOMPAT@
LIBCRYPT = @LIBCRYPT@
LIBDL = @LIBDL@
LIBJPEG = @LIBJPEG@
LIBOBJS = @LIBOBJS@
LIBPNG = @LIBPNG@
LIBPTHREAD = @LIBPTHREAD@
LIBRESOLV = @LIBRESOLV@
LIBS = @LIBS@
LIBSM = @LIBSM@
LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LIBUCB = @LIBUCB@
LIBUTIL = @LIBUTIL@
LIBZ = @LIBZ@
LIB_POLL = @LIB_POLL@
LIB_QPE = @LIB_QPE@
LIB_QT = @LIB_QT@
LIB_X11 = @LIB_X11@
LIB_XEXT = @LIB_XEXT@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MOC = @MOC@
NOOPT_CFLAGS = @NOOPT_CFLAGS@
NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
QTE_NORTTI = @QTE_NORTTI@
QT_INCLUDES = @QT_INCLUDES@
QT_LDFLAGS = @QT_LDFLAGS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TOPSUBDIRS = @TOPSUBDIRS@
UIC = @UIC@
UIC_TR = @UIC_TR@
USER_INCLUDES = @USER_INCLUDES@
USER_LDFLAGS = @USER_LDFLAGS@
USE_EXCEPTIONS = @USE_EXCEPTIONS@
USE_RPATH = @USE_RPATH@
USE_RTTI = @USE_RTTI@
USE_THREADS = @USE_THREADS@
VERSION = @VERSION@
WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_INCLUDES = @X_INCLUDES@
X_LDFLAGS = @X_LDFLAGS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
kde_includes = @kde_includes@
kde_libraries = @kde_libraries@
kde_qtver = @kde_qtver@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
qt_includes = @qt_includes@
qt_libraries = @qt_libraries@
qt_test_threshold = @qt_test_threshold@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
x_includes = @x_includes@
x_libraries = @x_libraries@
AM_CPPFLAGS = -DUIC -DQT_INTERNAL_XML
AM_CXXFLAGS = $(KDE_CXXFLAGS)
bin_PROGRAMS = puic
puic_SOURCES = widgetdatabase.cpp uic.cpp subclassing.cpp parser.cpp object.cpp main.cpp form.cpp embed.cpp domtool.cpp
puic_LDADD = $(LIB_QT) $(LIBZ)
man_MANS = puic.1
EXTRA_DIST = domtool.cpp domtool.h embed.cpp form.cpp globaldefs.h main.cpp object.cpp parser.cpp parser.h subclassing.cpp uic.cpp uic.h widgetdatabase.cpp widgetdatabase.h widgetinterface.h puic.1
# These paths are KDE specific :
# kde_bindir Where executables should go to. Use bin_PROGRAMS or bin_SCRIPTS.
# kde_libdir Where shared libraries should go to. Use lib_LTLIBRARIES.
# kde_moduledir Where modules (e.g. parts) should go to. Use kde_module_LTLIBRARIES.
# kde_styledir Where Qt/KDE widget styles should go to (new in KDE 3).
# kde_designerdir Where Qt Designer plugins should go to (new in KDE 3).
# set the include path for X, qt and KDE
INCLUDES = $(all_includes)
#>- METASOURCES = AUTO
# the library search path.
puic_LDFLAGS = $(all_libraries) $(KDE_RPATH)
subdir = puic
mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
bin_PROGRAMS = puic$(EXEEXT)
PROGRAMS = $(bin_PROGRAMS)
am_puic_OBJECTS = widgetdatabase.$(OBJEXT) uic.$(OBJEXT) \
subclassing.$(OBJEXT) parser.$(OBJEXT) object.$(OBJEXT) \
main.$(OBJEXT) form.$(OBJEXT) embed.$(OBJEXT) domtool.$(OBJEXT)
#>- puic_OBJECTS = $(am_puic_OBJECTS)
#>+ 6
puic_final_OBJECTS = puic.all_cpp.o
puic_nofinal_OBJECTS = widgetdatabase.$(OBJEXT) uic.$(OBJEXT) \
subclassing.$(OBJEXT) parser.$(OBJEXT) object.$(OBJEXT) \
main.$(OBJEXT) form.$(OBJEXT) embed.$(OBJEXT) domtool.$(OBJEXT)
@KDE_USE_FINAL_FALSE@puic_OBJECTS = $(puic_nofinal_OBJECTS)
@KDE_USE_FINAL_TRUE@puic_OBJECTS = $(puic_final_OBJECTS)
puic_DEPENDENCIES =
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
am__depfiles_maybe = depfiles
#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/domtool.Po ./$(DEPDIR)/embed.Po \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/form.Po ./$(DEPDIR)/main.Po \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/parser.Po \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/subclassing.Po ./$(DEPDIR)/uic.Po \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/widgetdatabase.Po
#>+ 11
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/puic.all_cpp.P ./$(DEPDIR)/domtool.Po ./$(DEPDIR)/embed.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/form.Po ./$(DEPDIR)/main.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/parser.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/subclassing.Po ./$(DEPDIR)/uic.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/widgetdatabase.Po
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/domtool.Po ./$(DEPDIR)/embed.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/form.Po ./$(DEPDIR)/main.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/object.Po ./$(DEPDIR)/parser.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/subclassing.Po ./$(DEPDIR)/uic.Po \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/widgetdatabase.Po
#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
#>+ 2
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS)
#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
#>- $(AM_CXXFLAGS) $(CXXFLAGS)
#>+ 3
LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS)
CXXLD = $(CXX)
#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@
#>+ 2
CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(puic_SOURCES)
NROFF = nroff
MANS = $(man_MANS)
DIST_COMMON = Makefile.am Makefile.in TODO
SOURCES = $(puic_SOURCES)
#>- all: all-am
#>+ 1
all: docs-am all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && \
#>- $(AUTOMAKE) --gnu puic/Makefile
#>+ 3
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu puic/Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/puic/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(bindir)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
|| test -f $$p1 \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
else :; fi; \
done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
rm -f $(DESTDIR)$(bindir)/$$f; \
done
clean-binPROGRAMS:
@list='$(bin_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
puic$(EXEEXT): $(puic_OBJECTS) $(puic_DEPENDENCIES)
@rm -f puic$(EXEEXT)
$(CXXLINK) $(puic_LDFLAGS) $(puic_OBJECTS) $(puic_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/domtool.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/embed.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/form.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subclassing.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widgetdatabase.Po@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
man1dir = $(mandir)/man1
install-man1: $(man1_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(man1dir)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
done
uninstall-man1:
@$(NORMAL_UNINSTALL)
@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.1*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
1*) ;; \
*) ext='1' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
rm -f $(DESTDIR)$(man1dir)/$$inst; \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
#>+ 4
KDE_DIST=stamp-h.in puic.pro LICENSE.GPL
DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(MANS)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
#>- clean: clean-am
#>+ 1
clean: kde-rpo-clean clean-am
#>- clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
#>+ 1
clean-am: clean-final clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-man
install-exec-am: install-binPROGRAMS
install-info: install-info-am
install-man: install-man1
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man
uninstall-man: uninstall-man1
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
clean-generic clean-libtool ctags distclean distclean-compile \
distclean-depend distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am info info-am install \
install-am install-binPROGRAMS install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-man install-man1 install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS \
uninstall-info-am uninstall-man uninstall-man1
messages:
LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
if test -n "$$LIST"; then \
$(XGETTEXT) $$LIST -o $(podir)/puic.pot; \
fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#>+ 2
docs-am:
#>+ 6
force-reedit:
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu puic/Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/puic/Makefile.in
#>+ 9
bcheck: bcheck-am
bcheck-am:
test ! -r bchecktest.cc.class || mv -f bchecktest.cc.class bchecktest.cc.oldclass
@echo "int main() {return 0;}" > bchecktest.cc
for i in $(include_HEADERS); do echo "#include \"$$i\"" >> bchecktest.cc; done
test ! -s bchecktest.cc || $(CXXCOMPILE) --dump-class-hierarchy bchecktest.cc
test ! -s bchecktest.cc.oldclass || test ! -s bchecktest.cc.class || cmp -s bchecktest.cc.oldclass bchecktest.cc.class
#>+ 11
puic.all_cpp.cpp: $(srcdir)/Makefile.in $(srcdir)/widgetdatabase.cpp $(srcdir)/uic.cpp $(srcdir)/subclassing.cpp $(srcdir)/parser.cpp $(srcdir)/object.cpp $(srcdir)/main.cpp $(srcdir)/form.cpp $(srcdir)/embed.cpp $(srcdir)/domtool.cpp
@echo 'creating puic.all_cpp.cpp ...'; \
rm -f puic.all_cpp.files puic.all_cpp.final; \
echo "#define KDE_USE_FINAL 1" >> puic.all_cpp.final; \
for file in widgetdatabase.cpp uic.cpp subclassing.cpp parser.cpp object.cpp main.cpp form.cpp embed.cpp domtool.cpp ; do \
echo "#include \"$$file\"" >> puic.all_cpp.files; \
test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> puic.all_cpp.final; \
done; \
cat puic.all_cpp.final puic.all_cpp.files > puic.all_cpp.cpp; \
rm -f puic.all_cpp.final puic.all_cpp.files
#>+ 3
clean-final:
-rm -f puic.all_cpp.cpp
#>+ 2
final:
$(MAKE) puic_OBJECTS="$(puic_final_OBJECTS)" all-am
#>+ 2
final-install:
$(MAKE) puic_OBJECTS="$(puic_final_OBJECTS)" install-am
#>+ 2
no-final:
$(MAKE) puic_OBJECTS="$(puic_nofinal_OBJECTS)" all-am
#>+ 2
no-final-install:
$(MAKE) puic_OBJECTS="$(puic_nofinal_OBJECTS)" install-am
#>+ 3
cvs-clean:
$(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean
#>+ 3
kde-rpo-clean:
-rm -f *.rpo
#>+ 3
nmcheck:
nmcheck-am: nmcheck

@ -0,0 +1,7 @@
- PNGs embedded in ui files and B&W pictures in external MimeSourceFactory remain untested
(and thus probably wrong)
- PerlQt does not handle subclassing yet, so don't use the -subimpl option
- database code needs more testing
- ...

@ -0,0 +1,453 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "domtool.h"
#include <qsizepolicy.h>
#include <qcolor.h>
#include <qcursor.h>
#include <qdatetime.h>
#include <qrect.h>
#include <qsize.h>
#include <qfont.h>
#include <qdom.h>
/*!
\class DomTool domtool.h
\brief Tools for the dom
A collection of static functions used by Resource (part of the
designer) and Uic.
*/
/*!
Returns the contents of property \a name of object \a e as
variant or the variant passed as \a defValue if the property does
not exist.
\sa hasProperty()
*/
QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment )
{
QDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
if ( n.attribute( "name" ) != name )
continue;
return elementToVariant( n.firstChild().toElement(), defValue, comment );
}
}
return defValue;
}
/*!
\overload
*/
QVariant DomTool::readProperty( const QDomElement& e, const QString& name, const QVariant& defValue )
{
QString comment;
return readProperty( e, name, defValue, comment );
}
/*!
Returns wheter object \a e defines property \a name or not.
\sa readProperty()
*/
bool DomTool::hasProperty( const QDomElement& e, const QString& name )
{
QDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
if ( n.attribute( "name" ) != name )
continue;
return TRUE;
}
}
return FALSE;
}
QStringList DomTool::propertiesOfType( const QDomElement& e, const QString& type )
{
QStringList result;
QDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
QDomElement n2 = n.firstChild().toElement();
if ( n2.tagName() == type )
result += n.attribute( "name" );
}
}
return result;
}
QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue )
{
QString dummy;
return elementToVariant( e, defValue, dummy );
}
/*!
Interprets element \a e as variant and returns the result of the interpretation.
*/
QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment )
{
QVariant v;
if ( e.tagName() == "rect" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0, w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QRect( x, y, w, h ) );
} else if ( e.tagName() == "point" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QPoint( x, y ) );
} else if ( e.tagName() == "size" ) {
QDomElement n3 = e.firstChild().toElement();
int w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QSize( w, h ) );
} else if ( e.tagName() == "color" ) {
v = QVariant( readColor( e ) );
} else if ( e.tagName() == "font" ) {
QDomElement n3 = e.firstChild().toElement();
QFont f( defValue.toFont() );
while ( !n3.isNull() ) {
if ( n3.tagName() == "family" )
f.setFamily( n3.firstChild().toText().data() );
else if ( n3.tagName() == "pointsize" )
f.setPointSize( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "bold" )
f.setBold( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "italic" )
f.setItalic( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "underline" )
f.setUnderline( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "strikeout" )
f.setStrikeOut( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
v = QVariant( f );
} else if ( e.tagName() == "string" ) {
v = QVariant( e.firstChild().toText().data() );
QDomElement n = e;
n = n.nextSibling().toElement();
if ( n.tagName() == "comment" )
comment = n.firstChild().toText().data();
} else if ( e.tagName() == "cstring" ) {
v = QVariant( QCString( e.firstChild().toText().data() ) );
} else if ( e.tagName() == "number" ) {
bool ok = TRUE;
v = QVariant( e.firstChild().toText().data().toInt( &ok ) );
if ( !ok )
v = QVariant( e.firstChild().toText().data().toDouble() );
} else if ( e.tagName() == "bool" ) {
QString t = e.firstChild().toText().data();
v = QVariant( t == "true" || t == "1", 0 );
} else if ( e.tagName() == "pixmap" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "iconset" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "image" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "enum" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "set" ) {
v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "sizepolicy" ) {
QDomElement n3 = e.firstChild().toElement();
QSizePolicy sp;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hsizetype" )
sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "vsizetype" )
sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "horstretch" )
sp.setHorStretch( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "verstretch" )
sp.setVerStretch( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
v = QVariant( sp );
} else if ( e.tagName() == "cursor" ) {
v = QVariant( QCursor( e.firstChild().toText().data().toInt() ) );
} else if ( e.tagName() == "stringlist" ) {
QStringList lst;
QDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() )
lst << n.firstChild().toText().data();
v = QVariant( lst );
} else if ( e.tagName() == "date" ) {
QDomElement n3 = e.firstChild().toElement();
int y, m, d;
y = m = d = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "year" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "month" )
m = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "day" )
d = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QDate( y, m, d ) );
} else if ( e.tagName() == "time" ) {
QDomElement n3 = e.firstChild().toElement();
int h, m, s;
h = m = s = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hour" )
h = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "minute" )
m = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "second" )
s = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QTime( h, m, s ) );
} else if ( e.tagName() == "datetime" ) {
QDomElement n3 = e.firstChild().toElement();
int h, mi, s, y, mo, d ;
h = mi = s = y = mo = d = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hour" )
h = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "minute" )
mi = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "second" )
s = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "year" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "month" )
mo = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "day" )
d = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = QVariant( QDateTime( QDate( y, mo, d ), QTime( h, mi, s ) ) );
}
return v;
}
/*! Returns the color which is returned in the dom element \a e.
*/
QColor DomTool::readColor( const QDomElement &e )
{
QDomElement n = e.firstChild().toElement();
int r= 0, g = 0, b = 0;
while ( !n.isNull() ) {
if ( n.tagName() == "red" )
r = n.firstChild().toText().data().toInt();
else if ( n.tagName() == "green" )
g = n.firstChild().toText().data().toInt();
else if ( n.tagName() == "blue" )
b = n.firstChild().toText().data().toInt();
n = n.nextSibling().toElement();
}
return QColor( r, g, b );
}
/*!
Returns the contents of attribute \a name of object \a e as
variant or the variant passed as \a defValue if the attribute does
not exist.
\sa hasAttribute()
*/
QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment )
{
QDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "attribute" ) {
if ( n.attribute( "name" ) != name )
continue;
return elementToVariant( n.firstChild().toElement(), defValue, comment );
}
}
return defValue;
}
/*!
\overload
*/
QVariant DomTool::readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue )
{
QString comment;
return readAttribute( e, name, defValue, comment );
}
/*!
Returns wheter object \a e defines attribute \a name or not.
\sa readAttribute()
*/
bool DomTool::hasAttribute( const QDomElement& e, const QString& name )
{
QDomElement n;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "attribute" ) {
if ( n.attribute( "name" ) != name )
continue;
return TRUE;
}
}
return FALSE;
}
static bool toBool( const QString& s )
{
return s == "true" || s.toInt() != 0;
}
/*!
Convert Qt 2.x format to Qt 3.0 format if necessary
*/
void DomTool::fixDocument( QDomDocument& doc )
{
QDomElement e;
QDomNode n;
QDomNodeList nl;
int i = 0;
e = doc.firstChild().toElement();
if ( e.tagName() != "UI" )
return;
// latest version, don't do anything
if ( e.hasAttribute("version") && e.attribute("version").toDouble() > 3.0 )
return;
nl = doc.elementsByTagName( "property" );
// in 3.0, we need to fix a spelling error
if ( e.hasAttribute("version") && e.attribute("version").toDouble() == 3.0 ) {
for ( i = 0; i < (int) nl.length(); i++ ) {
QDomElement el = nl.item(i).toElement();
QString s = el.attribute( "name" );
if ( s == "resizeable" ) {
el.removeAttribute( "name" );
el.setAttribute( "name", "resizable" );
}
}
return;
}
// in versions smaller than 3.0 we need to change more
e.setAttribute( "version", 3.0 );
e.setAttribute("stdsetdef", 1 );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
QString name;
QDomElement n2 = e.firstChild().toElement();
if ( n2.tagName() == "name" ) {
name = n2.firstChild().toText().data();
if ( name == "resizeable" )
e.setAttribute( "name", "resizable" );
else
e.setAttribute( "name", name );
e.removeChild( n2 );
}
bool stdset = toBool( e.attribute( "stdset" ) );
if ( stdset || name == "toolTip" || name == "whatsThis" ||
name == "buddy" ||
e.parentNode().toElement().tagName() == "item" ||
e.parentNode().toElement().tagName() == "spacer" ||
e.parentNode().toElement().tagName() == "column"
)
e.removeAttribute( "stdset" );
else
e.setAttribute( "stdset", 0 );
}
nl = doc.elementsByTagName( "attribute" );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
QString name;
QDomElement n2 = e.firstChild().toElement();
if ( n2.tagName() == "name" ) {
name = n2.firstChild().toText().data();
e.setAttribute( "name", name );
e.removeChild( n2 );
}
}
nl = doc.elementsByTagName( "image" );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
QString name;
QDomElement n2 = e.firstChild().toElement();
if ( n2.tagName() == "name" ) {
name = n2.firstChild().toText().data();
e.setAttribute( "name", name );
e.removeChild( n2 );
}
}
nl = doc.elementsByTagName( "widget" );
for ( i = 0; i < (int) nl.length(); i++ ) {
e = nl.item(i).toElement();
QString name;
QDomElement n2 = e.firstChild().toElement();
if ( n2.tagName() == "class" ) {
name = n2.firstChild().toText().data();
e.setAttribute( "class", name );
e.removeChild( n2 );
}
}
}

@ -0,0 +1,53 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef DOMTOOL_H
#define DOMTOOL_H
#include <qvariant.h>
#include <qnamespace.h>
class QDomElement;
class QDomDocument;
class DomTool : public Qt
{
public:
static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue );
static QVariant readProperty( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment );
static bool hasProperty( const QDomElement& e, const QString& name );
static QStringList propertiesOfType( const QDomElement& e, const QString& type );
static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue );
static QVariant elementToVariant( const QDomElement& e, const QVariant& defValue, QString &comment );
static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue );
static QVariant readAttribute( const QDomElement& e, const QString& name, const QVariant& defValue, QString& comment );
static bool hasAttribute( const QDomElement& e, const QString& name );
static QColor readColor( const QDomElement &e );
static void fixDocument( QDomDocument& );
};
#endif // DOMTOOL_H

@ -0,0 +1,264 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk>
** Copyright (c) 2002 Riverbank Computing Limited <info@riverbankcomputing.co.uk>
** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com>
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/*
** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler,
** a work derivated from uic (the Qt User Interface Compiler)
** and pyuic (the PyQt User Interface Compiler).
**
** G.Garand
**
**********************************************************************/
#include "uic.h"
#include <qfile.h>
#include <qimage.h>
#include <qstringlist.h>
#include <qdatetime.h>
#include <qfileinfo.h>
#define NO_STATIC_COLORS
#include <globaldefs.h>
#include <qregexp.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
struct EmbedImage
{
int width, height, depth;
int numColors;
QRgb* colorTable;
QString name;
QString cname;
bool alpha;
};
static QString convertToCIdentifier( const char *s )
{
QString r = s;
int len = r.length();
if ( len > 0 && !isalpha( (char)r[0].latin1() ) )
r[0] = '_';
for ( int i=1; i<len; i++ ) {
if ( !isalnum( (char)r[i].latin1() ) )
r[i] = '_';
}
return r;
}
static void embedData( QTextStream& out, const uchar* input, int nbytes )
{
static const char hexdigits[] = "0123456789abcdef";
QString s;
for ( int i=0; i<nbytes; i++ )
{
if ( (i%14) == 0 )
{
s += "\n ";
out << (const char*)s;
s.truncate( 0 );
}
uint v = input[i];
s += "0x";
s += hexdigits[(v >> 4) & 15];
s += hexdigits[v & 15];
if ( i < nbytes-1 )
s += ", ";
else
s += "\n";
}
if ( s.length() )
out << (const char*)s;
}
static void embedData( QTextStream& out, const QRgb* input, int n )
{
out << hex;
const QRgb *v = input;
for ( int i=0; i<n; i++ ) {
if ( (i%6) == 0 )
out << endl << " ";
out << "0x";
out << hex << *v++;
if ( i < n-1 )
out << ", ";
else
out << ";" << endl;
}
out << dec; // back to decimal mode
}
void Uic::embed( QTextStream& out, const char* project, const QStringList& images )
{
QString cProject = convertToCIdentifier( project );
QStringList::ConstIterator it;
out << "# Image collection for project '" << project << "'." << endl;
out << "#" << endl;
out << "# Generated from reading image files: " << endl;
for ( it = images.begin(); it != images.end(); ++it )
out << "# " << *it << endl;
out << "#" << endl;
out << "# Created: " << QDateTime::currentDateTime().toString() << endl;
out << "# by: The PerlQt User Interface Compiler (puic)" << endl;
out << "#" << endl;
out << "# WARNING! All changes made in this file will be lost!" << endl;
out << endl;
out << "use strict;" << endl;
out << "use utf8;" << endl;
out << endl;
out << indent << "package DesignerMimeSourceFactory_" << cProject << ";" << endl;
out << indent << "use Qt;" << endl;
out << indent << "use Qt::isa qw(Qt::MimeSourceFactory);" << endl;
out << endl;
QPtrList<EmbedImage> list_image;
int image_count = 0;
for ( it = images.begin(); it != images.end(); ++it ) {
QImage img;
if ( !img.load( *it ) ) {
fprintf( stderr, "puic: cannot load image file %s\n", (*it).latin1() );
continue;
}
EmbedImage *e = new EmbedImage;
e->width = img.width();
e->height = img.height();
e->depth = img.depth();
e->numColors = img.numColors();
e->colorTable = new QRgb[e->numColors];
e->alpha = img.hasAlphaBuffer();
memcpy(e->colorTable, img.colorTable(), e->numColors*sizeof(QRgb));
QFileInfo fi( *it );
e->name = fi.fileName();
e->cname = QString("$image_%1").arg( image_count++);
list_image.append( e );
out << "# " << *it << endl;
QString s;
QString imgname = (const char *)e->cname;
//my $i0 = Qt::Image($image_0_data, 22, 22, 32, undef, &Qt::Image::BigEndian);
//$i0->setAlphaBuffer(1);
//my $image0 = Qt::Pixmap($i0);
if ( e->depth == 32 ) {
out << indent << "my " << imgname << "_data = pack 'L*'," << endl;
embedData( out, (QRgb*)img.bits(), e->width*e->height );
} else {
if ( e->depth == 1 )
img = img.convertBitOrder(QImage::BigEndian);
out << indent << "my " << imgname << "_data = pack 'C*'," << endl;
embedData( out, img.bits(), img.numBytes() );
}
out << endl;
if ( e->numColors ) {
out << indent << "my " << imgname << "_ctable = " << endl;
out << indent << "[" << endl;
embedData( out, e->colorTable, e->numColors );
out << endl;
out << indent << "];" << endl;
}
}
if ( !list_image.isEmpty() ) {
out << indent << "my %embed_images = (\n";
++indent;
EmbedImage *e = list_image.first();
while ( e )
{
out << indent << "\"" << e->name << "\"" << " => [" << e->cname << "_data, "
<< e->width << ", " << e->height << ", " << e->depth << ", "
<< (e->numColors ? e->cname + "_ctable" : QString::fromLatin1("undef") ) << ", "
<< (e->alpha ? "1" : "0") << "]," << endl;
e = list_image.next();
}
--indent;
out << indent << ");" << endl;
out << endl;
out << indent << "my %images = ();" << endl;
out << endl;
out << endl;
out << indent << "sub uic_findImage" << endl;
out << indent << "{" << endl;
++indent;
out << indent << "my $name = shift;" << endl;
out << indent << "return $images{$name} if exists $images{$name};" << endl;
out << indent << "return Qt::Image() unless exists $embed_images{$name};" << endl;
out << indent << endl;
out << indent << "my $img = Qt::Image(@{$embed_images{$name}}[0..4], &Qt::Image::BigEndian);" << endl;
out << indent << "${$embed_images{$name}}[5] && $img->setAlphaBuffer(1);" << endl;
out << indent << "$images{$name} = $img;" << endl;
out << indent << "return $img;" << endl;
--indent;
out << indent << "}" << endl;
out << endl;
out << indent << "sub data" << endl;
out << indent << "{" << endl;
++indent;
out << indent << "my $abs_name = shift;" << endl;
out << indent << "my $img = uic_findImage($abs_name);" << endl;
out << indent << "if($img->isNull())" << endl;
out << indent << "{" << endl;
++indent;
out << indent << "Qt::MimeSourceFactory::removeFactory(this);" << endl;
out << indent << "my $s = Qt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl;
out << indent << "Qt::MimeSourceFactory::addFactory(this);" << endl;
out << indent << "return $s;" << endl;
--indent;
out << indent << "}" << endl;
out << indent << "Qt::MimeSourceFactory::defaultFactory()->setImage($abs_name, $img);" << endl;
out << indent << "return Qt::MimeSourceFactory::defaultFactory()->data($abs_name);" << endl;
--indent;
out << indent << "}" << endl;
out << endl;
out << endl;
out << indent << "package staticImages;" << endl;
out << indent << "use Qt;" << endl;
out << indent << "use DesignerMimeSourceFactory_" << cProject << ";" << endl;
out << indent << "our %factories;" << endl;
out << indent << endl;
out << indent << "my $factory = DesignerMimeSourceFactory_" << cProject << ";" << endl;
out << indent << "Qt::MimeSourceFactory::defaultFactory()->addFactory($factory);" << endl;
out << indent << "$factories{'DesignerMimeSourceFactory_" << cProject << "'} = $factory;" << endl;
out << endl;
out << indent << "END" << endl;
out << indent << "{" << endl;
++indent;
out << indent << "for( values %factories )" << endl;
out << indent << "{" << endl;
++indent;
out << indent << "Qt::MimeSourceFactory::defaultFactory()->removeFactory($_);" << endl;
--indent;
out << indent << "}" << endl;
out << indent << "%factories = ();" << endl;
--indent;
out << indent << "}" << endl;
out << indent << "1;" << endl;;
out << endl;
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,45 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef GLOBALDEFS_H
#define GLOBALDEFS_H
#include <qcolor.h>
#define BOXLAYOUT_DEFAULT_MARGIN 11
#define BOXLAYOUT_DEFAULT_SPACING 6
#ifndef NO_STATIC_COLORS
static QColor *backColor1 = 0;
static QColor *backColor2 = 0;
static QColor *selectedBack = 0;
static void init_colors()
{
if ( backColor1 )
return;
backColor1 = new QColor( 236, 245, 255 );
backColor2 = new QColor( 250, 250, 250 );
selectedBack = new QColor( 221, 221, 221 );
}
#endif
#endif

@ -0,0 +1,325 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk>
** Copyright (c) 2002 Germain Garand <germain@ebooksfrance.com>
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/*
** 06/2002 : Initial release of puic, the PerlQt User Interface Compiler,
** a work derivated from uic (the Qt User Interface Compiler)
** and pyuic (the PyQt User Interface Compiler).
**
** G.Garand
**
**********************************************************************/
#include "uic.h"
#include "parser.h"
#include "widgetdatabase.h"
#include "domtool.h"
#include <qapplication.h>
#include <qfile.h>
#include <qstringlist.h>
#include <qdatetime.h>
#define NO_STATIC_COLORS
#include <globaldefs.h>
#include <stdio.h>
#include <stdlib.h>
#define PUIC_VERSION "0.70"
void getDBConnections( Uic& uic, QString& s);
int main( int argc, char * argv[] )
{
PyIndent indent;
bool execCode = FALSE;
bool subcl = FALSE;
bool imagecollection = FALSE;
bool imagecollection_tmpfile = FALSE;
QStringList images;
const char *error = 0;
const char* fileName = 0;
const char* className = 0;
QCString outputFile;
QCString image_tmpfile;
const char* projectName = 0;
const char* trmacro = 0;
bool nofwd = FALSE;
bool fix = FALSE;
QApplication app(argc, argv, FALSE);
QString uicClass;
for ( int n = 1; n < argc && error == 0; n++ ) {
QCString arg = argv[n];
if ( arg[0] == '-' ) { // option
QCString opt = &arg[1];
if ( opt[0] == 'o' ) { // output redirection
if ( opt[1] == '\0' ) {
if ( !(n < argc-2) ) {
error = "Missing output-file name";
break;
}
outputFile = argv[++n];
} else
outputFile = &opt[1];
} else if ( opt[0] == 'e' || opt == "embed" ) {
imagecollection = TRUE;
if ( opt == "embed" || opt[1] == '\0' ) {
if ( !(n < argc-2) ) {
error = "Missing arguments.";
break;
}
projectName = argv[++n];
} else {
projectName = &opt[1];
}
if ( argc > n+1 && qstrcmp( argv[n+1], "-f" ) == 0 ) {
imagecollection_tmpfile = TRUE;
image_tmpfile = argv[n+2];
n += 2;
}
} else if ( opt == "nofwd" ) {
nofwd = TRUE;
} else if ( opt == "subimpl" ) {
subcl = TRUE;
if ( !(n < argc-2) ) {
error = "Missing arguments.";
break;
}
className = argv[++n];
} else if ( opt == "tr" ) {
if ( opt == "tr" || opt[1] == '\0' ) {
if ( !(n < argc-1) ) {
error = "Missing tr function.";
break;
}
trmacro = argv[++n];
} else {
trmacro = &opt[1];
}
} else if ( opt == "version" ) {
fprintf( stderr,
"PerlQt User Interface Compiler v%s for Qt version %s\n", PUIC_VERSION,
QT_VERSION_STR );
exit( 1 );
} else if ( opt == "help" ) {
break;
} else if ( opt == "fix" ) {
fix = TRUE;
} else if ( opt[0] == 'p' ) {
uint tabstop;
bool ok;
if ( opt[1] == '\0' ) {
if ( !(n < argc-1) ) {
error = "Missing indent";
break;
}
tabstop = QCString(argv[++n]).toUInt(&ok);
} else
tabstop = opt.mid(1).toUInt(&ok);
if (ok)
indent.setTabStop(tabstop);
else
error = "Invalid indent";
} else if ( opt == "x" ) {
execCode = TRUE;
} else {
error = QString( "Unrecognized option " + opt ).latin1();
}
} else {
if ( imagecollection && !imagecollection_tmpfile )
images << argv[n];
else if ( fileName ) // can handle only one file
error = "Too many input files specified";
else
fileName = argv[n];
}
}
if ( argc < 2 || error || (!fileName && !imagecollection ) ) {
fprintf( stderr, "PerlQt user interface compiler.\n" );
if ( error )
fprintf( stderr, "puic: %s\n", error );
fprintf( stderr, "Usage: %s [options] [mode] <uifile>\n"
"\nGenerate implementation:\n"
" %s [options] <uifile>\n"
"Generate image collection:\n"
" %s [options] -embed <project> <image1> <image2> <image3> ...\n"
"\t<project>\tproject name\n"
"\t<image[0..n]>\timage files\n"
"or\n"
" %s [options] -embed <project> -f <file>\n"
"\t<project>\tproject name\n"
"\t<file>\t\ttemporary file containing image names\n"
"Generate subclass implementation:\n"
" %s [options] -subimpl <classname> <uifile>\n"
"\t<classname>\tname of the subclass to generate\n"
"Options:\n"
"\t-o file\t\tWrite output to file rather than stdout\n"
"\t-p indent\tSet the indent in spaces (0 to use a tab)\n"
"\t-nofwd\t\tOmit imports of custom widgets\n"
"\t-tr func\tUse func(...) rather than trUtf8(...) for i18n\n"
"\t-x\t\tGenerate extra code to test the class\n"
"\t-version\tDisplay version of puic\n"
"\t-help\t\tDisplay this information\n"
, argv[0], argv[0], argv[0], argv[0], argv[0] );
return 1;
}
if ( imagecollection_tmpfile ) {
QFile ifile( image_tmpfile );
if ( ifile.open( IO_ReadOnly ) ) {
QTextStream ts( &ifile );
QString s = ts.read();
s = s.simplifyWhiteSpace();
images = QStringList::split( ' ', s );
for ( QStringList::Iterator it = images.begin(); it != images.end(); ++it )
*it = (*it).simplifyWhiteSpace();
}
}
Uic::setIndent(indent);
QFile fileOut;
if ( !outputFile.isEmpty() ) {
fileOut.setName( outputFile );
if (!fileOut.open( IO_WriteOnly ) ) {
qWarning( "puic: Could not open output file '%s'", outputFile.data() );
return 1;
}
} else {
fileOut.open( IO_WriteOnly, stdout );
}
QTextStream out( &fileOut );
if ( imagecollection ) {
out.setEncoding( QTextStream::Latin1 );
Uic::embed( out, projectName, images );
return 0;
}
out.setEncoding( QTextStream::UnicodeUTF8 );
QFile file( fileName );
if ( !file.open( IO_ReadOnly ) ) {
qWarning( "puic: Could not open file '%s' ", fileName );
return 1;
}
QDomDocument doc;
QString errMsg;
int errLine;
if ( !doc.setContent( &file, &errMsg, &errLine ) ) {
qWarning( QString("puic: Failed to parse %s: ") + errMsg + QString (" in line %d\n"), fileName, errLine );
return 1;
}
QDomElement e = doc.firstChild().toElement();
if ( e.hasAttribute("version") && e.attribute("version").toDouble() > 3.2 ) {
qWarning( QString("puic: File generated with too recent version of Qt Designer (%s). Recent extensions won't be handled."),
e.attribute("version").latin1() );
return 1;
}
DomTool::fixDocument( doc );
if ( fix ) {
out << doc.toString();
return 0;
}
if ( !subcl ) {
out << "# Form implementation generated from reading ui file '" << fileName << "'" << endl;
out << "#" << endl;
out << "# Created: " << QDateTime::currentDateTime().toString() << endl;
out << "# by: The PerlQt User Interface Compiler (puic)" << endl;
out << "#" << endl;
out << "# WARNING! All changes made in this file will be lost!" << endl;
out << endl;
out << endl;
}
out << "use strict;" << endl;
out << "use utf8;" << endl;
out << endl;
out << endl;
Uic uic( fileName, outputFile, out, doc, subcl, trmacro ? trmacro : "trUtf8", className, nofwd, uicClass );
if (execCode) {
out << endl;
out << endl;
out << indent << "package main;" << endl;
out << endl;
out << "use Qt;" << endl;
out << "use " << (subcl ? QString::fromLatin1(className) : uicClass) << ";" << endl;
out << endl;
out << indent << "my $a = Qt::Application(\\@ARGV);" << endl;
QString s;
getDBConnections( uic, s);
out << s;
out << indent << "my $w = " << (subcl? QString::fromLatin1(className) : uicClass) << ";" << endl;
out << indent << "$a->setMainWidget($w);" << endl;
out << indent << "$w->show;" << endl;
out << indent << "exit $a->exec;" << endl;
}
if ( fileOut.status() != IO_Ok ) {
qWarning( "uic: Error writing to file" );
if ( !outputFile.isEmpty() )
remove( outputFile );
}
return 0;
}
void getDBConnections( Uic& uic, QString& s)
{
int num = 0;
for ( QStringList::Iterator it = uic.dbConnections.begin(); it != uic.dbConnections.end(); ++it ) {
if ( !(*it).isEmpty()) {
QString inc = (num ? QString::number(num+1) : QString::null);
s += "\n# Connection to database " + (*it) + "\n\n";
s += "my $DRIVER" + inc + " =\t\t'QMYSQL3';" + (inc?"":" # appropriate driver") + "\n";
s += "my $DATABASE" + inc + " =\t\t'foo';" + (inc?"":" # name of your database") + "\n";
s += "my $USER" + inc + "=\t\t'john';" + (inc?"":" # username") + "\n";
s += "my $PASSWORD" + inc + "=\t\t'ZxjGG34s';" + (inc?"":" # password for USER") + "\n";
s += "my $HOST" + inc + "=\t\t'localhost';" + (inc?"":" # host on which the database is running") + "\n";
s += "\n";
s += "my $db" + inc + " = Qt::SqlDatabase::addDatabase( $DRIVER" + inc;
if (inc)
s+= ", '" + (*it) + "'";
s += " );\n";
s += " $db" + inc + "->setDatabaseName( $DATABASE" + inc + " );\n";
s += " $db" + inc + "->setUserName( $USER" + inc + " );\n";
s += " $db" + inc + "->setPassword( $PASSWORD" + inc + " );\n";
s += " $db" + inc + "->setHostName( $HOST" + inc + " );\n";
s += "\n";
s += "if( !$db" + inc + "->open() )\n";
s += "{\n";
s += " Qt::MessageBox::information( undef, 'Unable to open database',\n";
s += " $db" + inc + "->lastError()->databaseText() . \"\\n\");\n";
s += " exit 1;\n";
s += "}\n";
s += "\n";
num++;
}
}
}

@ -0,0 +1,768 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "uic.h"
#include "parser.h"
#include "widgetinterface.h"
#include "widgetdatabase.h"
#include "domtool.h"
#include <qregexp.h>
#include <qsizepolicy.h>
#include <qstringlist.h>
#define NO_STATIC_COLORS
#include <globaldefs.h>
/*!
Creates a declaration for the object given in \a e.
Children are not traversed recursively.
\sa createObjectImpl()
*/
void Uic::createObjectDecl( const QDomElement& e )
{
if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) {
out << indent << registerObject(getLayoutName(e) ) << endl;
} else {
QString objClass = getClassName( e );
if ( objClass.isEmpty() )
return;
QString objName = getObjectName( e );
if ( objName.isEmpty() )
return;
// ignore QLayoutWidgets
if ( objClass == "Qt::LayoutWidget" )
return;
// register the object and unify its name
objName = registerObject( objName );
out << indent << objName << endl;
}
}
/*!
Creates a PerlQt attribute declaration for the object given in \a e.
Children are not traversed recursively.
*/
void Uic::createAttrDecl( const QDomElement& e )
{
if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) {
out << indent << registerObject(getLayoutName(e) ) << endl;
} else {
QString objClass = getClassName( e );
if ( objClass.isEmpty() )
return;
QString objName = getObjectName( e );
if ( objName.isEmpty() )
return;
// ignore QLayoutWidgets
if ( objClass == "Qt::LayoutWidget" )
return;
// register the object and unify its name
objName = registerObject( objName );
out << indent << objName << endl;
QDomElement n = getObjectProperty( e, "font");
if ( !n.isNull() )
out << indent << objName + "_font" << endl;
}
}
/*!
Creates an implementation for the object given in \a e.
Traverses recursively over all children.
Returns the name of the generated child object.
\sa createObjectDecl()
*/
static bool createdCentralWidget = FALSE;
QString Uic::createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& par, const QString& layout )
{
QString parent( par );
if ( parent == "this" && isMainWindow ) {
if ( !createdCentralWidget )
out << indent << "setCentralWidget(Qt::Widget(this, \"qt_central_widget\"));" << endl;
createdCentralWidget = TRUE;
parent = "centralWidget()";
}
QDomElement n;
QString objClass, objName;
int numItems = 0;
int numColumns = 0;
int numRows = 0;
if ( layouts.contains( e.tagName() ) )
return createLayoutImpl( e, parentClass, parent, layout );
objClass = getClassName( e );
if ( objClass.isEmpty() )
return objName;
objName = getObjectName( e );
QString definedName = objName;
bool isTmpObject = objName.isEmpty() || objClass == "Qt::LayoutWidget";
if ( isTmpObject ) {
if ( objClass[0] == 'Q' )
objName = "$" + objClass.mid( 4 );
else
objName = "$" + objClass.lower();
}
bool isLine = objClass == "Line";
if ( isLine )
objClass = "Qt::Frame";
out << endl;
if ( objClass == "Qt::LayoutWidget" ) {
if ( layout.isEmpty() ) {
// register the object and unify its name
objName = registerObject( objName );
out << indent << (isTmpObject ? QString::fromLatin1("my ") : QString::null) << objName << " = Qt::Widget(" << parent << ", '" << objName << "');" << endl;
} else {
// the layout widget is not necessary, hide it by creating its child in the parent
QString result;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if (tags.contains( n.tagName() ) )
result = createObjectImpl( n, parentClass, parent, layout );
}
return result;
}
} else if ( objClass != "Qt::ToolBar" && objClass != "Qt::MenuBar" ) {
// register the object and unify its name
objName = registerObject( objName );
// Temporary objects don't go into the class instance dictionary.
out << indent << (isTmpObject ? QString("my ") : QString::null) << objName << " = " << createObjectInstance( objClass, parent, objName ) << ";" << endl;
}
if ( objClass == "Qt::AxWidget" ) {
QString controlId;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" && n.attribute( "name" ) == "control" ) {
controlId = n.firstChild().toElement().text();
}
}
out << indent << objName << "->setControl(\"" << controlId << "\");" << endl;
}
lastItem = "undef";
// set the properties and insert items
bool hadFrameShadow = FALSE;
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
bool stdset = stdsetdef;
if ( n.hasAttribute( "stdset" ) )
stdset = toBool( n.attribute( "stdset" ) );
QString prop = n.attribute( "name" );
if ( prop == "database" )
continue;
QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset );
if ( value.isEmpty() )
continue;
if ( prop == "name" )
continue;
if ( isLine && prop == "frameShadow" )
hadFrameShadow = TRUE;
if ( prop == "buddy" && value.startsWith("\"") && value.endsWith("\"") ) {
buddies << Buddy( objName, value.mid(1, value.length() - 2 ) );
continue;
}
if ( isLine && prop == "orientation" ) {
prop = "frameShape";
if ( value.right(10) == "Horizontal" )
value = "&Qt::Frame::HLine";
else
value = "&Qt::Frame::VLine";
if ( !hadFrameShadow ) {
prop = "frameStyle";
value += " | &Qt::Frame::Sunken";
}
}
if ( prop == "buttonGroupId" ) {
if ( parentClass == "Qt::ButtonGroup" )
out << indent << parent << "->insert( " << objName << "," << value << ");" << endl;
continue;
}
if ( prop == "frameworkCode" )
continue;
if ( objClass == "Qt::MultiLineEdit" &&
QRegExp("echoMode|hMargin|maxLength|maxLines|undoEnabled").exactMatch(prop) )
continue;
QString call = objName + "->";
bool needClose = false;
if ( stdset ) {
call += mkStdSet( prop ) + "( ";
} else {
call += "setProperty( \"" + prop + "\", Qt::Variant(" ;
needClose = true;
}
if ( prop == "accel" )
call += "Qt::KeySequence( " + value + " )"+ (needClose ? " )": "") + " );";
else
call += value + (needClose ? " )": "") + " );";
if ( n.firstChild().toElement().tagName() == "string" ||
prop == "currentItem" ) {
trout << indent << call << endl;
} else {
out << indent << call << endl;
}
} else if ( n.tagName() == "item" ) {
QString call;
QString value;
if ( objClass.mid( 4 ) == "ListBox" ) {
call = createListBoxItemImpl( n, objName );
if ( !call.isEmpty() ) {
if ( numItems == 0 )
trout << indent << objName << "->clear();" << endl;
trout << indent << call << endl;
}
} else if ( objClass.mid( 4 ) == "ComboBox" ) {
call = createListBoxItemImpl( n, objName, &value );
if ( !call.isEmpty() ) {
if ( numItems == 0 )
trout << indent << objName << "->clear();" << endl;
trout << indent << call << endl;
}
} else if ( objClass.mid( 4 ) == "IconView" ) {
call = createIconViewItemImpl( n, objName );
if ( !call.isEmpty() ) {
if ( numItems == 0 )
trout << indent << objName << "->clear();" << endl;
trout << indent << call << endl;
}
} else if ( objClass.mid( 4 ) == "ListView" ) {
call = createListViewItemImpl( n, objName, QString::null );
if ( !call.isEmpty() ) {
if ( numItems == 0 )
trout << indent << objName << "->clear();" << endl;
trout << call << endl;
}
}
if ( !call.isEmpty() )
numItems++;
} else if ( n.tagName() == "column" || n.tagName() == "row" ) {
QString call;
QString value;
if ( objClass.mid( 4 ) == "ListView" ) {
call = createListViewColumnImpl( n, objName, &value );
if ( !call.isEmpty() ) {
out << call;
trout << indent << objName << "->header()->setLabel( "
<< numColumns++ << ", " << value << " );\n";
}
} else if ( objClass == "Qt::Table" || objClass == "Qt::DataTable" ) {
bool isCols = ( n.tagName() == "column" );
call = createTableRowColumnImpl( n, objName, &value );
if ( !call.isEmpty() ) {
out << call;
trout << indent << objName << "->"
<< ( isCols ? "horizontalHeader" : "verticalHeader" )
<< "()->setLabel( "
<< ( isCols ? numColumns++ : numRows++ )
<< ", " << value << " );\n";
}
}
}
}
// create all children, some widgets have special requirements
if ( objClass == "Qt::TabWidget" ) {
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( tags.contains( n.tagName() ) ) {
QString page = createObjectImpl( n, objClass, objName );
QString comment;
QString label = DomTool::readAttribute( n, "title", "", comment ).toString();
out << indent << objName << "->insertTab( " << page << ", \"\" );" << endl;
trout << indent << objName << "->changeTab( " << page << ", "
<< trcall( label, comment ) << " );" << endl;
}
}
} else if ( objClass == "Qt::WidgetStack" ) {
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( tags.contains( n.tagName() ) ) {
QString page = createObjectImpl( n, objClass, objName );
int id = DomTool::readAttribute( n, "id", "" ).toInt();
out << indent << objName << "->addWidget( " << page << ", " << id << " );" << endl;
}
}
} else if ( objClass == "Qt::ToolBox" ) {
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( tags.contains( n.tagName() ) ) {
QString page = createObjectImpl( n, objClass, objName );
QString label = DomTool::readAttribute( n, "label", "" ).toString();
out << indent << objName << "->addItem( " << page << ", \"" << label << "\" );" << endl;
}
}
} else if ( objClass != "Qt::ToolBar" && objClass != "Qt::MenuBar" ) { // standard widgets
WidgetInterface *iface = 0;
QString QtObjClass = objClass;
QtObjClass.replace( QRegExp("^Qt::"), "Q" );
QtObjClass.replace( QRegExp("^KDE::"), "K" );
widgetManager()->queryInterface( QtObjClass, &iface );
#ifdef QT_CONTAINER_CUSTOM_WIDGETS
int id = WidgetDatabase::idFromClassName( QtObjClass );
if ( WidgetDatabase::isContainer( id ) && WidgetDatabase::isCustomPluginWidget( id ) && iface ) {
QWidgetContainerInterfacePrivate *iface2 = 0;
iface->queryInterface( IID_QWidgetContainer, (QUnknownInterface**)&iface2 );
if ( iface2 ) {
bool supportsPages = iface2->supportsPages( QtObjClass );
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( tags.contains( n.tagName() ) ) {
if ( supportsPages ) {
QString page = createObjectImpl( n, objClass, objName );
QString comment;
QString label = DomTool::readAttribute( n, "label", "", comment ).toString();
out << indent << iface2->createCode( objClass, objName, page, label ) << endl;
} else {
createObjectImpl( n, objClass, objName );
}
}
}
iface2->release();
}
iface->release();
} else {
#endif
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( tags.contains( n.tagName() ) )
createObjectImpl( n, objClass, objName );
}
#ifdef QT_CONTAINER_CUSTOM_WIDGETS
}
#endif
}
return objName;
}
/*!
Creates a set-call for property \a exclusiveProp of the object
given in \a e.
If the object does not have this property, the function does nothing.
Exclusive properties are used to generate the implementation of
application font or palette change handlers in createFormImpl().
*/
void Uic::createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp )
{
QDomElement n;
QString objClass = getClassName( e );
if ( objClass.isEmpty() )
return;
QString objName = getObjectName( e );
#if 0 // it's not clear whether this check should be here or not
if ( objName.isEmpty() )
return;
#endif
for ( n = e.firstChild().toElement(); !n.isNull(); n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" ) {
bool stdset = stdsetdef;
if ( n.hasAttribute( "stdset" ) )
stdset = toBool( n.attribute( "stdset" ) );
QString prop = n.attribute( "name" );
if ( prop != exclusiveProp )
continue;
QString value = setObjectProperty( objClass, objName, prop, n.firstChild().toElement(), stdset );
if ( value.isEmpty() )
continue;
// we assume the property isn't of type 'string'
++indent;
out << indent << objName << "->setProperty(\"" << prop << "\", Qt::Variant(" << value << "));" << endl;
--indent;
}
}
}
/*! Attention: this function has to be in sync with
Resource::saveProperty() and DomTool::elementToVariant. If you
change one, change all.
*/
QString Uic::setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset )
{
QString v;
if ( e.tagName() == "rect" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0, w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::Rect(%1, %2, %3, %4)";
v = v.arg(x).arg(y).arg(w).arg(h);
} else if ( e.tagName() == "point" ) {
QDomElement n3 = e.firstChild().toElement();
int x = 0, y = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "x" )
x = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "y" )
y = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::Point(%1, %2)";
v = v.arg(x).arg(y);
} else if ( e.tagName() == "size" ) {
QDomElement n3 = e.firstChild().toElement();
int w = 0, h = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "width" )
w = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "height" )
h = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::Size(%1, %2)";
v = v.arg(w).arg(h);
} else if ( e.tagName() == "color" ) {
QDomElement n3 = e.firstChild().toElement();
int r = 0, g = 0, b = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "red" )
r = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "green" )
g = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "blue" )
b = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::Color(%1, %2, %3)";
v = v.arg(r).arg(g).arg(b);
} else if ( e.tagName() == "font" ) {
QDomElement n3 = e.firstChild().toElement();
QString attrname = e.parentNode().toElement().attribute( "name", "font" );
QString fontname;
if ( !obj.isEmpty() ) {
fontname = registerObject( "$" + obj + "_" + attrname );
out << indent << "my " << fontname << " = Qt::Font(" << obj << "->font);" << endl;
} else {
fontname = "$" + registerObject( "font" );
out << indent << "my " << fontname << " = Qt::Font(this->font);" << endl;
}
while ( !n3.isNull() ) {
if ( n3.tagName() == "family" )
out << indent << fontname << "->setFamily(\"" << n3.firstChild().toText().data() << "\");" << endl;
else if ( n3.tagName() == "pointsize" )
out << indent << fontname << "->setPointSize(" << n3.firstChild().toText().data() << ");" << endl;
else if ( n3.tagName() == "bold" )
out << indent << fontname << "->setBold(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl;
else if ( n3.tagName() == "italic" )
out << indent << fontname << "->setItalic(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl;
else if ( n3.tagName() == "underline" )
out << indent << fontname << "->setUnderline(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl;
else if ( n3.tagName() == "strikeout" )
out << indent << fontname << "->setStrikeOut(" << mkBool( n3.firstChild().toText().data() ) << ");" << endl;
n3 = n3.nextSibling().toElement();
}
if ( prop == "font" ) {
if ( !obj.isEmpty() )
out << indent << obj << "->setFont(" << fontname << ");" << endl;
else
out << indent << "setFont(" << fontname << ");" << endl;
} else {
v = fontname;
}
} else if ( e.tagName() == "string" ) {
QString txt = e.firstChild().toText().data();
QString com = getComment( e.parentNode() );
if ( prop == "toolTip" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) {
if ( !obj.isEmpty() )
trout << indent << "Qt::ToolTip::add(" << obj << ", "
<< trcall( txt, com ) << ");" << endl;
else
out << indent << "Qt::ToolTip::add( this, "
<< trcall( txt, com ) << ");" << endl;
} else if ( prop == "whatsThis" && objClass != "Qt::Action" && objClass != "Qt::ActionGroup" ) {
if ( !obj.isEmpty() )
trout << indent << "Qt::WhatsThis::add(" << obj << ", "
<< trcall( txt, com ) << ");" << endl;
else
trout << indent << "Qt::WhatsThis::add( this,"
<< trcall( txt, com ) << ");" << endl;
} else {
v = trcall( txt, com );
}
} else if ( e.tagName() == "cstring" ) {
v = "\"%1\"";
v = v.arg( e.firstChild().toText().data() );
} else if ( e.tagName() == "number" ) {
v = "int(%1)";
v = v.arg( e.firstChild().toText().data() );
} else if ( e.tagName() == "bool" ) {
if ( stdset )
v = "%1";
else
v = "Qt::Variant(%1, 0)";
v = v.arg( mkBool( e.firstChild().toText().data() ) );
} else if ( e.tagName() == "pixmap" ) {
v = e.firstChild().toText().data();
if( !externPixmaps )
v.prepend( '$' );
if ( !pixmapLoaderFunction.isEmpty() ) {
v.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) );
v.append( QString( externPixmaps ? "\"" : "" ) + ")" );
}
} else if ( e.tagName() == "iconset" ) {
v = "Qt::IconSet(%1)";
QString s = e.firstChild().toText().data();
if( !externPixmaps )
s.prepend( '$' );
if ( !pixmapLoaderFunction.isEmpty() ) {
s.prepend( pixmapLoaderFunction + "(" + QString( externPixmaps ? "\"" : "" ) );
s.append( QString( externPixmaps ? "\"" : "" ) + ")" );
}
v = v.arg( s );
} else if ( e.tagName() == "image" ) {
v = e.firstChild().toText().data() + "->convertToImage()";
} else if ( e.tagName() == "enum" ) {
if ( stdset )
v = "&%1::%2()";
else
v = "\"%1\"";
QString oc = objClass;
QString ev = e.firstChild().toText().data();
if ( oc == "Qt::ListView" && ev == "Manual" ) // #### workaround, rename QListView::Manual in 4.0
oc = "Qt::ScrollView";
if ( stdset )
v = v.arg( oc ).arg( ev );
else
v = v.arg( ev );
} else if ( e.tagName() == "set" ) {
QString keys( e.firstChild().toText().data() );
QStringList lst = QStringList::split( '|', keys );
v = "int(&";
QStringList::Iterator it = lst.begin();
while ( it != lst.end() ) {
v += objClass + "::" + *it;
if ( it != lst.fromLast() )
v += " | &";
++it;
}
v += ")";
} else if ( e.tagName() == "sizepolicy" ) {
QDomElement n3 = e.firstChild().toElement();
QSizePolicy sp;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hsizetype" )
sp.setHorData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "vsizetype" )
sp.setVerData( (QSizePolicy::SizeType)n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "horstretch" )
sp.setHorStretch( n3.firstChild().toText().data().toInt() );
else if ( n3.tagName() == "verstretch" )
sp.setVerStretch( n3.firstChild().toText().data().toInt() );
n3 = n3.nextSibling().toElement();
}
QString tmp = (obj.isEmpty() ? QString::fromLatin1("this") : obj) + "->";
v = "Qt::SizePolicy(%1, %2, %3, %4, " + tmp + "sizePolicy()->hasHeightForWidth())";
v = v.arg( (int)sp.horData() ).arg( (int)sp.verData() ).arg( sp.horStretch() ).arg( sp.verStretch() );
} else if ( e.tagName() == "palette" ) {
QPalette pal;
bool no_pixmaps = e.elementsByTagName( "pixmap" ).count() == 0;
QDomElement n;
if ( no_pixmaps ) {
n = e.firstChild().toElement();
while ( !n.isNull() ) {
QColorGroup cg;
if ( n.tagName() == "active" ) {
cg = loadColorGroup( n );
pal.setActive( cg );
} else if ( n.tagName() == "inactive" ) {
cg = loadColorGroup( n );
pal.setInactive( cg );
} else if ( n.tagName() == "disabled" ) {
cg = loadColorGroup( n );
pal.setDisabled( cg );
}
n = n.nextSibling().toElement();
}
}
if ( no_pixmaps && pal == QPalette( pal.active().button(), pal.active().background() ) ) {
v = "Qt::Palette(Qt::Color(%1,%2,%3), Qt::Color(%1,%2,%3))";
v = v.arg( pal.active().button().red() ).arg( pal.active().button().green() ).arg( pal.active().button().blue() );
v = v.arg( pal.active().background().red() ).arg( pal.active().background().green() ).arg( pal.active().background().blue() );
} else {
QString palette = "pal";
if ( !pal_used ) {
out << indent << palette << " = Qt::Palette();" << endl;
pal_used = TRUE;
}
QString cg = "cg";
if ( !cg_used ) {
out << indent << cg << " = Qt::ColorGroup();" << endl;
cg_used = TRUE;
}
n = e.firstChild().toElement();
while ( !n.isNull() && n.tagName() != "active" )
n = n.nextSibling().toElement();
createColorGroupImpl( cg, n );
out << indent << palette << "->setActive(" << cg << ");" << endl;
n = e.firstChild().toElement();
while ( !n.isNull() && n.tagName() != "inactive" )
n = n.nextSibling().toElement();
createColorGroupImpl( cg, n );
out << indent << palette << "->setInactive(" << cg << ");" << endl;
n = e.firstChild().toElement();
while ( !n.isNull() && n.tagName() != "disabled" )
n = n.nextSibling().toElement();
createColorGroupImpl( cg, n );
out << indent << palette << "->setDisabled(" << cg << ");" << endl;
v = palette;
}
} else if ( e.tagName() == "cursor" ) {
v = "Qt::Cursor(%1)";
v = v.arg( e.firstChild().toText().data() );
} else if ( e.tagName() == "date" ) {
QDomElement n3 = e.firstChild().toElement();
int y, m, d;
y = m = d = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "year" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "month" )
m = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "day" )
d = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::Date(%1,%2,%3)";
v = v.arg(y).arg(m).arg(d);
} else if ( e.tagName() == "time" ) {
QDomElement n3 = e.firstChild().toElement();
int h, m, s;
h = m = s = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hour" )
h = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "minute" )
m = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "second" )
s = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::Time(%1, %2, %3)";
v = v.arg(h).arg(m).arg(s);
} else if ( e.tagName() == "datetime" ) {
QDomElement n3 = e.firstChild().toElement();
int h, mi, s, y, mo, d;
h = mi = s = y = mo = d = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "hour" )
h = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "minute" )
mi = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "second" )
s = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "year" )
y = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "month" )
mo = n3.firstChild().toText().data().toInt();
else if ( n3.tagName() == "day" )
d = n3.firstChild().toText().data().toInt();
n3 = n3.nextSibling().toElement();
}
v = "Qt::DateTime(Qt::Date(%1, %2, %3), Qt::Time(%4, %5, %6))";
v = v.arg(y).arg(mo).arg(d).arg(h).arg(mi).arg(s);
} else if ( e.tagName() == "stringlist" ) {
QStringList l;
QDomElement n3 = e.firstChild().toElement();
QString listname;
if ( !obj.isEmpty() ) {
listname = obj + "->{_strlist";
listname = registerObject( listname );
listname += "}";
out << indent << listname << " = [";
} else {
listname = registerObject( "$" + listname );
out << indent << "my " << listname << " = [";
}
int i = 0;
while ( !n3.isNull() ) {
if ( n3.tagName() == "string" )
{
out << "'" << n3.firstChild().toText().data().simplifyWhiteSpace() << "'";
n3 = n3.nextSibling().toElement();
if( n3.isNull() )
break;
i++;
if( (i%3) == 0 )
{
++indent;
out << "," << endl << indent;
--indent;
}
else
out << ", ";
}
else
n3 = n3.nextSibling().toElement();
}
out << "];" << endl;
v = listname;
}
return v;
}
/*! Extracts a named object property from \a e.
*/
QDomElement Uic::getObjectProperty( const QDomElement& e, const QString& name )
{
QDomElement n;
for ( n = e.firstChild().toElement();
!n.isNull();
n = n.nextSibling().toElement() ) {
if ( n.tagName() == "property" && n.toElement().attribute("name") == name )
return n;
}
return n;
}

@ -0,0 +1,66 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "parser.h"
#include <qobject.h>
#include <qstringlist.h>
class NormalizeObject : public QObject
{
public:
NormalizeObject() : QObject() {}
static QCString normalizeSignalSlot( const char *signalSlot ) { return QObject::normalizeSignalSlot( signalSlot ); }
};
QString Parser::cleanArgs( const QString &func )
{
QString slot( func );
int begin = slot.find( "(" ) + 1;
QString args = slot.mid( begin );
args = args.left( args.find( ")" ) );
QStringList lst = QStringList::split( ',', args );
QString res = slot.left( begin );
for ( QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) {
if ( it != lst.begin() )
res += ",";
QString arg = *it;
int pos = 0;
if ( ( pos = arg.find( "&" ) ) != -1 ) {
arg = arg.left( pos + 1 );
} else if ( ( pos = arg.find( "*" ) ) != -1 ) {
arg = arg.left( pos + 1 );
} else {
arg = arg.simplifyWhiteSpace();
if ( ( pos = arg.find( ':' ) ) != -1 )
arg = arg.left( pos ).simplifyWhiteSpace() + ":" + arg.mid( pos + 1 ).simplifyWhiteSpace();
QStringList l = QStringList::split( ' ', arg );
if ( l.count() == 2 ) {
if ( l[ 0 ] != "const" && l[ 0 ] != "unsigned" && l[ 0 ] != "var" )
arg = l[ 0 ];
} else if ( l.count() == 3 ) {
arg = l[ 0 ] + " " + l[ 1 ];
}
}
res += arg;
}
res += ")";
return QString::fromLatin1( NormalizeObject::normalizeSignalSlot( res.latin1() ) );
}

@ -0,0 +1,33 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef PARSER_H
#define PARSER_H
#include <qstring.h>
class Parser
{
public:
static QString cleanArgs( const QString &func );
};
#endif

@ -0,0 +1,78 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.TH "PUIC" "1" "August 21, 2003" "Lutz Badenheuer <lutz.badenheuer@t-online.de>" ""
.SH "NAME"
puic \- perl user interface compiler
.SH "SYNOPSIS"
.B puic [options] [mode] <uifile>
.SH "DESCRIPTION"
This manual page documents briefly the
.B puic
command.
.PP
\fBpuic\fP is a program you can use to compile .ui and .ui.h
files (from Qt Designer) into perl (actually, PerlQt) code. This
enables you to draw your application using Qt Designer, compile
and then run it.
PerlQt is an API for Perl to the Qt toolkit from Trolltech. With
PerlQt, you can use Qt widgets in perl code, thus giving a GUI to
your perl programs.
.SH "OPTIONS"
\fBGenerate implementation:\fR
puic [options] <uifile>
\fBGenerate image collection:\fR
puic [options] \-embed <project> <image1> <image2> <image3> ...
<project> project name
<image[0..n]> image files
\fBGenerate subclass implementation:\fR
puic [options] \-subimpl <classname> <uifile>
<classname> name of the subclass to generate
.TP
.B Options:
.TP
.B \-o file
Write output to file rather than stdout
.TP
.B \-p indent
Set the indent in spaces (0 to use a tab)
.TP
.B \-nofwd
Omit imports of custom widgets
.TP
.B \-tr func
Use func(...) rather than trUtf8(...) for i18n
.TP
.B \-x
Generate extra code to test the class
.TP
.B \-version
Display version of puic
.TP
.B \-help
Show summary of options
.SH "SEE ALSO"
http://perlqt.sourceforge.net/
.SH "AUTHOR"
This manual page was written by Lutz Badenheuer <Lutz.Badenheuer@t\-online.de>,
for the Debian project (but may be used by others).

@ -0,0 +1,28 @@
TEMPLATE = app
INCLUDEPATH += .
CONFIG += qt warn_on
exists( $(QTDIR)/lib/libqt-mt* ) {
CONFIG += thread
}
DEFINES += UIC QT_INTERNAL_XML
# Input
HEADERS += domtool.h \
globaldefs.h \
parser.h \
uic.h \
widgetdatabase.h \
widgetinterface.h
SOURCES += domtool.cpp \
embed.cpp \
form.cpp \
main.cpp \
object.cpp \
parser.cpp \
subclassing.cpp \
uic.cpp \
widgetdatabase.cpp

@ -0,0 +1,191 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "uic.h"
#include "parser.h"
#include "widgetdatabase.h"
#include "domtool.h"
#include <qfile.h>
#include <qstringlist.h>
#include <qdatetime.h>
#define NO_STATIC_COLORS
#include <globaldefs.h>
#include <qregexp.h>
#include <stdio.h>
#include <stdlib.h>
/*!
Creates an implementation for a subclass \a subClass of the form
given in \a e
\sa createSubDecl()
*/
void Uic::createSubImpl( const QDomElement &e, const QString& subClass )
{
QDomElement n;
QDomNodeList nl;
int i;
QString objClass = getClassName( e );
if ( objClass.isEmpty() )
return;
out << indent << "package " << subClass << ";" << endl;
out << indent << "use Qt;" << endl;
out << indent << "use " << nameOfClass << ";" << endl;
out << indent << "use Qt::isa qw("<< nameOfClass << ");" << endl;
out << endl;
// constructor
out << indent << "sub NEW" << endl;
out << indent << "{" << endl;
++indent;
if ( objClass == "Qt::Dialog" || objClass == "Qt::Wizard" ) {
out << indent << "shift->SUPER::NEW(@_[0..3]);" << endl;
} else if ( objClass == "Qt::Widget") {
out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl;
} else if ( objClass == "Qt::MainWindow" ) {
out << indent << "shift->SUPER::NEW(@_[0..2]);" << endl;
out << indent << "statusBar();" << endl;
isMainWindow = TRUE;
} else {
out << indent << "shift->SUPER::NEW(@_[0,1]);" << endl;
}
--indent;
out << indent << "}" << endl;
out << endl;
// find additional functions
QStringList publicSlots, protectedSlots, privateSlots;
QStringList publicSlotTypes, protectedSlotTypes, privateSlotTypes;
QStringList publicSlotSpecifier, protectedSlotSpecifier, privateSlotSpecifier;
QStringList publicFuncts, protectedFuncts, privateFuncts;
QStringList publicFunctRetTyp, protectedFunctRetTyp, privateFunctRetTyp;
QStringList publicFunctSpec, protectedFunctSpec, privateFunctSpec;
nl = e.parentNode().toElement().elementsByTagName( "slot" );
for ( i = 0; i < (int) nl.length(); i++ ) {
n = nl.item(i).toElement();
if ( n.parentNode().toElement().tagName() != "slots"
&& n.parentNode().toElement().tagName() != "connections" )
continue;
QString l = n.attribute( "language", "C++" );
if ( l != "C++" && l != "Perl" ) //- mmh
continue;
QString returnType = n.attribute( "returnType", "void" );
QString functionName = n.firstChild().toText().data().stripWhiteSpace();
if ( functionName.endsWith( ";" ) )
functionName = functionName.left( functionName.length() - 1 );
QString specifier = n.attribute( "specifier" );
QString access = n.attribute( "access" );
if ( access == "protected" ) {
protectedSlots += functionName;
protectedSlotTypes += returnType;
protectedSlotSpecifier += specifier;
} else if ( access == "private" ) {
privateSlots += functionName;
privateSlotTypes += returnType;
privateSlotSpecifier += specifier;
} else {
publicSlots += functionName;
publicSlotTypes += returnType;
publicSlotSpecifier += specifier;
}
}
nl = e.parentNode().toElement().elementsByTagName( "function" );
for ( i = 0; i < (int) nl.length(); i++ ) {
n = nl.item(i).toElement();
QString fname = n.attribute( "name" );
fname = Parser::cleanArgs( fname );
if ( n.parentNode().toElement().tagName() != "functions" )
continue;
QString l = n.attribute( "language", "C++" );
if ( l != "C++" && l != "Perl" ) //- mmh
continue;
QString returnType = n.attribute( "returnType", "void" );
QString functionName = n.firstChild().toText().data().stripWhiteSpace();
if ( functionName.endsWith( ";" ) )
functionName = functionName.left( functionName.length() - 1 );
QString specifier = n.attribute( "specifier" );
QString access = n.attribute( "access" );
if ( access == "protected" ) {
protectedFuncts += functionName;
protectedFunctRetTyp += returnType;
protectedFunctSpec += specifier;
} else if ( access == "private" ) {
privateFuncts += functionName;
privateFunctRetTyp += returnType;
privateFunctSpec += specifier;
} else {
publicFuncts += functionName;
publicFunctRetTyp += returnType;
publicFunctSpec += specifier;
}
}
// FIXME PerlQt: distinguishing public/protected/private slots does not make any sense in the forseable future
// but nevermind, never forget somewhere far beyond the sky, Ashley Winters is furbishing *Plan 42* ! :)
if ( !publicFuncts.isEmpty() )
writeFunctionsSubImpl( publicFuncts, publicFunctRetTyp, publicFunctSpec, subClass, "public function" );
if ( !publicSlots.isEmpty() )
writeFunctionsSubImpl( publicSlots, publicSlotTypes, publicSlotSpecifier, subClass, "public slot" );
if ( !protectedFuncts.isEmpty() )
writeFunctionsSubImpl( protectedFuncts, protectedFunctRetTyp, protectedFunctSpec, subClass, "protected function" );
if ( !protectedSlots.isEmpty() )
writeFunctionsSubImpl( protectedSlots, protectedSlotTypes, protectedSlotSpecifier, subClass, "protected slot" );
if ( !privateFuncts.isEmpty() )
writeFunctionsSubImpl( privateFuncts, privateFunctRetTyp, privateFunctSpec, subClass, "private function" );
if ( !privateSlots.isEmpty() )
writeFunctionsSubImpl( privateSlots, privateSlotTypes, privateSlotSpecifier, subClass, "private slot" );
out << "1;" << endl;
}
void Uic::writeFunctionsSubImpl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst,
const QString &subClass, const QString &descr )
{
QValueListConstIterator<QString> it, it2, it3;
for ( it = fuLst.begin(), it2 = typLst.begin(), it3 = specLst.begin();
it != fuLst.end(); ++it, ++it2, ++it3 ) {
QString type = *it2;
if ( type.isEmpty() )
type = "void";
if ( *it3 == "non virtual" )
continue;
out << endl;
int astart = (*it).find('(');
out << indent << "sub " << (*it).left(astart)<< endl;
out << indent << "{" << endl;
++indent;
out << indent << "print \"" << subClass << "->" << (*it) << ": (Private) Not implemented yet.\\n\";" << endl;
--indent;
out << indent << "}" << endl;
}
out << endl;
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,195 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
** Copyright (c) 2001 Phil Thompson <phil@river-bank.demon.co.uk>
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef UIC_H
#define UIC_H
#include <qdom.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qmap.h>
#include <qtextstream.h>
#include <qpalette.h>
#include <qvariant.h>
#ifndef Q_DUMMY_COMPARISON_OPERATOR
# warning "Defining Q_DUMMY_COMPARISON_OPERATOR"
# ifdef Q_FULL_TEMPLATE_INSTANTIATION
# define Q_DUMMY_COMPARISON_OPERATOR(C) \
bool operator==( const C& ) const { \
qWarning( #C"::operator==( const "#C"& ) got called." ); \
return FALSE; \
}
# else
# define Q_DUMMY_COMPARISON_OPERATOR(C)
# endif
#endif
class PyIndent
{
public:
PyIndent() : tabStop(4), current(0) {calc();}
void setTabStop(uint n) {tabStop = n; calc();}
void operator++() {++current; calc();}
void operator--() {--current; calc();}
operator QString() {return indstr;}
private:
uint tabStop;
uint current;
QString indstr;
void calc();
};
class Uic : public Qt
{
public:
Uic( const QString &fn, const char *outputFn, QTextStream& outStream,
QDomDocument doc, bool subcl, const QString &trm,
const QString& subClass, bool omitForwardDecls, QString &uicClass );
static void setIndent(const PyIndent &pyind) {indent = pyind;}
void createFormImpl( const QDomElement &e );
void createSubImpl( const QDomElement &e, const QString& subclname );
void createObjectDecl( const QDomElement& e );
void createAttrDecl( const QDomElement& e );
void createActionDecl( const QDomElement& e );
void createActionImpl( const QDomElement& e, const QString &parent );
void createToolbarImpl( const QDomElement &e, const QString &parentClass, const QString &parent );
void createMenuBarImpl( const QDomElement &e, const QString &parentClass, const QString &parent );
void createPopupMenuImpl( const QDomElement &e, const QString &parentClass, const QString &parent );
QString createObjectImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null );
QString createLayoutImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null );
QString createObjectInstance( const QString& objClass, const QString& parent, const QString& objName );
QString createSpacerImpl( const QDomElement &e, const QString& parentClass, const QString& parent, const QString& layout = QString::null );
void createExclusiveProperty( const QDomElement & e, const QString& exclusiveProp );
QString createListBoxItemImpl( const QDomElement &e, const QString &parent, QString *value = 0 );
QString createIconViewItemImpl( const QDomElement &e, const QString &parent );
QString createListViewColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 );
QString createTableRowColumnImpl( const QDomElement &e, const QString &parent, QString *value = 0 );
QString createListViewItemImpl( const QDomElement &e, const QString &parent,
const QString &parentItem );
void createColorGroupImpl( const QString& cg, const QDomElement& e );
QColorGroup loadColorGroup( const QDomElement &e );
QDomElement getObjectProperty( const QDomElement& e, const QString& name );
QString getPixmapLoaderFunction( const QDomElement& e );
QString getFormClassName( const QDomElement& e );
QString getClassName( const QDomElement& e );
QString getObjectName( const QDomElement& e );
QString getLayoutName( const QDomElement& e );
QString getInclude( const QString& className );
QString setObjectProperty( const QString& objClass, const QString& obj, const QString &prop, const QDomElement &e, bool stdset );
QString registerObject( const QString& name );
QString registeredName( const QString& name );
bool isObjectRegistered( const QString& name );
QStringList unique( const QStringList& );
QString trcall( const QString& sourceText, const QString& comment = "" );
static void embed( QTextStream& out, const char* project, const QStringList& images );
friend void getDBConnections(Uic& uic, QString& s);
private:
void registerLayouts ( const QDomElement& e );
QTextStream& out;
QTextOStream trout;
QString languageChangeBody;
QCString outputFileName;
QStringList objectNames;
QMap<QString,QString> objectMapper;
QStringList tags;
QStringList layouts;
QString formName;
QString lastItem;
QString trmacro;
bool nofwd;
static PyIndent indent;
struct Buddy
{
Buddy( const QString& k, const QString& b )
: key( k ), buddy( b ) {}
Buddy(){} // for valuelist
QString key;
QString buddy;
bool operator==( const Buddy& other ) const
{ return (key == other.key); }
};
struct CustomInclude
{
QString header;
QString location;
Q_DUMMY_COMPARISON_OPERATOR(CustomInclude)
};
QValueList<Buddy> buddies;
QStringList layoutObjects;
bool isLayout( const QString& name ) const;
uint item_used : 1;
uint cg_used : 1;
uint pal_used : 1;
uint stdsetdef : 1;
uint externPixmaps : 1;
QString nameOfClass;
QStringList namespaces;
QString bareNameOfClass;
QString pixmapLoaderFunction;
void registerDatabases( const QDomElement& e );
bool isWidgetInTable( const QDomElement& e, const QString& connection, const QString& table );
bool isFrameworkCodeGenerated( const QDomElement& e );
QString getDatabaseInfo( const QDomElement& e, const QString& tag );
void createFormImpl( const QDomElement& e, const QString& form, const QString& connection, const QString& table );
void writeFunctionsSubImpl( const QStringList &fuLst, const QStringList &typLst, const QStringList &specLst,
const QString &subClass, const QString &descr );
QStringList dbConnections;
QMap< QString, QStringList > dbCursors;
QMap< QString, QStringList > dbForms;
static bool isMainWindow;
static QString mkBool( bool b );
static QString mkBool( const QString& s );
bool toBool( const QString& s );
static QString fixString( const QString &str, bool encode = FALSE );
static bool onlyAscii;
static QString mkStdSet( const QString& prop );
static QString getComment( const QDomNode& n );
QVariant defSpacing, defMargin;
QString fileName;
bool writeFunctImpl;
void perlSlot(QStringList::Iterator &it);
};
#endif

@ -0,0 +1,953 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "widgetdatabase.h"
#include "widgetinterface.h"
#include <qapplication.h>
#define NO_STATIC_COLORS
#include <globaldefs.h>
#include <qstrlist.h>
#include <qdict.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qcleanuphandler.h>
#include <qfeatures.h>
#include <stdlib.h>
const int dbsize = 300;
const int dbcustom = 200;
const int dbdictsize = 211;
static WidgetDatabaseRecord* db[ dbsize ];
static QDict<int> *className2Id = 0;
static int dbcount = 0;
static int dbcustomcount = 200;
static QStrList *wGroups;
static QStrList *invisibleGroups;
static bool whatsThisLoaded = FALSE;
static QPluginManager<WidgetInterface> *widgetPluginManager = 0;
static bool plugins_set_up = FALSE;
static bool was_in_setup = FALSE;
QCleanupHandler<QPluginManager<WidgetInterface> > cleanup_manager;
WidgetDatabaseRecord::WidgetDatabaseRecord()
{
isForm = FALSE;
isContainer = FALSE;
icon = 0;
nameCounter = 0;
isCommon = FALSE;
isPlugin = FALSE;
}
WidgetDatabaseRecord::~WidgetDatabaseRecord()
{
delete icon;
}
/*!
\class WidgetDatabase widgetdatabase.h
\brief The WidgetDatabase class holds information about widgets
The WidgetDatabase holds information about widgets like toolTip(),
iconSet(), ... It works Id-based, so all access functions take the
widget id as parameter. To get the id for a widget (classname), use
idFromClassName().
All access functions are static. Having multiple widgetdatabases in
one application doesn't make sense anyway and so you don't need more
than an instance of the widgetdatabase.
For creating widgets, layouts, etc. see WidgetFactory.
*/
/*!
Creates widget database. Does nothing.
*/
WidgetDatabase::WidgetDatabase()
{
}
/*! Sets up the widget database. If the static widgetdatabase already
exists, the functions returns immediately.
*/
void WidgetDatabase::setupDataBase( int id )
{
was_in_setup = TRUE;
#ifndef UIC
Q_UNUSED( id )
if ( dbcount )
return;
#else
if ( dbcount && id != -2 )
return;
if ( dbcount && !plugins_set_up ) {
setupPlugins();
return;
}
if ( dbcount && plugins_set_up)
return;
#endif
wGroups = new QStrList;
invisibleGroups = new QStrList;
invisibleGroups->append( "Forms" );
invisibleGroups->append( "Temp" );
className2Id = new QDict<int>( dbdictsize );
className2Id->setAutoDelete( TRUE );
WidgetDatabaseRecord *r = 0;
r = new WidgetDatabaseRecord;
r->iconSet = "designer_pushbutton.png";
r->name = "QPushButton";
r->group = widgetGroup( "Buttons" );
r->toolTip = "Push Button";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_toolbutton.png";
r->name = "QToolButton";
r->group = widgetGroup( "Buttons" );
r->toolTip = "Tool Button";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_radiobutton.png";
r->name = "QRadioButton";
r->group = widgetGroup( "Buttons" );
r->toolTip = "Radio Button";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_checkbox.png";
r->name = "QCheckBox";
r->group = widgetGroup( "Buttons" );
r->toolTip = "Check Box";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_groupbox.png";
r->name = "QGroupBox";
r->group = widgetGroup( "Containers" );
r->toolTip = "Group Box";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_buttongroup.png";
r->name = "QButtonGroup";
r->group = widgetGroup( "Containers" );
r->toolTip = "Button Group";
r->isContainer = TRUE;
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_frame.png";
r->name = "QFrame";
r->group = widgetGroup( "Containers" );
r->toolTip = "Frame";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_tabwidget.png";
r->name = "QTabWidget";
r->group = widgetGroup( "Containers" );
r->toolTip = "Tabwidget";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_widgetstack.png";
r->name = "QWidgetStack";
r->group = widgetGroup( "Containers" );
r->toolTip = "Widget Stack";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_toolbox.png";
r->name = "QToolBox";
r->group = widgetGroup( "Containers" );
r->toolTip = "Tool Box";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_listbox.png";
r->name = "QListBox";
r->group = widgetGroup( "Views" );
r->toolTip = "List Box";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_listview.png";
r->name = "QListView";
r->group = widgetGroup( "Views" );
r->toolTip = "List View";
append( r );
#if !defined(QT_NO_ICONVIEW) || defined(UIC)
r = new WidgetDatabaseRecord;
r->iconSet = "designer_iconview.png";
r->name = "QIconView";
r->group = widgetGroup( "Views" );
r->toolTip = "Icon View";
append( r );
#endif
#if !defined(QT_NO_TABLE)
r = new WidgetDatabaseRecord;
r->iconSet = "designer_table.png";
r->name = "QTable";
r->group = widgetGroup( "Views" );
r->toolTip = "Table";
append( r );
#endif
#if !defined(QT_NO_SQL)
r = new WidgetDatabaseRecord;
r->iconSet = "designer_datatable.png";
r->includeFile = "qdatatable.h";
r->name = "QDataTable";
r->group = widgetGroup( "Database" );
r->toolTip = "Data Table";
append( r );
#endif
r = new WidgetDatabaseRecord;
r->iconSet = "designer_lineedit.png";
r->name = "QLineEdit";
r->group = widgetGroup( "Input" );
r->toolTip = "Line Edit";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_spinbox.png";
r->name = "QSpinBox";
r->group = widgetGroup( "Input" );
r->toolTip = "Spin Box";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_dateedit.png";
r->name = "QDateEdit";
r->group = widgetGroup( "Input" );
r->toolTip = "Date Edit";
r->includeFile = "qdatetimeedit.h";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_timeedit.png";
r->name = "QTimeEdit";
r->group = widgetGroup( "Input" );
r->toolTip = "Time Edit";
r->includeFile = "qdatetimeedit.h";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_datetimeedit.png";
r->name = "QDateTimeEdit";
r->group = widgetGroup( "Input" );
r->toolTip = "Date-Time Edit";
r->includeFile = "qdatetimeedit.h";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_multilineedit.png";
r->name = "QMultiLineEdit";
r->group = widgetGroup( "Temp" );
r->toolTip = "Multi Line Edit";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_richtextedit.png";
r->name = "QTextEdit";
r->group = widgetGroup( "Input" );
r->toolTip = "Rich Text Edit";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_combobox.png";
r->name = "QComboBox";
r->group = widgetGroup( "Input" );
r->toolTip = "Combo Box";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_slider.png";
r->name = "QSlider";
r->group = widgetGroup( "Input" );
r->toolTip = "Slider";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_scrollbar.png";
r->name = "QScrollBar";
r->group = widgetGroup( "Input" );
r->toolTip = "Scrollbar";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_dial.png";
r->name = "QDial";
r->group = widgetGroup( "Input" );
r->toolTip = "Dial";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_label.png";
r->name = "QLabel";
r->group = widgetGroup( "Temp" );
r->toolTip = "Label";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_label.png";
r->name = "TextLabel";
r->group = widgetGroup( "Display" );
r->toolTip = "Text Label";
r->whatsThis = "The Text Label provides a widget to display static text.";
r->isCommon = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_pixlabel.png";
r->name = "PixmapLabel";
r->group = widgetGroup( "Display" );
r->toolTip = "Pixmap Label";
r->whatsThis = "The Pixmap Label provides a widget to display pixmaps.";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_lcdnumber.png";
r->name = "QLCDNumber";
r->group = widgetGroup( "Display" );
r->toolTip = "LCD Number";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_line.png";
r->name = "Line";
r->group = widgetGroup( "Display" );
r->toolTip = "Line";
r->includeFile = "qframe.h";
r->whatsThis = "The Line widget provides horizontal and vertical lines.";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_progress.png";
r->name = "QProgressBar";
r->group = widgetGroup( "Display" );
r->toolTip = "Progress Bar";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_textview.png";
r->name = "QTextView";
r->group = widgetGroup( "Temp" );
r->toolTip = "Text View";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_textbrowser.png";
r->name = "QTextBrowser";
r->group = widgetGroup( "Display" );
r->toolTip = "Text Browser";
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_spacer.png";
r->name = "Spacer";
r->group = widgetGroup( "Temp" );
r->toolTip = "Spacer";
r->whatsThis = "The Spacer provides horizontal and vertical spacing to be able to manipulate the behaviour of layouts.";
append( r );
r = new WidgetDatabaseRecord;
r->name = "QWidget";
r->isForm = TRUE;
r->group = widgetGroup( "Forms" );
append( r );
r = new WidgetDatabaseRecord;
r->name = "QDialog";
r->group = widgetGroup( "Forms" );
r->isForm = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->name = "QWizard";
r->group = widgetGroup( "Forms" );
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->name = "QDesignerWizard";
r->group = widgetGroup( "Forms" );
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->name = "QLayoutWidget";
r->group = widgetGroup( "Temp" );
r->includeFile = "";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->name = "QSplitter";
r->group = widgetGroup( "Temp" );
r->includeFile = "qsplitter.h";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_tabwidget.png";
r->name = "QDesignerTabWidget";
r->group = widgetGroup( "Temp" );
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_tabwidget.png";
r->name = "QDesignerWidget";
r->group = widgetGroup( "Temp" );
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "designer_tabwidget.png";
r->name = "QDesignerDialog";
r->group = widgetGroup( "Temp" );
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "";
r->name = "QMainWindow";
r->includeFile = "qmainwindow.h";
r->group = widgetGroup( "Temp" );
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "";
r->name = "QDesignerAction";
r->includeFile = "qaction.h";
r->group = widgetGroup( "Temp" );
r->isContainer = FALSE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "";
r->name = "QDesignerActionGroup";
r->includeFile = "qaction.h";
r->group = widgetGroup( "Temp" );
r->isContainer = FALSE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "";
r->name = "QScrollView";
r->includeFile = "qscrollview.h";
r->group = widgetGroup( "Temp" );
r->isContainer = TRUE;
append( r );
#ifndef QT_NO_SQL
r = new WidgetDatabaseRecord;
r->iconSet = "";
r->name = "QDataBrowser";
r->includeFile = "qdatabrowser.h";
r->group = widgetGroup( "Database" );
r->toolTip = "Data Browser";
r->iconSet = "designer_databrowser.png";
r->isContainer = TRUE;
append( r );
r = new WidgetDatabaseRecord;
r->iconSet = "";
r->name = "QDataView";
r->includeFile = "qdataview.h";
r->group = widgetGroup( "Database" );
r->toolTip = "Data View";
r->iconSet = "designer_dataview.png";
r->isContainer = TRUE;
append( r );
#endif
#ifndef UIC
setupPlugins();
#endif
}
void WidgetDatabase::setupPlugins()
{
if ( plugins_set_up )
return;
plugins_set_up = TRUE;
QStringList widgets = widgetManager()->featureList();
for ( QStringList::Iterator it = widgets.begin(); it != widgets.end(); ++it ) {
if ( hasWidget( *it ) )
continue;
WidgetDatabaseRecord *r = new WidgetDatabaseRecord;
WidgetInterface *iface = 0;
widgetManager()->queryInterface( *it, &iface );
if ( !iface )
continue;
#ifndef UIC
QIconSet icon = iface->iconSet( *it );
if ( !icon.pixmap().isNull() )
r->icon = new QIconSet( icon );
#endif
QString grp = iface->group( *it );
if ( grp.isEmpty() )
grp = "3rd party widgets";
r->group = widgetGroup( grp );
r->toolTip = iface->toolTip( *it );
r->whatsThis = iface->whatsThis( *it );
r->includeFile = iface->includeFile( *it );
r->isContainer = iface->isContainer( *it );
r->name = *it;
r->isPlugin = TRUE;
append( r );
iface->release();
}
}
/*!
Returns the number of elements in the widget database.
*/
int WidgetDatabase::count()
{
setupDataBase( -1 );
return dbcount;
}
/*!
Returns the id at which the ids of custom widgets start.
*/
int WidgetDatabase::startCustom()
{
setupDataBase( -1 );
return dbcustom;
}
/*!
Returns the iconset which represents the class registered as \a id.
*/
QIconSet WidgetDatabase::iconSet( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return QIconSet();
#if !defined(UIC) && !defined(RESOURCE)
if ( !r->icon ) {
if ( r->iconSet.isEmpty() )
return QIconSet();
QPixmap pix = QPixmap::fromMimeSource( r->iconSet );
if ( pix.isNull() )
pix = QPixmap( r->iconSet );
r->icon = new QIconSet( pix );
}
return *r->icon;
#else
return QIconSet();
#endif
}
/*!
Returns the classname of the widget which is registered as \a id.
*/
QString WidgetDatabase::className( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return QString::null;
return r->name;
}
/*!
Returns the group the widget registered as \a id belongs to.
*/
QString WidgetDatabase::group( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return QString::null;
return r->group;
}
/*!
Returns the tooltip text of the widget which is registered as \a id.
*/
QString WidgetDatabase::toolTip( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return QString::null;
return r->toolTip;
}
/*!
Returns the what's this? text of the widget which is registered as \a id.
*/
QString WidgetDatabase::whatsThis( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return QString::null;
return r->whatsThis;
}
/*!
Returns the include file if the widget which is registered as \a id.
*/
QString WidgetDatabase::includeFile( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return QString::null;
if ( r->includeFile.isNull() )
return r->name.lower() + ".h";
return r->includeFile;
}
/*! Returns whether the widget registered as \a id is a form.
*/
bool WidgetDatabase::isForm( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return FALSE;
return r->isForm;
}
/*! Returns whether the widget registered as \a id can have children.
*/
bool WidgetDatabase::isContainer( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return FALSE;
return r->isContainer || r->isForm;
}
bool WidgetDatabase::isCommon( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return FALSE;
return r->isCommon;
}
QString WidgetDatabase::createWidgetName( int id )
{
setupDataBase( id );
QString n = className( id );
if ( n == "QLayoutWidget" )
n = "Layout";
if ( n[ 0 ] == 'Q' && n[ 1 ].lower() != n[ 1 ] )
n = n.mid( 1 );
int colonColon = n.findRev( "::" );
if ( colonColon != -1 )
n = n.mid( colonColon + 2 );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return n;
n += QString::number( ++r->nameCounter );
n[0] = n[0].lower();
return n;
}
/*! Returns the id for \a name or -1 if \a name is unknown.
*/
int WidgetDatabase::idFromClassName( const QString &name )
{
setupDataBase( -1 );
if ( name.isEmpty() )
return 0;
int *i = className2Id->find( name );
if ( i )
return *i;
if ( name == "FormWindow" )
return idFromClassName( "QLayoutWidget" );
#ifdef UIC
setupDataBase( -2 );
i = className2Id->find( name );
if ( i )
return *i;
#endif
return -1;
}
bool WidgetDatabase::hasWidget( const QString &name )
{
return className2Id->find( name ) != 0;
}
WidgetDatabaseRecord *WidgetDatabase::at( int index )
{
if ( index < 0 )
return 0;
if ( index >= dbcustom && index < dbcustomcount )
return db[ index ];
if ( index < dbcount )
return db[ index ];
return 0;
}
void WidgetDatabase::insert( int index, WidgetDatabaseRecord *r )
{
if ( index < 0 || index >= dbsize )
return;
db[ index ] = r;
className2Id->insert( r->name, new int( index ) );
if ( index < dbcustom )
dbcount = QMAX( dbcount, index );
}
void WidgetDatabase::append( WidgetDatabaseRecord *r )
{
if ( !was_in_setup )
setupDataBase( -1 );
insert( dbcount++, r );
}
QString WidgetDatabase::widgetGroup( const QString &g )
{
if ( wGroups->find( g ) == -1 )
wGroups->append( g );
return g;
}
bool WidgetDatabase::isGroupEmpty( const QString &grp )
{
WidgetDatabaseRecord *r = 0;
for ( int i = 0; i < dbcount; ++i ) {
if ( !( r = db[ i ] ) )
continue;
if ( r->group == grp )
return FALSE;
}
return TRUE;
}
QString WidgetDatabase::widgetGroup( int i )
{
setupDataBase( -1 );
if ( i >= 0 && i < (int)wGroups->count() )
return wGroups->at( i );
return QString::null;
}
int WidgetDatabase::numWidgetGroups()
{
setupDataBase( -1 );
return wGroups->count();
}
bool WidgetDatabase::isGroupVisible( const QString &g )
{
setupDataBase( -1 );
return invisibleGroups->find( g ) == -1;
}
int WidgetDatabase::addCustomWidget( WidgetDatabaseRecord *r )
{
insert( dbcustomcount++, r );
return dbcustomcount - 1;
}
void WidgetDatabase::customWidgetClassNameChanged( const QString &oldName,
const QString &newName )
{
int id = idFromClassName( oldName );
if ( id == -1 )
return;
WidgetDatabaseRecord *r = db[ id ];
r->name = newName;
className2Id->remove( oldName );
className2Id->insert( newName, new int( id ) );
}
bool WidgetDatabase::isCustomWidget( int id )
{
if ( id >= dbcustom && id < dbcustomcount )
return TRUE;
return FALSE;
}
bool WidgetDatabase::isCustomPluginWidget( int id )
{
setupDataBase( id );
WidgetDatabaseRecord *r = at( id );
if ( !r )
return FALSE;
return r->isPlugin;
}
bool WidgetDatabase::isWhatsThisLoaded()
{
return whatsThisLoaded;
}
void WidgetDatabase::loadWhatsThis( const QString &docPath )
{
QString whatsthisFile = docPath + "/whatsthis";
QFile f( whatsthisFile );
if ( !f.open( IO_ReadOnly ) )
return;
QTextStream ts( &f );
while ( !ts.atEnd() ) {
QString s = ts.readLine();
QStringList l = QStringList::split( " | ", s );
int id = idFromClassName( l[ 1 ] );
WidgetDatabaseRecord *r = at( id );
if ( r )
r->whatsThis = l[ 0 ];
}
whatsThisLoaded = TRUE;
}
// ### Qt 3.1: make these publically accessible via QWidgetDatabase API
#if defined(UIC)
bool dbnounload = FALSE;
QStringList *dbpaths = 0;
#else
extern QString *qwf_plugin_dir;
#endif
QPluginManager<WidgetInterface> *widgetManager()
{
if ( !widgetPluginManager ) {
QString pluginDir = "/designer";
#if !defined(UIC)
if ( qwf_plugin_dir )
pluginDir = *qwf_plugin_dir;
#endif
widgetPluginManager = new QPluginManager<WidgetInterface>( IID_Widget, QApplication::libraryPaths(), pluginDir );
cleanup_manager.add( &widgetPluginManager );
#if defined(UIC)
if ( dbnounload )
widgetPluginManager->setAutoUnload( FALSE );
if ( dbpaths ) {
QStringList::ConstIterator it = dbpaths->begin();
for ( ; it != dbpaths->end(); ++it )
widgetPluginManager->addLibraryPath( *it );
}
#endif
}
return widgetPluginManager;
}

@ -0,0 +1,90 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef WIDGETDATABASE_H
#define WIDGETDATABASE_H
#include <qiconset.h>
#include <qstring.h>
#include "widgetinterface.h" // up here for GCC 2.7.* compatibility
#include <private/qpluginmanager_p.h>
extern QPluginManager<WidgetInterface> *widgetManager();
struct WidgetDatabaseRecord
{
WidgetDatabaseRecord();
~WidgetDatabaseRecord();
QString iconSet, name, group, toolTip, whatsThis, includeFile;
uint isContainer : 1;
uint isForm : 1;
uint isCommon : 1;
uint isPlugin : 1;
QIconSet *icon;
int nameCounter;
};
class WidgetDatabase : public Qt
{
public:
WidgetDatabase();
static void setupDataBase( int id );
static void setupPlugins();
static int count();
static int startCustom();
static QIconSet iconSet( int id );
static QString className( int id );
static QString group( int id );
static QString toolTip( int id );
static QString whatsThis( int id );
static QString includeFile( int id );
static bool isForm( int id );
static bool isContainer( int id );
static bool isCommon( int id );
static int idFromClassName( const QString &name );
static QString createWidgetName( int id );
static WidgetDatabaseRecord *at( int index );
static void insert( int index, WidgetDatabaseRecord *r );
static void append( WidgetDatabaseRecord *r );
static QString widgetGroup( const QString &g );
static QString widgetGroup( int i );
static int numWidgetGroups();
static bool isGroupVisible( const QString &g );
static bool isGroupEmpty( const QString &grp );
static int addCustomWidget( WidgetDatabaseRecord *r );
static bool isCustomWidget( int id );
static bool isCustomPluginWidget( int id );
static bool isWhatsThisLoaded();
static void loadWhatsThis( const QString &docPath );
static bool hasWidget( const QString &name );
static void customWidgetClassNameChanged( const QString &oldName, const QString &newName );
};
#endif

@ -0,0 +1,29 @@
/**********************************************************************
** Copyright (C) 2000-2001 Trolltech AS. All rights reserved.
**
** This file is part of Qt Designer.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef WIDGETINTERFACE_H
#define WIDGETINTERFACE_H
#include <private/qwidgetinterface_p.h>
#define WidgetInterface QWidgetFactoryInterface
#define IID_Widget IID_QWidgetFactory
#endif

@ -0,0 +1,6 @@
SUBDIRS = qt
include_HEADERS = smoke.h
EXTRA_DIST=smoke.h Makefile.am

@ -0,0 +1,573 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision: 1.3 $
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTODIRS = @AUTODIRS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONF_FILES = @CONF_FILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@
KDE_HAVE_GL = @KDE_HAVE_GL@
KDE_INCLUDES = @KDE_INCLUDES@
KDE_LDFLAGS = @KDE_LDFLAGS@
KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@
KDE_MT_LIBS = @KDE_MT_LIBS@
KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@
KDE_PLUGIN = @KDE_PLUGIN@
KDE_RPATH = @KDE_RPATH@
KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@
KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@
KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@
KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@
KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@
KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@
LDFLAGS = @LDFLAGS@
LIBCOMPAT = @LIBCOMPAT@
LIBCRYPT = @LIBCRYPT@
LIBDL = @LIBDL@
LIBJPEG = @LIBJPEG@
LIBOBJS = @LIBOBJS@
LIBPNG = @LIBPNG@
LIBPTHREAD = @LIBPTHREAD@
LIBRESOLV = @LIBRESOLV@
LIBS = @LIBS@
LIBSM = @LIBSM@
LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LIBUCB = @LIBUCB@
LIBUTIL = @LIBUTIL@
LIBZ = @LIBZ@
LIB_POLL = @LIB_POLL@
LIB_QPE = @LIB_QPE@
LIB_QT = @LIB_QT@
LIB_X11 = @LIB_X11@
LIB_XEXT = @LIB_XEXT@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MOC = @MOC@
NOOPT_CFLAGS = @NOOPT_CFLAGS@
NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
QTE_NORTTI = @QTE_NORTTI@
QT_INCLUDES = @QT_INCLUDES@
QT_LDFLAGS = @QT_LDFLAGS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TOPSUBDIRS = @TOPSUBDIRS@
UIC = @UIC@
UIC_TR = @UIC_TR@
USER_INCLUDES = @USER_INCLUDES@
USER_LDFLAGS = @USER_LDFLAGS@
USE_EXCEPTIONS = @USE_EXCEPTIONS@
USE_RPATH = @USE_RPATH@
USE_RTTI = @USE_RTTI@
USE_THREADS = @USE_THREADS@
VERSION = @VERSION@
WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_INCLUDES = @X_INCLUDES@
X_LDFLAGS = @X_LDFLAGS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
kde_includes = @kde_includes@
kde_libraries = @kde_libraries@
kde_qtver = @kde_qtver@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
qt_includes = @qt_includes@
qt_libraries = @qt_libraries@
qt_test_threshold = @qt_test_threshold@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
x_includes = @x_includes@
x_libraries = @x_libraries@
SUBDIRS = qt
include_HEADERS = smoke.h
EXTRA_DIST = smoke.h Makefile.am
subdir = smoke
mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
HEADERS = $(include_HEADERS)
#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
#>- ps-recursive install-info-recursive uninstall-info-recursive \
#>- all-recursive install-data-recursive install-exec-recursive \
#>- installdirs-recursive install-recursive uninstall-recursive \
#>- check-recursive installcheck-recursive
#>+ 5
#>- RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
#>- ps-recursive install-info-recursive uninstall-info-recursive \
#>- all-recursive install-data-recursive install-exec-recursive \
#>- installdirs-recursive install-recursive uninstall-recursive \
#>- check-recursive installcheck-recursive nmcheck-recursive
#>+ 5
RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
ps-recursive install-info-recursive uninstall-info-recursive \
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive nmcheck-recursive bcheck-recursive
DIST_COMMON = README $(include_HEADERS) Makefile.am Makefile.in
DIST_SUBDIRS = $(SUBDIRS)
#>- all: all-recursive
#>+ 1
all: docs-am all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && \
#>- $(AUTOMAKE) --gnu smoke/Makefile
#>+ 3
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu smoke/Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
includeHEADERS_INSTALL = $(INSTALL_HEADER)
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(includedir)
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
$(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; for p in $$list; do \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " rm -f $(DESTDIR)$(includedir)/$$f"; \
rm -f $(DESTDIR)$(includedir)/$$f; \
done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
@set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" \
distdir=../$(distdir)/$$subdir \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(HEADERS)
installdirs: installdirs-recursive
installdirs-am:
$(mkinstalldirs) $(DESTDIR)$(includedir)
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
#>- clean: clean-recursive
#>+ 1
clean: kde-rpo-clean clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
distclean-am: clean-am distclean-generic distclean-libtool \
distclean-tags
dvi: dvi-recursive
dvi-am:
info: info-recursive
info-am:
install-data-am: install-includeHEADERS
install-exec-am:
install-info: install-info-recursive
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-info-am
uninstall-info: uninstall-info-recursive
.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
clean-generic clean-libtool clean-recursive ctags \
ctags-recursive distclean distclean-generic distclean-libtool \
distclean-recursive distclean-tags distdir dvi dvi-am \
dvi-recursive info info-am info-recursive install install-am \
install-data install-data-am install-data-recursive \
install-exec install-exec-am install-exec-recursive \
install-includeHEADERS install-info install-info-am \
install-info-recursive install-man install-recursive \
install-strip installcheck installcheck-am installdirs \
installdirs-am installdirs-recursive maintainer-clean \
maintainer-clean-generic maintainer-clean-recursive mostlyclean \
mostlyclean-generic mostlyclean-libtool mostlyclean-recursive \
pdf pdf-am pdf-recursive ps ps-am ps-recursive tags \
tags-recursive uninstall uninstall-am uninstall-includeHEADERS \
uninstall-info-am uninstall-info-recursive uninstall-recursive
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#>+ 2
docs-am:
#>+ 6
force-reedit:
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu smoke/Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/Makefile.in
#>+ 5
bcheck: bcheck-recursive
bcheck-am:
#>+ 2
final:
$(MAKE) all-am
#>+ 2
final-install:
$(MAKE) install-am
#>+ 2
no-final:
$(MAKE) all-am
#>+ 2
no-final-install:
$(MAKE) install-am
#>+ 3
cvs-clean:
$(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean
#>+ 3
kde-rpo-clean:
-rm -f *.rpo
#>+ 3
nmcheck:
nmcheck-am: nmcheck

@ -0,0 +1,17 @@
lib_LTLIBRARIES = libsmokeqt.la
# set the include path for X, qt and KDE
INCLUDES = -I$(srcdir)/.. $(all_includes)
EXTRA_DIST=generate.pl.in qtguess.pl.in qt_smoke.h Makefile.am Makefile.in
# the library search path.
libsmokeqt_la_LDFLAGS = -version-info 3:1:2 -no-undefined $(all_libraries) $(GL_CFLAGS) $(KDE_RPATH)
# the libraries to link against.
libsmokeqt_la_LIBADD = $(LIB_QT) $(GL_LIBS)
# which sources should be compiled for perlqtkde
libsmokeqt_la_SOURCES = smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp \
x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp \
x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp

@ -0,0 +1,684 @@
# Makefile.in generated by automake 1.7.2 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision: 1.3 $
# @configure_input@
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
# Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_triplet = @host@
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTODIRS = @AUTODIRS@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CONF_FILES = @CONF_FILES@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@
GL_CFLAGS = @GL_CFLAGS@
GL_LIBS = @GL_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@
KDE_HAVE_GL = @KDE_HAVE_GL@
KDE_INCLUDES = @KDE_INCLUDES@
KDE_LDFLAGS = @KDE_LDFLAGS@
KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@
KDE_MT_LIBS = @KDE_MT_LIBS@
KDE_NO_UNDEFINED = @KDE_NO_UNDEFINED@
KDE_PLUGIN = @KDE_PLUGIN@
KDE_RPATH = @KDE_RPATH@
KDE_USE_CLOSURE_FALSE = @KDE_USE_CLOSURE_FALSE@
KDE_USE_CLOSURE_TRUE = @KDE_USE_CLOSURE_TRUE@
KDE_USE_FINAL_FALSE = @KDE_USE_FINAL_FALSE@
KDE_USE_FINAL_TRUE = @KDE_USE_FINAL_TRUE@
KDE_USE_NMCHECK_FALSE = @KDE_USE_NMCHECK_FALSE@
KDE_USE_NMCHECK_TRUE = @KDE_USE_NMCHECK_TRUE@
LDFLAGS = @LDFLAGS@
LIBCOMPAT = @LIBCOMPAT@
LIBCRYPT = @LIBCRYPT@
LIBDL = @LIBDL@
LIBJPEG = @LIBJPEG@
LIBOBJS = @LIBOBJS@
LIBPNG = @LIBPNG@
LIBPTHREAD = @LIBPTHREAD@
LIBRESOLV = @LIBRESOLV@
LIBS = @LIBS@
LIBSM = @LIBSM@
LIBSOCKET = @LIBSOCKET@
LIBTOOL = @LIBTOOL@
LIBUCB = @LIBUCB@
LIBUTIL = @LIBUTIL@
LIBZ = @LIBZ@
LIB_POLL = @LIB_POLL@
LIB_QPE = @LIB_QPE@
LIB_QT = @LIB_QT@
LIB_X11 = @LIB_X11@
LIB_XEXT = @LIB_XEXT@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MOC = @MOC@
NOOPT_CFLAGS = @NOOPT_CFLAGS@
NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
QTE_NORTTI = @QTE_NORTTI@
QT_INCLUDES = @QT_INCLUDES@
QT_LDFLAGS = @QT_LDFLAGS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
TOPSUBDIRS = @TOPSUBDIRS@
UIC = @UIC@
UIC_TR = @UIC_TR@
USER_INCLUDES = @USER_INCLUDES@
USER_LDFLAGS = @USER_LDFLAGS@
USE_EXCEPTIONS = @USE_EXCEPTIONS@
USE_RPATH = @USE_RPATH@
USE_RTTI = @USE_RTTI@
USE_THREADS = @USE_THREADS@
VERSION = @VERSION@
WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_INCLUDES = @X_INCLUDES@
X_LDFLAGS = @X_LDFLAGS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_RANLIB = @ac_ct_RANLIB@
ac_ct_STRIP = @ac_ct_STRIP@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__quote = @am__quote@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
kde_includes = @kde_includes@
kde_libraries = @kde_libraries@
kde_qtver = @kde_qtver@
libdir = @libdir@
libexecdir = @libexecdir@
localstatedir = @localstatedir@
mandir = @mandir@
oldincludedir = @oldincludedir@
prefix = @prefix@
program_transform_name = @program_transform_name@
qt_includes = @qt_includes@
qt_libraries = @qt_libraries@
qt_test_threshold = @qt_test_threshold@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
x_includes = @x_includes@
x_libraries = @x_libraries@
lib_LTLIBRARIES = libsmokeqt.la
# set the include path for X, qt and KDE
INCLUDES = -I$(srcdir)/.. $(all_includes)
EXTRA_DIST = generate.pl.in qtguess.pl.in qt_smoke.h Makefile.am Makefile.in
# the library search path.
#>- libsmokeqt_la_LDFLAGS = -version-info 3:1:2 -no-undefined $(all_libraries) $(GL_CFLAGS) $(KDE_RPATH)
#>+ 1
libsmokeqt_la_LDFLAGS = -version-info 3:1:2 -no-undefined $(KDE_NO_UNDEFINED) $(all_libraries) $(GL_CFLAGS) $(KDE_RPATH)
# the libraries to link against.
libsmokeqt_la_LIBADD = $(LIB_QT) $(GL_LIBS)
# which sources should be compiled for perlqtkde
libsmokeqt_la_SOURCES = smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp \
x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp \
x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp
subdir = smoke/qt
mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = qtguess.pl generate.pl
LTLIBRARIES = $(lib_LTLIBRARIES)
libsmokeqt_la_DEPENDENCIES =
am_libsmokeqt_la_OBJECTS = smokedata.lo x_1.lo x_2.lo x_3.lo x_4.lo \
x_5.lo x_6.lo x_7.lo x_8.lo x_9.lo x_10.lo x_11.lo x_12.lo \
x_13.lo x_14.lo x_15.lo x_16.lo x_17.lo x_18.lo x_19.lo x_20.lo
#>- libsmokeqt_la_OBJECTS = $(am_libsmokeqt_la_OBJECTS)
#>+ 6
libsmokeqt_la_final_OBJECTS = libsmokeqt_la.all_cpp.lo
libsmokeqt_la_nofinal_OBJECTS = smokedata.lo x_1.lo x_2.lo x_3.lo x_4.lo \
x_5.lo x_6.lo x_7.lo x_8.lo x_9.lo x_10.lo x_11.lo x_12.lo \
x_13.lo x_14.lo x_15.lo x_16.lo x_17.lo x_18.lo x_19.lo x_20.lo
@KDE_USE_FINAL_FALSE@libsmokeqt_la_OBJECTS = $(libsmokeqt_la_nofinal_OBJECTS)
@KDE_USE_FINAL_TRUE@libsmokeqt_la_OBJECTS = $(libsmokeqt_la_final_OBJECTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/admin/depcomp
am__depfiles_maybe = depfiles
#>- @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/smokedata.Plo ./$(DEPDIR)/x_1.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_10.Plo ./$(DEPDIR)/x_11.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_12.Plo ./$(DEPDIR)/x_13.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_14.Plo ./$(DEPDIR)/x_15.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_16.Plo ./$(DEPDIR)/x_17.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_18.Plo ./$(DEPDIR)/x_19.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_2.Plo ./$(DEPDIR)/x_20.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_3.Plo ./$(DEPDIR)/x_4.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_5.Plo ./$(DEPDIR)/x_6.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_7.Plo ./$(DEPDIR)/x_8.Plo \
#>- @AMDEP_TRUE@ ./$(DEPDIR)/x_9.Plo
#>+ 23
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@DEP_FILES = $(DEPDIR)/libsmokeqt_la.all_cpp.P ./$(DEPDIR)/smokedata.Plo ./$(DEPDIR)/x_1.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_10.Plo ./$(DEPDIR)/x_11.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_12.Plo ./$(DEPDIR)/x_13.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_14.Plo ./$(DEPDIR)/x_15.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_16.Plo ./$(DEPDIR)/x_17.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_18.Plo ./$(DEPDIR)/x_19.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_2.Plo ./$(DEPDIR)/x_20.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_3.Plo ./$(DEPDIR)/x_4.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_5.Plo ./$(DEPDIR)/x_6.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_7.Plo ./$(DEPDIR)/x_8.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_TRUE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_9.Plo
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@DEP_FILES = ./$(DEPDIR)/smokedata.Plo ./$(DEPDIR)/x_1.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_10.Plo ./$(DEPDIR)/x_11.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_12.Plo ./$(DEPDIR)/x_13.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_14.Plo ./$(DEPDIR)/x_15.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_16.Plo ./$(DEPDIR)/x_17.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_18.Plo ./$(DEPDIR)/x_19.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_2.Plo ./$(DEPDIR)/x_20.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_3.Plo ./$(DEPDIR)/x_4.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_5.Plo ./$(DEPDIR)/x_6.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_7.Plo ./$(DEPDIR)/x_8.Plo \
@AMDEP_TRUE@@KDE_USE_FINAL_FALSE@ @AMDEP_TRUE@ ./$(DEPDIR)/x_9.Plo
#>- CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
#>- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
#>+ 2
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS)
#>- LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
#>- $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
#>- $(AM_CXXFLAGS) $(CXXFLAGS)
#>+ 3
LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS)
CXXLD = $(CXX)
#>- CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
#>- $(AM_LDFLAGS) $(LDFLAGS) -o $@
#>+ 2
CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(KDE_CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libsmokeqt_la_SOURCES)
DIST_COMMON = Makefile.am Makefile.in generate.pl.in qtguess.pl.in
SOURCES = $(libsmokeqt_la_SOURCES)
#>- all: all-am
#>+ 1
all: docs-am all-am
.SUFFIXES:
.SUFFIXES: .cpp .lo .o .obj
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && \
#>- $(AUTOMAKE) --gnu smoke/qt/Makefile
#>+ 3
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu smoke/qt/Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/qt/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
qtguess.pl: $(top_builddir)/config.status qtguess.pl.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
generate.pl: $(top_builddir)/config.status generate.pl.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
libLTLIBRARIES_INSTALL = $(INSTALL)
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p="`echo $$p | sed -e 's|^.*/||'`"; \
echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
#>- libsmokeqt.la: $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES)
#>+ 2
@KDE_USE_CLOSURE_TRUE@libsmokeqt.la: libsmokeqt.la.closure $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES)
@KDE_USE_CLOSURE_FALSE@libsmokeqt.la: $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES)
$(CXXLINK) -rpath $(libdir) $(libsmokeqt_la_LDFLAGS) $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smokedata.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_1.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_10.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_11.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_12.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_13.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_14.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_15.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_16.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_17.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_18.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_19.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_20.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_3.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_4.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_5.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_6.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_7.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_8.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_9.Plo@am__quote@
distclean-depend:
-rm -rf ./$(DEPDIR)
.cpp.o:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
.cpp.obj:
@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
.cpp.lo:
@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
@am__fastdepCXX_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
@am__fastdepCXX_TRUE@ then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
@am__fastdepCXX_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
@am__fastdepCXX_TRUE@ fi
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
ETAGS = etags
ETAGSFLAGS =
CTAGS = ctags
CTAGSFLAGS =
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$tags$$unique" \
|| $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
#>+ 4
KDE_DIST=header_list generate_makefile_am.pl
DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)
top_distdir = ../..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkinstalldirs) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES)
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
#>- clean: clean-am
#>+ 1
clean: kde-rpo-clean clean-am
#>- clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
#>- mostlyclean-am
#>+ 2
clean-am: clean-closures clean-final clean-generic clean-libLTLIBRARIES clean-libtool \
mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-compile distclean-depend \
distclean-generic distclean-libtool distclean-tags
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am:
install-exec-am: install-libLTLIBRARIES
install-info: install-info-am
install-man:
installcheck-am:
maintainer-clean: maintainer-clean-am
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool ctags distclean \
distclean-compile distclean-depend distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am info \
info-am install install-am install-data install-data-am \
install-exec install-exec-am install-info install-info-am \
install-libLTLIBRARIES install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-info-am \
uninstall-libLTLIBRARIES
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#>+ 8
libsmokeqt.la.closure: $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_DEPENDENCIES)
@echo "int main() {return 0;}" > libsmokeqt_la_closure.cpp
@$(LTCXXCOMPILE) -c libsmokeqt_la_closure.cpp
$(CXXLINK) libsmokeqt_la_closure.lo $(libsmokeqt_la_LDFLAGS) $(libsmokeqt_la_OBJECTS) $(libsmokeqt_la_LIBADD) $(LIBS)
@rm -f libsmokeqt_la_closure.* libsmokeqt.la.closure
@echo "timestamp" > libsmokeqt.la.closure
#>+ 3
clean-closures:
-rm -f libsmokeqt.la.closure
#>+ 2
docs-am:
#>+ 6
force-reedit:
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu smoke/qt/Makefile
cd $(top_srcdir) && perl admin/am_edit PerlQt-3.008/smoke/qt/Makefile.in
#>+ 9
bcheck: bcheck-am
bcheck-am:
test ! -r bchecktest.cc.class || mv -f bchecktest.cc.class bchecktest.cc.oldclass
@echo "int main() {return 0;}" > bchecktest.cc
for i in $(include_HEADERS); do echo "#include \"$$i\"" >> bchecktest.cc; done
test ! -s bchecktest.cc || $(CXXCOMPILE) --dump-class-hierarchy bchecktest.cc
test ! -s bchecktest.cc.oldclass || test ! -s bchecktest.cc.class || cmp -s bchecktest.cc.oldclass bchecktest.cc.class
#>+ 11
libsmokeqt_la.all_cpp.cpp: $(srcdir)/Makefile.in smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp
@echo 'creating libsmokeqt_la.all_cpp.cpp ...'; \
rm -f libsmokeqt_la.all_cpp.files libsmokeqt_la.all_cpp.final; \
echo "#define KDE_USE_FINAL 1" >> libsmokeqt_la.all_cpp.final; \
for file in smokedata.cpp x_1.cpp x_2.cpp x_3.cpp x_4.cpp x_5.cpp x_6.cpp x_7.cpp x_8.cpp x_9.cpp x_10.cpp x_11.cpp x_12.cpp x_13.cpp x_14.cpp x_15.cpp x_16.cpp x_17.cpp x_18.cpp x_19.cpp x_20.cpp ; do \
echo "#include \"$$file\"" >> libsmokeqt_la.all_cpp.files; \
test ! -f $(srcdir)/$$file || egrep '^#pragma +implementation' $(srcdir)/$$file >> libsmokeqt_la.all_cpp.final; \
done; \
cat libsmokeqt_la.all_cpp.final libsmokeqt_la.all_cpp.files > libsmokeqt_la.all_cpp.cpp; \
rm -f libsmokeqt_la.all_cpp.final libsmokeqt_la.all_cpp.files
#>+ 3
clean-final:
-rm -f libsmokeqt_la.all_cpp.cpp
#>+ 2
final:
$(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_final_OBJECTS)" all-am
#>+ 2
final-install:
$(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_final_OBJECTS)" install-am
#>+ 2
no-final:
$(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_nofinal_OBJECTS)" all-am
#>+ 2
no-final-install:
$(MAKE) libsmokeqt_la_OBJECTS="$(libsmokeqt_la_nofinal_OBJECTS)" install-am
#>+ 3
cvs-clean:
$(MAKE) admindir=$(top_srcdir)/admin -f $(top_srcdir)/admin/Makefile.common cvs-clean
#>+ 3
kde-rpo-clean:
-rm -f *.rpo
#>+ 3
nmcheck:
nmcheck-am: nmcheck

@ -0,0 +1,153 @@
#!/usr/bin/perl -w
## Run this first, to generate the x_*.cpp files from the Qt headers
## using kalyptus
my $kalyptusdir = "../../kalyptus";
use File::Basename;
use File::Copy qw|cp|;
use File::Compare;
use Cwd;
my $here = getcwd;
my $outdir = $here . "/generate.pl.tmpdir";
my $finaloutdir = $here;
my $defines = "qtdefines";
my $headerlist = "header_list";
my $definespath = "$here/$defines";
my $headerlistpath = "$here/$headerlist";
## Note: outdir and finaloutdir should NOT be the same dir!
# Delete all x_*.cpp files under outdir (or create outdir if nonexistent)
if (-d $outdir) { system "rm -f $outdir/x_*.cpp"; } else { mkdir $outdir; }
mkdir $finaloutdir unless (-d $finaloutdir);
# Load the QT_NO_* macros found in "qtdefines". They'll be passed to kalyptus
my $macros="";
if ( -e $definespath ){
print "Found '$defines'. Reading preprocessor symbols from there...\n";
$macros = " --defines=$definespath ";
}
# Need to cd to kalyptus's directory so that perl finds Ast.pm etc.
chdir "$kalyptusdir" or die "Couldn't go to $kalyptusdir (edit script to change dir)\n";
# Find out which header files we need to parse
# We don't want all of them - e.g. not template-based stuff
my %excludes = (
'qaccessible.h' => 1, # Accessibility support is not compiled by defaut
'qassistantclient.h' => 1, # Not part of Qt (introduced in Qt-3.1)
'qmotif.h' => 1, #
'qmotifwidget.h' => 1, # Motif extension (introduced in Qt-3.1)
'qmotifdialog.h' => 1, #
'qxt.h' => 1, # Xt
'qxtwidget.h' => 1, # Xt
'qdns.h' => 1, # internal
'qgl.h' => 1, # OpenGL
'qglcolormap.h' => 1, # OpenGL
'qnp.h' => 1, # NSPlugin
'qttableview.h' => 1, # Not in Qt anymore...
'qtmultilineedit.h' => 1, # Not in Qt anymore...
'qwidgetfactory.h' => 1, # Just an interface
'qsharedmemory.h' => 1, # "not part of the Qt API" they say
'qwindowsstyle.h' => 1, # Qt windowsstyle, plugin
'qmotifstyle.h' => 1,
'qcompactstyle.h' => 1,
'qinterlacestyle.h' => 1,
'qmotifplusstyle.h' => 1,
'qsgistyle.h' => 1,
'qplatinumstyle.h' => 1,
'qcdestyle.h' => 1,
'qwindowsxpstyle.h' => 1 # play on the safe side
);
# Some systems have a QTDIR = KDEDIR = PREFIX
# We need a complete list
my %includes;
open(HEADERS, $headerlistpath) or die "Couldn't open $headerlistpath: $!\n";
map { chomp ; $includes{$_} = 1 } <HEADERS>;
close HEADERS;
# Can we compile the OpenGl module ?
if("@KDE_HAVE_GL@" eq "yes")
{
open(DEFS, $definespath);
my @defs = <DEFS>;
close DEFS;
if(!grep(/QT_NO_OPENGL/, @defs))
{
$excludes{'qgl.h'} = undef;
$excludes{'qglcolormap.h'} = undef;
}
else
{
print STDERR "Qt was not compiled with OpenGL support...\n Skipping QGL Classes.\n";
}
}
# List Qt headers, and exclude the ones listed above
my @headers = ();
$qtinc= '@qt_includes@';
opendir (QT, $qtinc) or die "Couldn't find $qtinc";
foreach $filename (readdir(QT)) {
$entry = $qtinc."/".$filename;
if ( ( -e $entry or -l $entry ) # A real file or a symlink
&& ( ! -d _ ) ) # Not a symlink to a dir though
{
push(@headers, $entry)
if ( !defined $excludes{$filename} # Not excluded
&& $includes{$filename} # Known header
&& $filename =~ /\.h$/ ); # Not a backup file etc. Only headers.
undef $includes{$filename}
}
}
closedir QT;
# Launch kalyptus
system "perl kalyptus @ARGV --globspace -fsmoke --name=qt $macros --no-cache --outputdir=$outdir @headers";
my $exit = $? >> 8;
exit $exit if ($exit);
# Generate diff for smokedata.cpp
unless ( -e "$finaloutdir/smokedata.cpp" ) {
open( TOUCH, ">$finaloutdir/smokedata.cpp");
close TOUCH;
}
system "diff -u $finaloutdir/smokedata.cpp $outdir/smokedata.cpp > $outdir/smokedata.cpp.diff";
# Copy changed or new files to finaloutdir
opendir (OUT, $outdir) or die "Couldn't opendir $outdir";
foreach $filename (readdir(OUT)) {
next if ( -d "$outdir/$filename" ); # only files, not dirs
my $docopy = 1;
if ( -f "$finaloutdir/$filename" ) {
$docopy = compare("$outdir/$filename", "$finaloutdir/$filename"); # 1 if files are differents
}
if ($docopy) {
#print STDERR "Updating $filename...\n";
cp("$outdir/$filename", "$finaloutdir/$filename");
}
}
closedir OUT;
# Check for deleted files and warn
my $deleted = 0;
opendir(FINALOUT, $finaloutdir) or die "Couldn't opendir $finaloutdir";
foreach $filename (readdir(FINALOUT)) {
next if ( -d "$finaloutdir/$filename" ); # only files, not dirs
if ( $filename =~ /.cpp$/ && ! ($filename =~ /_la_closure.cpp/) && ! -f "$outdir/$filename" ) {
print STDERR "Removing obsolete file $filename\n";
unlink "$finaloutdir/$filename";
$deleted = 1;
}
}
closedir FINALOUT;
# Delete outdir
system "rm -rf $outdir";

@ -0,0 +1,56 @@
#!/usr/bin/perl -w
use File::Basename;
use File::Copy qw|cp|;
use File::Compare;
use Cwd;
my $here = getcwd;
my $outdir = $here;
my $tempfile = "$outdir/.Makefile.am.tmpfile";
# Update list of source files in $outdir/Makefile.am
open( MAKEFILE, "<$outdir/Makefile.am" ) or die;
my $makeFileData = '';
my $found = 0;
while (<MAKEFILE>) {
if (/^libsmokeqt_la_SOURCES/)
{
$found = 1;
$makeFileData .= "libsmokeqt_la_SOURCES = smokedata.cpp";
}
$makeFileData .= $_ if (!$found);
}
close MAKEFILE;
die "libsmokeqt_la_SOURCES not found" if (!$found);
open( MAKEFILE, ">$tempfile" ) or die;
print MAKEFILE $makeFileData;
my $count = 0;
opendir (FILES, $outdir) or die;
foreach $filename (readdir(FILES)) {
if ( $filename =~ /^x_.*\.cpp$/ ) {
if ( $count++ == 7 ) {
$count = 0;
print MAKEFILE " \\\n";
}
print MAKEFILE " $filename";
}
}
print MAKEFILE "\n";
close MAKEFILE;
closedir FILES;
if (compare("$tempfile", "$outdir/Makefile.am")) {
cp("$tempfile", "$outdir/Makefile.am");
print STDERR "Makefile.am updated.\n";
}
else {
print STDERR "Makefile.am unchanged.\n";
}
unlink $tempfile;
exit 0;

@ -0,0 +1,350 @@
q1xcompatibility.h
qabstractlayout.h
qaccel.h
qaccessible.h
qaction.h
qapp.h
qapplication.h
qarray.h
qasciicache.h
qasciidict.h
qassistantclient.h
qasyncimageio.h
qasyncio.h
qbig5codec.h
qbitarray.h
qbitarry.h
qbitmap.h
qbrush.h
qbttngrp.h
qbuffer.h
qbuttongroup.h
qbutton.h
qcache.h
qcanvas.h
qcdestyle.h
qcheckbox.h
qchkbox.h
qcleanuphandler.h
qclipboard.h
qclipbrd.h
qcollect.h
qcollection.h
qcolordialog.h
qcolor.h
qcombobox.h
qcombo.h
qcommonstyle.h
qcompactstyle.h
qconfig-dist.h
qconfig.h
qconnect.h
qconnection.h
qcstring.h
qcursor.h
qdatabrowser.h
qdatastream.h
qdatatable.h
qdataview.h
qdatetimeedit.h
qdatetime.h
qdatetm.h
qdeepcopy.h
qdesktopwidget.h
qdial.h
qdialog.h
qdict.h
qdir.h
qdns.h
qdockarea.h
qdockwindow.h
qdom.h
qdragobject.h
qdrawutil.h
qdrawutl.h
qdropsite.h
qdstream.h
qeditorfactory.h
qerrormessage.h
qeucjpcodec.h
qeuckrcodec.h
qevent.h
qeventloop.h
qfeatures.h
qfiledef.h
qfiledialog.h
qfiledlg.h
qfile.h
qfileinf.h
qfileinfo.h
qfocusdata.h
qfontdatabase.h
qfontdialog.h
qfontdta.h
qfont.h
qfontinf.h
qfontinfo.h
qfontmet.h
qfontmetrics.h
qframe.h
qftp.h
qgarray.h
qgb18030codec.h
qgbkcodec.h
qgcache.h
qgdict.h
qgeneric.h
qgif.h
qglcolormap.h
qgl.h
qglist.h
qglobal.h
qgplugin.h
qgrid.h
qgridview.h
qgroupbox.h
qgrpbox.h
qguardedptr.h
qgvector.h
qhbox.h
qhbuttongroup.h
qheader.h
qhgroupbox.h
qhostaddress.h
qhttp.h
qiconset.h
qiconview.h
qimageformatplugin.h
qimage.h
qinputdialog.h
qintcache.h
qintcach.h
qintdict.h
qinterlacestyle.h
qiodev.h
qiodevice.h
qjiscodec.h
qjpunicode.h
qkeycode.h
qkeysequence.h
qlabel.h
qlayout.h
qlcdnumber.h
qlcdnum.h
qlibrary.h
qlined.h
qlineedit.h
qlistbox.h
qlist.h
qlistview.h
qlocalfs.h
qmainwindow.h
qmap.h
qmemarray.h
qmenubar.h
qmenudata.h
qmenudta.h
qmessagebox.h
qmetaobject.h
qmetaobj.h
qmime.h
qmlined.h
qmodules.h
qmotifdialog.h
qmotif.h
qmotifplusstyle.h
qmotifstyle.h
qmotifwidget.h
qmovie.h
qmsgbox.h
qmultilinedit.h
qmultilineedit.h
qmutex.h
qnamespace.h
qnetwork.h
qnetworkprotocol.h
qobjcoll.h
qobjdefs.h
qobjectcleanuphandler.h
qobjectdefs.h
qobjectdict.h
qobject.h
qobjectlist.h
qpaintdc.h
qpaintdevicedefs.h
qpaintdevice.h
qpaintdevicemetrics.h
qpaintd.h
qpainter.h
qpair.h
qpalette.h
qpdevmet.h
qpen.h
qpicture.h
qpixmapcache.h
qpixmap.h
qplatinumstyle.h
qpmcache.h
qpntarry.h
qpointarray.h
qpoint.h
qpolygonscanner.h
qpopmenu.h
qpopupmenu.h
qprintdialog.h
qprinter.h
qprndlg.h
qprocess.h
qprogbar.h
qprogdlg.h
qprogressbar.h
qprogressdialog.h
qpsprn.h
qptrcollection.h
qptrdict.h
qptrlist.h
qptrqueue.h
qptrstack.h
qptrvector.h
qpushbt.h
qpushbutton.h
qqueue.h
qradiobt.h
qradiobutton.h
qrangecontrol.h
qrangect.h
qrect.h
qregexp.h
qregion.h
qremotefactory.h
qremoteplugin.h
qrtlcodec.h
qscopedptr.h
qscrbar.h
qscrollbar.h
qscrollview.h
qsemaphore.h
qsemimodal.h
qserversocket.h
qsession.h
qsessionmanager.h
qsettings.h
qsgistyle.h
qshared.h
qsignal.h
qsignalmapper.h
qsignalslotimp.h
qsimplerichtext.h
qsizegrip.h
qsize.h
qsizepolicy.h
qsjiscodec.h
qslider.h
qsocketdevice.h
qsocket.h
qsocketnotifier.h
qsocknot.h
qsortedlist.h
qsound.h
qspinbox.h
qsplashscreen.h
qsplitter.h
qsqlcursor.h
qsqldatabase.h
qsqldriver.h
qsqldriverplugin.h
qsqleditorfactory.h
qsqlerror.h
qsqlfield.h
qsqlform.h
qsql.h
qsqlindex.h
qsqlpropertymap.h
qsqlquery.h
qsqlrecord.h
qsqlresult.h
qsqlselectcursor.h
qstack.h
qstatusbar.h
qstring.h
qstringlist.h
qstrlist.h
qstrvec.h
qstylefactory.h
qstyle.h
qstyleplugin.h
qstylesheet.h
qsyntaxhighlighter.h
qtabbar.h
qtabdialog.h
qtabdlg.h
qtable.h
qtabwidget.h
qtextbrowser.h
qtextcodecfactory.h
qtextcodec.h
qtextcodecplugin.h
qtextedit.h
qtextstream.h
qtextview.h
qt.h
qthread.h
qtimer.h
qtl.h
qtmultilineedit.h
qtoolbar.h
qtoolbutton.h
qtoolbox.h
qtooltip.h
qtranslator.h
qtsciicodec.h
qtstream.h
qttableview.h
qurl.h
qurlinfo.h
qurloperator.h
qutfcodec.h
quuid.h
qvalidator.h
qvaluelist.h
qvaluestack.h
qvaluevector.h
qvariant.h
qvbox.h
qvbuttongroup.h
qvector.h
qvgroupbox.h
qwaitcondition.h
qwhatsthis.h
qwidcoll.h
qwidgetfactory.h
qwidget.h
qwidgetintdict.h
qwidgetlist.h
qwidgetplugin.h
qwidgetstack.h
qwindefs.h
qwindowdefs.h
qwindow.h
qwindowsstyle.h
qwizard.h
qwmatrix.h
qworkspace.h
qwsbeosdecoration_qws.h
qwscommand_qws.h
qwscursor_qws.h
qwsdecoration_qws.h
qwsdefaultdecoration_qws.h
qwsdisplay_qws.h
qwsevent_qws.h
qwshydrodecoration_qws.h
qwskde2decoration_qws.h
qwskdedecoration_qws.h
qwsmanager_qws.h
qwsmouse_qws.h
qwsproperty_qws.h
qwsregionmanager_qws.h
qwssocket_qws.h
qwsutils_qws.h
qwswindowsdecoration_qws.h
qxml.h

@ -0,0 +1,9 @@
#ifndef QT_SMOKE_H
#define QT_SMOKE_H
// Defined in smokedata.cpp, initialized by init_qt_Smoke(), used by all .cpp files
extern Smoke* qt_Smoke;
class QGlobalSpace { };
#endif

@ -0,0 +1,501 @@
#!/usr/bin/perl
# qtguess.pl : check how Qt was compiled. Issue a list of all defined QT_NO_* macros, one per line.
#
# author: germain Garand <germain@ebooksfrance.com>
# licence: GPL v.2
# options: -q: be quieter
# -o file: redirect output to "file". (default: ./qtdefines)
# -t [0..15]: set the testing threshold (see below)
# -f "flags": additional compiler flags/parameters
use Getopt::Std;
use vars qw/$opt_f $opt_o $opt_p/;
getopts('qo:f:t:');
# Threshold :
# 0 - test basic Qt types/classes
# 5 - test higher level, non-gui classes
# 8 - test options of the above (ex: QT_NO_IMAGE_SMOOTHSCALE)
# 10 - test basic widgets
# 12 - test composite widgets
# 13 - test widgets inheriting composite widgets
# 15 - test goodies (default)
my $default_threshold = @qt_test_threshold@;
my $cc = "@CXX@";
my $ccflags = $opt_f || "@CXXFLAGS@";
my $nspaces = 50;
my %qtdefs=();
my %qtundefs=();
my $tmp = gettmpfile();
my $qtinc = '@qt_includes@';
my $allinc = '@all_includes@';
my $alllib = '@all_libraries@';
my $qtflags ='@LIB_QT@';
my %x;
$x{'LIBPNG'} = '@LIBPNG@';
$x{'LIBJPEG'} = '@LIBJPEG@';
$x{'LIBSM'} = '@LIBSM@';
$x{'LIBSOCKET'} = '@LIBSOCKET@';
$x{'LIBDL'} = '@LIBDL@';
$x{'LIBRESOLV'} = '@LIBRESOLV@';
$x{'LIB_X11'} = '@LIB_X11@';
$x{'X_PRE_LIBS'} = '@X_PRE_LIBS@';
$x{'LIB_X11'} =~ s/\$\((.*?)\)/$x{$1}/g;
$qtflags =~ s/\$\((.*?)\)/$x{$1}/g;
-e "$qtinc/qglobal.h" or die "Invalid Qt directory.\n";
my $ccmd = "$cc $ccflags $allinc $alllib -o $tmp $tmp.cpp $qtflags";
my $threshold = defined($opt_t)?$opt_t : $default_threshold;
$threshold >= 0 or die "invalid testing threshold: $threshold\n";
print "Checking how Qt was built... \n";
print "Threshold is set to $threshold\n" unless $opt_q;
my($count, $used, $total);
map{ $tests{$_}->[2]>=$threshold ? ($used++, $total++):$total++ } keys %tests;
print "Number of defines to be tested : $used/$total\n\n" unless $opt_q;
open( QTDEFS, ">".($opt_o || "qtdefines") ) or die "Can't open output file: $!\n";
grab_qglobal_symbols();
preliminary_test();
perform_all_tests();
print +scalar(keys %qtdefs) . " defines found.\n";
print QTDEFS join("\n", keys %qtdefs), "\n";
close;
#--------------------------------------------------------------#
sub gettmpfile
{
my $tmpdir = $ENV{'TMP'} || ".";
my $tmpname = $$."-qtguess";
while( -e "$tmpdir/$tmpname" || -e "$tmpdir/${tmpname}.cpp" )
{
$tmpname .= int (rand * 9);
}
return "$tmpdir/$tmpname";
}
#--------------------------------------------------------------#
sub grab_qglobal_symbols
{
my $cmd = "$cc -E -D__cplusplus -dM -I$qtinc $qtinc/qglobal.h 2>/dev/null";
my $symbols = `$cmd`;
for(0..1)
{
if( check_exit_status($?) )
{
while( $symbols =~/^#\s*define\s*(QT_\S+)/gm )
{
$qtdefs{$1} = 1;
}
print "Found ". scalar( keys %qtdefs )." predefined symbol".((scalar( keys %qtdefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %qtdefs));
while( $symbols =~/^#\s*define\s*QT_MODULE_(\S+)/gm )
{
$qtundefs{"QT_NO_$1"} = 1;
}
print "Found ". scalar( keys %qtundefs )." undefined symbol".((scalar( keys %qtundefs ) -1)?"s":"")." in qglobal.h\n" unless ($opt_q or !(keys %qtundefs));
last;
}
elsif(! $_) # first try
{
print "Failed to run $cmd.\nTrying without __cplusplus (might be already defined)\n";
$cmd = "$cc -E -dM -I$qtinc $qtinc/qglobal.h 2>/dev/null";
$symbols = `$cmd`;
next;
}
}
}
#--------------------------------------------------------------#
sub preliminary_test
{
my $msg = "Trying to compile and link a small program...";
print $msg, " " x ($nspaces - length($msg) + 8);
open( OUT, ">${tmp}.cpp" ) or die "Failed to open temp file ${tmp}.cpp: $!\n";
my $simple=q£
#include <qapplication.h>
int main( int argc, char **argv )
{
QApplication foo( argc, argv );
return 0;
}
£;
print OUT $simple;
close OUT;
my $out = `$ccmd 2>&1`;
if( !check_exit_status($?) )
{
die <<"EOF";
FAILED : check your configuration.
Failed program was:
$simple
Compiled with:
$ccmd
Compiler output:
$out
EOF
}
else
{
print "OK\n";
}
}
#--------------------------------------------------------------#
sub perform_all_tests
{
foreach ( sort { $tests{$a}->[2] <=> $tests{$b}->[2]} keys %tests)
{
$tests{$_}->[2] < $threshold and next;
($qtdefs{$_} || $qtundefs{$_}) and do
{
print "\rSkipping $_ (in qglobal.h)".( " " x (($nspaces-16) - length($_)) ).($qtundefs{$_}?"*Undefined*":" [Defined]").($opt_q?"":"\n");
next
};
print "\rTesting $_".( " " x ($nspaces - length($_)) );
open( OUT, ">${tmp}.cpp" ) or die "Failed to open temp file ${tmp}.cpp: $!\n";
foreach $def(keys %qtdefs)
{
print OUT "#define $def\n";
}
foreach $inc(split /,\s*/, $tests{$_}->[0])
{
print OUT "#include <$inc>\n";
}
print OUT "#include <qfeatures.h>\n";
print OUT $tests{$_}->[3] if $tests{$_}->[3]; # need to define some classes ?
print OUT qq£
int main( int argc, char **argv )
{
$tests{$_}->[1]
return 0;
}
£;
close OUT;
my $out = `$ccmd 2>&1`;
my $ok = check_exit_status($?);
if( !$ok )
{
$qtdefs{$_} = 1;
}
print +$opt_q ? ++$count."/$used" : ( $ok ? "*Undefined*\n" : " [Defined]\n" );
}
$opt_q && print "\n";
}
#--------------------------------------------------------------#
sub check_exit_status
{
my $a = 0xFFFF & shift;
if( !$a )
{
return 1;
}
elsif( $a == 0xFF00 )
{
die "\nSystem call failed: $!\n";
}
elsif( $a > 0x80 )
{
# non-zero status.
}
else
{
if( $a & 0x80 )
{
die "\n$cc coredumped with signal ". ($a & ~0x80);
}
die "\n$cc interrupted by signal $a\n";
}
return 0;
}
#--------------------------------------------------------------#
END
{
unlink $tmp if -e $tmp;
unlink "${tmp}.cpp" if -e "${tmp}.cpp";
}
#--------------------------------------------------------------#
BEGIN {
# "DEFINE" => ["header-1.h,... header-n.h", "main() code", priority, "Definitions (if needed)"]
our %tests = (
"QT_NO_ACCEL" => ["qaccel.h", "QAccel foo( (QWidget*)NULL );", 5],
"QT_NO_ACTION" => ["qaction.h", "QAction foo( (QObject*)NULL );", 5],
"QT_NO_ASYNC_IO" => ["qasyncio.h", "QAsyncIO foo();", 5],
"QT_NO_ASYNC_IMAGE_IO"=> ["qasyncimageio.h", "QImageDecoder foo( (QImageConsumer*) NULL );", 5],
"QT_NO_BIG_CODECS" => ["qbig5codec.h", "QBig5Codec foo();", 5],
"QT_NO_BUTTON" => ["qbutton.h", "QButton foo( (QWidget*)NULL );", 10],
"QT_NO_BUTTONGROUP" => ["qbuttongroup.h", "QButtonGroup foo( (QWidget*)NULL );", 12],
"QT_NO_CANVAS" => ["qcanvas.h", "QCanvas foo( (QObject*)NULL );", 10],
"QT_NO_CHECKBOX" => ["qcheckbox.h", "QCheckBox( (QWidget*)NULL );", 10],
"QT_NO_CLIPBOARD" => ["qapplication.h, qclipboard.h", q£
QApplication foo( argc, argv );
QClipboard *baz= foo.clipboard();
£, 5],
"QT_NO_COLORDIALOG" => ["qcolordialog.h", "QColorDialog::customCount();", 12],
"QT_NO_COMBOBOX" => ["qcombobox.h", "QComboBox( (QWidget*)NULL );", 10],
"QT_NO_COMPAT" => ["qfontmetrics.h", q£
QFontMetrics *foo= new QFontMetrics( QFont() );
int bar = foo->width( 'c' );
£, 0],
"QT_NO_COMPONENT" => ["qapplication.h", q£
QApplication foo( argc, argv );
foo.addLibraryPath( QString::null );
£, 5],
"QT_NO_CURSOR" => ["qcursor.h", "QCursor foo;", 5],
"QT_NO_DATASTREAM" => ["qdatastream.h", "QDataStream foo;", 5],
"QT_NO_DATETIMEEDIT" => ["qdatetimeedit.h", "QTimeEdit foo;", 12],
"QT_NO_DIAL" => ["qdial.h", "QDial foo;", 10],
"QT_NO_DIALOG" => ["qdialog.h", "QDialog foo;", 12],
"QT_NO_DIR" => ["qdir.h", "QDir foo;", 5],
"QT_NO_DNS" => ["qdns.h", "QDns foo;", 5],
"QT_NO_DOM" => ["qdom.h", "QDomDocumentType foo;", 5],
"QT_NO_DRAGANDDROP" => ["qevent.h", "QDropEvent foo( QPoint(1,1) );", 5],
"QT_NO_DRAWUTIL" => ["qdrawutil.h, qcolor.h", "qDrawPlainRect( (QPainter *) NULL, 0, 0, 0, 0, QColor() );", 10],
"QT_NO_ERRORMESSAGE" => ["qerrormessage.h", "QErrorMessage foo( (QWidget*) NULL );", 13],
"QT_NO_FILEDIALOG" => ["qfiledialog.h", "QFileIconProvider foo;", 13],
"QT_NO_FONTDATABASE" => ["qfontdatabase.h", "QFontDatabase foo;", 5],
"QT_NO_FONTDIALOG" => ["qfontdialog.h", "QFontDialog::getFont( (bool *)NULL );", 12],
"QT_NO_FRAME" => ["qframe.h", "QFrame foo;", 10],
"QT_NO_GRID" => ["qgrid.h", "QGrid foo(5);", 12],
"QT_NO_GRIDVIEW" => ["qgridview.h", "QFoo foo;", 13, q£
class QFoo: public QGridView
{
public:
QFoo(){};
~QFoo(){};
void paintCell(QPainter *, int, int){};
};
£],
"QT_NO_GROUPBOX" => ["qgroupbox.h", "QGroupBox foo;", 12],
"QT_NO_HBOX" => ["qhbox.h", "QHBox foo;", 12],
"QT_NO_HBUTTONGROUP" => ["qhbuttongroup.h", "QHButtonGroup foo;", 13],
"QT_NO_HEADER" => ["qheader.h", "QHeader foo;", 10],
"QT_NO_HGROUPBOX" => ["qhgroupbox.h", "QHGroupBox foo;", 13],
"QT_NO_ICONSET" => ["qiconset.h", "QIconSet foo;", 8],
"QT_NO_ICONVIEW" => ["qiconview.h", "QIconView foo;", 13],
"QT_NO_IMAGEFORMATPLUGIN" => ["qimageformatplugin.h, qstringlist.h", "QFoo foo;", 5, q£
class QFoo: public QImageFormatPlugin
{
public:
QFoo() {};
~QFoo() {};
QStringList keys() const { return QStringList(); };
bool installIOHandler( const QString &format ) { return true; };
};
Q_EXPORT_PLUGIN( QFoo )
£],
"QT_NO_IMAGE_DITHER_TO_1" => ["qimage.h", q£
QImage *foo = new QImage;
foo->createAlphaMask();
£, 8],
"QT_NO_IMAGE_HEURISTIC_MASK" => ["qimage.h", q£
QImage *foo = new QImage;
foo->createHeuristicMask();
£, 8],
"QT_NO_IMAGE_MIRROR" => ["qimage.h", q£
QImage *foo = new QImage;
foo->mirror();
£, 8],
"QT_NO_IMAGE_SMOOTHSCALE" => ["qimage.h", q£
QImage *foo = new QImage;
foo->smoothScale( 10, 10);
£, 8],
"QT_NO_IMAGE_TEXT" => ["qimage.h", "QImageTextKeyLang foo;", 8],
"QT_NO_IMAGE_TRANSFORMATION" => ["qimage.h", q£
QImage *foo = new QImage;
foo->scale( 10, 10);
£, 8],
"QT_NO_IMAGE_TRUECOLOR" => ["qimage.h", q£
QImage *foo = new QImage;
foo->convertDepthWithPalette( 1, (QRgb*) NULL, 1 );
£, 8],
"QT_NO_INPUTDIALOG" => ["qinputdialog.h, qstring.h", q£QInputDialog::getText( QString::null, QString::null);£, 13],
"QT_NO_IMAGEIO" => ["qbitmap.h, qstring.h", q£
QBitmap foo( QString::fromLatin1("foobar") );
£, 5],
"QT_NO_IMAGEIO_JPEG" => ["qjpegio.h", "qInitJpegIO();", 8],
"QT_NO_IMAGEIO_MNG" => ["qmngio.h", "qInitMngIO();", 8],
"QT_NO_IMAGEIO_PNG" => ["qpngio.h", "qInitPngIO();", 8],
"QT_NO_LABEL" => ["qlabel.h", "QLabel foo( (QWidget*) NULL );", 10],
"QT_NO_LAYOUT" => ["qlayout.h", "QFoo foo;", 10, q£
class QFoo: public QLayout
{
public:
QFoo() {};
~QFoo() {};
void addItem( QLayoutItem * ) { };
QSize sizeHint() const { return QSize(); }
QLayoutIterator iterator() { return QLayoutIterator( (QGLayoutIterator *) NULL ); };
void setGeometry( const QRect & ) { };
};
£],
"QT_NO_LCDNUMBER" => ["qlcdnumber.h", "QLCDNumber foo;", 12],
"QT_NO_LINEEDIT" => ["qlineedit.h", "QLineEdit foo( (QWidget *) NULL );", 12],
"QT_NO_LISTBOX" => ["qlistbox.h", "QListBox foo;", 13],
"QT_NO_LISTVIEW" => ["qlistview.h", "QListView foo;", 13],
"QT_NO_MAINWINDOW" => ["qmainwindow.h", "QMainWindow foo;", 13],
"QT_NO_MENUBAR" => ["qmenubar.h", "QMenuBar foo;", 13],
"QT_NO_MOVIE" => ["qmovie.h", "QMovie foo;", 5],
"QT_NO_MENUDATA" => ["qmenudata.h", "QMenuData foo;", 9],
"QT_NO_MESSAGEBOX" => ["qmessagebox.h", "QMessageBox foo;", 13],
"QT_NO_MIME" => ["qmime.h", "QMimeSourceFactory foo;", 5],
"QT_NO_MIMECLIPBOARD" => ["qapplication.h, qclipboard.h", q£
QApplication foo( argc, argv );
QClipboard *baz= foo.clipboard();
baz->data();
£, 8],
"QT_NO_MULTILINEEDIT" => ["qmultilineedit.h", "QMultiLineEdit foo;", 14],
"QT_NO_NETWORK" => ["qnetwork.h", "qInitNetworkProtocols();", 5],
"QT_NO_NETWORKPROTOCOL" => ["qnetworkprotocol.h", "QNetworkProtocol foo;", 8],
"QT_NO_NETWORKPROTOCOL_FTP" => ["qftp.h", "QFtp foo;", 9],
"QT_NO_PALETTE" => ["qpalette.h", "QColorGroup foo;", 5],
"QT_NO_PICTURE" => ["qpicture.h", "QPicture foo;", 5],
"QT_NO_PIXMAP_TRANSFORMATION" =>["qbitmap.h, qwmatrix.h", q£
QBitmap *foo= new QBitmap();
QWMatrix bar;
foo->xForm( bar );
£, 5],
"QT_NO_POPUPMENU" => ["qpopupmenu.h", "QPopupMenu foo;", 12],
"QT_NO_PRINTER" => ["qprinter.h", "QPrinter foo;", 5],
"QT_NO_PRINTDIALOG" => ["qprintdialog.h", "QPrintDialog foo( (QPrinter*) NULL );", 13],
"QT_NO_PROCESS" => ["qprocess.h", "QProcess foo;", 5],
"QT_NO_PROGRESSBAR" => ["qprogressbar.h", "QProgressBar foo;", 12],
"QT_NO_PROGRESSDIALOG" => ["qprogressdialog.h", "QProgressDialog foo;", 13],
"QT_NO_PUSHBUTTON" => ["qpushbutton.h", "QPushButton foo( (QWidget *) NULL );", 12],
"QT_NO_PROPERTIES" => ["qmetaobject.h", "QMetaProperty foo;", 0],
# "QT_NO_QTMULTILINEEDIT" => ["qtmultilineedit.h", "QtMultiLineEdit foo;", 15],
# "QT_NO_QTTABLEVIEW" => ["qttableview.h", "QFoo foo;", 16, q£
# class QFoo: public QtTableView
# {
# public:
# QFoo() {};
# ~QFoo() {};
# void paintCell( QPainter *, int, int) {};
# };
# £],
"QT_NO_QUUID_STRING" => ["quuid.h", "QUuid foo( QString::null );", 8],
"QT_NO_RANGECONTROL" => ["qrangecontrol.h", "QRangeControl foo;", 10],
"QT_NO_REGEXP" => ["qregexp.h", "QRegExp foo;", 5],
"QT_NO_REGEXP_WILDCARD" => ["qregexp.h", q£
QRegExp foo;
foo.wildcard();
£, 8],
"QT_NO_REMOTE" => ["qapplication.h", q£
QApplication foo( argc, argv );
foo.remoteControlEnabled();
£, 15],
"QT_NO_RADIOBUTTON" => ["qradiobutton.h", "QRadioButton foo( (QWidget *) NULL );", 12],
"QT_NO_RICHTEXT" => ["qsimplerichtext.h, qstring.h, qfont.h", "QSimpleRichText foo( QString::null, QFont() );", 10],
"QT_NO_SCROLLBAR" => ["qscrollbar.h", "QScrollBar foo( (QWidget *) NULL );", 12],
"QT_NO_SCROLLVIEW" => ["qscrollview.h", "QScrollView foo;", 12],
"QT_NO_SEMIMODAL" => ["qsemimodal.h", "QSemiModal foo;", 10],
"QT_NO_SESSIONMANAGER" => ["qapplication.h", q£
QApplication foo( argc, argv );
foo.sessionId();
£, 15],
"QT_NO_SETTINGS" => ["qsettings.h", "QSettings foo;", 5],
"QT_NO_SIGNALMAPPER" => ["qsignalmapper.h", "QSignalMapper foo( (QObject *) NULL );", 0],
"QT_NO_SIZEGRIP" => ["qsizegrip.h", "QSizeGrip foo( (QWidget *) NULL );", 10],
"QT_NO_SLIDER" => ["qslider.h", "QSlider foo( (QWidget *) NULL );", 12],
"QT_NO_SOUND" => ["qsound.h", "QSound foo( QString::null );", 5],
"QT_NO_SPINWIDGET" => ["qrangecontrol.h", "QSpinWidget foo;", 10],
"QT_NO_SPRINTF" => ["qcolor.h", q£
QColor foo;
foo.name();
£, 0],
"QT_NO_SQL" => ["qsqlcursor.h", "QSqlCursor foo;", 5],
"QT_NO_STRINGLIST" => ["qstringlist.h", "QStringList foo;", 0],
"QT_NO_STYLE" => ["qapplication.h", q£
QApplication foo( argc, argv );
foo.style();
£, 15],
# "QT_NO_STYLE_CDE" => ["qcdestyle.h", "QCDEStyle foo;", 16],
# "QT_NO_STYLE_COMPACT" => ["qcompactstyle.h", "QCompactStyle foo;", 16],
# "QT_NO_STYLE_INTERLACE" => ["qinterlacestyle.h", "QInterlaceStyle foo;", 16],
# "QT_NO_STYLE_PLATINUM" => ["qplatinumstyle.h", "QPlatinumStyle foo;", 16],
# "QT_NO_STYLE_MOTIF" => ["qmotifstyle.h", "QMotifStyle foo;", 16],
# "QT_NO_STYLE_MOTIFPLUS" => ["qmotifplusstyle.h", "QMotifPlusStyle foo;", 16],
# "QT_NO_STYLE_SGI" => ["qsgistyle.h", "QSGIStyle foo;", 16],
# "QT_NO_STYLE_WINDOWS" => ["qwindowsstyle.h", "QWindowsStyle foo;", 16],
"QT_NO_TABBAR" => ["qtabbar.h", "QTabBar foo;", 10],
"QT_NO_TABDIALOG" => ["qtabdialog.h", "QTabDialog foo;", 12],
"QT_NO_TABLE" => ["qtable.h", "QTable foo;", 10],
"QT_NO_TABWIDGET" => ["qtabwidget.h", "QTabWidget foo;", 10],
"QT_NO_TEXTBROWSER" => ["qtextbrowser.h", "QTextBrowser foo;", 14],
"QT_NO_TEXTCODEC" => ["qtextcodec.h", "QTextCodec::codecForIndex(1);", 5],
"QT_NO_TEXTCODECPLUGIN" => ["qtextcodecplugin.h, qstringlist.h, qvaluelist.h, qtextcodec.h", "QFoo foo;", 6, q£
class QFoo: public QTextCodecPlugin
{
public:
QFoo() {};
~QFoo() {};
QStringList names() const {return QStringList();}
QValueList<int>mibEnums() const {return QValueList<int>();}
QTextCodec *createForName( const QString & name ) {return (QTextCodec *)NULL;}
QTextCodec *createForMib( int mib ) {return (QTextCodec *)NULL;}
};
Q_EXPORT_PLUGIN( QFoo )
£],
"QT_NO_TEXTEDIT" => ["qtextedit.h", "QTextEdit foo;", 13],
"QT_NO_TEXTSTREAM" => ["qtextstream.h", "QTextStream foo;", 5],
"QT_NO_TEXTVIEW" => ["qtextview.h", "QTextView foo;", 14], #Obsolete
"QT_NO_TOOLBAR" => ["qtoolbar.h", "QToolBar foo;", 10],
"QT_NO_TOOLBUTTON" => ["qtoolbutton.h", "QToolButton foo((QWidget *) NULL );", 12],
"QT_NO_TOOLTIP" => ["qtooltip.h", "QToolTip::hide();", 10],
"QT_NO_TRANSFORMATIONS" => ["qpainter.h", q£
QPainter *foo= new QPainter();
foo->setViewXForm( true );£, 5],
"QT_NO_VARIANT" => ["qvariant.h", "QVariant foo;", 0],
"QT_NO_WHATSTHIS" => ["qwhatsthis.h", "QWhatsThis::inWhatsThisMode();", 10],
"QT_NO_WHEELEVENT" => ["qevent.h", "QWheelEvent foo( QPoint(1,1), 1, 1 );", 5],
"QT_NO_WIDGET_TOPEXTRA" => ["qwidget.h", "QWidget foo; foo.caption();", 9],
"QT_NO_WIDGETSTACK" => ["qwidgetstack.h", "QWidgetStack foo;", 13],
"QT_NO_WIZARD" => ["qwizard.h", "QWizard foo;", 13],
"QT_NO_WMATRIX" => ["qwmatrix.h", "QWMatrix foo;", 0],
"QT_NO_XML" => ["qxml.h", "QXmlNamespaceSupport foo;", 5],
);
}

@ -0,0 +1,353 @@
#ifndef SMOKE_H
#define SMOKE_H
#include <string.h>
/*
* Copyright (C) 2002, Ashley Winters <qaqortog@nwlink.com>
*/
class SmokeBinding;
class Smoke {
public:
union StackItem; // defined below
/**
* A stack is an array of arguments, passed to a method when calling it.
*/
typedef StackItem* Stack;
enum EnumOperation {
EnumNew,
EnumDelete,
EnumFromLong,
EnumToLong
};
typedef short Index;
typedef void (*ClassFn)(Index method, void* obj, Stack args);
typedef void* (*CastFn)(void* obj, Index from, Index to);
typedef void (*EnumFn)(EnumOperation, Index, void*&, long&);
enum ClassFlags {
cf_constructor = 0x01, // has a constructor
cf_deepcopy = 0x02, // has copy constructor
cf_virtual = 0x04, // has virtual destructor
cf_undefined = 0x10 // defined elsewhere
};
/**
* Describe one class.
*/
struct Class {
const char *className; // Name of the class
Index parents; // Index into inheritanceList
ClassFn classFn; // Calls any method in the class
EnumFn enumFn; // Handles enum pointers
unsigned short flags; // ClassFlags
};
enum MethodFlags {
mf_static = 0x01,
mf_const = 0x02
};
/**
* Describe one method of one class.
*/
struct Method {
Index classId; // Index into classes
Index name; // Index into methodNames; real name
Index args; // Index into argumentList
unsigned char numArgs; // Number of arguments
unsigned char flags; // MethodFlags (const/static/etc...)
Index ret; // Index into types for the return type
Index method; // Passed to Class.classFn, to call method
};
/**
* One MethodMap entry maps the munged method prototype
* to the Method entry.
*
* The munging works this way:
* $ is a plain scalar
* # is an object
* ? is a non-scalar (reference to array or hash, undef)
*
* e.g. QApplication(int &, char **) becomes QApplication$?
*/
struct MethodMap {
Index classId; // Index into classes
Index name; // Index into methodNames; munged name
Index method; // Index into methods
};
enum TypeFlags {
// The first 4 bits indicate the TypeId value, i.e. which field
// of the StackItem union is used.
tf_elem = 0x0F,
// Always only one of the next three flags should be set
tf_stack = 0x10, // Stored on the stack, 'type'
tf_ptr = 0x20, // Pointer, 'type*'
tf_ref = 0x30, // Reference, 'type&'
// Can | whatever ones of these apply
tf_const = 0x40 // const argument
};
/**
* One Type entry is one argument type needed by a method.
* Type entries are shared, there is only one entry for "int" etc.
*/
struct Type {
const char *name; // Stringified type name
Index classId; // Index into classes. -1 for none
unsigned short flags; // TypeFlags
};
// We could just pass everything around using void* (pass-by-reference)
// I don't want to, though. -aw
union StackItem {
void* s_voidp;
bool s_bool;
char s_char;
unsigned char s_uchar;
short s_short;
unsigned short s_ushort;
int s_int;
unsigned int s_uint;
long s_long;
unsigned long s_ulong;
float s_float;
double s_double;
long s_enum;
void* s_class;
};
enum TypeId {
t_voidp,
t_bool,
t_char,
t_uchar,
t_short,
t_ushort,
t_int,
t_uint,
t_long,
t_ulong,
t_float,
t_double,
t_enum,
t_class,
t_last // number of pre-defined types
};
// Passed to constructor
/**
* The classes array defines every class for this module
*/
Class *classes;
Index numClasses;
/**
* The methods array defines every method in every class for this module
*/
Method *methods;
Index numMethods;
/**
* methodMaps maps the munged method prototypes
* to the methods entries.
*/
MethodMap *methodMaps;
Index numMethodMaps;
/**
* Array of method names, for Method.name and MethodMap.name
*/
const char **methodNames;
Index numMethodNames;
/**
* List of all types needed by the methods (arguments and return values)
*/
Type *types;
Index numTypes;
/**
* Groups of class IDs (-1 separated) used as super class lists.
* For classes with super classes: Class.parents = index into this array.
*/
Index *inheritanceList;
/**
* Groups of type IDs (-1 separated), describing the types of argument for a method.
* Method.args = index into this array.
*/
Index *argumentList;
/**
* Groups of method prototypes with the same number of arguments, but different types.
* Used to resolve overloading.
*/
Index *ambiguousMethodList;
/**
* Function used for casting from/to the classes defined by this module.
*/
CastFn castFn;
// Not passed to constructor
SmokeBinding *binding;
/**
* Constructor
*/
Smoke(Class *_classes, Index _numClasses,
Method *_methods, Index _numMethods,
MethodMap *_methodMaps, Index _numMethodMaps,
const char **_methodNames, Index _numMethodNames,
Type *_types, Index _numTypes,
Index *_inheritanceList,
Index *_argumentList,
Index *_ambiguousMethodList,
CastFn _castFn) :
classes(_classes), numClasses(_numClasses),
methods(_methods), numMethods(_numMethods),
methodMaps(_methodMaps), numMethodMaps(_numMethodMaps),
methodNames(_methodNames), numMethodNames(_numMethodNames),
types(_types), numTypes(_numTypes),
inheritanceList(_inheritanceList),
argumentList(_argumentList),
ambiguousMethodList(_ambiguousMethodList),
castFn(_castFn),
binding(0)
{}
inline void *cast(void *ptr, Index from, Index to) {
if(!castFn) return ptr;
return (*castFn)(ptr, from, to);
}
// return classname directly
inline const char *className(Index classId) {
return classes[classId].className;
}
inline int leg(Index a, Index b) { // ala Perl's <=>
if(a == b) return 0;
return (a > b) ? 1 : -1;
}
inline Index idType(const char *t) {
if(!t) return 0;
Index imax = numTypes;
Index imin = 0;
Index icur = -1;
int icmp = -1;
while(imax >= imin) {
icur = (imin + imax) / 2;
if(icur > 0)
icmp = strcmp(types[icur].name, t);
else
icmp = -1;
if(!icmp) break;
if(icmp > 0)
imax = icur - 1;
else
imin = icur + 1;
}
return (!icmp) ? icur : 0;
}
inline Index idClass(const char *c) {
if(!c) return 0;
Index imax = numClasses;
Index imin = 0;
Index icur = -1;
int icmp = -1;
while(imax >= imin) {
icur = (imin + imax) / 2;
if(icur > 0)
icmp = strcmp(classes[icur].className, c);
else
icmp = -1;
if(!icmp) break;
if(icmp > 0)
imax = icur - 1;
else
imin = icur + 1;
}
return (!icmp) ? icur : 0;
}
inline Index idMethodName(const char *m) {
if(!m) return 0;
Index imax = numMethodNames;
Index imin = 0;
Index icur = -1;
int icmp = -1;
while(imax >= imin) {
icur = (imin + imax) / 2;
icmp = strcmp(methodNames[icur], m);
if(!icmp) break;
if(icmp > 0)
imax = icur - 1;
else
imin = icur + 1;
}
return (!icmp) ? icur : 0;
}
inline Index idMethod(Index c, Index name) {
Index imax = numMethodMaps;
Index imin = 0;
Index icur = -1;
int icmp = -1;
while(imax >= imin) {
icur = (imin + imax) / 2;
icmp = leg(methodMaps[icur].classId, c);
if(!icmp) {
icmp = leg(methodMaps[icur].name, name);
if(!icmp) break;
}
if(icmp > 0)
imax = icur - 1;
else
imin = icur + 1;
}
return (!icmp) ? icur : 0;
}
inline Index findMethod(Index c, Index name) {
// TODO: If method is in a parent module, forward the call from here
if(!c || !name) return 0;
Index mid = idMethod(c, name);
if(mid) return mid;
if(!classes[c].parents) return 0;
for(int p = classes[c].parents; inheritanceList[p] ; p++) {
mid = findMethod(inheritanceList[p], name);
if(mid) return mid;
}
return 0;
}
inline Index findMethod(const char *c, const char *name) {
Index idc = idClass(c);
Index idname = idMethodName(name);
return findMethod(idc, idname);
}
};
class SmokeBinding {
protected:
Smoke *smoke;
public:
SmokeBinding(Smoke *s) : smoke(s) {}
virtual void deleted(Smoke::Index classId, void *obj) = 0;
virtual bool callMethod(Smoke::Index method, void *obj, Smoke::Stack args, bool isAbstract = false) = 0;
virtual char* className(Smoke::Index classId) = 0;
virtual ~SmokeBinding() {}
};
#endif

@ -0,0 +1 @@
timestamp

@ -0,0 +1,4 @@
smoke
PerlQt
puic

@ -0,0 +1,11 @@
BEGIN{ chdir("PerlQt/t") or die "couldn't chdir to PerlQt: $!\n" }
END{ chdir("../..") or die "couldn't chdir to ../..\n" }
use blib;
use Test::Harness;
$Test::Harness::switches = "-w -Mblib=../blib";
@t = glob("*.t");
runtests(@t);
Loading…
Cancel
Save