Added KDE3 version of Knights

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knights@1091568 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
commit a8c9924456

@ -0,0 +1,10 @@
Authors of the Knights Project
Project Leader & Lead Programmer
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
Communications Programmer
Alexander Wels <agpwels@adelphia.net>
See the "About Knights" dialog for a complete and current list of
those who have helped make Knights possible.

@ -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,30 @@
Knights 0.6 -- Tuesday May 20th, 2003
Troy Corbin Jr. <troy@knights-chess.com>
* Changed version to 0.6
* Added a new tab that displays details from a loaded PGN match.
* Added a server selector to the Login dialog.
* Added hyperlinks to the ICS Console.
* Improved printed output.
* Added printing capabilities to the ICS Console.
- Reduced the time needed to resize the board by about 33%
- Fixed bug where the New Match dialog sometimes defaulted to an unplayable
match.
- Fixed a bug in our XBoard protocol implementation which caused some engines
( like GNUChess ) to fail.
- Fixed bug where some loaded matches wouldn't display the player's names.
- Fixed a crash that occured when you closed an ICS related tab, then
disconnected from the ICS.
- Fixed a crash that occured when you couldn't connect to your ICS.
- Expanded the range of the "Opponent's Strength" slider so that it didn't
cripple some engines.
- Fixed a bug where selecting the current board position from the Notation Bar
could erase the board.
- Fixed a bug where an engine that does not implement the 'pause' feature could
have caused Knights' clocks to continue running during a pause.
- Fixed a bug where the console could be displayed in doublespace.
- Fixed the Match->Resign option.
- Knights generated PGN files now save NAG, RAV, and Annotations.
- Removed the ability to swap sides midgame. This will be reinstated later when
we can implement a more feature-rich and trouble free dialog box.
- Potential memory leak fixed ( thanks to Jon Keating! )

@ -0,0 +1,176 @@
====================
Creating Themes
====================
This document is your guide to creating themes for the Knights chess
interface.
-----------------------
1. Anatomy of a Theme:
-----------------------
A theme is a collection of images, sounds, and settings which create a
unique representation of a chess environment. Typically, this theme is in the
form of a gzipped tarball.
There are three types of themes for Knights: Chessboard themes, Chessmen
themes, and Audio themes.
------------------------
2. Tarball Information:
------------------------
Themes must be stored in tarballs. Knights will use any type of tarball that
KDE supports. A good test is to try loading it in Konqueror using a
tar://mytarball URL. Generaly speaking, using the standard gzipped tarball
( with a '.tar.gz' extension ) will be fine.
The first two letters of your filename must be 'KB', 'KC', or 'KS' depending on
the type of theme it is. KB tells Knights that it is a Chessboard theme,
and KC represents Chessmen themes. KS is a sound theme. This is
case-sensitive.
Between the prefix and the extension comes your theme's name. Write it exactly
how you want it displayed in Knights, except use underscores instead of spaces.
So if you want your theme to be called "My Uber Chessmen" within Knights, you'd
have the following filename: KCMy_Uber_Chessmen.tar.gz
As a general rule, you should remove write and execute permissions on the
files, and either remove Owner/Group attributes, or make them something
harmless ( like nobody:users )
---------------------------
3. theme.conf Information:
---------------------------
Every theme must contain a text file called 'theme.conf'. Here's a
sample theme.conf file:
################################
# A Sample theme.conf file
################################
[General]
Type=Board
Name=Default
Version=1.0
Author=Troy Corbin Jr.
AuthorEmail=tcorbin@users.sourceforge.net
AuthorWWW=http://knights.sourceforge.net
Notes=This is the default chessboard for Knights. It was made with the Gimp.
[2DWhite]
King=white.king.png
Queen=white.queen.png
Bishop=white.bishop.png
Knight=white.knight.png
Rook=white.rook.png
Pawn=white.pawn.png
[2DBlack]
King=black.king.png
Queen=black.queen.png
Bishop=black.bishop.png
Knight=black.knight.png
Rook=black.rook.png
Pawn=black.pawn.png
[2DBoard]
Light=square.light.png
Dark=square.dark.png
Motion=square.motion.png
Select=square.select.png
Danger=square.danger.png
[Coordinates]
TextColor=255,255,255
ShadowColor=0,0,0
[Audio]
Select=select.wav
Move=move.wav
Check=check.wav
MatchOver=matchover.wav
Challenge=notify.wav
Tell=tell.wav
Notification=notify.wav
DrawOffer=draw.wav
Say=tell.wav
Promote=promote.wav
################################
Nothing too tough to figure out. 'Type' must be one of the following:
- Board
- Chessmen
- Audio
- 3DBoard ( For future use )
- 3DChessmen ( For future use )
'Name' is your theme's name and 'Version' is the version of your theme. Author,
AuthorEmail, and AuthorWWW should be self explanitory. Notes are any comments
you want to add.
The '2DWhite' and '2DBlack' sections are required in Chessman themes. Each line
specifies the file to be used for each different piece type.
'2DBoard' and 'Coordinates' are required in Chessboard themes. 'Light' and
'Dark' specify the file to be used for each color square on the board. 'Motion'
is the highlight used to indicate that a piece moved, 'Select' is the selection
highlight, and 'Danger' indicates an attacked piece. The 'Coordinates' are
standard 8bit RGB colors. These are the colors that Knights will use for board
coordinates. Try to use colors that contrast with the board itself.
New in Knights 0.5.6 are Chessboard borders. They are not required, but they
can greatly enhance the appearance of your chessboard. If you'd like to use one
then under '2DBoard' add the following lines:
HaveBorder=true
Border=border.png
BorderLightOn=light_on.png
BorderLightOff=light_off.png
-----------------------
4. Pixmap Information:
-----------------------
Your pixmaps can be in any format that Qt supports, as long as it supports an
alpha channel. For this reason you are strongly encouraged to stick with PNG
images. Note that there are a few exceptions to this in Chessboard themes. The
'Light', 'Dark', and 'Border' pixmaps constitute the lowest layer of graphics,
and so they will never be transparent. Therefore, for these items you can use
non-transparent file types ( like JPEG ).
Knights will scale your pixmaps to the current theme size. This means you can
supply any sized images you want and Knights will make it work. However, when
Knights has to enlarge a pixmap, the resulting image tends to be of poor
quality. To keep this from happening to your themes, you should make all your
pixmaps 144 pixels by 144 pixels. This ensures that your images will never be
enlarged, and it's not so large that it's wasteful.
Borders are an exception to the size rule. The 'Border' itself needs to be 9
times the size of your other images. So if you use the recommended 144 pixel
image size, the 'Border' needs to be 1296 pixels. Likewise, the 'BorderLightOn'
and 'BorderLightOff' images need to be half the size of your other images. So
a regular size image of 144 pixels required that the lights be 72 pixels.
----------------------
5. Audio Information:
----------------------
Like pixmaps, you can supply your audio using any file format that aRts
supports. I recommend you stick with .wav and .ogg, although the last time
I checked aRts' Ogg Vorbis support was flaky with short sounds. Also, for
very short sounds, .wav files are actually smaller. It's best to try both
and see which works best with your paticular sounds.
----------------------
6. Copyrights:
----------------------
If you're planning to share your themes with the Knights Project, you must be
the copyright owner on all the material contained in the theme. As much as I'd
love to see the heads of Neo and Agent Smith flying around the board, I don't
want to recieve any nasty letters from Warner Brothers.
Your material must also be released under a GNU or similar license. If you're
in doubt, contact us and we'll work it out.

@ -0,0 +1,369 @@
Knights 0.5.9 -- Friday January 17th, 2003
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Changed version to 0.5.9
* The console is now organized into 'Tabs', rather than using a splitter. These
tabs can be dynamicaly organized into different windows by simply dragging
them. Drag a tab onto the desktop to create another tab window.
* Added the 'Seek Graph', which is a plotted chart of matches which people are
seeking. It behaves very much like the 'Sought Match List', but the graph
makes it easy to spot matches around your desired Rating / Time Controls.
* Added movement animations.
* Added a 'New Match' dialog that opens whenever you start a new match. It
allows you to set the time controls, players for each side, and more.
* Moved theme installation to the 'Settings' menu.
- Major speed improvments when selecting and dragging chessmen.
* You can now install multiple themes at once.
* Knights now handles keyboard input better. Don't worry about pressing
'Enter' before you start chatting, just begin.
* Knights can now auto-configure the following additional chess engines:
Cilian, Faile, OliThink, Pepito, and Yace.
- Fixed sloppy SAN disambiguation where it wasn't needed.
- Fixed gcc 3.1 compilation errors.
* Added Italian translations.
* Added Finnish translations.
- Fixed a bug where Knights would sometimes declare a draw too early.
- Fixed a bug in which the King could castle even if an adjacent position was
being attacked.
* Knights can now correctly read PGN files that contain FEN notation.
* You can now right click on a match's button to access a mini-file menu.
- XBoard is now the default engine protocol when you configure a new engine.
* Added basic support for the UCI engine protocol.
- Removed the listing for the Knights engine protocol.
* New users must accept our license ( the GPL ) before they can continue.
* Movement highlights now also work when reviewing a match.
* You can choose to login to your ICS as a 'guest' from the Login Dialog.
- Fixed a bug which sometimes kept audio from working.
* The 'Help' button in the 'Configure Knights...' dialog will now display
context sensitive help, depending on what page you're viewing.
* Knights can read and display images stored in the SCID *.img file format.
- Fixed problem where the Console wouldn't redraw without focus.
* You can now change the Console's text size using it's context menu.
- The Retract menu option can now be used several times in a row.
- Knights' main window is now raised to the top and given focus whenever a
new match starts, or whenever you select a different match.
* You can now have multiple PGN files open at the same time.
- Major rewrite of internal communications code.
- Fixed bug that made en passant moves illegal when your king was in check.
- Countless minor bugfixes.
Knights 0.5.6 -- Friday June 21st, 2002
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Changed version to 0.5.6
- Fixed a bug in the setup wizard that makes every server but FICS the
current server.
- Knights will now handle invalid ICS logins in a sane manner.
- If you accept or counter-challenge a match offer from the
console, the Match Pop-up will go away.
- Fixed a bug where Less-than and Pipe symbols wouldn't render in the console.
- ( Possibily? ) Fixed a bug that caused Knights to repeat the final moves in a
match in the PGN game.
- If your opponent on ICS resigns, Knights now handles it properly.( Redux )
* Added a History file to Knights. It will contain all past ChangeLog entries
while ChangeLog will only contain entries for the current version.
* Expanded error reporting for failed theme installation.
- Fixed missing character bug in ICC play.
* The "Auto Close Last ICS" option is now on by default.
* You now setup Timeseal for each individual server.
* Added a combobox that lets you select the level of profanity filtering your
ICS preforms on incomming messages.
( Settings->Configure Knights->Chess Servers->Options->Profanity Filter )
- Knights should now correctly use the "Clock Ticking" and "Lag Compensation"
data sent to it by FICS.
* Added support for movelist retrieval from ICS ( experimental )
- Fixed Knights' parsing of Recursive Annotation Variations. RAVs embedded
within one another are now recognised and kept track of.
- Fixed the display of Numerical Annotation Glyphs
* Added support for proposed NAGs #140-154 and #190-195
- After loading a completed match, Knights now stops the clock and displays an
appropriate message on the Status Bar.
* Knights now fills out the "Mode" PGN tag when it knows the correct value.
- Fixed a bug where Knights looked for the "root" entry in a chessman
theme.conf rather than "rook".
* Knights now reads and uses the Notation Coordinate Colors specified within
theme.conf files.
- Fixed the time read from saved, unfinished PGN games.
* Moved the "Seconds Between Seek Updates" and "Auto Close Last ICS" options
from the General Settings to the Server Options tab.
- Rewrote the engine communications code to use KDE's KProcess instead of UNIX
pipes and signals. This should make Knights more portable, and should fix
some obscure errors.
* Applied KDE3 compatability patch from Harald Fernengel
- Made internal changes to the shutdown procedure. (KDE3)
- Made internal changes to the console's stylesheet. (KDE3)
* Made some minor changes with layout spacing.
- Fixed the Status Bar so that it's alignment is automatic, based on the
current language.
* Replaced the Default Board's 'Highlight' graphics with new images that
show off KDE3's true alpha-channel support. ( Blatant eye-candy, yum )
- Disabled the back button in the Setup Wizard's last page so you can't go back
and set everything up multiple times.
* When examining a match, manipulating the Notation List will now move you
back and forth through the match.
* Moving the mouse wheel will now navigate the Notation List.
* Added "Player History" to the right-click menu in the Sought Games List.
- Fixed that annoying Console 'jump' you got whenever a match began.
- Fixed the coloring of t-shouts and says.
* You can now continue to drag your chessman even after your opponent has moved
* The 'Show Last Move' option now uses the 'Movement' highlight to display the
appropriate positions. If a chessman was attacked as a part of the previous
move, then that position is shown with the 'Attack' highlight.
* When you preform a 'Premove', it will be represented on the board using
transparent chessmen, rather than the old way ( which was represented with
nothing =).
* You can now preform premoves during a match vs. a computer opponent.
* Left clicking anywhere on the board will cancel a premove.
* Added the "Assess" option to the right-click menu in the Sought Games List.
* Improved handling of Disconnections during ICS play. Also improved handling
of "Illegal Move" messages.
* "Play White" and "Play Black" menu options will now be disabled during an
ICS match.
* Added the ability to Print the notation for the current Match.
* Added translations to French, German, and Estonian.
- Fixed shutdown crash that occured when console was still open.
* Added 'Borders' to Chessboard themes.
- Knights no longer requires OpenGL.
* Added 'busy' cursor when waiting for opponent to move.
* Added the "Bowron Abernethy Chess Engine" to the list of autodetected
engines in the Setup Wizard.
- Fixed a bug in the Challenge Dialog Box that scrambled match parameters.
* Expanded 'Notification' coloring.
Knights 0.5.4.1 -- Wednesday February 6th, 2002
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Changed version to 0.5.4.1
- Fixed critical error which disabled your ability to capture pieces.
Knights 0.5.4 -- Monday February 4th, 2002
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Changed version to 0.5.4
* All matches now use the same image cache, rather than creating it's own.
This will save you 2 meg of memory per concurrent match.
- Fixed a bug which prevented some castling.
* Added the 'Resign' option. ( Match->Resign )
* Knights now automatically adjusts the display depending on which army you're
playing. If you're black, it will be displayed on the bottom. Of course, the
option 'Reverse Board Orientation' reverses this effect: the local player's
army will be displayed at the top.
- Fixed problem with the display of the clocks while playing over an ICS.
- Fixed a bug where Knights will send the resign command to an ICS whenever
an ICS match is closed. Now, resign is never sent to ICS unless you tell
Knights to do so.
- If your opponent on ICS resigns, Knights now handles it properly.
- Knights now writes the correct result of a resigned game in .pgn files.
* Knights now fills out the PlayerType and Termination .pgn tags when it knows
the correct value.
* Implemented "drag & drop" movement of chessmen.
* Streamlined a lot of drawing code, making some operations ( like "Reverse
Board Orientation" ) much faster
* Added initial support for examining games via ICS.
* Added SOUND! ( Settings->Configure Knights->Audio )
* Optimized various bits of ICS code
* You can now call your opponent's flag ( Match->Call Flag )
- Fixed some bugs concerning ambiguous SAN notation
* Increased the width of the clock displays, making them more readable with
smaller boards.
* Added an option to automatically close the previous ICS match when you
begin a new one. ( Settings->Configure Knights->General->Automatically
Close Previous ICS Match )
* Knights can now begin with a match vs PC open, or it can begin connecting
to your ICS. ( Settings->Configure Knights->General->When Knights Begins
It Should: )
* Added Premove support. ( Settings->Configure Knights->Chess Servers->
Options->enable Premove )
* Added checkboxes for ICS Shouts, Unregistered Tells, Kibitzes, Seeks, and
Private Matches. ( Settings->Configure Knights->Chess Servers->Options )
- Fixed the "Reject Draw" option for ICS games.
- Fixed a bug where Channel Reply didn't work when the last channel message
came from an unregistered user.
* The menu option "Match->Reverse Board Orientation F2" has been renamed to
"Match->Flip Board F2". This option now works independently of the original
option ( Settings->Configure Knights->Display->Reverse Board Orientation" ).
Where the original option effects every board ( and is saved between
sessions ), this new Match Menu option effects only the current match, and
is not saved in any way.
* Now when you're challenged in ICS, a dialog will pop up with the details of
the challenge. From here you can accept or decline, or change the parameters
and make a counter offer.
* Added a patch from Harald Fernengel that makes Knights compatable with KDE3.
- Fixed bug where new ICS games began with garbage highlights.
- Fixed a bug which disabled en Passant moves via ICS game.
* Added extra error messages to detect theme loading problems.
Knights 0.5.1 -- Friday December 21st, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
- Fixed a compile bug for Tru64 users
- Fixed a bug introduced in 0.5 that made all play over ICS impossible
- Fixed a bug where Knights counted the opening position in an ICS match
as a move.
- Fixed another ICS related bug where moves you made, which ICS echos back,
were counted twice.
- Fixed yet another bug. This one wrote SAN for a pawn's captures in a way which
was incompatible with other programs.
Knights 0.5 -- Monday December 17th, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Changed version to 0.5
- Some distros had a problem compiling 2 lines of the documentation. This
has been fixed.
- Fixed a bug where recieving a position for a game we don't know about caused
Knights to crash.
- Fixed a bug where Knights did not notify ICS when a game was closed.
- In ICS matches where the local player was black, the chessmen were displayed
on the wrong coordinates on the board, making the match unplayable. This has
been fixed.
- Incomming clock times from ICS matches where divided by 10, making a 2 minute
clock look like 12 seconds. This has been fixed.
* Buffered the output of the Sought Games List to help remove the
"flashing" effect.
- Fixed the ability to review games on an ICS.
* Added ability to read .pgn files that contain multiple matches. Knights will
display a summary of the matches in a new window, and you simply click ( or
double-click based on your global KDE settings ) on a match to review it.
- The Sought Games List required a double click to accept a match, regardless
of your global KDE preferences. This has been fixed.
* Knights can now append all your saved games to a single .pgn file.
* Added the "Accept Match", "Tell...", "Finger", and "Add to Friends List"
options to the Sought Games List right click menu.
* Added "Reverse Board Orientation" option to the Match menu thanks to a patch
from Kunnar Klauks.
- Knights now closes the connection to the ICS when you close the console.
- Fixed a bug where a pawn promotion in a loaded game would prompt you to
choose the promotion.
- Fixed the phantom button bug which could occur if you closed matches
out of sequence.
* Added support for the XBoard commands "telluser" and "tellusererror".
- Did some minor code cleanup throughout the project.
Knights 0.4.9 -- Tuesday December 4th, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
- Changed version number to 0.4.9
* Added option to disable the splash screen
* Added configuration for internet servers
* The Game menu is now the File menu, and the Opponent menu is now the Match
menu.
- The new game menu now dynamically enables or disables game types based on
your configuration. So, if you don't have any chess engines configured, you
can't play a vs. PC or PC vs PC game. Likewise for internet play and server
configuration.
* Added the Console... which handles sending and receiving messages via chess
server, and any other online transactions that don't occur Over the Board.
* Added "High Quality" mode, which displays a much smoother chessboard with
very little pixelation... even at the smallest board sizes. However, there
is a noticeable speed tradeoff.
* Added a 2Meg cache which greatly offsets much of the speed loss in High
Quality mode ( At least on my 600 it does ). Still not as fast as regular,
which should be fine for lower-end machines.
- Knights now displays an error message when you try playing with a bad book
engine configuration.
- Fixed bug where Knights couldn't read a move from a .pgn file if it was the
last token on the line.
* Knights will now read themes from two locations... The system-wide themes
directory ( usually /usr/share/apps/knights/themes ) and the media directory
so you can run Knights without installing it ( ../media )
* Added the 'Ponder' option to the Opponent menu.
* Added the 'Show Last Move' option to the Settings menu.
* Added 'Pause/Resume' functions to the Game menu.
* Separated themes into two - a board theme and a chessman theme.
- Removed the Green Marble theme from the Knights distro.
* Created the ThemePack distro. All themes ( except default ) will go here.
- Fixed the 'Reverse Orientation' option... it now displays correctly.
* Extended Knights' document handling to act like you would expect it: It
remembers URLs ( to resave, or save a loaded game ), and prompts whenever
an unsaved game is about to be destroyed.
* Expanded .pgn support to include multiple games per file and propper
parsing of comments.
* Added application/pgn mimetype
* Knights now connects to FICS and will play chess there.
* Added ALT-R to reply to the last private tell you recieved.
* Added ALT-C to chat on the last channel you recieved a message on.
* Knights now supports multiple matches at once.
* Knights will now default Pawn Promotions to Queen if the user does not
select one.
* Added ability to Retract or Undo a move while playing against an engine.
* Added a "Install Themes" function in the Settings.
* Added ability to modify the key bindings.
* Added a setup wizard to get new users up and running faster.
* Too many minor changes to document.
Knights 0.4.6 -- Wednesday August 15th, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
- Changed version to 0.4.6
* Added en passant moves.
* Added rules for 50 move rule.
* Added rules for forced draws. ( 10.3 & 10.4 of F.I.D.E. Laws of Chess )
* Knights now sends time & otim to engines that want it.
- Fixed bug where Knights interpreted messages during a game into feature
commands. This occurred while playing Crafty. It sent "time control" during a
match, which Knights interpreted as "feature time=0" due to the way Knights
parses engine data as space separated tokens. A Timer was added to engineio
which keeps any feature commands from comming through after an initial two
seconds. This will probably become a problem again, however, and I should
look into making Knights read engine data as full lines rather than space
separated tokens.
- Fixed bug where internal records, and therefore PGN output, did not reflect
engine names properly when the feature myname was used. Now internal
records are not initiated until after the engines have initiated.
- Fixed bug where the last move of a game could result in an Illegal Move
error being printed on the status bar.
* Knights now recognizes all PGN Tags.
* Loaded games will now be displayed as it loads.
* Added command line option -d <path> for specifying Knights' data directory
- Fixed bug where the king could castle even after he moved
- v 0.4.5 broke the Promotion Selection Dialog. It is now fixed.
* Selecting previous moves from the notation combobox will let you review
the game. If someone makes a move while you're reviewing, you are returned
to the current position.
* The up and down arrow keys will cycle you through your game's history.
- You should now be able to continue a game if the engine thinks you've made
an illegal move.
* Added "Force Move" command to force a computer opponent to make a move.
* Added "Offer Draw" command to offer a draw to your opponent.
* Experimental support for Book Engines
- Fixed FEATURE delay for XBoard compatible engines
- Fixed a bug where new installs had to create two engines and switch them once
before any engines would load.
* Added "Reverse Board Orientation" option which, well, reverses the board's
orientation. =)
* Added first draft of documentation.
- Fixed minor bug in XBoard protocol's alternative move command
- Fixed other minor XBoard compliance issues
- Confirmed that KnightCap works with Knights
- Confirmed that Sjeng works with Knights
- Consolidated entries for GNUChess v4, XBoard v1, XBoard v2, and XBoard v3
protocols into XBoard
* Engine configurator now sorts the engine list
- Other minor tweaks that I can't remember
Knights 0.4.5 -- Sunday July 29th, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Re-rendered graphics
* graphics are scalable... 14 different board sizes per theme
* Themes now stored in tarballs
* Knights recognizes and accepts most XBoard version 2 Features
* Crafty v18.9 is confirmed to work!
Knights 0.4.4 -- Friday July 20th, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* enabled engine setup from Settings
* enabled engine vs. engine games
* Knights now recognizes true time control periods
* enabled playing as the black army
* added work on supporting book engines
* minor changes to the main interface
Knights 0.4.2 -- Tuesday July 17th, 2001
Troy Corbin Jr. <tcorbin@users.sourceforge.net>
* Initial public offering via CVS

@ -0,0 +1,26 @@
Dependencies:
-------------
- Qt 3.x
- KDE 3.x
- Autoconf 2.5
- Automake 1.6
You'll also need to have your $KDEDIR environment variable set correctly.
Installing from Tarball Distribution:
-------------------------------------
Type: ./configure
make
make install
Installing from CVS:
--------------------
Type: make -f Makefile.dist
./configure
make
make install

@ -0,0 +1,54 @@
####### kdevelop will overwrite this part!!! (begin)##########
SUBDIRS = admin doc knights media po
####### kdevelop will overwrite this part!!! (end)############
# 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
rpm_prep: doc clean distclean-generic ${PACKAGE}.spec
rm -R -f /tmp/${PACKAGE}-@RPM_VERSION@
mkdir -p /tmp/${PACKAGE}-@RPM_VERSION@
(cd ${srcdir} ; cp -R -a ./* /tmp/${PACKAGE}-@RPM_VERSION@ )
(cd /tmp/ ; \
touch ${PACKAGE}-@RPM_VERSION@/doc/help_{en,de,fr,et}.docbook ; \
find ${SRC_PREFIX}-@RPM_VERSION@ -name CVS > \
/tmp/${PACKAGE}-tar-excludes.lst ; \
find ${SRC_PREFIX}-@RPM_VERSION@ -name Makefile \
-o -name Makefile.in >> \
/tmp/${PACKAGE}-tar-excludes.lst ; \
echo "${SRC_PREFIX}-@RPM_VERSION@/doc/api" >> \
/tmp/${PACKAGE}-tar-excludes.lst ; \
tar --exclude-from=/tmp/${PACKAGE}-tar-excludes.lst \
-chzf ${PACKAGE}-@RPM_VERSION@.tar.gz \
${SRC_PREFIX}-@RPM_VERSION@ ; \
rm -f /tmp/${PACKAGE}-tar-excludes.lst )
rm -R -f /tmp/${PACKAGE}-@RPM_VERSION@
# does not work with original SuSE-6.4 rpm
# you will need an update of the rpm package !
rpm: rpm_prep
rpm -ta /tmp/${PACKAGE}-@RPM_VERSION@.tar.gz
src.rpm: rpm_prep
rpm -ts /tmp/${PACKAGE}-@RPM_VERSION@.tar.gz

@ -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,44 @@
Knights - A chess interface for the K Desktop Environment
FOR INSTALLATION INSTRUCTIONS, SEE THE "INSTALL" FILE
- What Is Knights?
Knights is a graphical chess interface designed to work with KDE. Knights
is called a chess 'interface' because it does not come with it's own computer
players. There are several very good computer players ( Chess Engines )
already. Unfortunatly, most chess engines do not include fully featured GUIs.
Instead, they rely on other programs ( like Knights ) to fill the gap.
- How can I learn more about Knights?
If you're interested in learning more, you should visit our project's website
at http://knights.sourceforge.net
- What Chess Engines work with Knights?
Knights should support any engine which uses the XBoard protocol developed by
Tim Mann. Knights will also offer it's own protocol for future use. To date,
the following chess engines have been confirmed to work with Knights. If you
know of another, please let me know so I can update this list.
- GNUChess v4.0 patchlevel 80
- GNUChess v5.02
- Crafty v18.09
- Crafty v18.10
- KnightCap v3.3
- Sjeng v10.0
- BabyChess
- What can I do to help Knights?
Knights can always use help in a number of areas. The best way to get started
would be to express your interests on the knights-devel mailing list. You can
sign up from here:
http://sourceforge.net/mail/?group_id=31461
Currently, we're very interested in talking to a graphics artist about
designing some new themes, and we would like to talk to some advanced
chess players about helping to develop the tutorials.

48
TODO

@ -0,0 +1,48 @@
Knights TODO version 0.6
- Server Selector in dlg_logic
- Bughouse/Crazyhouse Support
o Add support for multiple boards viewed at once
- Convert the Main Window to use the TabManager
o Must find a way to replicate the top-menu
o Must move most of the knights class into the match class
- Time to remove the knights class completely?!?!?!?
o Umm.. is the main window going to look OK with the menu BELOW the tabGrip and close button?
o We can remove the thinbutton class
o Must make game boards dynamically resizeable
- Resizing is slow. How can we speed this up?
o Add support for a 'sideboard' which displays waiting chessmen
- Must use TabManager tabs
o Resizing will be slow. We must find a way to speed up resizing.
- Add scratchboard support
o Must replace match's right-click code with a pop-up menu
or context sensitive actions
- Implement io_email
- Implement 'Online Player' option in New Match Dialog
o If player is not online at the time, begin connecting
o Once online, begin seeking a match w/ time controls set in New Match dialog
- Implement audio speech which follows teh action on the board
o Must find someone with a great voice. :-)
- Support hyperlinks in the console

File diff suppressed because it is too large Load Diff

11308
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

1516
config.guess vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,169 @@
/* 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 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
/* C++ compiler supports template repository */
#undef HAVE_TEMPLATE_REPOSITORY
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define if you want Xinerama support */
#undef HAVE_XINERAMA
/* 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
/* 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
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/*
* 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
/*
* 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,300 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.57. Invocation command line was
$ ./configure --host=x86_64-linux-gnu --build=x86_64-linux-gnu --enable-libsuffix --disable-debug --disable-rpath --sysconfdir=/etc --includedir=/opt/kde3/include/kde --infodir=/opt/kde3/share/info --mandir=/opt/kde3/share/man --with-qt-dir=/usr/share/qt3 --prefix=/opt/kde3 --with-extra-libs=/opt/kde3/lib
## --------- ##
## Platform. ##
## --------- ##
hostname = argus4
uname -m = x86_64
uname -r = 2.6.31-16-generic
uname -s = Linux
uname -v = #53-Ubuntu SMP Tue Dec 8 04:02:15 UTC 2009
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /opt/kde3/bin
PATH: /opt/kde3/games
PATH: /opt/kde3/bin
PATH: /home/eldarion/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
## ----------- ##
## Core tests. ##
## ----------- ##
configure:1509: checking build system type
configure:1527: result: x86_64-pc-linux-gnu
configure:1535: checking host system type
configure:1549: result: x86_64-pc-linux-gnu
configure:1557: checking target system type
configure:1571: result: x86_64-pc-linux-gnu
configure:1616: checking for a BSD-compatible install
configure:1670: result: /usr/bin/install -c
configure:1685: checking for -p flag to install
configure:1698: result: yes
configure:1709: checking whether build environment is sane
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-pc-linux-gnu
ac_cv_build_alias=x86_64-linux-gnu
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-Wall -g -O2'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-g -O2'
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=-Wl,-Bsymbolic-functions
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-linux-gnu
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=x86_64-linux-gnu
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-pc-linux-gnu
ac_cv_host_alias=x86_64-linux-gnu
ac_cv_path_install='/usr/bin/install -c'
ac_cv_target=x86_64-pc-linux-gnu
ac_cv_target_alias=x86_64-linux-gnu
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL=''
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR=''
ARTSCCONFIG=''
AUTOCONF=''
AUTODIRS=''
AUTOHEADER=''
AUTOMAKE=''
AWK=''
CC=''
CCDEPMODE=''
CFLAGS='-Wall -g -O2'
CONF_FILES=''
CPP=''
CPPFLAGS=''
CXX=''
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS='-g -O2'
DCOPIDL2CPP=''
DCOPIDL=''
DCOP_DEPENDENCIES=''
DEFS=''
DEPDIR=''
ECHO='echo'
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FRAMEWORK_COREAUDIO=''
GMSGFMT=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM=''
KDECONFIG=''
KDE_EXTRA_RPATH=''
KDE_INCLUDES=''
KDE_LDFLAGS=''
KDE_MT_LDFLAGS=''
KDE_MT_LIBS=''
KDE_PLUGIN=''
KDE_RPATH=''
KDE_USE_CLOSURE_FALSE=''
KDE_USE_CLOSURE_TRUE=''
KDE_USE_FINAL_FALSE=''
KDE_USE_FINAL_TRUE=''
KDE_XSL_STYLESHEET=''
LDFLAGS='-Wl,-Bsymbolic-functions'
LIBCOMPAT=''
LIBCRYPT=''
LIBDL=''
LIBJPEG=''
LIBOBJS=''
LIBPNG=''
LIBPTHREAD=''
LIBRESOLV=''
LIBS=''
LIBSM=''
LIBSOCKET=''
LIBTOOL=''
LIBUCB=''
LIBUTIL=''
LIBXINERAMA=''
LIBZ=''
LIB_KAB=''
LIB_KABC=''
LIB_KDECORE=''
LIB_KDEPRINT=''
LIB_KDEUI=''
LIB_KFILE=''
LIB_KFM=''
LIB_KHTML=''
LIB_KIO=''
LIB_KPARTS=''
LIB_KSPELL=''
LIB_KSYCOCA=''
LIB_POLL=''
LIB_QPE=''
LIB_QT=''
LIB_SMB=''
LIB_X11=''
LIB_XEXT=''
LN_S=''
LTLIBOBJS=''
MAKEINFO=''
MCOPIDL=''
MEINPROC=''
MOC=''
MSGFMT=''
NOOPT_CFLAGS=''
NOOPT_CXXFLAGS=''
NOREPO=''
OBJEXT=''
PACKAGE=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
QTE_NORTTI=''
QT_INCLUDES=''
QT_LDFLAGS=''
RANLIB=''
REPO=''
SET_MAKE=''
SHELL='/bin/bash'
STRIP=''
TOPSUBDIRS=''
UIC=''
UIC_TR=''
USER_INCLUDES=''
USER_LDFLAGS=''
USE_EXCEPTIONS=''
USE_RTTI=''
USE_THREADS=''
VERSION=''
WOVERLOADED_VIRTUAL=''
XGETTEXT=''
X_EXTRA_LIBS=''
X_INCLUDES=''
X_LDFLAGS=''
X_PRE_LIBS=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_RANLIB=''
ac_ct_STRIP=''
all_includes=''
all_libraries=''
am__include=''
am__quote=''
bindir='${exec_prefix}/bin'
build='x86_64-pc-linux-gnu'
build_alias='x86_64-linux-gnu'
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='pc'
datadir='${prefix}/share'
exec_prefix='NONE'
host='x86_64-pc-linux-gnu'
host_alias='x86_64-linux-gnu'
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='pc'
includedir='/opt/kde3/include/kde'
infodir='/opt/kde3/share/info'
install_sh=''
kde_appsdir=''
kde_bindir=''
kde_confdir='/etc/kde3'
kde_datadir=''
kde_htmldir='/usr/share/doc/kde/HTML'
kde_icondir=''
kde_includes=''
kde_libraries=''
kde_libs_htmldir=''
kde_libs_prefix=''
kde_locale=''
kde_mimedir=''
kde_moduledir=''
kde_qtver=''
kde_servicesdir=''
kde_servicetypesdir=''
kde_sounddir=''
kde_styledir=''
kde_templatesdir=''
kde_wallpaperdir=''
kde_widgetdir=''
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='/opt/kde3/share/man'
oldincludedir='/usr/include'
prefix='/opt/kde3'
program_transform_name='s,x,x,'
qt_includes=''
qt_libraries=''
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='/etc'
target='x86_64-pc-linux-gnu'
target_alias=''
target_cpu='x86_64'
target_os='linux-gnu'
target_vendor='pc'
x_includes='NONE'
x_libraries='NONE'
## ----------- ##
## confdefs.h. ##
## ----------- ##
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME ""
#define PACKAGE_STRING ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
configure: caught signal 2
configure: exit 1

1622
config.sub vendored

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
./admin/configure.in.min
configure.in.in

@ -0,0 +1,85 @@
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., 51 Franklin Street, Fifth Floor,
dnl Boston, MA 02110-1301, 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
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_SYSTEM
dnl Perform program name transformation
AC_ARG_PROGRAM
dnl Automake doc recommends to do this only here. (Janos)
AM_INIT_AUTOMAKE(knights, 0.6) 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
AM_KDE_WITH_NLS
KDE_USE_QT(3.0.0)
AC_PATH_KDE
#MIN_CONFIG(3.0.0)
dnl PACKAGE set before
AC_PREREQ(2.5)
KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(meinproc)])
AC_SUBST(MEINPROC)
KDE_CREATE_SUBDIRSLIST
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ admin/Makefile ])
AC_CONFIG_FILES([ doc/Makefile ])
AC_CONFIG_FILES([ knights/Makefile ])
AC_CONFIG_FILES([ media/Makefile ])
AC_CONFIG_FILES([ po/Makefile ])
AC_OUTPUT
if test "$all_tests" = "bad"; then
if test ! "$cache_file" = "/dev/null"; then
echo ""
echo "Please remove the file $cache_file after changing your setup"
echo "so that configure will find the changes next time."
echo ""
fi
else
echo ""
echo "Good - your configure finished. Start make now"
echo ""
fi

@ -0,0 +1,8 @@
#MIN_CONFIG(3.0.0)
AM_INIT_AUTOMAKE(knights,0.6)
AC_PREREQ(2.5)
KDE_FIND_PATH(meinproc, MEINPROC, [$kde_default_bindirs], [KDE_MISSING_PROG_ERROR(meinproc)])
AC_SUBST(MEINPROC)

@ -0,0 +1,118 @@
####### kdevelop will overwrite this part!!! (begin)##########
EXTRA_DIST = help_en.docbook help_fr.docbook
####### kdevelop will overwrite this part!!! (end)############
MAINTAINERCLEANFILES = ./*.html
CLEANFILES = core *~ .deps/* doc/*~ *.orig changes.docbook
DISTCLEANFILES = Makefile.in Makefile
LANGUAGES = en fr de et it fi es ru
SUFFIXES = .docbook .po .pot
SGMLDIR=$(kde_datadir)/ksgmltools2
DOCDIR = $(DESTDIR)${kde_htmldir}
XML2POT = xml2pot
PO2XML = po2xml
MSGMERGE = msgmerge
help_en.pot: help_en.docbook
$(XML2POT) help_en.docbook > help_en.pot
# --- translated docbook online help ---
help_fr.po: help_en.pot
$(MSGMERGE) -o help_fr.po help_fr.po help_en.pot
help_fr.docbook: help_en.docbook help_en.pot
${MAKE} help_fr.po
@echo "converting french help"
@ $(PO2XML) help_en.docbook help_fr.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ French\ /g \
> help_fr.docbook
help_de.po: help_en.pot
$(MSGMERGE) -o help_de.po help_de.po help_en.pot
help_de.docbook: help_en.docbook help_en.pot
${MAKE} help_de.po
@echo "converting german help"
@ $(PO2XML) help_en.docbook help_de.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ German\ /g \
> help_de.docbook
help_et.po: help_en.pot
$(MSGMERGE) -o help_et.po help_et.po help_en.pot
help_et.docbook: help_en.docbook help_en.pot
${MAKE} help_et.po
@echo "converting estonian help"
@ $(PO2XML) help_en.docbook help_et.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Estonian\ /g \
> help_de.docbook
help_it.po: help_en.pot
$(MSGMERGE) -o help_it.po help_it.po help_en.pot
help_it.docbook: help_en.docbook help_en.pot
${MAKE} help_it.po
@echo "converting italian help"
@ $(PO2XML) help_en.docbook help_it.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Italian\ /g \
> help_it.docbook
help_fi.po: help_en.pot
$(MSGMERGE) -o help_fi.po help_fi.po help_en.pot
help_fi.docbook: help_en.docbook help_en.pot
${MAKE} help_fi.po
@echo "converting finnish help"
@ $(PO2XML) help_en.docbook help_fi.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Finnish\ /g \
> help_fi.docbook
help_es.po: help_en.pot
$(MSGMERGE) -o help_es.po help_es.po help_en.pot
help_es.docbook: help_en.docbook help_en.pot
${MAKE} help_es.po
@echo "converting spanish help"
@ $(PO2XML) help_en.docbook help_es.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Spanish\ /g \
> help_es.docbook
help_ru.po: help_en.pot
$(MSGMERGE) -o help_ru.po help_ru.po help_en.pot
help_ru.docbook: help_en.docbook help_en.pot
${MAKE} help_ru.po
@echo "converting russian help"
@ $(PO2XML) help_en.docbook help_ru.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Russian\ /g \
> help_ru.docbook
# --- ---
install-data-local:
echo installing docs in $(DOCDIR)
for lang in ${LANGUAGES}; do \
{ \
$(mkinstalldirs) ${DOCDIR}/$${lang}/$(PACKAGE); \
$(INSTALL_DATA) help_$${lang}.docbook ${DOCDIR}/$${lang}/$(PACKAGE)/index.docbook; \
if test ! -e ${DOCDIR}/$${lang}/$(PACKAGE)/common ; then \
rm -f ${DOCDIR}/$${lang}/$(PACKAGE)/common ; fi ; \
( cd ${DOCDIR}/$${lang}/${PACKAGE} ; ln -sf ../common . ) ; \
}; done
cd ${DOCDIR} ; \
if test ! -e default/$(PACKAGE) -a -e default ; then ln -sf ../en/$(PACKAGE) default; fi;
uninstall-local:
for lang in ${LANGUAGES}; do { \
rm -R -f ${DOCDIR}/$${lang}/${PACKAGE} ; \
rmdir -p --ignore-fail-on-non-empty $(DOCDIR)/$$lang >/dev/null 2>&1; \
if test -L ${DOCDIR}/default/$(PACKAGE); then rm -f ${DOCDIR}/default/$(PACKAGE); fi; \
}; done
all:

@ -0,0 +1,533 @@
# Makefile.in generated automatically by automake 1.5 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision: 1.7 $
# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
# 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@
####### kdevelop will overwrite this part!!! (begin)##########
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_HEADER = $(INSTALL_DATA)
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_alias = @build_alias@
build_triplet = @build@
host_alias = @host_alias@
host_triplet = @host@
target_alias = @target_alias@
target_triplet = @target@
AMTAR = @AMTAR@
ARTSCCONFIG = @ARTSCCONFIG@
AS = @AS@
AUTODIRS = @AUTODIRS@
AWK = @AWK@
CC = @CC@
CONF_FILES = @CONF_FILES@
CPP = @CPP@
CXX = @CXX@
CXXCPP = @CXXCPP@
DCOPIDL = @DCOPIDL@
DCOPIDL2CPP = @DCOPIDL2CPP@
DCOP_DEPENDENCIES = @DCOP_DEPENDENCIES@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOXYGEN = @DOXYGEN@
DOXYGEN_PROJECT_NAME = @DOXYGEN_PROJECT_NAME@
DOXYGEN_PROJECT_NUMBER = @DOXYGEN_PROJECT_NUMBER@
DPMSINC = @DPMSINC@
DPMSLIB = @DPMSLIB@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
FRAMEWORK_COREAUDIO = @FRAMEWORK_COREAUDIO@
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
GLINC = @GLINC@
GLLIB = @GLLIB@
GMSGFMT = @GMSGFMT@
IDL = @IDL@
IDL_DEPENDENCIES = @IDL_DEPENDENCIES@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JAR = @JAR@
JAVAC = @JAVAC@
JAVAH = @JAVAH@
JVMLIBS = @JVMLIBS@
KDECONFIG = @KDECONFIG@
KDE_EXTRA_RPATH = @KDE_EXTRA_RPATH@
KDE_HAS_DOXYGEN = @KDE_HAS_DOXYGEN@
KDE_HAVE_DOT = @KDE_HAVE_DOT@
KDE_INCLUDES = @KDE_INCLUDES@
KDE_LDFLAGS = @KDE_LDFLAGS@
KDE_MT_LDFLAGS = @KDE_MT_LDFLAGS@
KDE_MT_LIBS = @KDE_MT_LIBS@
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_XSL_STYLESHEET = @KDE_XSL_STYLESHEET@
LEX = @LEX@
LEXLIB = @LEXLIB@
LIBBZ2 = @LIBBZ2@
LIBCOMPAT = @LIBCOMPAT@
LIBCRYPT = @LIBCRYPT@
LIBDL = @LIBDL@
LIBGEN = @LIBGEN@
LIBJPEG = @LIBJPEG@
LIBMICO = @LIBMICO@
LIBOBJS = @LIBOBJS@
LIBPNG = @LIBPNG@
LIBPTHREAD = @LIBPTHREAD@
LIBPYTHON = @LIBPYTHON@
LIBQIMGIO = @LIBQIMGIO@
LIBRESOLV = @LIBRESOLV@
LIBSHADOW = @LIBSHADOW@
LIBSM = @LIBSM@
LIBSOCKET = @LIBSOCKET@
LIBSSL = @LIBSSL@
LIBTIFF = @LIBTIFF@
LIBTOOL = @LIBTOOL@
LIBUCB = @LIBUCB@
LIBUTIL = @LIBUTIL@
LIBXINERAMA = @LIBXINERAMA@
LIBZ = @LIBZ@
LIB_KAB = @LIB_KAB@
LIB_KABC = @LIB_KABC@
LIB_KDECORE = @LIB_KDECORE@
LIB_KDEPRINT = @LIB_KDEPRINT@
LIB_KDEUI = @LIB_KDEUI@
LIB_KFILE = @LIB_KFILE@
LIB_KFM = @LIB_KFM@
LIB_KHTML = @LIB_KHTML@
LIB_KIMGIO = @LIB_KIMGIO@
LIB_KIO = @LIB_KIO@
LIB_KPARTS = @LIB_KPARTS@
LIB_KSPELL = @LIB_KSPELL@
LIB_KSYCOCA = @LIB_KSYCOCA@
LIB_POLL = @LIB_POLL@
LIB_QPE = @LIB_QPE@
LIB_QT = @LIB_QT@
LIB_QTOPIA = @LIB_QTOPIA@
LIB_SMB = @LIB_SMB@
LIB_X11 = @LIB_X11@
LIB_XEXT = @LIB_XEXT@
LN_S = @LN_S@
MCOPIDL = @MCOPIDL@
MEINPROC = @MEINPROC@
MICO_INCLUDES = @MICO_INCLUDES@
MICO_LDFLAGS = @MICO_LDFLAGS@
MOC = @MOC@
MSGFMT = @MSGFMT@
NOOPT_CFLAGS = @NOOPT_CFLAGS@
NOOPT_CXXFLAGS = @NOOPT_CXXFLAGS@
NOREPO = @NOREPO@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PAMLIBS = @PAMLIBS@
PASSWDLIBS = @PASSWDLIBS@
PYTHONINC = @PYTHONINC@
PYTHONLIB = @PYTHONLIB@
PYTHONMODDIR = @PYTHONMODDIR@
QTDOCDIR = @QTDOCDIR@
QTE_NORTTI = @QTE_NORTTI@
QTOPIA_INCLUDES = @QTOPIA_INCLUDES@
QT_INCLUDES = @QT_INCLUDES@
QT_LDFLAGS = @QT_LDFLAGS@
RANLIB = @RANLIB@
RC = @RC@
REPO = @REPO@
SETUIDFLAGS = @SETUIDFLAGS@
SSL_INCLUDES = @SSL_INCLUDES@
SSL_LDFLAGS = @SSL_LDFLAGS@
STRIP = @STRIP@
TOPSUBDIRS = @TOPSUBDIRS@
UIC = @UIC@
UIC_TR = @UIC_TR@
USER_INCLUDES = @USER_INCLUDES@
USER_LDFLAGS = @USER_LDFLAGS@
USE_EXCEPTIONS = @USE_EXCEPTIONS@
USE_RTTI = @USE_RTTI@
USE_THREADS = @USE_THREADS@
VERSION = @VERSION@
WOVERLOADED_VIRTUAL = @WOVERLOADED_VIRTUAL@
XGETTEXT = @XGETTEXT@
XPMINC = @XPMINC@
XPMLIB = @XPMLIB@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_INCLUDES = @X_INCLUDES@
X_LDFLAGS = @X_LDFLAGS@
X_PRE_LIBS = @X_PRE_LIBS@
all_includes = @all_includes@
all_libraries = @all_libraries@
am__include = @am__include@
am__quote = @am__quote@
idldir = @idldir@
install_sh = @install_sh@
jni_includes = @jni_includes@
kde_appsdir = @kde_appsdir@
kde_bindir = @kde_bindir@
kde_confdir = @kde_confdir@
kde_datadir = @kde_datadir@
kde_htmldir = @kde_htmldir@
kde_icondir = @kde_icondir@
kde_includes = @kde_includes@
kde_libraries = @kde_libraries@
kde_libs_htmldir = @kde_libs_htmldir@
kde_libs_prefix = @kde_libs_prefix@
kde_locale = @kde_locale@
kde_mimedir = @kde_mimedir@
kde_moduledir = @kde_moduledir@
kde_qtver = @kde_qtver@
kde_servicesdir = @kde_servicesdir@
kde_servicetypesdir = @kde_servicetypesdir@
kde_sounddir = @kde_sounddir@
kde_styledir = @kde_styledir@
kde_templatesdir = @kde_templatesdir@
kde_wallpaperdir = @kde_wallpaperdir@
kde_widgetdir = @kde_widgetdir@
micodir = @micodir@
qt_includes = @qt_includes@
qt_libraries = @qt_libraries@
x_includes = @x_includes@
x_libraries = @x_libraries@
EXTRA_DIST = help_en.docbook help_fr.docbook
####### kdevelop will overwrite this part!!! (end)############
MAINTAINERCLEANFILES = ./*.html
CLEANFILES = core *~ .deps/* doc/*~ *.orig changes.docbook
DISTCLEANFILES = Makefile.in Makefile
LANGUAGES = en fr de et it fi es ru
SUFFIXES = .docbook .po .pot
SGMLDIR = $(kde_datadir)/ksgmltools2
DOCDIR = $(DESTDIR)${kde_htmldir}
XML2POT = xml2pot
PO2XML = po2xml
MSGMERGE = msgmerge
subdir = doc
mkinstalldirs = $(SHELL) $(top_srcdir)/admin/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
DIST_SOURCES =
DIST_COMMON = Makefile.am Makefile.in
#>- all: all-am
#>+ 1
all: docs-am all-am
.SUFFIXES:
.SUFFIXES: .docbook .po .pot
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
#>- cd $(top_srcdir) && \
#>- $(AUTOMAKE) --gnu doc/Makefile
#>+ 3
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
cd $(top_srcdir) && perl admin/am_edit knights-0.6/doc/Makefile.in
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && \
CONFIG_HEADERS= CONFIG_LINKS= \
CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status
uninstall-info-am:
tags: TAGS
TAGS:
#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
#>+ 4
KDE_DIST=help_et.po help_fi.po help_de.po help_it.po help_ru.po help_es.po help_fr.po help_en.pot
DISTFILES= $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)
top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
if test -f $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
$(mkinstalldirs) "$(distdir)/$$dir"; \
fi; \
if test -d $$d/$$file; then \
cp -pR $$d/$$file $(distdir) \
|| 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
installdirs:
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)" \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
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-am
#>+ 1
clean: kde-rpo-clean clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
info: info-am
info-am:
install-data-am: install-data-local
install-exec-am:
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-generic mostlyclean-libtool
uninstall-am: uninstall-info-am uninstall-local
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am info info-am install install-am install-data \
install-data-am install-data-local install-exec install-exec-am \
install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic \
mostlyclean-libtool uninstall uninstall-am uninstall-info-am \
uninstall-local
help_en.pot: help_en.docbook
$(XML2POT) help_en.docbook > help_en.pot
# --- translated docbook online help ---
help_fr.po: help_en.pot
$(MSGMERGE) -o help_fr.po help_fr.po help_en.pot
help_fr.docbook: help_en.docbook help_en.pot
${MAKE} help_fr.po
@echo "converting french help"
@ $(PO2XML) help_en.docbook help_fr.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ French\ /g \
> help_fr.docbook
help_de.po: help_en.pot
$(MSGMERGE) -o help_de.po help_de.po help_en.pot
help_de.docbook: help_en.docbook help_en.pot
${MAKE} help_de.po
@echo "converting german help"
@ $(PO2XML) help_en.docbook help_de.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ German\ /g \
> help_de.docbook
help_et.po: help_en.pot
$(MSGMERGE) -o help_et.po help_et.po help_en.pot
help_et.docbook: help_en.docbook help_en.pot
${MAKE} help_et.po
@echo "converting estonian help"
@ $(PO2XML) help_en.docbook help_et.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Estonian\ /g \
> help_de.docbook
help_it.po: help_en.pot
$(MSGMERGE) -o help_it.po help_it.po help_en.pot
help_it.docbook: help_en.docbook help_en.pot
${MAKE} help_it.po
@echo "converting italian help"
@ $(PO2XML) help_en.docbook help_it.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Italian\ /g \
> help_it.docbook
help_fi.po: help_en.pot
$(MSGMERGE) -o help_fi.po help_fi.po help_en.pot
help_fi.docbook: help_en.docbook help_en.pot
${MAKE} help_fi.po
@echo "converting finnish help"
@ $(PO2XML) help_en.docbook help_fi.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Finnish\ /g \
> help_fi.docbook
help_es.po: help_en.pot
$(MSGMERGE) -o help_es.po help_es.po help_en.pot
help_es.docbook: help_en.docbook help_en.pot
${MAKE} help_es.po
@echo "converting spanish help"
@ $(PO2XML) help_en.docbook help_es.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Spanish\ /g \
> help_es.docbook
help_ru.po: help_en.pot
$(MSGMERGE) -o help_ru.po help_ru.po help_en.pot
help_ru.docbook: help_en.docbook help_en.pot
${MAKE} help_ru.po
@echo "converting russian help"
@ $(PO2XML) help_en.docbook help_ru.po | \
sed s/^\ \ \<\!ENTITY\ %\ English\ /\ \ \<\!ENTITY\ %\ Russian\ /g \
> help_ru.docbook
# --- ---
install-data-local:
echo installing docs in $(DOCDIR)
for lang in ${LANGUAGES}; do \
{ \
$(mkinstalldirs) ${DOCDIR}/$${lang}/$(PACKAGE); \
$(INSTALL_DATA) help_$${lang}.docbook ${DOCDIR}/$${lang}/$(PACKAGE)/index.docbook; \
if test ! -e ${DOCDIR}/$${lang}/$(PACKAGE)/common ; then \
rm -f ${DOCDIR}/$${lang}/$(PACKAGE)/common ; fi ; \
( cd ${DOCDIR}/$${lang}/${PACKAGE} ; ln -sf ../common . ) ; \
}; done
cd ${DOCDIR} ; \
if test ! -e default/$(PACKAGE) -a -e default ; then ln -sf ../en/$(PACKAGE) default; fi;
uninstall-local:
for lang in ${LANGUAGES}; do { \
rm -R -f ${DOCDIR}/$${lang}/${PACKAGE} ; \
rmdir -p --ignore-fail-on-non-empty $(DOCDIR)/$$lang >/dev/null 2>&1; \
if test -L ${DOCDIR}/default/$(PACKAGE); then rm -f ${DOCDIR}/default/$(PACKAGE); fi; \
}; done
all:
# 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 doc/Makefile
cd $(top_srcdir) && perl admin/am_edit knights-0.6/doc/Makefile.in
#>+ 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

@ -0,0 +1,795 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN" "dtd/kdex.dtd" [
<!ENTITY kappname "Knights">
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE" > <!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title>
The Knights Handbook
</title>
<authorgroup>
<author>
<firstname>Troy</firstname>
<surname>Corbin Jr.</surname>
<affiliation>
<address>
<email>tcorbin@users.sf.net</email>
</address>
</affiliation>
</author>
<othercredit role="developer">
<firstname>Troy</firstname>
<surname>Corbin Jr.</surname>
<affiliation>
<address>
<email>tcorbin@users.sf.net</email>
</address>
</affiliation>
<contrib>Developer</contrib>
</othercredit>
</authorgroup>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
<copyright>
<year>2001, 2002</year>
<holder>Troy Corbin Jr.</holder>
</copyright>
<legalnotice>
&FDLNotice;
</legalnotice>
<date>
2003-05-17
</date>
<releaseinfo>
0.6
</releaseinfo>
<abstract>
<para>
Knights is a graphical chess interface for &kde;. It supports chess matches against computer engines like GNUChess and Crafty, watching two computer engines play against each other, solitaire chess, matches played via Internet Chess Servers, and reviewing matches saved in Portable Game Notation.
</para>
</abstract>
<keywordset>
<keyword>knights</keyword>
<keyword>KDE</keyword>
<keyword>game</keyword>
<keyword>chess</keyword>
<keyword>gnuchess</keyword>
<keyword>crafty</keyword>
<keyword>ICS</keyword>
<keyword>SAN</keyword>
<keyword>PGN</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title>Introduction</title>
<para>
Chess is a game of strategy with a long history and many variations, and Knights aims to be the ultimate chess resource on your computer. Knights provides a virtual chess board and pieces which you can use to play against a variety of opponents. Currently, those opponents include yourself ( Solitaire chess is a wonderful way to improve your skill at the game ), computer opponents ( sometimes called chess engines ) which you have installed on your computer, and people connected to an internet chess server. In the future, you will also be able to play against a friend using email.
</para>
<para>
If you like to review chess matches which other people have played, Knights can help. Using Portable Game Notation ( <acronym>PGN</acronym> ), Knights can exchange recorded chess matches with most other computer chess programs. You can also record your own matches with Knights, and share them with anyone.
</para>
<para>
Future versions of Knights will include comprehensive chess education in the form of interactive tutorials. These tutorials will help new players grasp the basics, and help them evolve into advanced players.
</para>
</chapter>
<chapter id="getting-started">
<title>Getting Started</title>
<para>
The following sections will help you become familiar with Knights quickly.
</para>
<sect1 id="interface-chessboard">
<title>The Chessboard</title>
<para>
If you've ever played chess before, then Knights' chessboard should be easy to understand. It always displays one player at the top of the screen and the other at the bottom. By default, your pieces always start at the bottom while your opponent's start at the top.
</para>
<para>
Directly below the board are two clocks. The left clock has a white background and always shows the time for the white player. The right clock is always black and shows the time for the black player.
</para>
<sect2 id="interface-chessboard-move">
<title>Making a Move</title>
<para>
To move a chessman, simply click the left mouse button while your pointer is over the chessman you wish to move. If it's your turn to move, the chessman will become highlighted. This lets you know that Knights is ready to move that chessman for you. Now, move your pointer to the position where you want your chessman to move to. Click the left mouse button. You've just moved your chessman!
</para>
<para>
You can also move your chessman using "Drag and Drop". Hold down the left mouse button over the chessman you wish to move and, while still holding down the mouse button, move your chessman to it's new position and release the button.
</para>
</sect2>
<sect2 id="interface-chessboard-preview">
<title>Using Preview</title>
<para>
The Preview feature shows you where each chessman can move on a given turn. To use this feature, move your pointer so that it is over the chessman you wish to examine. Now, click the right mouse button. Any position which that chessman can move to will be highlighted. Moves which will result in a chessman being captured are colored differently.
</para>
<para>
If the chessman you are examining is yours, and it is your turn, you may go head and move him by left clicking on the desired square.
</para>
<tip>
<para>
You can tell Knights to automatically preview possible moves every time you left click on a chessman. See the <link linkend="configure-display-general">Display Settings</link> chapter to find out how.
</para>
</tip>
</sect2>
<sect2 id="interface-chessboard-notation">
<title>SAN Notation</title>
<para>
You will notice that in the lower-right corner, there is a button which displays the last move using Standard Algebraic Notation ( <acronym>SAN</acronym> ). Clicking this button will display all the moves in this match. You can review a previous position by selecting it from this list. Another way to move through this list is to use the <keycombo action="simul"><keycap>Up</keycap></keycombo> and <keycombo action="simul"><keycap>Down</keycap></keycombo> arrow keys on your keyboard. This will step through each move one at a time.
</para>
<note>
<para>
You can not make your next move while you are reviewing the match. You must return to the most recent entry in the list before you can make your move. If someone else makes a move while you are reviewing a previous position, Knights will automatically return you to the current position.
</para>
</note>
</sect2>
</sect1>
<sect1 id="new-match">
<title>Starting a New Match</title>
<para>
To start a new match, click on the <menuchoice><guimenu>File</guimenu></menuchoice> menu, then select <menuchoice><guimenu>New Match...</guimenu></menuchoice>.
</para>
<sect2 id="new-match-dialog">
<title>The New Match Window</title>
<para>
The New Match Window lets you change the type of chess match you'd like to play.
</para>
<note>
<para>
Online games can not be started from here. If you'd like to play chess online, please see the section of this document titled <link linkend="online">Using Knights Online</link>.
</para>
</note>
<para>
Clicking <menuchoice><guimenu>Human</guimenu></menuchoice> will tell Knights that you want to control this color yourself.
</para>
<para>
The <menuchoice><guimenu>Computer</guimenu></menuchoice> option, if available, will tell Knights that a Computer Opponent ( also known as a Chess Engine ) should control this color. Another window will pop up with a list of opponents that you have installed. After selecting an opponent, you should use the <menuchoice><guimenu>Player Strength</guimenu></menuchoice> slider to customize your opponent's skill level. Due to the fact that each computer opponent is unique, some which are set to <menuchoice><guimenu>Weak</guimenu></menuchoice> may actually be better than opponents set to <menuchoice><guimenu>Strong</guimenu></menuchoice>. Also note that some may completely ignore your preference and play that same no matter what skill level you select.
</para>
<para>
The <menuchoice><guimenu>Email</guimenu></menuchoice> option is not yet supported by Knights.
</para>
<para>
Once you've selected the players, you'll want to select the time controls for this match. <menuchoice><guimenu>Base Time</guimenu></menuchoice> is the number of minutes that this player has at the beginning of the match. After you make a number of moves, you'll receive extra time on your clock. <menuchoice><guimenu>Moves Per Base Time</guimenu></menuchoice> controls the number of moves needed to receive that extra time. <menuchoice><guimenu>Increment Per Move</guimenu></menuchoice> is yet another time bonus that you receive after every move.
</para>
</sect2>
</sect1>
</chapter>
<chapter id="online">
<title>Using Knights Online</title>
<para>
Knights can connect you with thousands of other chess players around the globe. You can play games, observe others playing, attend live classes, or just relax and chat.
</para>
<para>
Although Knights tries to make it easy to use a chess server, there are many commands and functions for each server that are beyond the scope of this document. You should check with the chess server you intend to use for a full description of these.
</para>
<sect1 id="getting-started-online">
<title>Getting Started</title>
<para>
If you used the Setup Wizard when you first installed Knights, then Knights will connect to the <ulink url="http://www.freechess.org">Free Internet Chess Server</ulink> by default. If you did not use the Setup Wizard, or you'd prefer to connect to another chess server, you'll need to change Knights' settings. See the section of this document titled <link linkend="configure-servers">Chess Servers</link> for instructions on doing this.
</para>
<para>
Your computer will need to be connected to the Internet before you attempt to connect to a chess server. Knights will display an error message if it can not access the Internet.
</para>
<para>
Some chess servers will require you to have a membership, which sometimes includes paying a membership fee. You will need to visit the website of your chosen chess server to sign up for membership.
</para>
<para>
If you are not interested in obtaining a membership, but you still want to play chess online, some chess servers will allow you to play as a free guest without signing up for anything. This is strongly suggested for those who have never played chess online before.
</para>
<sect2 id="getting-started-online-connecting">
<title>Connecting to a Server</title>
<para>
To connect to a chess server, click on <menuchoice><guimenu>File</guimenu></menuchoice>, and then select <menuchoice><guimenuitem>Connect to Server</guimenuitem></menuchoice>.
</para>
<para>
A new window will pop up asking for your <menuchoice><guimenu>Login</guimenu></menuchoice> and <menuchoice><guimenu>Password</guimenu></menuchoice>. You should have recieved these when you signed up for membership with this chess server. If you do not have a membership yet, click on the <menuchoice><guimenu>Log in as guest</guimenu></menuchoice> option.
</para>
</sect2>
</sect1>
<sect1 id="online-tools">
<title>Online Tools</title>
<para>
Once Knights has established a connection with your chosen chess server, several new tools will be displayed to help you make the most of your time online.
</para>
<sect2 id="online-tools-console">
<title>The Console</title>
<para>
The Console is your primary communications tool while you're online. All of the messages that are sent to you are displayed here.
</para>
<para>
Messages can be colored differently depending on the type of message. For example, a message from a chat channel may be displayed in blue, while message sent specifically to you may be in green. These colors ( and fonts ) may be customized by going to <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure Knights...</guimenuitem></menuchoice>. Then click on <menuchoice><guimenu>Display</guimenu></menuchoice>, and then the <menuchoice><guimenu>Console</guimenu></menuchoice> tab.
</para>
<para>
This is also where you send your messages out. Just start typing on your keyboard to write a message, and press <keycombo action="simul"><keycap>Enter</keycap></keycombo> to send it. Knights will remember the last 100 messages you sent out, which you can access by pressing <keycombo action="simul"><keycap>SHIFT + UP</keycap></keycombo> and <keycombo action="simul"><keycap>SHIFT + DOWN</keycap></keycombo>.
</para>
<para>
There are several shortcuts available for the most commonly used server commands. To see a list of these, your should read the section of this document titled <link linkend="key-bindings">Command Reference</link>.
</para>
</sect2>
<sect2 id="online-tools-sought-list">
<title>The Sought Games List</title>
<para>
Ok, you've connected to a chess server. Now how do you play chess on it?
</para>
<para>
The Sought Games List will help. Right click on it, and select <menuchoice><guimenu>Seek Matches</guimenu></menuchoice>. A list of other players, who are also interested in playing a game of chess, will appear. When you find one you like, simply left click on it to start playing.
</para>
<para>
As you'll notice, there are a number of actions you can take when you right click on a match. They are:
</para>
<itemizedlist>
<listitem>
<para>
<menuchoice><guimenu>Tell...</guimenu></menuchoice> will begin a private message between you and the player offering this match. Simply select this and type your message.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Assess</guimenu></menuchoice> will display a graph that shows you how your rating will be effected if you play a match against this opponent.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Player Info</guimenu></menuchoice>, otherwise known as "Finger", will display a wealth of information about this player. This information can include how long the player has been online, his rating for different types of chess matches, win/loss statistics, etc.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Player History</guimenu></menuchoice> shows the results of the last 14 or so games played by this opponent. There are columns in the history display for the players and their ratings (as adjusted by the result of the match), the winner, the type of match (blitz/standard, rated/unrated) and the date.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Add to Friends</guimenu></menuchoice> tells your ICS that you want to be notified whenever this player logs on and off the server. In the future, Knights will display your friends list so you can easily send them messages, observe their matches, and more.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Ignore This Player</guimenu></menuchoice> keeps you from hearing anything this player says, including private messages.
</para>
</listitem>
</itemizedlist>
</sect2>
<sect2 id="online-tools-sought-graph">
<title>The Sought Games Graph</title>
<para>
The Sought Games Graph performs the same function as the Sought Games List, but with one difference: Instead of displaying a list of players, it displays a graph.
</para>
<para>
Usually, when you're interested in playing a chess match, you already know how long you want the match to be, and you already know that you want to play against an opponent of a particular skill level. The graph is very useful for this, because it organizes the available games based on it's length, and on your opponent's strength.
</para>
<para>
Stronger opponents are listed at the top of the graph, while weaker opponents are listed at the bottom. Shorter games are listed at the left, while longer games are listed at the right. Rated games are displayed using a solid square, while unrated games use a hollow square.
</para>
<para>
Right clicking on a match will display the same menu used in the Sought Games List. That menu includes:
</para>
<itemizedlist>
<listitem>
<para>
<menuchoice><guimenu>Tell...</guimenu></menuchoice> will begin a private message between you and the player offering this match. Simply select this and type your message.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Assess</guimenu></menuchoice> will display a graph that shows you how your rating will be effected if you play a match against this opponent.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Player Info</guimenu></menuchoice>, otherwise known as "Finger", will display a wealth of information about this player. This information can include how long the player has been online, his rating for different types of chess matches, win/loss statistics, etc.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Player History</guimenu></menuchoice> shows the results of the last 14 or so games played by this opponent. There are columns in the history display for the players and their ratings (as adjusted by the result of the match), the winner, the type of match (blitz/standard, rated/unrated) and the date.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Add to Friends</guimenu></menuchoice> tells your ICS that you want to be notified whenever this player logs on and off the server. In the future, Knights will display your friends list so you can easily send them messages, observe their matches, and more.
</para>
</listitem>
<listitem>
<para>
<menuchoice><guimenu>Ignore This Player</guimenu></menuchoice> keeps you from hearing anything this player says, including private messages.
</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>
</chapter>
<chapter id="organizing-tabs">
<title>Organizing Your Tabs</title>
<para>
Knights often must display more than just the chessboard. For example, when you play chess online, Knights must open up a new window containing several new tools. These tools are stacked on top of each other using tabs to help keep your desktop from getting too cluttered, but what if you want to see more than one of these tools at a time?
</para>
<para>
At the top of each tab, you'll find a Grip widget. It looks like three horizontal lines, and when you move your pointer over it, the pointer will change into four arrows. When this happens, you can click and drag that tab to a different position on the screen. If you drag it to another tab, then they will merge together into the same window. If you do not drag it onto another tab, it will create it's own window at the new location.
</para>
<para>
To the right of the Grip is a Close button. Clicking on this button will close out this Tab. If this was the only Tab in it's window, then the window will be closed as well.
</para>
<note>
<para>
Whenever a tab is closed, Knights will remember the size of that tab.
</para>
</note>
</chapter>
<chapter id="configure">
<title>Settings</title>
<para>
One of our primary goals is to make Knights easy to setup and customize. When you need to customize Knights, select <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure Knights...</guimenuitem></menuchoice>. A new window will be displayed. The following sections describe the various options available from this new window.
</para>
<sect1 id="configure-general">
<title>General</title>
<para>
<menuchoice><guimenu>Your Name</guimenu></menuchoice> is the name Knights records on saved games for you.
</para>
<para>
<menuchoice><guimenu>When Knights Begins It Should:</guimenu></menuchoice> This allows you to customize Knights' behavior when you run the program.
</para>
<para>
<menuchoice><guimenu>Save Match on Close?</guimenu></menuchoice> When you close a chess match, Knights can automatically save it for you. If this match doesn't yet have a file name, you will be prompted for one.
</para>
<para>
The <menuchoice><guimenu>Append to Save File</guimenu></menuchoice> option tells Knights that you wish to save all your games to a single pgn file. This is useful for players who wish to analyze their matches later in a chess database program like <ulink url="http://scid.sourceforge.net/">SCID</ulink>.
</para>
<para>
<menuchoice><guimenu>Pause on Minimize</guimenu></menuchoice> This will cause Knights to pause all your matches when you minimize the Knights window.
</para>
<note>
<para>
Some types of matches ( like matches on <acronym>ICS</acronym> ) can not be paused in this way.
</para>
</note>
<para>
<menuchoice><guimenu>Always Promote to Queen</guimenu></menuchoice> When checked, any of your pawns that get promoted will automatically become a queen. Otherwise Knights will prompt you each time a pawn is promoted.
</para>
<para>
<menuchoice><guimenu>Call Flag Automatically</guimenu></menuchoice> This option will automatically declare you the winner of the match if your opponent's clock runs out of time.
</para>
</sect1>
<sect1 id="configure-display">
<title>Display</title>
<sect2 id="configure-display-general">
<title>General</title>
<para>
Use the <menuchoice><guimenu>Install New Themes</guimenu></menuchoice> button to install themes that you've downloaded.
</para>
<para>
Use the <menuchoice><guimenu>Board Themes</guimenu></menuchoice> and <menuchoice><guimenu>Chessman Themes</guimenu></menuchoice> buttons to select the look of your board. Knights only includes one board theme and one chessman theme, but others are available for download.<ulink url="http://sourceforge.net/project/showfiles.php?group_id=31461">Click here</ulink> to download the Knights Themepack.
</para>
<para>
<menuchoice><guimenu>Theme Size</guimenu></menuchoice> can be adjusted to make the board larger or smaller.
</para>
<para>
Using the <menuchoice><guimenu>Reverse Board Orientation</guimenu></menuchoice> option is like turning the chessboard 180 degrees. Normally, the board is displayed with your army on the bottom and your opponent's army on top. Checking this option puts your army on the top and your opponent's army on the bottom.
</para>
<para>
<menuchoice><guimenu>Display Startup Logo</guimenu></menuchoice> toggles the welcome screen.
</para>
<para>
<menuchoice><guimenu>Automatic Preview</guimenu></menuchoice> will enable the Preview feature for the left mouse button.
</para>
<para>
<menuchoice><guimenu>Show Last Move</guimenu></menuchoice> will highlight the chessman that moved on the previous turn.
</para>
<para>
<menuchoice><guimenu>Show Coordinates</guimenu></menuchoice> will draw the Rank and File coordinates on the board.
</para>
</sect2>
<sect2 id="configure-display-console">
<title>Console</title>
<para>
The Font buttons allow you to alter the font for each different kind of text displayed on the console. The Color buttons beside them let you change the color which that font will be displayed in. The seventh extra Color button changes the background color.
</para>
<para>
<menuchoice><guimenu>Restore Defaults</guimenu></menuchoice> will disregard any changes you've made to the font and color options, returning them to their original state.
</para>
</sect2>
</sect1>
<sect1 id="configure-audio">
<title>Audio</title>
<para>
Knights uses sounds to keep you informed of important events both on and off the board. For example, Knights can play a sound when a chessman is moved, or play another sound when someone sends you a private message online. This section describes the different options you have when it comes to Knights' sounds.
</para>
<para>
The <menuchoice><guimenu>enable Audio</guimenu></menuchoice> checkbox is like the power button on your stereo. Uncheck this, and all of Knights' sounds are turned off.
</para>
<para>
<menuchoice><guimenu>Audio Themes</guimenu></menuchoice> allows you to choose between different audio themes, which are similar to the graphical themes. Knights only includes one sound theme, but others may be available for download from the internet.
</para>
<para>
The <menuchoice><guimenu>Volume</guimenu></menuchoice> slider allows you to adjust how loudly Knights will play it's sounds.
</para>
<note>
<para>
This is independent of the volume controls in your mixer and on your speakers. In other words, if the volume in Knights is at maximum, but your mixer's volume is at minimum, then you will not be able to hear Knights' sounds.
</para>
</note>
<para>
<menuchoice><guimenu>For Current Match Only</guimenu></menuchoice> is a checkbox that allows you to turn off all sounds from chess matches that you are not actively watching. So if you have a match vs. GNUChess running, but you're looking at your match vs. Crafty, only the Crafty match will make sounds. When you click on the GNUChess match again, then it will make sounds again and the Crafty match will fall silent.
</para>
</sect1>
<sect1 id="configure-engines">
<title>Computer Opponents</title>
<para>
Here you'll be able to configure Knights to use various "Chess Engines", which are computer opponents you can play chess against. These engines are separate programs that do not come with Knights. To use them, you must first download a chess engine. Tim Mann's <ulink url="http://www.tim-mann.org/engines.html">Chess Engines</ulink> page has a great list of available engines for you to download. Knights should work with all of these. See the README and INSTALL instructions that come with each engine to install it.
</para>
<para>
Once you have a chess engine installed, click the <guimenu>Add...</guimenu> button on the right hand side of the window. A new window will be displayed.
</para>
<para>
The only things that you MUST enter to use the engine are the <guimenu>Protocol</guimenu> and the <guimenu>Engine Filename</guimenu>.
</para>
<para>
<guimenu>Engine Name</guimenu> is what Knights will call this engine when you select it as an opponent, or if there is an error. This is set for you if you leave it blank.
</para>
<para>
<guimenu>Protocol</guimenu> is a list of "languages" that computer opponents can speak. Knights acts like a translator by taking what the engine says and converting it into a move on the virtual chessboard. It is important to have the correct protocol or else the engine won't be able to play.
</para>
<note>
<para>
For most engines, you should select XBoard as the protocol. The Knights protocol is reserved for future engines to use.
</para>
</note>
<para>
<guimenu>Engine Filename</guimenu> should contain the actual location of the engine on your filesystem. Include the full path, unless the engine is in the search path. If you don't want to type this in, you can browse your filesystem with the folder icon on the right. Simply find the engine, left click on it, and left click Open.
</para>
<para>
<guimenu>Command Line Arguments</guimenu> is where you should add any special options for this engine. See the engine's documentation for a list of options and their useage.
</para>
<para>
<guimenu>Log File</guimenu> is a special text document which records the "conversation" between Knights and the engine. This is very useful for engine developers and for users who are having trouble getting Knights to work with a particular engine. Most users can leave this blank.
</para>
<para>
Click OK and Knights is now ready to use this engine!
</para>
<para>
You'll notice options which enable "Book Engines". Book engines are a kind of helper for the computer opponent. These types of engines are new and experimental. Therefore, you should not enable these unless you are a chess engine developer or unless you're sure that the engine supports "Bookengine" mode ( XBoard version 3 and Knights protocols ).
</para>
</sect1>
<sect1 id="configure-servers">
<title>Chess Servers</title>
<para>
This section is where you'll configure all your options related to Internet Chess Servers.
</para>
<sect2 id="configure-servers-servers">
<title>Servers</title>
<para>
If you'd like to configure Knights to use a new Chess Server, click the "Add..." button on the right hand side of the window. A new window will be displayed.
</para>
<para>
This window is used to tell Knights how it can connect to our chess server. <menuchoice><guimenu>Server Name</guimenu></menuchoice> is a descriptive title for the server. You can enter anything you want here. "My Chess Server", "FICS", etc.
</para>
<para>
<menuchoice><guimenu>Server URL</guimenu></menuchoice> is the address of the server.
</para>
<para>
<menuchoice><guimenu>Server Port</guimenu></menuchoice> tells Knights which port to communicate with the server on. If this is left blank, Knights will try to guess the port number.
</para>
<para>
<menuchoice><guimenu>Username</guimenu></menuchoice> and <menuchoice><guimenu>Password</guimenu></menuchoice> will store your login information. If you do not wish for Knights to remember your login information, just leave these blank and you will be prompted each time you connect.
</para>
<para>
A <menuchoice><guimenu>Timeseal</guimenu></menuchoice> is a program that helps to reduce the effect of Internet lag on your clock. It can be quite unpleasant to lose a match because your Internet connection is slow. If you have a Timeseal program that you'd like to use, enter the full path and filename for it here.
</para>
<para>
<menuchoice><guimenu>Log File</guimenu></menuchoice> can be used to keep a record of your session online. Be warned though: Knights does not maintain the size of your logfiles.
</para>
<para>
When all is done you can click <menuchoice><guimenuitem>OK</guimenuitem></menuchoice> to add this chess server to the list of those Knights will connect with.
</para>
</sect2>
<sect2 id="configure-servers-options">
<title>Options</title>
<para>
The <menuchoice><guimenu>Profanity Filter</guimenu></menuchoice> can be used to garble undesirable words. It has six levels of filtration.
</para>
<para>
<menuchoice><guimenu>Automatically Close Previous ICS Match</guimenu></menuchoice> does was it says. If you just played a match and you're starting a new one, Knights will go ahead and close the last one for you.
</para>
<para>
<menuchoice><guimenu>Private Matches</guimenu></menuchoice> will tell your ICS that you don't want your match to be observable.
</para>
<para>
The <menuchoice><guimenu>enable Premove</guimenu></menuchoice> option allows you to move your next chessman while it's still your opponent's turn. Knights will remember your selection and move the piece for you as soon as it's your turn again.
</para>
<para>
The <menuchoice><guimenu>enable Kibitzes</guimenu></menuchoice> option will display Kibitz message on the console if enabled.
</para>
<para>
<menuchoice><guimenu>enable Unregistered Tells</guimenu></menuchoice> will allow you to hear messages from unregistered users.
</para>
<para>
<menuchoice><guimenu>enable Shouts</guimenu></menuchoice> will allow you to hear shouts.
</para>
<para>
The <menuchoice><guimenu>enable Seeks</guimenu></menuchoice> option will display Sought Match messages.
</para>
<para>
<menuchoice><guimenu>Seconds Between Seek Updates</guimenu></menuchoice> This tells Knights how often you want it to refresh it's Sought Games List. Valid numbers range between 3 seconds to 2 minutes ( 120 seconds ).
</para>
</sect2>
</sect1>
</chapter>
<chapter id="key-bindings">
<title>Command Reference</title>
<itemizedlist>
<listitem>
<para>
<keycombo action="simul"><keycap>UP</keycap></keycombo> - Pressing up will step backwards through the move list and show you the previous position.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>DOWN</keycap></keycombo> - Pressing down will step forward through the move list and show you the next board position.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>ENTER</keycap></keycombo> - Pressing Enter will always bring up the Console cursor so you can enter text. Pressing Enter again will remove it and send anything you typed in between.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>PAGE UP</keycap></keycombo> and <keycombo action="simul"><keycap>PAGE DOWN</keycap></keycombo> - Pressing these keys will scroll the Console up and down.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>SHIFT + UP</keycap></keycombo> and <keycombo action="simul"><keycap>SHIFT + DOWN</keycap></keycombo> - These will scroll through the history of what you've typed previously. Very handy for repeating commands.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>ALT + C</keycap></keycombo> - This will begin a reply to the last channel who sent you a tell.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>ALT + K</keycap></keycombo> - This will begin a kibitz, which can be heard by everyone observing a match, including the players.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>ALT + R</keycap></keycombo> - This will begin a reply to the last person who sent you a private tell.
</para>
</listitem>
<listitem>
<para>
<keycombo action="simul"><keycap>ALT + W</keycap></keycombo> - This will begin a whisper, which can be heard by everyone observing the current match, but not by the players of that match.
</para>
</listitem>
</itemizedlist>
</chapter>
<chapter id="credits">
<title>Credits and License</title>
<para>
Knights
</para>
<para>
Program copyright 2001, 2002 Troy Corbin Jr. <email>tcorbin@users.sf.net</email>
</para>
<para>
Documentation copyright 2001, 2002 Troy Corbin Jr. <email>tcorbin@users.sf.net</email>
</para>
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL;
&underGPL;
</chapter>
<appendix id="installation">
<title>Installation</title>
<sect1 id="installation-obtain-knights">
<title>How to obtain Knights</title>
<para>
The Knights Project is located at <ulink url="http://knights.sourceforge.net/">http://knights.sourceforge.net</ulink>. It will usually contain the most up-to-date information on Knights available.
</para>
<note>
<para>
If you're using the <ulink url="http://www.opennic.org/">OpenNIC</ulink> root service, then you can reach the Knights Project at <ulink url="http://www.knights.oss/">http://www.knights.oss</ulink>.
</para>
</note>
</sect1>
<sect1 id="installation-requirements">
<title>Requirements</title>
<para>
Before you can install Knights, you must have the <ulink url="http://www.kde.org">K Desktop Environment</ulink> version 3.x or newer installed on your system. Knights also requires that you have <ulink url="http://www.gnu.org/directory/Software_development/Program_build_automation/autoconf.html">Autoconf</ulink> version 2.5 and <ulink url="http://www.gnu.org/directory/Software_development/Program_build_automation/automake.html">Automake</ulink> version 1.6.
</para>
</sect1>
<sect1 id="installation-compilation">
<title>Compilation and Installation</title>
<para>
Knights uses <application>autoconf</application> and <application>automake</application> to ensure that compiling is easy. If for some reason Knights won't compile for you, help is available at the Knights Project website located at <ulink url="http://knights.sourceforge.net/">http://knights.sourceforge.net</ulink>.
</para>
<para>
You must have the KDEDIR environment variable defined before you begin the installation. Without this, Knights will not be able to access it's resources! To add the KDEDIR environment variable, you need to edit your /etc/profile ( or ~/.bash_profile ) and add the line:
</para>
<para>
<userinput><command>export KDEDIR="/usr"</command></userinput>
</para>
<para>
...where /usr is your KDE's base directory.
</para>
<para>
Now, change the present working directory to the location where you unarchived Knights and type the following:
</para>
<informalexample>
<screen width="40">
<prompt>%</prompt> <userinput><command>./configure</command></userinput>
<prompt>%</prompt> <userinput><command>make</command></userinput>
<prompt>%</prompt> <userinput><command>make</command> <option>install</option></userinput>
</screen>
</informalexample>
<para>
Knights should now be installed and ready to go. You can type <userinput><command>knights</command></userinput> in a terminal to start the game, or create an icon for it and select that.
</para>
</sect1>
</appendix>
<appendix id="command-line">
<title>Command Line Options</title>
<para>
Knights is a graphical chess interface and tries to make full use of it. Most every option you'd ever want should be available from Knights' Settings menu and Configure window. However, there are rare cases where a command line option is an absolute must. Here are descriptions for those options.
</para>
<screen width="40">
<prompt>%</prompt> <userinput><command>knights</command> <option>-d <replaceable>path</replaceable></option></userinput>
</screen>
<para>
The use of this command line option is depreciated. If Knights displays garbage rather than a chessboard, then you did not set the KDEDIR environment variable correctly before compiling Knights. Please see the Installation instructions for the proper compiling procedures.
</para>
<screen width="40">
<prompt>%</prompt> <userinput><command>knights</command> <option><replaceable>filename</replaceable></option></userinput>
</screen>
<para>
By appending a filename to the command line, you can start Knights with a chess match already loaded for you.
</para>
</appendix>
<appendix id="kml">
<title>Knights Markup Language</title>
<para>
The Knights Markup Language is a variation on HTML with the specific purpose of formatting and displaying PGN data. The formatting is actually done using Qt's default rich-text commands. Since these are already explained at length on Trolltech's <ulink url="http://doc.trolltech.com/3.1/qstylesheet.html#details">website</ulink>, they will not be covered here.
</para>
<para>
This appendix lists the macros used within KML to represent PGN data. These macros are case-sensitive.
</para>
<para>
<command>%whiteimage%</command> - This will be replaced with an image showing the white player's picture, or a generic image if Knights can't find it.
</para>
<para>
<command>%blackimage%</command> - This will be replaced with an image showing the black player's picture, or a generic image if Knights can't find it.
</para>
<para>
<command>%moves%</command> - This represents the move data. Recursive annotations appear in italics, while comments appear in bold type.
</para>
<para>
<command>%site%</command> - Represents the PGN tag: Site.
</para>
<para>
<command>%date%</command> - Represents the PGN tag: Date.
</para>
<para>
<command>%round%</command> - Represents the PGN tag: Round.
</para>
<para>
<command>%result%</command> - Represents the PGN tag: Result.
</para>
<para>
<command>%white%</command> - Represents the PGN tag: White.
</para>
<para>
<command>%whitetitle%</command> - Represents the PGN tag: White Title.
</para>
<para>
<command>%whiteelo%</command> - Represents the PGN tag: White ELO.
</para>
<para>
<command>%whiteuscf%</command> - Represents the PGN tag: White USCF.
</para>
<para>
<command>%whitena%</command> - Represents the PGN tag: White NA.
</para>
<para>
<command>%whitetype%</command> - Represents the PGN tag: White Type.
</para>
<para>
<command>%black%</command> - Represents the PGN tag: Black.
</para>
<para>
<command>%blacktitle%</command> - Represents the PGN tag: Black Title.
</para>
<para>
<command>%blackelo%</command> - Represents the PGN tag: Black ELO.
</para>
<para>
<command>%blackuscf%</command> - Represents the PGN tag: Black USCF.
</para>
<para>
<command>%blackna%</command> - Represents the PGN tag: Black NA.
</para>
<para>
<command>%blacktype%</command> - Represents the PGN tag: Black Type.
</para>
<para>
<command>%time%</command> - Represents the PGN tag: Time.
</para>
<para>
<command>%utctime%</command> - Represents the PGN tag: UTC Time.
</para>
<para>
<command>%utcdate%</command> - Represents the PGN tag: UTC Date.
</para>
<para>
<command>%event%</command> - Represents the PGN tag: Event.
</para>
<para>
<command>%eventdate%</command> - Represents the PGN tag: Event Date.
</para>
<para>
<command>%eventsponsor%</command> - Represents the PGN tag: Event Sponsor.
</para>
<para>
<command>%section%</command> - Represents the PGN tag: Section.
</para>
<para>
<command>%stage%</command> - Represents the PGN tag: Stage.
</para>
<para>
<command>%board%</command> - Represents the PGN tag: Board.
</para>
<para>
<command>%opening%</command> - Represents the PGN tag: Opening.
</para>
<para>
<command>%variation%</command> - Represents the PGN tag: Variation.
</para>
<para>
<command>%subvariation%</command> - Represents the PGN tag: Subvariation.
</para>
<para>
<command>%eco%</command> - Represents the PGN tag: ECO.
</para>
<para>
<command>%nic%</command> - Represents the PGN tag: NIC.
</para>
<para>
<command>%timecontrol%</command> - Represents the PGN tag: Time Control.
</para>
<para>
<command>%termination%</command> - Represents the PGN tag: Termination.
</para>
<para>
<command>%setup%</command> - Represents the PGN tag: Setup.
</para>
<para>
<command>%fen%</command> - Represents the PGN tag: FEN.
</para>
<para>
<command>%annotator%</command> - Represents the PGN tag: Annotator.
</para>
<para>
<command>%mode%</command> - Represents the PGN tag: Mode.
</para>
<para>
<command>%plycount%</command> - Represents the PGN tag: Plycount.
</para>
</appendix>
</book>
<!--
Local Variables:
mode: sgml
sgml-omittag: nil
sgml-shorttag: t
End:
-->

@ -0,0 +1,658 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN" "dtd/kdex.dtd" [
<!ENTITY kappname "Knights">
<!ENTITY % addindex "IGNORE">
<!ENTITY % French "INCLUDE"
> <!-- change language only here -->
]>
<book lang="&language;">
<bookinfo>
<title
> </title>
<authorgroup>
<author
> </author>
<othercredit role="developer">
<firstname
>Troy</firstname>
<surname
>Corbin Jr.</surname>
<affiliation>
<address>
<email
>tcorbin@users.sf.net</email>
</address>
</affiliation>
<contrib
></contrib>
</othercredit>
</authorgroup>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
<copyright>
<year
>2001, 2002</year>
<holder
></holder>
</copyright>
<legalnotice>
&FDLNotice;
</legalnotice>
<date>
2003-05-17
</date>
<releaseinfo>
0.6
</releaseinfo>
<abstract>
<para
> </para>
</abstract>
<keywordset>
<keyword
></keyword>
<keyword
></keyword>
<keyword
></keyword>
<keyword
></keyword>
<keyword
></keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
</chapter>
<chapter id="getting-started">
<title
></title>
<para
> </para>
<sect1 id="interface-chessboard">
<title
></title>
<para
> </para>
<para
> </para>
<sect2 id="interface-chessboard-move">
<title
></title>
<para
> </para>
<para
> </para>
</sect2>
<sect2 id="interface-chessboard-preview">
<title
></title>
<para
> </para>
<para
> </para>
<tip
> <para
> </para
> </tip>
</sect2>
<sect2 id="interface-chessboard-notation">
<title
></title>
<para
> </para>
<note
> <para
> </para
> </note>
</sect2>
</sect1>
<sect1 id="new-match">
<title
></title>
<para
> </para>
<sect2 id="new-match-dialog">
<title
></title>
<para
> </para>
<note
> <para
> </para
> </note>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</sect2>
</sect1>
</chapter>
<chapter id="online">
<title
></title>
<para
> </para>
<para
> </para>
<sect1 id="getting-started-online">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<sect2 id="getting-started-online-connecting">
<title
></title>
<para
> </para>
<para
> </para>
</sect2>
</sect1>
<sect1 id="online-tools">
<title
></title>
<para
> </para>
<sect2 id="online-tools-console">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</sect2>
<sect2 id="online-tools-sought-list">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<itemizedlist
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> </itemizedlist>
</sect2>
<sect2 id="online-tools-sought-graph">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<itemizedlist
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> </itemizedlist>
</sect2>
</sect1>
</chapter>
<chapter id="organizing-tabs">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<note
> <para
> </para
> </note>
</chapter>
<chapter id="configure">
<title
></title>
<para
> </para>
<sect1 id="configure-general">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<note
> <para
> </para
> </note>
<para
> </para>
<para
> </para>
</sect1>
<sect1 id="configure-display">
<title
></title>
<sect2 id="configure-display-general">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</sect2>
<sect2 id="configure-display-console">
<title
></title>
<para
> </para>
<para
> </para>
</sect2>
</sect1>
<sect1 id="configure-audio">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<note
> <para
> </para
> </note>
<para
> </para>
</sect1>
<sect1 id="configure-engines">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<note
> <para
> </para
> </note>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</sect1>
<sect1 id="configure-servers">
<title
></title>
<para
> </para>
<sect2 id="configure-servers-servers">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</sect2>
<sect2 id="configure-servers-options">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</sect2>
</sect1>
</chapter>
<chapter id="key-bindings">
<title
></title>
<itemizedlist
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> <listitem
> <para
> </para
> </listitem
> </itemizedlist>
</chapter>
<chapter id="credits">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL;
&underGPL;
</chapter>
<appendix id="installation">
<title
></title>
<sect1 id="installation-obtain-knights">
<title
></title>
<para
> </para>
<note
> <para
> </para
> </note>
</sect1>
<sect1 id="installation-requirements">
<title
></title>
<para
> </para>
</sect1>
<sect1 id="installation-compilation">
<title
></title>
<para
> </para>
<para
> </para>
<para
> <userinput
><command
></command
></userinput
> </para>
<para
> </para>
<para
> </para>
<informalexample
> <screen width="40">
</screen
> </informalexample>
<para
> </para>
</sect1>
</appendix>
<appendix id="command-line">
<title
></title>
<para
> </para>
<screen width="40">
</screen>
<para
> </para>
<screen width="40">
</screen>
<para
> </para>
</appendix>
<appendix id="kml">
<title
></title>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
<para
> </para>
</appendix>
</book>
<!--
Local Variables:
mode: sgml
sgml-omittag: nil
sgml-shorttag: t
End:
-->

@ -0,0 +1,15 @@
Begin3
Title: Knights
Version: 0.6
Entered-date:
Description: A graphical chess interface for KDE
Keywords: chess KDE FICS PGN ICS crafty gnuchess
Author: Troy Corbin Jr. <troy@knights-chess.com>
Maintained-by: Troy Corbin Jr. <troy@knights-chess.com>
Primary-site: http://knights-chess.com
Home-page:
Original-site:
Platforms: Linux and other Unices
Copying-policy: GNU Public License
End

@ -0,0 +1,95 @@
#
# Knights Spec File
#
# Writen with Knights 0.4.9
#
%define name knights
%define version 0.4.9
%define release 1mdk
Summary: A chess interface for the K Desktop Environment
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: GPL
Group: Games/Boards
Source:%{name}-%{version}.tar.gz
URL: http://knights.sourceforge.net/
Distribution: Mandrake Linux
Vendor: Mandrake
Packager: Troy Corbin Jr. <tcorbin@users.sourceforge.net>
Requires: kde
BuildRoot: %{_tmppath}/%{name}-buildroot
%description
A chess interface for the K Desktop Environment. Knights works with all
XBoard compatible chess engines, FICS, and .pgn files.
%prep
rm -rf $RPM_BUILD_ROOT
%setup -a 0
%build
./configure i586-mandrake-linux \
--prefix=/usr \
--exec-prefix=/usr \
--bindir=/usr/bin \
--sbindir=/usr/sbin \
--sysconfdir=/etc \
--datadir=/usr/share \
--includedir=/usr/include \
--libdir=/usr/lib \
--libexecdir=/usr/lib \
--localstatedir=/var/lib \
--sharedstatedir=/usr/com \
--mandir=/usr/share/man \
--infodir=/usr/share/info
%make
%install
# The menu entry used by debian and mandrake
cat << EOF > $RPM_BUILD_ROOT/%{_menudir}/knights
command="/usr/bin/knights"
icon="knights.pgn"
needs="kde"
section="Amusement/Boards"
title="Knights"
longtitle="A graphical chess interface for KDE"
EOF
%makeinstall
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%doc README COPYING AUTHORS ChangeLog CreatingThemes TODO INSTALL
/usr/bin/knights
/usr/share/doc/HTML/en/knights/knights-01.png
/usr/share/doc/HTML/en/knights/knights-02.png
/usr/share/doc/HTML/en/knights/configure-02.png
/usr/share/doc/HTML/en/knights/configure-1.png
/usr/share/doc/HTML/en/knights/configure-3.png
/usr/share/doc/HTML/en/knights/index.docbook
/usr/share/apps/knights/splash.png
/usr/share/apps/knights/wizard.png
/usr/share/apps/knights/themes/KBDefault.tar.gz
/usr/share/apps/knights/themes/KCDefault.tar.gz
/usr/share/apps/knights/icon-display.png
/usr/share/apps/knights/icon-general.png
/usr/share/apps/knights/icon-console-bottom.png
/usr/share/apps/knights/icon-console-detach.png
/usr/share/apps/knights/icon-console-side.png
/usr/share/icons/locolor/16x16/apps/knights.png
/usr/share/icons/locolor/32x32/apps/knights.png
/usr/share/icons/hicolor/16x16/apps/knights.png
/usr/share/icons/hicolor/32x32/apps/knights.png
/usr/share/icons/hicolor/48x48/apps/knights.png
/usr/share/icons/hicolor/64x64/apps/knights.png
/usr/share/icons/locolor/16x16/mimetypes/pgn.png
/usr/share/icons/locolor/32x32/mimetypes/pgn.png
/usr/share/icons/hicolor/16x16/mimetypes/pgn.png
/usr/share/icons/hicolor/32x32/mimetypes/pgn.png
/usr/share/icons/hicolor/48x48/mimetypes/pgn.png
/usr/share/icons/hicolor/64x64/mimetypes/pgn.png
/usr/share/applnk/Amusement/Boards/knights.desktop

@ -0,0 +1,61 @@
####### kdevelop will overwrite this part!!! (begin)##########
bin_PROGRAMS = knights
## INCLUDES were found outside kdevelop specific part
knights_SOURCES = board_2d.cpp board_base.cpp setpagedisplay.cpp proto_xboard.cpp dlg_selectengine.cpp thinbuttons.cpp pgn.cpp io_engine.cpp dlg_challenge.cpp idmanager.cpp challenge_graph.cpp dlg_login.cpp tabgrip.cpp tabpage.cpp tab_seeklist.cpp dlg_engine.cpp setpageaudio.cpp proto_base.cpp dlg_server.cpp core.cpp match_param.cpp knightspixcache.cpp dlg_settings.cpp console.cpp match.cpp setpagegeneral.cpp splash.cpp audio.cpp main.cpp logic.cpp list_pgn.cpp challenge_graph_view.cpp accel.cpp dlg_selectemail.cpp challenge_rectangle.cpp knightstextview.cpp tabmanager.cpp command.cpp dlg_newmatch.cpp chessclock.cpp dlg_promote.cpp resource.cpp tabbox.cpp io_internet.cpp challenge_game.cpp knights.cpp tab_pgnview.cpp io_base.cpp wiz_setup.cpp setpageservers.cpp proto_uci.cpp setpageengines.cpp
knights_LDADD = -lqt-mt -lartskde -lkio -lkdeprint -lkdeui -lkdecore $(LIBSOCKET)
EXTRA_DIST = setpageengines.cpp proto_uci.cpp setpageservers.cpp wiz_setup.cpp setpageengines.h io_base.cpp knightsmap.h tab_pgnview.cpp knights.cpp challenge_game.cpp io_internet.cpp challenge_graph_view.h resource.h tabbox.cpp resource.cpp dlg_promote.cpp dlg_server.h pgn.h chessclock.cpp dlg_newmatch.cpp command.h io_internet.h challenge_rectangle.h command.cpp tabmanager.cpp dlg_promote.h definitions.h knightstextview.cpp challenge_rectangle.cpp dlg_selectemail.cpp splash.h list_pgn.h accel.cpp tabmanager.h match.h setpagedisplay.h challenge_graph_view.cpp list_pgn.cpp logic.h logic.cpp knightstextview.h main.cpp audio.cpp splash.cpp setpagegeneral.cpp match.cpp io_base.h console.h idmanager.h dlg_selectemail.h console.cpp tab_pgnview.h knights.h dlg_settings.cpp core.h knightspixcache.cpp thinbuttons.h dlg_settings.h setpageservers.h tab_seeklist.h match_param.cpp core.cpp match_param.h dlg_server.cpp pgn.desktop tabbox.h accel.h io_engine.h proto_base.cpp setpageaudio.cpp dlg_engine.cpp tab_seeklist.cpp tabpage.cpp challenge_graph.h tabgrip.cpp dlg_login.cpp challenge_graph.cpp proto_uci.h setpageaudio.h proto_base.h chessclock.h setpagegeneral.h idmanager.cpp dlg_challenge.cpp io_engine.cpp audio.h dlg_newmatch.h pgn.cpp dlg_engine.h thinbuttons.cpp wiz_setup.h dlg_selectengine.cpp challenge_game.h proto_xboard.cpp knightspixcache.h setpagedisplay.cpp tabgrip.h knights.desktop dlg_login.h proto_xboard.h dlg_challenge.h dlg_selectengine.h tabpage.h board_base.cpp board_base.h board_2d.cpp board_2d.h Makefile.am
install-data-local:
$(mkinstalldirs) $(kde_mimedir)/application/
$(INSTALL_DATA) $(srcdir)/pgn.desktop $(kde_mimedir)/application/pgn.desktop
$(mkinstalldirs) $(kde_appsdir)/Games/Board/
$(INSTALL_DATA) $(srcdir)/knights.desktop $(kde_appsdir)/Games/Board/knights.desktop
uninstall-local:
-rm -f $(kde_mimedir)/application/pgn.desktop
-rm -f $(kde_appsdir)/Games/Board/knights.desktop
####### kdevelop will overwrite this part!!! (end)############
# this 10 paths are KDE specific. Use them:
# kde_htmldir Where your docs should go to. (contains lang subdirs)
# kde_appsdir Where your application file (.kdelnk) should go to.
# kde_icondir Where your icon should go to.
# kde_minidir Where your mini icon should go to.
# kde_datadir Where you install application data. (Use a subdir)
# kde_locale Where translation files should go to.(contains lang subdirs)
# kde_cgidir Where cgi-bin executables should go to.
# kde_confdir Where config files should go to.
# kde_mimedir Where mimetypes should go to.
# kde_toolbardir Where general toolbar icons should go to.
# kde_wallpaperdir Where general wallpapers should go to.
# set the include path for X, qt and KDE
INCLUDES= $(all_includes)
METASOURCES = AUTO
# the library search path.
knights_LDFLAGS = $(all_libraries) $(KDE_RPATH)
# Uncomment the following two lines if you add a ui.rc file for your application to make use of
# KDE´s XML GUI builing
#rcdir = $(kde_datadir)/knights
#rc_DATA = knightsui.rc
#WARNING: if you use a ui.rc file above, use:
# messages: rc.cpp
# instead of
# messages:
messages:
LIST=`find $(srcdir) -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)/knights.pot; \
fi

@ -0,0 +1,60 @@
/***************************************************************************
accel.cpp - description
-------------------
begin : Wed Nov 6 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "accel.moc"
#include <klocale.h>
Accel::Accel( QWidget *parent, QObject *target ) : KAccel( parent )
{
insertItem( i18n("Previous Move"), "Previous Move", Key_Up, TRUE );
insertItem( i18n("Next Move"), "Next Move", Key_Down, TRUE );
insertItem( i18n("Enter Text"), "Enter Text", Key_Return, TRUE );
insertItem( i18n("Page Up"), "Page Up", Key_PageUp, TRUE );
insertItem( i18n("Page Down"), "Page Down", Key_PageDown, TRUE );
insertItem( i18n("Increase Board Size"), "Board Up", ALT + Key_Plus, TRUE );
insertItem( i18n("Decrease Board Size"), "Board Down", ALT + Key_Minus, TRUE );
insertItem( i18n("Last History Item"), "Last History Item", SHIFT + Key_Up, TRUE );
insertItem( i18n("Next History Item"), "Next History Item", SHIFT + Key_Down, TRUE );
insertItem( i18n("Reply to the Last Tell"), "Tell Reply", ALT + Key_R, TRUE );
insertItem( i18n("Reply to the Channel"), "Channel Reply", ALT + Key_C, TRUE );
insertItem( i18n("Kibitz"), "Kibitz", ALT + Key_K, TRUE );
insertItem( i18n("Whisper"), "Whisper", ALT + Key_W, TRUE );
readSettings();
if( target )
setTarget( target );
}
Accel::~Accel()
{
writeSettings();
}
void Accel::setTarget( QObject *target )
{
connectItem( "Board Down" , target, SIGNAL( board_down() ) );
connectItem( "Board Up" , target, SIGNAL( board_up() ) );
connectItem( "Previous Move" , target, SIGNAL( move_prev() ) );
connectItem( "Next Move" , target, SIGNAL( move_next() ) );
connectItem( "Page Up", target, SIGNAL( page_up() ) );
connectItem( "Page Down", target, SIGNAL( page_down() ) );
connectItem( "Last History Item", target, SIGNAL( history_prev() ) );
connectItem( "Next History Item", target, SIGNAL( history_next() ) );
connectItem( "Tell Reply", target, SIGNAL( reply_tell() ) );
connectItem( "Channel Reply", target, SIGNAL( reply_channel() ) );
connectItem( "Enter Text", target, SIGNAL( focus() ) );
connectItem( "Kibitz", target, SIGNAL( kibitz() ) );
connectItem( "Whisper", target, SIGNAL( whisper() ) );
}

@ -0,0 +1,59 @@
/***************************************************************************
accel.h - description
-------------------
begin : Wed Nov 6 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef ACCEL_H
#define ACCEL_H
#include <kaccel.h>
/**
*@author Troy Corbin Jr.
*/
class Accel : public KAccel
{
Q_OBJECT
public:
Accel( QWidget *parent=0, QObject *target=0 );
~Accel();
void setTarget( QObject* );
signals:
void focus( void );
void focus( const QChar& );
void board_up( void );
void board_down( void );
void move_prev( void );
void move_next( void );
void page_up( void );
void page_down( void );
void history_prev( void );
void history_next( void );
void reply_tell( void );
void reply_channel( void );
void kibitz( void );
void whisper( void );
};
#endif

@ -0,0 +1,177 @@
/***************************************************************************
audio.cpp - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "audio.h"
#include <arts/soundserver.h>
#include <arts/dispatcher.h>
#include <arts/flowsystem.h>
#include <arts/connect.h>
#include <ksimpleconfig.h>
#include <kio/netaccess.h>
#include <qptrlist.h>
#include <qfile.h>
#include <qmap.h>
class audioPrivate
{
public:
bool enabled;
bool firstTime;
QString theme;
Arts::Dispatcher dispatcher;
Arts::SoundServerV2 server;
Arts::PlayObjectFactory playObjectFactory;
QMap<int, Arts::PlayObject> audioMap;
QPtrList<KTempFile> fileRef;
};
audio::audio()
{
a = new audioPrivate;
a->server = Arts::Reference("global:Arts_SoundServerV2");
a->fileRef.setAutoDelete( TRUE );
if( a->server.isNull() )
{
a->enabled = FALSE;
kdWarning() << "audio::audio: Can not create Arts::SoundServerV2" << endl;
}
else
{
a->enabled = TRUE;
a->playObjectFactory = Arts::Reference("global:Arts_PlayObjectFactory");
}
a->firstTime = TRUE;
}
audio::~audio()
{
a->audioMap.clear();
a->fileRef.clear();
delete a;
}
void audio::play( const int snd )
{
if( a->firstTime || !enabled || !a->enabled )
return;
QMap<int, Arts::PlayObject>::Iterator IT = a->audioMap.find( snd );
if( IT == a->audioMap.end() )
{
return;
}
Arts::PlayObject* current = &IT.data();
if( volume )
{
Arts::Synth_BUS_UPLINK uplink = Arts::DynamicCast( current->_getChild( "uplink" ) );
uplink.stop();
current->_node()->stop();
Arts::disconnect( *current, "left", uplink, "left" );
Arts::disconnect( *current, "right", uplink, "right" );
Arts::StereoVolumeControl volumeControl = Arts::DynamicCast( a->server.createObject( "Arts::StereoVolumeControl" ) );
current->_addChild( volumeControl, "volume" );
uplink.start();
volumeControl.start();
current->_node()->start();
Arts::connect( *current, "left", volumeControl, "inleft" );
Arts::connect( *current, "right", volumeControl, "inright" );
Arts::connect( volumeControl, "outleft", uplink, "left" );
Arts::connect( volumeControl, "outright", uplink, "right" );
volumeControl.scaleFactor( ( 100 - volume ) / 100.0 );
}
Arts::poTime time = current->currentTime();
time.seconds = 0;
time.ms = 0;
current->seek( time );
current->play();
}
void audio::setTheme( const QString &newTheme )
{
QString configFile;
KSimpleConfig *themeConfig;
if( !enabled || !a->enabled )
return;
a->audioMap.clear();
a->fileRef.clear();
if( !KIO::NetAccess::download( newTheme + "theme.conf" , configFile ) )
{
kdWarning() << "audio::setTheme: Can not access theme.conf from " << newTheme << endl;
return;
}
themeConfig = new KSimpleConfig( configFile, TRUE );
/* Read the details about this theme */
themeConfig->setGroup( "General" );
themeHeader.name = themeConfig->readEntry( "Name", "Unknown" );
themeHeader.version = themeConfig->readEntry( "Version", "Unknown" );
themeHeader.author = themeConfig->readEntry( "Author", "Unknown" );
themeHeader.authorEmail = themeConfig->readEntry( "AuthorEmail", "Unknown" );
themeHeader.authorWWW = themeConfig->readEntry( "AuthorWWW", "Unknown" );
themeHeader.notes = themeConfig->readEntry( "Notes", "Unknown" );
/* Read the sounds */
themeConfig->setGroup( "Audio" );
a->theme = newTheme;
prepFile( a->theme + themeConfig->readEntry("Select"), SND_SELECT );
prepFile( a->theme + themeConfig->readEntry("Move"), SND_MOVE );
prepFile( a->theme + themeConfig->readEntry("Check"), SND_CHECK );
prepFile( a->theme + themeConfig->readEntry("MatchOver"), SND_MATCH_OVER );
prepFile( a->theme + themeConfig->readEntry("Challenge"), SND_CHALLENGE );
prepFile( a->theme + themeConfig->readEntry("Tell"), SND_TELL );
prepFile( a->theme + themeConfig->readEntry("Notification"), SND_NOTIFICATION );
prepFile( a->theme + themeConfig->readEntry("DrawOffer"), SND_DRAW_OFFER );
prepFile( a->theme + themeConfig->readEntry("Say"), SND_SAY );
prepFile( a->theme + themeConfig->readEntry("Promote"), SND_PROMOTE );
a->firstTime = FALSE;
delete themeConfig;
KIO::NetAccess::removeTempFile( configFile );
}
void audio::prepFile( const QString &source, const int &ref )
{
Arts::PlayObject player;
KTempFile *dest;
QString filename;
if( source.isEmpty() )
return;
dest = new KTempFile( QString::null, source.right(4), 700 );
dest->setAutoDelete( TRUE );
filename = dest->name();
if( !KIO::NetAccess::download( source, filename ) )
{
kdWarning() << "audio::prepFile: Can not download " << source << endl;
delete dest;
return;
}
player = a->playObjectFactory.createPlayObject( QFile::encodeName( dest->name() ).data() );
if( player.isNull() )
{
delete dest;
return;
}
a->fileRef.append( dest );
a->audioMap[ ref ] = player;
return;
}

@ -0,0 +1,64 @@
/***************************************************************************
audio.h - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef AUDIO_H
#define AUDIO_H
#include "definitions.h"
#include <kurl.h>
#include <ktempfile.h>
/**
*@author Troy Corbin Jr.
*/
/*
These represent the various sounds that can be played.
*/
const int SND_NONE = 0x00;
const int SND_SELECT = 0x01;
const int SND_MOVE = 0x02;
const int SND_MATCH_OVER = 0x03; // Deprecieated
const int SND_CHECK = 0x04;
const int SND_FLAG = 0x05;
const int SND_CHALLENGE = 0x50;
const int SND_TELL = 0x51;
const int SND_NOTIFICATION = 0x52;
const int SND_DRAW_OFFER = 0x53;
const int SND_SAY = 0x54;
const int SND_PROMOTE = 0x55;
class audioPrivate;
class audio
{
public:
audio();
~audio();
void play( const int );
void setTheme( const QString& );
bool enabled;
int volume;
ThemeHeader themeHeader;
protected:
void prepFile( const QString&, const int& );
private:
audioPrivate *a;
};
#endif

@ -0,0 +1,807 @@
/***************************************************************************
board_2d.cpp - description
-------------------
begin : Fri Feb 28 2003
copyright : (C) 2003 by The Knights Project
email : knights-general@lists.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "board_2d.moc"
#include "resource.h"
#include "logic.h"
#include "knightspixcache.h"
#include <kiconeffect.h>
#include <qpainter.h>
#include <qtimer.h>
static int MAX_STEPS = 18;
board_2d::board_2d(QWidget *parent, const char *name, resource *Rsrc, logic *Lgc ) : board_base(parent,name,Rsrc,Lgc)
{
updateX1 = updateY1 = 4000;
updateX2 = updateY2 = -4000;
init = TRUE;
premoveFrom = Null;
premoveTo = Null;
DragSprite = NULL;
lastMoveWasDrag = FALSE;
cache = myResource->pixCache;
int size = 8 + ( 1 * ( myResource->ThemeBorder == TRUE ) );
sprites.setAutoDelete( TRUE );
/* Setup Pixmaps */
myself.setOptimization( QPixmap::BestOptim );
myself.resize( myResource->ThemeSize * size, myResource->ThemeSize * size);
myself.fill();
/* Setup self */
setBackgroundMode( Qt::NoBackground );
show();
}
board_2d::~board_2d()
{
}
///////////////////////////////////////
//
// board_2d::coords
//
///////////////////////////////////////
QPoint board_2d::coords( const int &rank, const int &file )
{
QPoint tmp;
if( orientation == 0 )
{
tmp.setX( myResource->ThemeSize * file );
tmp.setY( myResource->ThemeSize * ( 7 - rank ) );
}
else
{
tmp.setX( myResource->ThemeSize * ( 7 - file ) );
tmp.setY( myResource->ThemeSize * rank );
}
if( myResource->ThemeBorder )
{
tmp.setX( tmp.x() + ( myResource->ThemeSize >> 1 ) );
tmp.setY( tmp.y() + ( myResource->ThemeSize >> 1 ) );
}
return tmp;
}
///////////////////////////////////////
//
// board_2d::position
//
///////////////////////////////////////
int board_2d::position( const QPoint &_point )
{
int file, rank;
int themeSize = myResource->ThemeSize;
QPoint point( _point );
if( myResource->ThemeBorder )
{
point.setX( point.x() - ( themeSize >> 1 ) );
point.setY( point.y() - ( themeSize >> 1 ) );
}
if( !orientation )
{
file = point.x() / themeSize;
rank = 7 - ( point.y() / themeSize );
}
else
{
file = 7 - ( point.x() / themeSize );
rank = point.y() / themeSize;
}
return ( ( rank << 3 ) + file );
}
///////////////////////////////////////
//
// board_2d::drawMove
//
///////////////////////////////////////
void board_2d::drawMove( const ChessMove &chessMove, const bool &reverse )
{
char fromPtr, toPtr, takenPtr(Null);
if( reverse )
{
fromPtr = ( chessMove.toRank << 3 ) + chessMove.toFile;
toPtr = ( chessMove.fromRank << 3 ) + chessMove.fromFile;
}
else
{
fromPtr = ( chessMove.fromRank << 3 ) + chessMove.fromFile;
toPtr = ( chessMove.toRank << 3 ) + chessMove.toFile;
}
/* Position where Man was taken != Target Position; ie. en passant */
if( chessMove.ManTaken != Null )
{
takenPtr = myLogic->Pointer( myLogic->chessman[ chessMove.ManTaken ].File, myLogic->chessman[ chessMove.ManTaken ].Rank );
}
/* Show Highlights */
if( myResource->OPTION_Show_Last_Move )
{
myLogic->current[ fromPtr ].Note = NOTE_MOVE;
if( chessMove.ManTaken != Null )
{
myLogic->current[ toPtr ].Note = NOTE_ATTACK;
}
else
{
myLogic->current[ toPtr ].Note = NOTE_MOVE;
}
}
/* Show Animation */
if( myResource->OPTION_Animate_Moves && !lastMoveWasDrag && isVisible() )
{
QTimer::singleShot( 0, this, SLOT( updateSprites() ) );
sprite *spritePtr = new sprite;
spritePtr->Steps = 1;
spritePtr->Restore = FALSE;
spritePtr->POSITION_Origin = fromPtr;
spritePtr->POSITION_Destination = toPtr;
spritePtr->POSITION_TargetTaken = takenPtr;
if( !reverse )
{
spritePtr->POINT_Origin = coords( chessMove.fromRank, chessMove.fromFile );
spritePtr->POINT_Destination = coords( chessMove.toRank, chessMove.toFile );
spritePtr->PIXMAP_Sprite = getChessman( spritePtr->POSITION_Destination );
}
else
{
spritePtr->POINT_Origin = coords( chessMove.toRank, chessMove.toFile );
spritePtr->POINT_Destination = coords( chessMove.fromRank, chessMove.fromFile );
spritePtr->PIXMAP_Sprite = getChessman( spritePtr->POSITION_Origin );
}
spritePtr->POINT_Current = spritePtr->POINT_Origin;
spritePtr->PIXMAP_FlipFrame.resize( spritePtr->PIXMAP_Sprite.size() );
sprites.append( spritePtr );
}
else
{
/* Draw this position only if we're not animating */
drawPosition( toPtr );
if( takenPtr != Null )
{
drawPosition( takenPtr );
}
}
/* Draw the originating position */
drawPosition( fromPtr );
if( QString( chessMove.SAN ).contains( "o-o", FALSE ) )
{
/* This is a castle */
ChessMove newMove;
strcpy( newMove.SAN, QString( "no" ).latin1() );
newMove.fromRank = chessMove.fromRank;
newMove.toRank = chessMove.toRank;
newMove.ManTaken = Null;
if( QString( chessMove.SAN ).contains( "o-o-o", FALSE ) )
{
/* Queenside */
newMove.fromFile = 0;
newMove.toFile = 3;
}
else
{
/* Kingside */
newMove.fromFile = 7;
newMove.toFile = 5;
}
drawMove( newMove, reverse );
}
lastMoveWasDrag = FALSE;
}
///////////////////////////////////////
//
// board_2d::resizeBoard( SLOT )
//
///////////////////////////////////////
void board_2d::resizeBoard( void )
{
int size = 8 + ( 1 * ( myResource->ThemeBorder == TRUE ) );
init = FALSE;
/* Resize myself */
myself.resize( myResource->ThemeSize * size, myResource->ThemeSize * size);
myself.fill();
/* Finish up */
setFixedSize( myResource->ThemeSize * size, myResource->ThemeSize * size);
redrawAll();
int inverseSize = IMAGE_MAX - myResource->ThemeSize;
MAX_STEPS = ( ( inverseSize * inverseSize ) / IMAGE_MAX ) + 7;
}
///////////////////////////////////////
//
// board_2d::redrawAll
//
///////////////////////////////////////
void board_2d::redrawAll( void )
{
register char tmp(0);
if( init )
return;
/* Set Orientation */
orientation = myResource->OPTION_Board_Orientation;
if( localArmy != WHITE )
orientation = !orientation;
if( flip )
orientation = !orientation;
/* Set Border */
if( myResource->ThemeBorder )
{
if( orientation )
{
QWMatrix matrix;
matrix.rotate( 180.0 );
myself = cache->Border.xForm( matrix );
}
else
myself = cache->Border;
}
/* Redraw All Positions */
while( tmp < 64 )
drawPosition( tmp++ );
redrawLights();
/* Make sure everything is repainted */
updateX1 = updateY1 = 0;
updateX2 = updateY2 = IMAGE_MAX * 9;
commit();
}
///////////////////////////////////////
//
// board_2d::redrawLights
//
///////////////////////////////////////
void board_2d::redrawLights( void )
{
int half, four;
QPoint black, white;
if( myResource->ThemeBorder )
{
half = myResource->ThemeSize >> 1;
four = myResource->ThemeSize << 2;
if( !orientation )
{
black.setX( 0 );
black.setY( four );
white.setX( 0 );
white.setY( four + half );
}
else
{
black.setX( myself.width() - half );
black.setY( four + half );
white.setX( myself.width() - half );
white.setY( four );
}
if( myLogic->OnMove != WHITE )
{
myBlit( black, &cache->BorderLightOn, cache->BorderLightOn.rect() );
myBlit( white, &cache->BorderLightOff, cache->BorderLightOff.rect() );
}
else
{
myBlit( black, &cache->BorderLightOff, cache->BorderLightOff.rect() );
myBlit( white, &cache->BorderLightOn, cache->BorderLightOn.rect() );
}
}
}
///////////////////////////////////////
//
// board_2d::drawPosition
//
///////////////////////////////////////
void board_2d::drawPosition( const int &pos )
{
int rank = pos >> 3;
int file = pos % 8;
QPixmap buffer;
QString cacheName = QString::number( myResource->ThemeSize );
QImage tempImage;
if( ( pos < 0 ) || ( pos > 63 ) ) return;
/*
Build the cache ref name
*/
if( color( rank, file ) )
cacheName += "L";
else
cacheName += "D";
if( !paused )
{
switch( myLogic->current[pos].Note )
{
case NOTE_SELECT:
case NOTE_HIGHLIGHT:
cacheName += "S";
break;
case NOTE_MOVE:
case NOTE_CASTLE:
case NOTE_PAWN_DOUBLE:
cacheName += "M";
break;
case NOTE_ATTACK:
case NOTE_ENPASSANT:
cacheName += "A";
break;
default:
cacheName += " ";
}
if( ( myLogic->current[pos].ManPtr != Null ) && ( !isSprite( pos ) ) )
{
if( myLogic->chessman[ myLogic->current[pos].ManPtr ].Army == WHITE )
cacheName += "W";
else
cacheName += "B";
switch( myLogic->chessman[myLogic->current[pos].ManPtr].Type )
{
case King:
cacheName += "K";
break;
case Queen:
cacheName += "Q";
break;
case Bishop:
cacheName += "B";
break;
case Knight:
cacheName += "N";
break;
case Rook:
cacheName += "R";
break;
case Pawn:
cacheName += "P";
break;
default:
break;
}
if( ( pos == premoveFrom ) || ( pos == premoveTo ) )
cacheName += "t"; // The means it's transparent
}
}
else
cacheName += " ";
if( cache->find( cacheName, buffer ) )
{
/*
Cache Hit... no need to redraw
*/
if( myResource->OPTION_Show_Coord )
drawCoords( &buffer, pos );
myBlit( coords( rank, file ), &buffer, buffer.rect() );
return;
}
/*
Cache miss
Draw the pixmap
*/
if( color( rank, file ) )
buffer = cache->SquareLight;
else
buffer = cache->SquareDark;
switch( myLogic->current[pos].Note )
{
case NOTE_HIGHLIGHT: // Fall Through
case NOTE_SELECT:
bitBlt( &buffer, 0, 0, &cache->HighlightSelect, 0, 0, -1, -1, Qt::CopyROP, FALSE);
break;
case NOTE_MOVE: // Fall Through
case NOTE_CASTLE: // Fall Through
case NOTE_PAWN_DOUBLE:
bitBlt( &buffer, 0, 0, &cache->HighlightMove, 0, 0, -1, -1, Qt::CopyROP, FALSE);
break;
case NOTE_ATTACK: // Fall Through
case NOTE_ENPASSANT:
bitBlt( &buffer, 0, 0, &cache->HighlightAttack, 0, 0, -1, -1, Qt::CopyROP, FALSE);
break;
default:
break;
}
if( !isSprite(pos) )
{
QPixmap chessman = getChessman( pos );
bitBlt( &buffer, 0, 0, &chessman, 0, 0, -1, -1, Qt::CopyROP, FALSE);
}
/* Now add this pixmap to the cache */
cache->add( cacheName, buffer );
/* */
if( myResource->OPTION_Show_Coord )
drawCoords( &buffer, pos );
myBlit( coords( rank, file ), &buffer, buffer.rect() );
}
///////////////////////////////////////
//
// board_2d::drawCoords
//
///////////////////////////////////////
void board_2d::drawCoords( QPixmap *pic, const int &pos )
{
QPainter painter;
QString letter;
int themeSize = myResource->ThemeSize - 4;
int targetRank, targetFile;
if( orientation == 0 )
{
targetRank = 0;
targetFile = 0;
}
else
{
targetRank = 7;
targetFile = 7;
}
/* Draw Rank */
if( ( pos >> 3 ) == targetRank )
{
letter = QString( QString("abcdefgh").at( pos % 8 ) );
painter.begin( pic );
painter.setFont( myResource->FONT_Standard );
painter.setPen( myResource->COLOR_Notation_Shadow );
painter.drawText( 3, 3, themeSize, themeSize,
Qt::AlignRight | Qt::AlignBottom, letter );
painter.setPen( myResource->COLOR_Notation );
painter.drawText( 2, 2, themeSize, themeSize,
Qt::AlignRight | Qt::AlignBottom, letter );
painter.end();
}
/* Draw File */
if( ( pos % 8 ) == targetFile )
{
letter = QString( QString("12345678").at( pos >> 3 ) );
painter.begin( pic );
painter.setFont( myResource->FONT_Standard );
painter.setPen( myResource->COLOR_Black );
painter.drawText( 3, 3, themeSize, themeSize,
Qt::AlignLeft | Qt::AlignTop, letter );
painter.setPen( myResource->COLOR_White );
painter.drawText( 2, 2, themeSize, themeSize,
Qt::AlignLeft | Qt::AlignTop, letter );
painter.end();
}
}
///////////////////////////////////////
//
// board_2d::mouseReleaseEvent
//
///////////////////////////////////////
void board_2d::mouseReleaseEvent( QMouseEvent *event )
{
event->accept();
if( DragSprite != NULL )
{
/* Destroy any sprites being dragged */
int tmp = DragSprite->POSITION_Origin;
myBlit( DragSprite->POINT_LastUpdate,
&DragSprite->PIXMAP_FlipFrame,
DragSprite->PIXMAP_FlipFrame.rect() );
sprites.removeRef( DragSprite );
DragSprite = NULL;
drawPosition( tmp );
commit();
lastMoveWasDrag = TRUE;
}
if(event->button() == Qt::LeftButton)
{
emit leftClick( position( event->pos() ) );
}
if(event->button() == Qt::RightButton)
{
emit rightClick( position( event->pos() ) );
}
}
///////////////////////////////////////
//
// board_2d::mousePressEvent
//
///////////////////////////////////////
void board_2d::mousePressEvent( QMouseEvent *event )
{
pressPoint = event->pos();
event->accept();
}
///////////////////////////////////////
//
// board_2d::mouseMoveEvent
//
///////////////////////////////////////
void board_2d::mouseMoveEvent( QMouseEvent *event )
{
event->accept();
if( DragSprite == NULL )
{
if( event->state() & Qt::LeftButton )
{
if( abs( pressPoint.x() - event->pos().x() ) + abs( pressPoint.y() - event->pos().y() ) > 6 )
{
/* Begin Dragging a piece */
DragSprite = new sprite;
sprites.append( DragSprite );
DragSprite->POINT_Origin = pressPoint;
DragSprite->POSITION_Origin = position( pressPoint );
emit leftClick( DragSprite->POSITION_Origin ); // Tell match that we just clicked on this piece
if( myLogic->current[ DragSprite->POSITION_Origin ].Note != NOTE_SELECT )
{
/* The selection didn't take.. back out. */
sprites.removeRef( DragSprite );
DragSprite = NULL;
drawPosition( position( pressPoint ) );
commit();
return;
}
/* Get the piece image and store it in dragPix */
DragSprite->PIXMAP_Sprite = getChessman( DragSprite->POSITION_Origin );
DragSprite->PIXMAP_FlipFrame.resize( DragSprite->PIXMAP_Sprite.size() );
DragSprite->Restore = FALSE;
}
else
/* Not enough dragging */
return;
} // End ( event->state() & Qt::LeftButton )
else
return; /* No dragging. Most events should end up here */
}
int halfSize = myResource->ThemeSize >> 1;
DragSprite->POINT_Current.setX( event->x() - halfSize );
DragSprite->POINT_Current.setY( event->y() - halfSize );
commit();
}
///////////////////////////////////////
//
// board_2d::getChessman
//
///////////////////////////////////////
QPixmap board_2d::getChessman( const int &pos )
{
QPixmap tmp;
register char type, army;
if( pos == premoveTo )
{
type = myLogic->chessman[myLogic->current[premoveFrom].ManPtr].Type;
army = myLogic->chessman[myLogic->current[premoveFrom].ManPtr].Army;
}
else
{
type = myLogic->chessman[myLogic->current[pos].ManPtr].Type;
army = myLogic->chessman[myLogic->current[pos].ManPtr].Army;
}
switch( type )
{
case King:
if( army == WHITE )
tmp = cache->WhiteKing;
else
tmp = cache->BlackKing;
break;
case Queen:
if( army == WHITE )
tmp = cache->WhiteQueen;
else
tmp = cache->BlackQueen;
break;
case Bishop:
if( army == WHITE )
tmp = cache->WhiteBishop;
else
tmp = cache->BlackBishop;
break;
case Knight:
if( army == WHITE )
tmp = cache->WhiteKnight;
else
tmp = cache->BlackKnight;
break;
case Rook:
if( army == WHITE )
tmp = cache->WhiteRook;
else
tmp = cache->BlackRook;
break;
case Pawn:
if( army == WHITE )
tmp = cache->WhitePawn;
else
tmp = cache->BlackPawn;
break;
default:
break;
}
if( ( pos == premoveFrom ) || ( pos == premoveTo ) )
{
KIconEffect::semiTransparent( tmp );
}
return tmp;
}
///////////////////////////////////////
//
// board_2d::setPremovePositions
//
///////////////////////////////////////
void board_2d::setPremovePositions( const int &posF, const int &posT )
{
premoveFrom = posF;
premoveTo = posT;
if( ( posF != Null ) && ( posT != Null ) )
{
myLogic->current[posF].Note = NOTE_NONE;
myLogic->current[posT].Note = NOTE_NONE;
drawPosition( posF );
drawPosition( posT );
commit();
}
}
///////////////////////////////////////
//
// board_2d::commit
//
///////////////////////////////////////
void board_2d::commit( void )
{
drawSprites();
bitBlt( this, updateX1, updateY1, &myself, updateX1, updateY1, updateX2, updateY2, Qt::CopyROP );
updateX1 = updateY1 = 4000;
updateX2 = updateY2 = -4000;
}
///////////////////////////////////////
//
// board_2d::paintEvent
//
///////////////////////////////////////
void board_2d::paintEvent( QPaintEvent *event )
{
/* Paint the Widget */
bitBlt( this, event->rect().topLeft(), &myself, event->rect(), Qt::CopyROP );
}
///////////////////////////////////////
//
// board_2d::drawSprites
//
///////////////////////////////////////
void board_2d::drawSprites( void )
{
int index;
sprite *spritePtr;
/* Remove all sprites from the pixmap */
for( index = (signed int)sprites.count() - 1; index > -1; index-- )
{
spritePtr = sprites.at(index);
if( spritePtr->Restore == FALSE )
{
spritePtr->Restore = TRUE;
}
else
{
myBlit( spritePtr->POINT_LastUpdate,
&spritePtr->PIXMAP_FlipFrame,
spritePtr->PIXMAP_FlipFrame.rect() );
}
}
/* Redraw all sprites */
for( index = 0; index < (signed int)sprites.count(); index++ )
{
spritePtr = sprites.at(index);
if( ( spritePtr == DragSprite ) || ( spritePtr->Steps < MAX_STEPS ) )
{
/* Redraw Sprite */
bitBlt( &spritePtr->PIXMAP_FlipFrame,
0,
0,
&myself,
spritePtr->POINT_Current.x(),
spritePtr->POINT_Current.y(),
spritePtr->PIXMAP_FlipFrame.width(),
spritePtr->PIXMAP_FlipFrame.height(),
Qt::CopyROP );
myBlit( spritePtr->POINT_Current,
&spritePtr->PIXMAP_Sprite,
spritePtr->PIXMAP_Sprite.rect() );
spritePtr->POINT_LastUpdate = spritePtr->POINT_Current;
}
else
{
/* Animation finished */
int origin = spritePtr->POSITION_Origin;
int destination = spritePtr->POSITION_Destination;
int target = spritePtr->POSITION_TargetTaken;
sprites.removeRef( spritePtr );
drawPosition( origin );
drawPosition( destination );
drawPosition( target );
index = -1;
}
}
}
///////////////////////////////////////
//
// board_2d::updateSprites
//
///////////////////////////////////////
void board_2d::updateSprites( void )
{
if( myResource->OPTION_Animate_Moves )
{
for( int index = 0; index < (signed int)sprites.count(); index++ )
{
sprite *spritePtr = sprites.at( index );
if( spritePtr == DragSprite )
continue;
QTimer::singleShot( 0, this, SLOT( updateSprites() ) );
if( spritePtr->Steps < MAX_STEPS )
{
double factor = ( 1.0 / (double)MAX_STEPS ) * (double)spritePtr->Steps;
int newX = (int)( ( spritePtr->POINT_Destination.x() - spritePtr->POINT_Origin.x() ) * factor );
int newY = (int)( ( spritePtr->POINT_Destination.y() - spritePtr->POINT_Origin.y() ) * factor );
spritePtr->POINT_Current = spritePtr->POINT_Origin + QPoint( newX, newY );
spritePtr->Steps += sprites.count();
}
}
commit();
}
}
///////////////////////////////////////
//
// board_2d::isSprite
//
///////////////////////////////////////
bool board_2d::isSprite( const int &pos )
{
for( unsigned int index = 0; index < sprites.count(); index++ )
{
sprite *tmpSprite = sprites.at( index );
if( tmpSprite->POSITION_Origin == pos )
{
return TRUE;
}
}
return FALSE;
}
///////////////////////////////////////
//
// board_2d::myBlit
//
///////////////////////////////////////
void board_2d::myBlit( const QPoint &dp, const QPaintDevice *src, const QRect &sr )
{
bitBlt( &myself, dp.x(), dp.y(), src, sr.x(), sr.y(), sr.width(), sr.height(), Qt::CopyROP );
if( dp.x() < updateX1 )
updateX1 = dp.x();
if( dp.y() < updateY1 )
updateY1 = dp.y();
if( dp.x() + sr.width() > updateX2 )
updateX2 = dp.x() + sr.width();
if( dp.y() + sr.height() > updateX2 )
updateX2 = dp.y() + sr.height();
}

@ -0,0 +1,99 @@
/***************************************************************************
board_2d.h - description
-------------------
begin : Fri Feb 28 2003
copyright : (C) 2003 by The Knights Project
email : knights-general@lists.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef BOARD_2D_H
#define BOARD_2D_H
#include <board_base.h>
#include <qpixmap.h>
#include <qptrlist.h>
/**
*@author The Knights Team
*/
typedef struct sprite
{
bool Restore;
int Steps;
int POSITION_Origin;
int POSITION_Destination;
int POSITION_TargetTaken;
QPoint POINT_Origin;
QPoint POINT_Current;
QPoint POINT_LastUpdate;
QPoint POINT_Destination;
QPixmap PIXMAP_Sprite;
QPixmap PIXMAP_FlipFrame;
};
typedef QPtrList<sprite> SpriteList;
class KnightsPixCache;
class board_2d : public board_base
{
Q_OBJECT
public:
board_2d(QWidget *parent=0, const char *name=0, resource *Rsrc=0, logic *Lgc=0);
~board_2d();
virtual void drawMove( const ChessMove &chessMove, const bool &reverse=FALSE );
virtual void setPremovePositions( const int&, const int& );
virtual void redrawLights( void );
void paintEvent( QPaintEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseMoveEvent( QMouseEvent *event );
public slots:
virtual void resizeBoard( void );
virtual void redrawAll( void );
virtual void drawPosition( const int& );
virtual void commit( void );
protected:
void drawCoords( QPixmap *pic, const int &pos );
QPoint coords( const int&, const int&);
int position( const QPoint& );
void drawSprites( void );
QPixmap getChessman( const int &pos );
bool isSprite( const int &pos );
void myBlit( const QPoint &dp, const QPaintDevice *src, const QRect &sr );
protected slots:
void updateSprites( void );
private:
SpriteList sprites;
sprite *DragSprite;
KnightsPixCache *cache;
QPixmap myself;
QPoint pressPoint;
bool orientation;
bool lastMoveWasDrag;
bool init;
int updateX1;
int updateY1;
int updateX2;
int updateY2;
/* Premove Positions */
int premoveFrom;
int premoveTo;
};
#endif

@ -0,0 +1,125 @@
/***************************************************************************
board_base.cpp - description
-------------------
begin : Fri Feb 28 2003
copyright : (C) 2003 by The Knights Team
email : knights-general@lists.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "board_base.moc"
#include "resource.h"
#include "logic.h"
board_base::board_base(QWidget *parent, const char *name, resource *Rsrc, logic *Lgc ) : QWidget(parent,name)
{
/* Setup Variables */
myResource = Rsrc;
myLogic = Lgc;
paused = false;
flip = false;
localArmy = WHITE;
}
board_base::~board_base()
{
}
///////////////////////////////////////
//
// board_base::setPaused
//
///////////////////////////////////////
void board_base::setPaused( const bool &state )
{
paused = state;
redrawAll();
}
///////////////////////////////////////
//
// board_base::setLocalArmy
//
///////////////////////////////////////
void board_base::setLocalArmy( const bool &state )
{
if( state == localArmy )
return;
localArmy = state;
redrawAll();
}
///////////////////////////////////////
//
// board_base::flipBoard
//
///////////////////////////////////////
void board_base::flipBoard( void )
{
flip = !flip;
redrawAll();
}
///////////////////////////////////////
//
// board_base::drawMove
//
///////////////////////////////////////
void board_base::drawMove( const ChessMove&, const bool& )
{
/* Subclasses MUST reimplement this */
}
///////////////////////////////////////
//
// board_base::resizeBoard
//
///////////////////////////////////////
void board_base::resizeBoard( void )
{
/* Subclasses MUST reimplement this */
}
///////////////////////////////////////
//
// board_base::redrawAll
//
///////////////////////////////////////
void board_base::redrawAll( void )
{
/* Subclasses MUST reimplement this */
}
///////////////////////////////////////
//
// board_base::drawPosition
//
///////////////////////////////////////
void board_base::drawPosition( const int& )
{
}
///////////////////////////////////////
//
// board_base::setPremovePositions
//
///////////////////////////////////////
void board_base::setPremovePositions( const int&, const int& )
{
}
///////////////////////////////////////
//
// board_base::commit
//
///////////////////////////////////////
void board_base::commit( void )
{
}
///////////////////////////////////////
//
// board_base::redrawLights
//
///////////////////////////////////////
void board_base::redrawLights( void )
{
}

@ -0,0 +1,68 @@
/***************************************************************************
board_base.h - description
-------------------
begin : Fri Feb 28 2003
copyright : (C) 2003 by The Knights Project
email : knights-general@lists.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef BOARD_BASE_H
#define BOARD_BASE_H
#include <stdlib.h>
#include <qwidget.h>
#include "definitions.h"
/**
*@author The Knights Project
*/
class resource;
class logic;
class board_base : public QWidget
{
Q_OBJECT
public:
board_base(QWidget *parent=0, const char *name=0, resource *Rsrc=0, logic *Lgc=0);
virtual ~board_base();
virtual void drawMove( const ChessMove &chessMove, const bool &reverse=FALSE );
virtual void setPremovePositions( const int&, const int& );
virtual void redrawLights( void );
public slots:
virtual void resizeBoard( void );
virtual void redrawAll( void );
virtual void setPaused( const bool& );
virtual void setLocalArmy( const bool& );
virtual void drawPosition( const int& );
virtual void commit( void );
void flipBoard( void );
signals:
void leftClick( int );
void rightClick( int );
protected:
resource *myResource;
logic *myLogic;
bool paused;
bool localArmy;
bool flip;
protected:
inline bool color( const int &rank, const int &file )
{ return abs( ( rank % 2 ) - ( file % 2 ) ); }
};
#endif

@ -0,0 +1,37 @@
/***************************************************************************
game.cpp - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qapplication.h>
#include "challenge_game.h"
Challenge_Game::Challenge_Game(QString seeker, QString seeker_rating, QString match_kind, QString rated, QString time, QString incr, QString uid)
: _player(seeker), _match_type(match_kind), _is_rated(rated)
{
_id = uid.toInt();
if( seeker_rating == "++++" )
_player_rating = 0;
else
_player_rating = seeker_rating.toInt();
_clock = time.toInt();
_increment = incr.toInt();
if( _is_rated == "unrated" )
_rated = false;
else
_rated = true;
}

@ -0,0 +1,47 @@
/***************************************************************************
game.h - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef GAME_H
#define GAME_H
#include <qstring.h>
class Challenge_Game {
public:
Challenge_Game(QString seeker, QString seeker_rating, QString match_kind, QString rated, QString time, QString incr, QString uid);
public:
int id() { return _id; };
int clock() { return _clock; };
int increment() { return _increment; };
bool rated() { return _rated; };
int rating() { return _player_rating; };
QString _player;
QString _match_type;
QString _is_rated;
private:
int _id;
bool _rated;
int _player_rating;
int _clock;
int _increment;
};
#endif

@ -0,0 +1,460 @@
/***************************************************************************
challenge_graph.cpp - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <kiconloader.h>
#include <kstddirs.h>
#include <kpopupmenu.h>
#include <qapplication.h>
#include <qcanvas.h>
#include <qlabel.h>
#include <qpen.h>
#include <qscrollview.h>
#include <qwidget.h>
#include <qrect.h>
#include <qbrush.h>
#include <qpainter.h>
#include <qregexp.h>
#include "challenge_graph.moc"
#include "challenge_graph_view.h"
#include "challenge_rectangle.h"
#include "command.h"
#include "definitions.h"
/* SIZE is for the size of the challenge square. It could become a class variable */
#define SIZE 8
#define OFFSET 2
#define SPACER SIZE+OFFSET
///////////////////////////////////////
//
// Challenge_Graph::Constructor
//
///////////////////////////////////////
Challenge_Graph::Challenge_Graph( QWidget* parent, const char* name, resource *Rsrc )
: QVBox(parent, name), myResource(Rsrc)
{
max_rating = 2600;
max_time = 60;
seek = FALSE;
graph = new QCanvas( 0, "Challenge_Graph" );
myStatusBar = new QLabel( this, "Challenge_Graph_Status_Bar" );
myView = new Challenge_Graph_View( *graph, this, "Challenge_Graph_View", 0, myStatusBar );
QObject::connect(myView, SIGNAL(leftClick(int)), SLOT(selectMatch(int)));
QObject::connect(myView, SIGNAL(rightClick(Challenge_Game*, const QPoint&)), SLOT(display_menuSeek(Challenge_Game*, const QPoint&)));
/* Setup Style for myStatusBar */
myStatusBar->setAlignment( Qt::AlignAuto | Qt::AlignVCenter | Qt::SingleLine );
myStatusBar->setFrameStyle( QFrame::Panel | QFrame::Sunken );
clear();
menuSeek = new KPopupMenu( this );
menuSeek->setCheckable( TRUE );
menuSeek->insertItem( i18n("Seek Matches"), this, SLOT( menuFunct(int) ), 0, MENU_SEEK );
menuSeek->insertSeparator();
menuSeek->insertItem( i18n("Accept This Match"), this, SLOT( menuFunct(int) ), 0, MENU_ACCEPT_MATCH );
menuSeek->insertItem( i18n("Tell..."), this, SLOT( menuFunct(int) ), 0, MENU_TELL );
menuSeek->insertItem( i18n("Assess..."), this, SLOT( menuFunct(int) ), 0, MENU_ASSESS );
menuSeek->insertItem( i18n("Player Info"), this, SLOT( menuFunct(int) ), 0, MENU_FINGER );
menuSeek->insertItem( QIconSet( myResource->LoadIcon( QString("history"), KIcon::Small ) ),
i18n("Player History"), this, SLOT( menuFunct(int) ), 0, MENU_HISTORY );
menuSeek->insertSeparator();
menuSeek->insertItem( i18n("Add to Friends"), this, SLOT( menuFunct(int) ), 0, MENU_NOTIFY );
menuSeek->insertItem( i18n("Ignore This Player"), this, SLOT( menuFunct(int) ), 0, MENU_CENSOR );
menuSeek->setItemChecked( MENU_SEEK, FALSE );
}
///////////////////////////////////////
//
// Challenge_Graph::Destructor
//
///////////////////////////////////////
Challenge_Graph::~Challenge_Graph()
{
}
///////////////////////////////////////
//
// Challenge_Graph::resizeEvent
//
///////////////////////////////////////
void Challenge_Graph::resizeEvent( QResizeEvent *e )
{
if( e->size() != e->oldSize() )
{
QSize newsize = e->size();
x_size = newsize.width() - 8;
y_size = newsize.height() - myStatusBar->height();
graph->resize( x_size, y_size );
createBackground();
}
}
///////////////////////////////////////
//
// Challenge_Graph::add
//
///////////////////////////////////////
void Challenge_Graph::add(Challenge_Game *seek)
{
double AdjustedClock = (float)seek->clock() + ( ( (float)seek->increment() / 60.0 ) * 20.0 );
double my_x = (float)x_size / (float)max_time * AdjustedClock;
double mag = (float)max_rating / (float)y_size;
double my_y = ( max_rating - seek->rating() ) / mag;
//bleah
//a bit of a hack for the status bar real estate & values larger then MAX
if ( seek->rating() < 250)
my_y = (max_rating - 250) / mag;
else if ( seek->rating() >= max_rating )
my_y = 10;
if ( seek->clock() > (max_time-3) )
my_x = x_size/max_time * (max_time-3);
int time_control_x = (int)(my_x);
int rating_y = (int)(my_y);
if ( isEmpty(time_control_x, rating_y) )
drawChallenge(time_control_x, rating_y, seek->rated(), seek);
else
addTo_Nearest_Neighbour(time_control_x, rating_y, seek->rated(), seek);
}
///////////////////////////////////////
//
// Challenge_Graph::clear
//
///////////////////////////////////////
void Challenge_Graph::clear()
{
myView->reset();
graph->update();
}
///////////////////////////////////////
//
// Challenge_Graph::drawChallenge
//
///////////////////////////////////////
void Challenge_Graph::drawChallenge(int time_control_x, int rating_y, bool rated, Challenge_Game *challenge)
{
/* This next peice of unelegant code is fairly unnecessary. It is to keep everything on the screen */
/* It's based on the theory of prophylaxis */
int my_x = time_control_x;
int my_y = rating_y;
if( my_y >= y_size - SPACER)
my_y = y_size - SPACER;
if( my_y < SPACER )
my_y = SPACER;
if( my_x >= x_size - ( SPACER ) )
my_x = x_size - ( SPACER ); /*Since squares draw from the top left */
if( my_x < SPACER )
my_x = SIZE;
QCanvasPolygonalItem *item = new Challenge_Rectangle(my_x, my_y, SIZE, SIZE, graph, challenge);
item->setPen( myResource->COLOR_GraphForeground );
item->move( time_control_x, rating_y );
item->show();
if( rated )
item->setBrush( QBrush(myResource->COLOR_GraphForeground) );
else
item->setBrush( QBrush(myResource->COLOR_GraphBackground, Qt::SolidPattern) );
item->show();
graph->update();
}
///////////////////////////////////////
//
// Challenge_Graph::isEmpty
//
///////////////////////////////////////
bool Challenge_Graph::isEmpty(int x, int y)
{
QCanvasItemList l = graph->collisions( QRect(x, y, SIZE, SIZE) );
if( l.count() )
return false;
return true;
}
/* This function does a spiral search for the nearest neighbour */
/* Pre: TRUE
Post: Finds the nearest non-overlapping position to the original coordinates */
///////////////////////////////////////
//
// Challenge_Graph::addTo_Nearest_Neighbour
//
///////////////////////////////////////
bool Challenge_Graph::addTo_Nearest_Neighbour(int orig_x, int orig_y, bool rated, Challenge_Game * challenge, int searchdepth)
{
int right = 1;
int down = 2;
int left = 2;
int up = 3;
int x = orig_x;
int y = orig_y - ( SIZE + OFFSET );
/* Check the location on top*/
if ( isEmpty( x, y ) )
{
drawChallenge( x, y, rated, challenge );
return true;
}
/* Now search in a spiral */
while( right < searchdepth )
{
for( int i = 0; i < right; i++ )
{
x += SPACER;
if( isEmpty( x, y ) )
{
drawChallenge( x, y, rated, challenge );
return true;
}
}
for( int i = 0; i < down; i++ )
{
y += SPACER;
if( isEmpty( x, y ) )
{
drawChallenge( x, y, rated, challenge );
return true;
}
}
for( int i = 0; i < left; i++ )
{
x -= SPACER;
if( isEmpty( x, y) )
{
drawChallenge( x, y, rated, challenge );
return true;
}
}
for( int i = 0; i < up; i++ )
{
y -= SPACER;
if( isEmpty( x, y ) )
{
drawChallenge( x, y, rated, challenge );
return true;
}
}
/* Grow the spiral bounds */
right += 2;
down += 2;
left += 2;
up += 2;
}
return false;
}
///////////////////////////////////////
//
// Challenge_Graph::createBackground
//
///////////////////////////////////////
void Challenge_Graph::createBackground( void )
{
QPainter painter;
QColor ink;
QWMatrix matrix;
int colorTotal;
background.resize( y_size, x_size );
background.fill( myResource->COLOR_GraphBackground );
/* Find out if we have a dark bgcolor or a light one. */
colorTotal = ( myResource->COLOR_GraphBackground.red() +
myResource->COLOR_GraphBackground.blue() +
myResource->COLOR_GraphBackground.green() );
/* Set our ink to something that will contrast well */
if( colorTotal < 384 ) // 384 = 50% gray
ink = myResource->COLOR_GraphBackground.light();
else
ink = myResource->COLOR_GraphBackground.dark();
/* Paint the text on */
painter.begin( &background );
painter.setFont( myResource->FONT_Standard );
painter.setPen( ink );
painter.drawText( 64, 12, i18n( "Rating" ) );
painter.end();
matrix.rotate( -90.0 );
background = background.xForm( matrix );
painter.begin( &background );
painter.setFont( myResource->FONT_Standard );
painter.setPen( ink );
painter.drawText( 64, y_size - 8, i18n( "Time" ) );
painter.end();
graph->setBackgroundPixmap( background );
}
///////////////////////////////////////
//
// Challenge_Graph::selectMatch
//
///////////////////////////////////////
void Challenge_Graph::selectMatch( int matchID )
{
if( matchID )
emit sendCMD( Command( 0, CMD_Start_Match, QString::number( matchID ) ) );
}
///////////////////////////////////////
//
// Challenge_Graph::menuFunct
//
///////////////////////////////////////
void Challenge_Graph::menuFunct( int funct )
{
switch( funct )
{
case MENU_SEEK:
emit sendCMD( Command( 0, CMD_Toggle_Seek ) );
break;
case MENU_FINGER:
emit sendCMD( Command( 0, CMD_Player_Finger, selectedPlayerName ) );
break;
case MENU_TELL:
emit sendCMD( Command( 0, CMD_Set_Input, QString( "tell %1 " ).arg( selectedPlayerName ) ) );
break;
case MENU_NOTIFY:
emit sendCMD( Command( 0, CMD_Add_Friend, selectedPlayerName ) );
break;
case MENU_CENSOR:
emit sendCMD( Command( 0, CMD_Ignore_Player, selectedPlayerName ) );
break;
case MENU_HISTORY:
emit sendCMD( Command( 0, CMD_Player_History, selectedPlayerName ) );
break;
case MENU_ACCEPT_MATCH:
emit sendCMD( Command( 0, CMD_Start_Match, QString::number( selectedMatchID ) ) );
break;
case MENU_ASSESS:
emit sendCMD( Command( 0, CMD_Assess, selectedPlayerName ) );
break;
default:
break;
}
}
///////////////////////////////////////
//
// Challenge_Graph::updateSoughtList
//
///////////////////////////////////////
void Challenge_Graph::updateSoughtList( void )
{
unsigned int loop;
Challenge_Game *cg;
clear();
for( loop = 0; loop < SF_01.count(); loop++ )
{
cg = new Challenge_Game( SF_01[loop],
SF_02[loop],
SF_03[loop],
SF_04[loop],
SF_05[loop],
SF_06[loop],
SF_07[loop] );
add( cg );
}
SF_01.clear();
SF_02.clear();
SF_03.clear();
SF_04.clear();
SF_05.clear();
SF_06.clear();
SF_07.clear();
seek = TRUE;
}
///////////////////////////////////////
//
// Challenge_Graph::addSoughtItem
//
///////////////////////////////////////
void Challenge_Graph::addSoughtItem( const QString &src )
{
QStringList fields = QStringList::split( QChar(' '), src, FALSE );
SF_01 << fields[2]; // Name
SF_02 << fields[1]; // Rating
SF_03 << fields[6]; // Match Type
SF_04 << fields[5]; // Is Rated?
SF_05 << fields[3]; // Base Time
SF_06 << fields[4]; // Increment
SF_07 << fields[0]; // ID#
}
///////////////////////////////////////
//
// Challenge_Graph::display_menuSeek
//
///////////////////////////////////////
void Challenge_Graph::display_menuSeek( Challenge_Game *Item, const QPoint &Pos )
{
bool enable;
if( Item != NULL )
{
selectedPlayerName = Item->_player.replace( QRegExp("\\(.+\\)"), QString("") );
selectedMatchID = Item->id();
enable = TRUE;
}
else
{
enable = FALSE;
}
menuSeek->setItemChecked( MENU_SEEK, seek );
menuSeek->setItemEnabled( MENU_FINGER, enable );
menuSeek->setItemEnabled( MENU_TELL, enable );
menuSeek->setItemEnabled( MENU_NOTIFY, enable );
menuSeek->setItemEnabled( MENU_CENSOR, enable );
menuSeek->setItemEnabled( MENU_HISTORY, enable );
menuSeek->setItemEnabled( MENU_ACCEPT_MATCH, enable );
menuSeek->setItemEnabled( MENU_ASSESS, enable );
menuSeek->popup( Pos );
}
///////////////////////////////////////
//
// Challenge_Graph::recvCMD
//
///////////////////////////////////////
void Challenge_Graph::recvCMD( const Command& command )
{
switch(((Command)command).getCommand())
{
case CMD_Add_Sought_Match:
addSoughtItem( ((Command)command).getData() );
break;
case CMD_Show_Sought_List:
updateSoughtList();
break;
case CMD_Hide_Sought_List:
clear();
seek = FALSE;
break;
default:
break;
}
}

@ -0,0 +1,93 @@
/***************************************************************************
challenge_graph.h - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CHALLENGE_GRAPH_H
#define CHALLENGE_GRAPH_H
#include <qstringlist.h>
#include <qvbox.h>
#include <qevent.h>
#include <qcolor.h>
#include "resource.h"
#include "challenge_game.h"
class KPopupMenu;
class QCanvas;
class QLabel;
class Challenge_Graph_View;
class Command;
class Challenge_Graph : public QVBox
{
Q_OBJECT
public:
Challenge_Graph(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
virtual ~Challenge_Graph();
void resizeEvent( QResizeEvent* );
void add( Challenge_Game *seek );
void clear();
signals:
void sendCMD( const Command& );
public slots:
void recvCMD( const Command& );
void display_menuSeek( Challenge_Game*, const QPoint& );
void selectMatch( int );
void menuFunct( int );
protected:
virtual bool isEmpty( int x, int y );
void drawChallenge( int time_control_x, int rating_y, bool rated, Challenge_Game *challenge );
bool addTo_Nearest_Neighbour( int orig_x, int orig_y, bool rated, Challenge_Game *challenge, int searchdepth=10 );
void createBackground( void );
void addSoughtItem( const QString& );
void updateSoughtList( void );
private:
int x_size;
int y_size;
int max_rating;
int max_time;
bool seek;
resource *myResource;
QCanvas *graph;
Challenge_Graph_View *myView;
QLabel *myStatusBar;
QPixmap background;
KPopupMenu *menuSeek;
int selectedMatchID;
QString selectedPlayerName;
/*
These StringLists temporarily store Sought Game data
until all ads have been displayed.
*/
QStringList SF_01;
QStringList SF_02;
QStringList SF_03;
QStringList SF_04;
QStringList SF_05;
QStringList SF_06;
QStringList SF_07;
};
#endif

@ -0,0 +1,112 @@
/***************************************************************************
challenge_graph_view.cpp - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <string>
#include <qpoint.h>
#include <qstring.h>
#include "challenge_graph_view.moc"
#include "challenge_graph.h"
#include "challenge_rectangle.h"
///////////////////////////////////////
//
// Challenge_Graph_View::Constructor
//
///////////////////////////////////////
Challenge_Graph_View::Challenge_Graph_View(QCanvas& c, QWidget * parent,const char* name, WFlags f, QLabel *qsb)
: QCanvasView(&c,parent,name,f), canvas(c), statusbar(qsb)
{
setHScrollBarMode( QScrollView::AlwaysOff );
setVScrollBarMode( QScrollView::AlwaysOff );
if ( parent )
parent->installEventFilter( this );
QScrollView::viewport()->setMouseTracking(true);
}
///////////////////////////////////////
//
// Challenge_Graph_View::Destructor
//
///////////////////////////////////////
Challenge_Graph_View::~Challenge_Graph_View()
{
}
///////////////////////////////////////
//
// Challenge_Graph_View::contentsMousePressEvent
//
///////////////////////////////////////
void Challenge_Graph_View::contentsMousePressEvent(QMouseEvent* e)
{
QCanvasItemList l = canvas.collisions(e->pos());
QCanvasItemList::Iterator it = l.begin();
for(; it != l.end(); ++it )
{
Challenge_Rectangle *cr = dynamic_cast<Challenge_Rectangle *>(*it);
Challenge_Game *g = cr->getGame();
if( e->button() == Qt::LeftButton )
emit leftClick( g->id() );
if( e->button() == Qt::RightButton )
emit rightClick( g, e->globalPos() );
return;
}
if( e->button() == Qt::RightButton )
emit rightClick( NULL, e->globalPos() ); // We need to catch all right clicks
}
///////////////////////////////////////
//
// Challenge_Graph_View::reset
//
///////////////////////////////////////
void Challenge_Graph_View::reset()
{
QCanvasItemList list = canvas.allItems();
QCanvasItemList::Iterator it = list.begin();
for(; it != list.end(); ++it )
{
Challenge_Rectangle *cr = dynamic_cast<Challenge_Rectangle *>(*it);
Challenge_Game *g = cr->getGame();
delete g;
if ( *it )
delete *it;
}
}
///////////////////////////////////////
//
// Challenge_Graph_View::contentsMouseMoveEvent
//
///////////////////////////////////////
void Challenge_Graph_View::contentsMouseMoveEvent(QMouseEvent* e)
{
QString match;
QCanvasItemList l = canvas.collisions(e->pos());
QCanvasItemList::Iterator it = l.begin();
for(; it!=l.end(); ++it)
{
Challenge_Rectangle *cr = dynamic_cast<Challenge_Rectangle *>(*it);
Challenge_Game *g = cr->getGame();
match = i18n( " Name: %1 Rating: %2 Match Type: %3 %4 Base Time: %5 Increment: %6" )
.arg( g->_player ).arg( g->rating() ).arg( g->_match_type ).arg( g->_is_rated )
.arg( g->clock() ).arg( g->increment() );
break;
}
statusbar->setText( match );
}

@ -0,0 +1,50 @@
/***************************************************************************
challenge_graph_view.h - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CHALLENGE_GRAPH_VIEW_H
#define CHALLENGE_GRAPH_VIEW_H
#include <qevent.h>
#include <qcanvas.h>
#include <qlabel.h>
#include "challenge_game.h"
class Challenge_Graph_View : public QCanvasView
{
Q_OBJECT
public:
Challenge_Graph_View(QCanvas&, QWidget* parent=0, const char* name=0, WFlags f=0, QLabel *qsb=0);
~Challenge_Graph_View();
void reset();
signals:
void leftClick(int);
void rightClick(Challenge_Game*, const QPoint&);
protected:
void contentsMousePressEvent(QMouseEvent*);
void contentsMouseMoveEvent(QMouseEvent*);
void updateStatusBar(QString msg);
private:
QCanvas &canvas;
QLabel *statusbar;
};
#endif

@ -0,0 +1,34 @@
/***************************************************************************
challenge_rectangle.cpp - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "challenge_rectangle.h"
Challenge_Rectangle::Challenge_Rectangle
(int x, int y, int width, int height, QCanvas * canvas, Challenge_Game * ptr)
: QCanvasRectangle(x,y,width,height,canvas), challenge(ptr)
{
}
Challenge_Game* Challenge_Rectangle::getGame()
{
return challenge;
}
Challenge_Rectangle::~Challenge_Rectangle()
{
this->hide();
}

@ -0,0 +1,36 @@
/***************************************************************************
challenge_rectangle.h - description
-------------------
begin : Mon Jan 7 2002
copyright : (C) 2003 by Eric Faccer
email : e.faccer@qut.edu.au
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CHALLENGE_RECTANGLE_H
#define CHALLENGE_RECTANGLE_H
#include <qcanvas.h>
#include "challenge_game.h"
class Challenge_Rectangle : public QCanvasRectangle
{
public:
Challenge_Rectangle(int x=0, int y=0, int width=0, int height=0, QCanvas * canvas=0, Challenge_Game * ptr=0);
~Challenge_Rectangle();
Challenge_Game* getGame();
private:
Challenge_Game * challenge;
};
#endif

@ -0,0 +1,195 @@
/***************************************************************************
chessclock.cpp - description
-------------------
begin : Mon Jul 2 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "chessclock.moc"
#include "audio.h"
chessclock::chessclock(QWidget *parent, const char *name, resource *Rsrc ) : QWidget(parent,name)
{
Resource = Rsrc;
Silent = TRUE;
WhiteIndex = 0;
BlackIndex = 0;
Flag[WHITE] = FALSE;
Flag[BLACK] = FALSE;
whiteClock = " 0:00:00 ";
blackClock = " 0:00:00 ";
}
chessclock::~chessclock()
{
}
///////////////////////////////////////
//
// chessclock::Set
//
///////////////////////////////////////
void chessclock::Set( const int WhiteSec, const int BlackSec, const bool onMove )
{
/* these times are in centi seconds */
White.Seconds = WhiteSec / 10;
Black.Seconds = BlackSec / 10;
ArmyOnMove = onMove;
}
///////////////////////////////////////
//
// chessclock::Reset
//
///////////////////////////////////////
void chessclock::Reset( void )
{
Pause();
WhiteIndex = 0;
BlackIndex = 0;
White = Resource->TCPWhite[WhiteIndex];
Black = Resource->TCPBlack[BlackIndex];
White.Seconds *= 10;
White.Increment *= 10;
Black.Seconds *= 10;
Black.Increment *= 10;
ArmyOnMove = WHITE;
External = FALSE;
UpdateStrings();
}
///////////////////////////////////////
//
// chessclock::Pause
//
///////////////////////////////////////
void chessclock::Pause( void )
{
Silent = TRUE;
}
///////////////////////////////////////
//
// chessclock::Resume
//
///////////////////////////////////////
void chessclock::Resume( void )
{
Silent = FALSE;
}
///////////////////////////////////////
//
// chessclock::getCentiseconds
//
///////////////////////////////////////
int chessclock::getCentiseconds( const bool Army )
{
if( Army == WHITE )
{
return White.Seconds * 10;
}
return Black.Seconds * 10;
}
///////////////////////////////////////
//
// chessclock::Moved
//
///////////////////////////////////////
void chessclock::Moved( void )
{
Pause();
if( ArmyOnMove == WHITE )
{
ArmyOnMove = BLACK;
White.Moves--;
White.Seconds += White.Increment;
if( White.Moves < 1 )
{
WhiteIndex++;
if( WhiteIndex == (signed)Resource->TCPWhite.count() ) WhiteIndex--;
White = Resource->TCPWhite[WhiteIndex];
White.Seconds *= 10;
White.Increment *= 10;
}
}
else
{
ArmyOnMove = WHITE;
Black.Moves--;
Black.Seconds += Black.Increment;
if( Black.Moves < 1 )
{
BlackIndex++;
if( BlackIndex == (signed)Resource->TCPBlack.count() ) BlackIndex--;
Black = Resource->TCPBlack[BlackIndex];
Black.Seconds *= 10;
Black.Increment *= 10;
}
}
Resume();
}
///////////////////////////////////////
//
// chessclock::Tick
//
///////////////////////////////////////
void chessclock::Tick( void )
{
if( Silent ) return;
if( ArmyOnMove == WHITE )
{
White.Seconds--;
if( ( White.Seconds < 0 ) && ( Flag[WHITE] == FALSE ) )
{
Flag[WHITE] = TRUE;
emit flagFell( WHITE );
Resource->play( SND_FLAG );
}
}
else
{
Black.Seconds--;
if( ( Black.Seconds < 0 ) && ( Flag[BLACK] == FALSE ) )
{
Flag[BLACK] = TRUE;
emit flagFell( BLACK );
Resource->play( SND_FLAG );
}
}
UpdateStrings();
}
///////////////////////////////////////
//
// chessclock::UpdateStrings
//
///////////////////////////////////////
void chessclock::UpdateStrings( void )
{
int tmp;
int h, m, s;
char sign;
sign = ' ';
if( White.Seconds < 0 ) sign = '-';
tmp = abs(White.Seconds / 10);
s = ( tmp % 60 );
m = ( ( tmp / 60 ) % 60 );
h = ( ( tmp / 60 ) / 60 );
whiteClock.sprintf( " %c%.1d:%.2d:%.2d ", sign, h, m, s );
sign = ' ';
if( Black.Seconds < 0 ) sign = '-';
tmp = abs(Black.Seconds / 10);
s = ( tmp % 60 );
m = ( ( tmp / 60 ) % 60 );
h = ( ( tmp / 60 ) / 60 );
blackClock.sprintf( " %c%.1d:%.2d:%.2d ", sign, h, m, s );
}

@ -0,0 +1,75 @@
/***************************************************************************
chessclock.h - description
-------------------
begin : Mon Jul 2 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CHESSCLOCK_H
#define CHESSCLOCK_H
#include <qwidget.h>
#include <qstring.h>
#include <stdlib.h>
#include "definitions.h"
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class chessclock : public QWidget
{
Q_OBJECT
public:
chessclock( QWidget *parent=0, const char *name=0, resource *Rsrc=0 );
~chessclock();
/* The Set function accepts Centiseconds ( 1/100 second ) */
void Set( const int WhiteSec, const int BlackSec, const bool onMove );
void Reset( void );
void Pause( void );
void Resume( void );
void Moved( void );
int getCentiseconds( const bool Army );
QString whiteClock;
QString blackClock;
bool Silent;
bool Flag[2];
public slots:
void Tick( void );
signals:
void flagFell( const bool );
private:
resource *Resource;
TCP White;
TCP Black;
int WhiteIndex;
int BlackIndex;
bool ArmyOnMove;
bool External;
void UpdateStrings( void );
};
#endif

@ -0,0 +1,98 @@
/***************************************************************************
command.cpp - description
-------------------
begin : Sun Jun 30 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "command.h"
Command::Command( int ID, int Command, int WhiteTime, int BlackTime, struct ChessMove Move )
{
white_time = WhiteTime;
black_time = BlackTime;
move = Move;
id = ID;
command = Command;
}
Command::Command( int ID, int Command, int WhiteTime, int BlackTime, struct ChessMove Move, QString Data )
{
white_time = WhiteTime;
black_time = BlackTime;
data = Data;
move = Move;
id = ID;
command = Command;
}
Command::Command( int ID, int Command, int WhiteTime, int BlackTime, QString Data )
{
white_time = WhiteTime;
black_time = BlackTime;
data = Data;
id = ID;
command = Command;
}
Command::Command( int ID, int Command )
{
clear();
id = ID;
command = Command;
}
Command::Command( int ID, int Command, QString Data )
{
clear();
id = ID;
command = Command;
data = Data;
}
Command::Command()
{
clear();
}
Command::~Command()
{
}
void Command::clear(void)
{
white_time = 0;
black_time = 0;
command = CMD_None;
clearMove( &move );
}
///////////////////////////////////////
//
// Command::clearMove
//
///////////////////////////////////////
void Command::clearMove( ChessMove *Move )
{
Move->fromFile = Null;
Move->fromRank = Null;
Move->toFile = Null;
Move->toRank = Null;
Move->Promote = Null;
Move->ManTaken = Null;
Move->NAG = 0;
Move->ICS_MoveCounter = 0;
Move->ICS_PawnPushFile = Null;
Move->ICS_Mode = Null;
Move->ICS_OnMove = 0;
Move->ICS_ClockTicking = TRUE;
}

@ -0,0 +1,194 @@
/***************************************************************************
command.h - description
-------------------
begin : Sun Jun 30 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef COMMAND_H
#define COMMAND_H
#include <qstring.h>
#include "definitions.h"
/**
*@author Alexander Wels.
*/
/* Commands */
/*
These constants represent the game's desire to send the IOs a command.
SendCMD will convert them to the correct command for the current protocol.
*/
const int CMD_None = 0x00000000;
const int CMD_Init = 0x00000001;
const int CMD_NewGame = 0x00000002;
const int CMD_Exit = 0x00000003;
const int CMD_MoveNow = 0x00000004;
const int CMD_Pause = 0x00000005;
const int CMD_Resume = 0x00000006;
const int CMD_Move = 0x00000007;
const int CMD_Illegal = 0x00000008;
const int CMD_Play_White = 0x00000009;
const int CMD_Play_Black = 0x0000000a;
const int CMD_Result_White = 0x0000000b;
const int CMD_Result_Black = 0x0000000c;
const int CMD_Result_Draw = 0x0000000d;
const int CMD_Your_Time = 0x0000000e;
const int CMD_Enemy_Time = 0x0000000f;
const int CMD_Offer_Draw = 0x00000010;
const int CMD_Ponder = 0x00000011;
const int CMD_No_Pondering = 0x00000012;
const int CMD_Book_Mode = 0x00000013;
const int CMD_Out_Of_Book = 0x00000014;
const int CMD_Check_Book = 0x00000015;
const int CMD_Retract_Move = 0x00000016;
const int CMD_Hint = 0x00000017;
const int CMD_Listen = 0x00000018;
const int CMD_Play = 0x00000019;
const int CMD_Tell_User = 0x0000001a;
const int CMD_Tell_User_Error = 0x0000001b;
const int CMD_White_Resign = 0x0000001c;
const int CMD_Black_Resign = 0x0000001d;
const int CMD_White_Called_Flag = 0x0000001e;
const int CMD_Black_Called_Flag = 0x0000001f;
const int CMD_Set_Depth = 0x00000020;
const int CMD_Set_Board = 0x00000021;
const int CMD_Set_Difficulty = 0x00000022;
const int CMD_Tell_Opponent = 0x00000023;
const int CMD_Tell_Others = 0x00000024;
const int CMD_Tell_All = 0x00000025;
const int CMD_Tell_ICS = 0x00000026;
const int CMD_Set_Name = 0x00000028;
/* Engine Specific */
const int CMD_UCI_Hint = 0x00100001;
const int CMD_Send_SIGTERM = 0x00100002;
const int CMD_Send_SIGINT = 0x00100003;
/* Internet specific commands */
const int CMD_Reject_Draw = 0x01000001;
const int CMD_Reset_Server = 0x01000002;
const int CMD_Examine_Forward = 0x01000003;
const int CMD_Examine_Backward = 0x01000004;
const int CMD_Lost_Contact = 0x01000005;
const int CMD_Bad_Login = 0x01000006;
const int CMD_Toggle_Seek = 0x01000007;
const int CMD_Assess = 0x01000008;
const int CMD_Player_Finger = 0x01000009;
const int CMD_Player_History = 0x0100000a;
const int CMD_Add_Friend = 0x0100000b;
const int CMD_Ignore_Player = 0x0100000c;
const int CMD_Start_Match = 0x0100000d;
/* These commands are from Match to Core ONLY */
const int CMD_New_Players = 0x02000001;
/* These commands are sent to ICS Related Widgets */
const int CMD_Add_Sought_Match = 0x03000001;
const int CMD_Show_Sought_List = 0x03000002;
const int CMD_Hide_Sought_List = 0x03000003;
const int CMD_Set_Input = 0x03000004;
const int CMD_Set_Src_Tell = 0x03000005;
const int CMD_Set_Src_Channel = 0x03000006;
const int CMD_Append_To_Console = 0x03000007;
const int CMD_Send_To_ICS = 0x03000008;
class Command
{
protected:
int white_time; // Centiseconds
int black_time; // Centiseconds
struct ChessMove move;
int command;
int id;
QString data; // Generic String... used for ICS and FEN, etc.
public:
Command( int ID, int Command );
Command( int ID, int Command, QString Data );
Command( int ID, int Command, int WhiteTime, int BlackTime, struct ChessMove Move );
Command( int ID, int Command, int WhiteTime, int BlackTime, struct ChessMove Move, QString Data );
Command( int ID, int Command, int WhiteTime, int BlackTime, QString Data );
Command();
~Command();
void clear( void );
/* Static Public Members */
static void clearMove( struct ChessMove *Move );
/* Inline Members */
int getWhiteTime( void )
{
return white_time;
}
int getBlackTime( void )
{
return black_time;
}
struct ChessMove& getMove( void )
{
return move;
}
int getID( void )
{
return id;
}
int getCommand( void )
{
return command;
}
QString& getData( void )
{
return data;
}
void setWhiteTime( int time )
{
white_time = time;
}
void setBlackTime( int time )
{
black_time = time;
}
void setMove( struct ChessMove &NewMove )
{
move = NewMove;
}
void setID( int NewID )
{
id = NewID;
}
void setCommand( int &NewCommand )
{
command = NewCommand;
}
void setData( QString &NewData )
{
data = NewData;
}
};
#endif

@ -0,0 +1,264 @@
/***************************************************************************
console.cpp - description
-------------------
begin : Sun May 27 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "console.moc"
#include "knightstextview.h"
#include "accel.h"
#include "tabmanager.h"
/* KDE */
#include <klineedit.h>
#include <kiconloader.h>
#include <qregexp.h>
#include <qstyle.h>
Console::Console(QWidget *parent,
const char *name,
resource *Rsrc ) : QVBox(parent,name)
{
myResource = Rsrc;
SelfMoving = FALSE;
QStyle& Style = QApplication::style();
margin = Style.defaultFrameWidth();
myTextView = new KnightsTextView( this, myResource );
myLineEdit = new KLineEdit( this, "console_edit" );
/* Configure misc */
setBG();
myTextView->setStaticBackground( FALSE );
connect( myLineEdit, SIGNAL( returnPressed( const QString& ) ), this, SLOT( getText( const QString& ) ) );
connect( myResource->myAccel, SIGNAL( history_prev() ), this, SLOT( historyBackward() ) );
connect( myResource->myAccel, SIGNAL( history_next() ), this, SLOT( historyForward() ) );
connect( myResource->myAccel, SIGNAL( page_up() ), this, SLOT( pageUp() ) );
connect( myResource->myAccel, SIGNAL( page_down() ), this, SLOT( pageDown() ) );
connect( myResource->myAccel, SIGNAL( kibitz() ), this, SLOT( kibitz() ) );
connect( myResource->myAccel, SIGNAL( whisper() ), this, SLOT( whisper() ) );
connect( myResource->myAccel, SIGNAL( reply_tell() ), this, SLOT( replyPrivate() ) );
connect( myResource->myAccel, SIGNAL( reply_channel() ), this, SLOT( replyChannel() ) );
connect( myResource->myAccel, SIGNAL( focus() ), this, SLOT( getFocus() ) );
connect( myResource->myAccel, SIGNAL( focus( const QChar& ) ), this, SLOT( getFocus( const QChar& ) ) );
myTextView->show();
myLineEdit->show();
show();
}
Console::~Console()
{
delete myLineEdit;
delete myTextView;
}
///////////////////////////////////////
//
// Console::pageDown
//
///////////////////////////////////////
void Console::pageDown( void )
{
myTextView->pageMove( Qt::Key_PageDown );
}
///////////////////////////////////////
//
// Console::pageUp
//
///////////////////////////////////////
void Console::pageUp( void )
{
myTextView->pageMove();
}
///////////////////////////////////////
//
// Console::recvCMD
//
///////////////////////////////////////
void Console::recvCMD( const Command& command )
{
QString modText; /* this will hold the text to append after it has been modified with anchors */
switch(((Command)command).getCommand())
{
case CMD_Append_To_Console:
if( myTextView->contentsY() >= ( myTextView->contentsHeight() - myTextView->visibleHeight() - 12 ) )
{
modText = insertTags(((Command)command).getData());
myTextView->append(modText);
myTextView->scrollToBottom();
}
else
{
modText = insertTags(((Command)command).getData());
myTextView->append(modText);
}
break;
case CMD_Set_Input:
myLineEdit->setText( ((Command)command).getData() );
if( !myLineEdit->hasFocus() )
getFocus();
break;
case CMD_Set_Src_Tell:
lastPrivateSource = ((Command)command).getData();
break;
case CMD_Set_Src_Channel:
lastChannelSource = ((Command)command).getData();
break;
default:
break;
}
}
///////////////////////////////////////
//
// Console::getText
//
///////////////////////////////////////
void Console::getText( const QString &text )
{
/* Append this text into our history */
history.append( text );
if( history.count() > 100 )
history.remove( history.begin() );
historyIT = history.end();
emit sendCMD( Command( 0, CMD_Send_To_ICS, text ) );
myLineEdit->clear();
}
///////////////////////////////////////
//
// Console::historyBack
//
///////////////////////////////////////
void Console::historyBackward( void )
{
if( history.count() && ( historyIT != history.begin() ) )
{
historyIT--;
myLineEdit->setText( (*historyIT) );
}
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::historyForward
//
///////////////////////////////////////
void Console::historyForward( void )
{
if( history.count() && ( historyIT != history.end() ) )
{
historyIT++;
myLineEdit->setText( (*historyIT) );
}
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::replyPrivate
//
///////////////////////////////////////
void Console::replyPrivate( void )
{
myLineEdit->setText( QString( "tell %1 " ).arg( lastPrivateSource ) );
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::replyChannel
//
///////////////////////////////////////
void Console::replyChannel( void )
{
myLineEdit->setText( QString( "tell %1 " ).arg( lastChannelSource ) );
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::kibitz
//
///////////////////////////////////////
void Console::kibitz( void )
{
myLineEdit->setText( QString( "kibitz " ) );
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::whisper
//
///////////////////////////////////////
void Console::whisper( void )
{
myLineEdit->setText( QString( "whisper " ) );
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::getFocus
//
///////////////////////////////////////
void Console::getFocus( void )
{
if( myLineEdit->hasFocus() )
{
getText( myLineEdit->text() );
}
setActiveWindow();
myResource->tabManager->showTab( this );
myLineEdit->setFocus();
}
void Console::getFocus( const QChar &c )
{
myLineEdit->setText( myLineEdit->text() + QString( c ) );
if( !myLineEdit->hasFocus() )
getFocus();
}
///////////////////////////////////////
//
// Console::setBG
//
///////////////////////////////////////
void Console::setBG( void )
{
myTextView->setPaper( QBrush( myResource->COLOR_Background ) );
}
///////////////////////////////////////
//
// Console::insertTags(QString data)
//
///////////////////////////////////////
QString Console::insertTags(QString data)
{
QRegExp hyperLinks("(http://(?:.)+(?:\\.(?:[^\\s\\r\\t<])+)+)");
QRegExp mailLinks("\\b((?:\\w|\\d)+\\@(?:\\w|\\d)+(?:\\.(?:\\d|\\w)+)+)\\b");
int pos = 0;
pos = hyperLinks.search(data, 0);
if(pos >= 0)
{
data.replace(hyperLinks, "<A HREF=\"" + hyperLinks.cap(0) + "\">" + hyperLinks.cap(0) + "</A>");
}
pos = mailLinks.search(data, 0);
if(pos >= 0)
{
data.replace(mailLinks, "<A HREF=\"mailto:" + mailLinks.cap(0) + "\">" + mailLinks.cap(0) + "</A>");
}
return data;
}

@ -0,0 +1,87 @@
/***************************************************************************
console.h - description
-------------------
begin : Sun May 27 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CONSOLE_H
#define CONSOLE_H
/* Qt */
#include <qstringlist.h>
#include <qvbox.h>
#include <qlayout.h>
/* Local */
#include "definitions.h"
#include "resource.h"
#include "command.h"
/**
*@author Troy Corbin Jr.
*/
class KLineEdit;
class KnightsTextView;
class Console : public QVBox
{
Q_OBJECT
public:
enum Direction
{
Up = 1,
Down = 0
};
Console(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~Console();
void buildAccel( void );
public slots:
void recvCMD( const Command& );
void getText( const QString& );
void historyBackward( void );
void historyForward( void );
void pageUp( void );
void pageDown( void );
void getFocus( void );
void getFocus( const QChar& );
void setBG( void );
void replyPrivate( void );
void replyChannel( void );
void kibitz( void );
void whisper( void );
signals:
void sendCMD( const Command& );
private:
QString insertTags(QString);
resource *myResource;
int margin;
bool SelfMoving;
KnightsTextView *myTextView;
KLineEdit *myLineEdit;
QStringList history;
QStringList::Iterator historyIT;
QString lastPrivateSource;
QString lastChannelSource;
};
#endif

@ -0,0 +1,892 @@
/***************************************************************************
core.cpp - description
-------------------
begin : Tue Oct 2 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* KDE */
#include <kfiledialog.h>
#include <kmessagebox.h>
/* Qt */
#include <qpushbutton.h>
/* Local */
#include "core.moc"
#include "match.h"
#include "list_pgn.h"
#include "thinbuttons.h"
#include "io_engine.h"
#include "io_internet.h"
#include "match_param.h"
/* Tabs */
#include "tabmanager.h"
///////////////////////////////////////
//
// core::core
//
///////////////////////////////////////
core::core(QWidget *parent, const char *name, resource *Rsrc ) : QWidget(parent,name)
{
myResource = Rsrc;
listPGN = NULL;
currentMatch = NULL;
myButtonGroup = new thinbuttons( this, "ButtonGroup", myResource );
myButtonGroup->show();
connect( myButtonGroup, SIGNAL( leftClick(int) ), this, SLOT( setMatch(int) ) );
connect( myButtonGroup, SIGNAL( menuItemSelected(int,int) ), this, SLOT( thinButtonMenu(int,int) ) );
myCoreClock.start( 100, FALSE );
resize();
}
///////////////////////////////////////
//
// core::~core
//
///////////////////////////////////////
core::~core()
{
myCoreClock.stop();
delete myButtonGroup;
}
///////////////////////////////////////
//
// core::createNewIO
//
///////////////////////////////////////
void core::createNewIO( int type, int ID, int side, int str )
{
io_internet *internetioPtr = NULL;
io_engine *engineioPtr = NULL;
// io_email *ioEmailPtr = NULL;
switch( type )
{
/* PLAYERTCP */
case PLAYERTCP:
if( ID == Null )
{
/* Create a NEW internetIO */
internetioPtr = new io_internet( this, myResource );
myIOMap.add( ID, internetioPtr );
internetioPtr->setID( ID );
connect( internetioPtr, SIGNAL( sendCMD( const Command& ) ), this, SLOT( command2Match( const Command& ) ) );
}
else
{
/* Use an existing internetIO */
internetioPtr = (io_internet*) myIOMap.find(Null);
if( internetioPtr == NULL )
{
kdWarning() << "core::createNewIO: Trying to connect a match to an internetIO that doesn't exsist." << endl;
}
else
{
myIOMap.add( ID, internetioPtr );
}
}
break;
/* PLAYEREXAMINE */
case PLAYEREXAMINE:
/* examine mode needs only 1 io mapped to it */
if( ID == Null )
{
/* Create a NEW internetIO */
internetioPtr = new io_internet( this, myResource );
myIOMap.add( ID, internetioPtr );
internetioPtr->setID( ID );
connect( internetioPtr, SIGNAL( sendCMD( const Command& ) ), this, SLOT( command2Match( const Command& ) ) );
}
else
{
internetioPtr = (io_internet*) myIOMap.find(ID);
if( internetioPtr == NULL )
{
/* no io mapped to the ID yet, use the internetio */
/* Use an existing internetIO */
internetioPtr = (io_internet*) myIOMap.find(Null);
if( internetioPtr == NULL )
{
kdWarning() << "core::createNewIO: Trying to connect a match to an internetIO that doesn't exsist." << endl;
}
else
{
myIOMap.add( ID, internetioPtr );
}
}
/* this ID is already mapped we don't need another one */
}
break;
/* PLAYERPC */
case PLAYERPC:
engineioPtr = new io_engine( this, myResource );
myIOMap.add( ID, engineioPtr );
engineioPtr->setID( ID );
connect( engineioPtr, SIGNAL( sendCMD( const Command& ) ), this, SLOT( command2Match( const Command& ) ) );
engineioPtr->Start( side );
engineioPtr->recvCMD( Command( ID, CMD_Set_Difficulty, QString().setNum( 1 << str ) ) );
break;
/* PLAYEREMAIL */
case PLAYEREMAIL:
// ioEmailPtr = new io_email( this, myResource );
// myIOMap.add( ID, ioEmailPtr );
// ioEmailPtr->setID( ID );
// connect( ioEmailPtr, SIGNAL( sendCMD( const Command& ) ), this, SLOT( command2Match( const Command& ) ) );
break;
default:
/* No IO needed */
break;
}
}
///////////////////////////////////////
//
// core::newMatch(match_params* param);
//
///////////////////////////////////////
match* core::newMatch( match_param* param )
{
match *match_ptr = NULL;
int newID;
/* create a new ID for the match */
newID = myIDManager.getNewID();
/* Create the match navigation button */
myButtonGroup->create( newID );
/* Create the match */
match_ptr = new match(this, param, myResource);
match_ptr->setID( newID );
myMatchMap.add( newID, match_ptr );
/* Create IOs */
createNewIO( param->type(WHITE), newID, WHITE, param->strength(WHITE) );
createNewIO( param->type(BLACK), newID, BLACK, param->strength(BLACK) );
/* Connect Signals */
connect( match_ptr, SIGNAL( sendCMD( const Command& ) ), this, SLOT( command2IO( const Command& ) ) );
connect( &myCoreClock, SIGNAL( timeout() ), match_ptr, SLOT( tick() ) );
/* Set this new match as the current match */
setMatch( newID );
setActiveWindow();
/* Save our configuration settings */
myResource->ConfigWrite();
return match_ptr;
}
///////////////////////////////////////
//
// core::setMatch
//
///////////////////////////////////////
void core::setMatch( int ID )
{
/*
Disconnect the current match from the display
*/
if( currentMatch != NULL )
{
currentMatch->setCurrent( FALSE );
disconnect( currentMatch, SIGNAL( setClocks() ), this, SLOT( slot_setClocks() ) );
disconnect( currentMatch, SIGNAL( setStatusBar( const int&, const QString& ) ), this, SLOT( slot_setStatusBar( const int&, const QString& ) ) );
disconnect( currentMatch, SIGNAL( setNotation() ), this, SLOT( slot_setNotation() ) );
currentMatch->setVisibility( FALSE );
}
/*
Now display the new match, and connect it's signals to the GUI
*/
currentMatch = myMatchMap.find( ID );
currentMatch->setVisibility( TRUE );
myButtonGroup->setButton( ID );
connect( currentMatch, SIGNAL( setClocks() ), this, SLOT( slot_setClocks() ) );
connect( currentMatch, SIGNAL( setStatusBar( const int&, const QString& ) ), this, SLOT( slot_setStatusBar( const int&, const QString& ) ) );
connect( currentMatch, SIGNAL( setNotation() ), this, SLOT( slot_setNotation() ) );
currentMatch->setCurrent( TRUE );
emit requestResize();
emit initMatch();
currentMatch->resendStatusBar();
/* Give Ourselves Focus */
setActiveWindow();
topLevelWidget()->raise();
}
///////////////////////////////////////
//
// core::clearAll
//
///////////////////////////////////////
bool core::clearAll( void )
{
while( myMatchMap.count() )
{
if( clearMatch() != TRUE ) return FALSE;
}
return TRUE;
}
///////////////////////////////////////
//
// core::clearMatch
//
///////////////////////////////////////
bool core::clearMatch( int id )
{
match *departingMatch, *nextMatch;
io_base *ioPtr;
if( id == Null )
{
if( currentMatch != NULL )
{
id = currentMatch->getID();
}
else
{
return FALSE;
}
}
departingMatch = myMatchMap.find(id);
/* A bad ID was passed */
if( departingMatch == NULL )
{
kdError() << "core::clearMatch: Bad matchID " << id << " could not be cleared." << endl;
return FALSE;
}
/* Save if needed */
if( departingMatch->modified() )
{
if( save( id, TRUE, FALSE ) == FALSE )
{
return FALSE;
}
}
/* Get ID of another match so it can become the current match */
if( departingMatch == currentMatch )
{
/* Find another match in the map */
nextMatch = --myMatchMap;
if( nextMatch == NULL )
{
++myMatchMap;
nextMatch = ++myMatchMap;
}
/* Set the new current match */
if( nextMatch != NULL )
{
setMatch( nextMatch->getID() );
}
else
{
currentMatch = NULL;
emit initMatch();
}
}
/* Remove IOs in this match... */
ioPtr = myIOMap.find(id);
while( ioPtr != NULL )
{
myIOMap.remove( id );
if( ioPtr->getType() != io_base::INTERNET )
{
delete ioPtr;
}
ioPtr = myIOMap.find(id);
}
/* ...and remove the match */
myMatchMap.remove( id );
myButtonGroup->remove( id );
delete departingMatch;
resize();
return TRUE;
}
///////////////////////////////////////
//
// core::resize
//
///////////////////////////////////////
void core::resize( void )
{
int size = 8 + ( 1 * ( myResource->ThemeBorder == TRUE ) );
if( currentMatch != NULL )
{
currentMatch->resize();
myButtonGroup->resize( currentMatch->width() );
myButtonGroup->move( 0, currentMatch->height() );
setFixedSize( currentMatch->width(), currentMatch->height() + myButtonGroup->height() );
}
else
{
myButtonGroup->resize( myResource->ThemeSize * size );
myButtonGroup->move( 0, myResource->ThemeSize * size );
setFixedSize( myResource->ThemeSize * size, ( myResource->ThemeSize * size ) + myButtonGroup->height() );
}
}
///////////////////////////////////////
//
// core::command2IO
//
///////////////////////////////////////
void core::command2IO( const Command &command )
{
io_base *io;
int id = ((Command)command).getID();
io = myIOMap.find(id);
while( io != NULL )
{
io->recvCMD(command);
io = myIOMap.findNext();
}
}
///////////////////////////////////////
//
// core::command2Match
//
///////////////////////////////////////
void core::command2Match( const Command &command )
{
match_param *paramPtr;
match *matchPtr;
Command cmd = command;
matchPtr = myMatchMap.find( cmd.getID() );
while( matchPtr != NULL )
{
/* Catch Commands Meant for Core */
switch( cmd.getCommand() )
{
case CMD_Hint:
KMessageBox::information( this, cmd.getData(), i18n("Hint") );
break;
case CMD_Tell_User:
KMessageBox::information( this, cmd.getData(), i18n( "Tell User" ) );
break;
case CMD_Tell_User_Error:
KMessageBox::sorry( this, cmd.getData(), i18n( "Tell User Error" ) );
break;
case CMD_Tell_Opponent:
paramPtr = matchPtr->getParam();
if( ( paramPtr->type( WHITE ) == PLAYERLOCAL ) ||
( paramPtr->type( BLACK ) == PLAYERLOCAL ) )
KMessageBox::information( this, cmd.getData(), i18n( "Tell Opponent" ) );
else
command2IO( command );
break;
case CMD_Tell_Others:
command2IO( command );
break;
case CMD_Tell_ICS:
command2IO( command );
break;
case CMD_Tell_All:
paramPtr = matchPtr->getParam();
if( ( paramPtr->type( WHITE ) == PLAYERLOCAL ) ||
( paramPtr->type( BLACK ) == PLAYERLOCAL ) )
KMessageBox::information( this, cmd.getData(), i18n( "Tell All" ) );
command2IO( command );
break;
case CMD_Out_Of_Book:
// engine[enginePtr - 1]->sendCMD( CMD_Check_Book );
break;
default:
/* Just send it to the Match */
matchPtr->recvCMD( command );
break;
}
matchPtr = myMatchMap.findNext();
}
}
///////////////////////////////////////
//
// core::flag
//
///////////////////////////////////////
bool core::flag( const bool Army )
{
if( currentMatch == NULL ) return FALSE;
return currentMatch->flag( Army );
return false;
}
///////////////////////////////////////
//
// core::clock
//
///////////////////////////////////////
QString core::clock( const bool Army )
{
if( currentMatch == NULL ) return QString::null;
return currentMatch->clock( Army );
return "";
}
///////////////////////////////////////
//
// core::modified
//
///////////////////////////////////////
bool core::modified( void )
{
if( currentMatch == NULL ) return FALSE;
return currentMatch->modified();
return false;
}
///////////////////////////////////////
//
// core::paused
//
///////////////////////////////////////
bool core::paused( void )
{
if( currentMatch == NULL ) return FALSE;
return currentMatch->paused();
return false;
}
///////////////////////////////////////
//
// core::isOnline
//
///////////////////////////////////////
bool core::isOnline( void )
{
unsigned int index;
for( index=0; index < myIOMap.count(); index++ )
{
if( myIOMap[index]->getType() == io_base::INTERNET )
{
return TRUE;
}
}
return FALSE;
}
///////////////////////////////////////
//
// core::onMove
//
///////////////////////////////////////
char core::onMove( void )
{
if( currentMatch == NULL ) return Null;
return currentMatch->onMove();
}
///////////////////////////////////////
//
// core::caption
//
///////////////////////////////////////
QString core::caption( void )
{
QButton *Button;
if( currentMatch == NULL ) return QString::null;
Button = myButtonGroup->find( currentMatch->getID() );
if( Button != NULL ) Button->setText( currentMatch->caption() );
return currentMatch->caption();
}
///////////////////////////////////////
//
// core::whiteInput
//
///////////////////////////////////////
char core::whiteInput(void)
{
if( currentMatch == NULL ) return Null;
return currentMatch->input(WHITE);
}
///////////////////////////////////////
//
// core::blackInput
//
///////////////////////////////////////
char core::blackInput(void)
{
if( currentMatch == NULL ) return Null;
return currentMatch->input(BLACK);
}
///////////////////////////////////////
//
// core::review
//
///////////////////////////////////////
void core::review( int Index )
{
if( currentMatch == NULL ) return;
currentMatch->review( Index );
}
///////////////////////////////////////
//
// core::inputOnMove
//
///////////////////////////////////////
char core::inputOnMove( bool reverse )
{
if( currentMatch == NULL ) return Null;
return currentMatch->inputOnMove( reverse );
}
///////////////////////////////////////
//
// core::notation
//
///////////////////////////////////////
QStringList* core::notation( void )
{
if( currentMatch == NULL ) return NULL;
return currentMatch->notation();
}
///////////////////////////////////////
//
// core::slot_setNotation
//
///////////////////////////////////////
void core::slot_setNotation( void )
{
emit setNotation();
}
///////////////////////////////////////
//
// core::slot_setStatusBar
//
///////////////////////////////////////
void core::slot_setStatusBar( const int &ID, const QString& MSG )
{
emit setStatusBar( ID, MSG );
}
///////////////////////////////////////
//
// core::slot_setClocks
//
///////////////////////////////////////
void core::slot_setClocks( void )
{
emit setClocks();
}
///////////////////////////////////////
//
// core::print
//
///////////////////////////////////////
void core::print( int ID )
{
match *m2p;
if( ID == Null )
{
m2p = currentMatch;
}
else
{
m2p = myMatchMap.find( ID );
}
if( m2p == NULL ) return;
m2p->print();
return;
}
///////////////////////////////////////
//
// core::load
//
///////////////////////////////////////
bool core::load( void )
{
const QString fileFilter( "*.pgn *.Pgn *.PGN|Portable Game Notation (.pgn)\n*|All Files" );
QString URL;
URL = KFileDialog::getOpenFileName( QString::null, QString( fileFilter ), this, i18n( "Load PGN..." ) );
if( URL.isEmpty() ) return FALSE;
return load( URL );
}
bool core::load( const QString &IncURL )
{
listPGN = new list_pgn( 0, "listPGN" );
myResource->tabManager->addTab( listPGN, IncURL.section( '/', -1 ) );
connect( listPGN, SIGNAL( selected( const QString&, const int& ) ), this, SLOT( load( const QString&, const int& ) ) );
listPGN->setURL( IncURL );
return TRUE;
}
bool core::load( const QString &url, const int &pos )
{
newMatch( new match_param( myResource, PLAYERLOAD, PLAYERLOAD ) );
return currentMatch->load( url, pos );
}
///////////////////////////////////////
//
// core::save
//
///////////////////////////////////////
bool core::save( const int ID, const bool Prompt, const bool SaveAs )
{
const QString fileFilter( "*.pgn *.Pgn *.PGN|Portable Game Notation (.pgn)\n*|All Files" );
match *match2bSaved;
int answer;
QString URL;
if( ID == Null )
{
/* Use current match */
match2bSaved = currentMatch;
}
else
{
match2bSaved = myMatchMap.find( ID );
}
if( match2bSaved == NULL ) return FALSE;
if( Prompt )
{
/* Prompt for the save */
myResource->ConfigWrite();
answer = KMessageBox::warningYesNoCancel( this,
i18n("Would you like to save this match?"),
i18n("Save Match?"),
QString::null,
QString::null,
QString("PromptForSaving") );
myResource->ConfigRead();
if( answer == KMessageBox::Cancel )
{
return FALSE;
}
if( answer == KMessageBox::No )
{
return TRUE;
}
}
/* Get the last URL we used */
URL = match2bSaved->url();
if( ( URL.isEmpty() ) || ( SaveAs ) )
{
/* Get a new URL */
URL = KFileDialog::getSaveFileName( QString::null, QString( fileFilter ), this, i18n( "Save Match..." ) );
if( URL.isNull() )
{
return FALSE;
}
if( URL.findRev( ".pgn", -1, FALSE ) == -1 )
{
URL += ".pgn";
}
}
if( match2bSaved->save( URL ) == FALSE )
{
emit setStatusBar( SAVE_ERROR );
return FALSE;
}
emit setStatusBar( SAVE_OK );
match2bSaved->setModified( FALSE );
return TRUE;
}
///////////////////////////////////////
//
// core::matchMenu
//
///////////////////////////////////////
void core::matchMenu( int opt )
{
unsigned int index;
switch(opt)
{
/* Offer / Accept Draw */
case MENU_OFFER_DRAW: // Fall Through
case MENU_ACCEPT_DRAW:
if( whiteInput() == PLAYERLOCAL )
{
command2Match( Command( currentMatch->getID(), CMD_Offer_Draw, QString("W") ) );
}
if( blackInput() == PLAYERLOCAL )
{
command2Match( Command( currentMatch->getID(), CMD_Offer_Draw, QString("B") ) );
}
command2IO( Command( currentMatch->getID(), CMD_Offer_Draw ) );
break;
/* Reject Draw */
case MENU_REJECT_DRAW:
command2IO( Command( currentMatch->getID(), CMD_Reject_Draw ) );
break;
/* Resign */
case MENU_RESIGN:
if( ( whiteInput() == PLAYERLOCAL ) && ( currentMatch->onMove() == WHITE ) )
{
command2IO( Command( currentMatch->getID(), CMD_White_Resign ) );
currentMatch->recvCMD( Command( currentMatch->getID(), CMD_White_Resign ) );
}
if( ( blackInput() == PLAYERLOCAL ) && ( currentMatch->onMove() == BLACK ) )
{
command2IO( Command( currentMatch->getID(), CMD_Black_Resign ) );
currentMatch->recvCMD( Command( currentMatch->getID(), CMD_Black_Resign ) );
}
break;
/* Retract */
case MENU_RETRACT:
command2IO( Command( currentMatch->getID(), CMD_Retract_Move ) );
currentMatch->retract();
currentMatch->retract();
emit setNotation();
if( onMove() == WHITE )
emit setStatusBar( WHITE_TURN );
else
emit setStatusBar( BLACK_TURN );
break;
/* Move Now */
case MENU_MOVE_NOW:
command2IO( Command( currentMatch->getID(), CMD_MoveNow ) );
break;
/* Hint */
case MENU_HINT:
currentMatch->requestHint();
break;
/* Orientation */
case MENU_ORIENTATION:
currentMatch->flip();
break;
/* Ponder */
case MENU_PONDER:
if( myResource->OPTION_Ponder )
{
command2IO( Command( currentMatch->getID(), CMD_Ponder ) );
}
else
{
command2IO( Command( currentMatch->getID(), CMD_No_Pondering ) );
}
break;
/* Pause */
case MENU_PAUSE:
currentMatch->setPaused( !currentMatch->paused() );
if( currentMatch->paused() )
{
command2IO( Command( currentMatch->getID(), CMD_Pause ) );
}
else
{
command2IO( Command( currentMatch->getID(), CMD_Resume ) );
}
break;
/* Pause All */
case MENU_PAUSEALL:
if( myMatchMap.count() )
{
for( index = 0; index < myMatchMap.count(); index++ )
{
if( ( whiteInput() == PLAYERTCP ) || ( blackInput() == PLAYERTCP ) )
continue;
myMatchMap[index]->setPaused( !myMatchMap[index]->paused() );
if( myMatchMap[index]->paused() )
{
command2IO( Command( currentMatch->getID(), CMD_Pause ) );
}
else
{
command2IO( Command( currentMatch->getID(), CMD_Resume ) );
}
}
}
break;
/* Call Flag */
case MENU_CALL_FLAG:
if( whiteInput() == PLAYERLOCAL )
{
command2IO( Command( currentMatch->getID(), CMD_White_Called_Flag ) );
currentMatch->recvCMD( Command( currentMatch->getID(), CMD_White_Called_Flag ) );
}
if( blackInput() == PLAYERLOCAL )
{
command2IO( Command( currentMatch->getID(), CMD_Black_Called_Flag ) );
currentMatch->recvCMD( Command( currentMatch->getID(), CMD_Black_Called_Flag ) );
}
break;
default:
break;
}
}
///////////////////////////////////////
//
// core::thinButtonMenu
//
///////////////////////////////////////
void core::thinButtonMenu( int id, int item )
{
switch( item )
{
case MENU_SAVE:
save( id, FALSE, FALSE );
break;
case MENU_SAVEAS:
save( id, FALSE, TRUE );
break;
case MENU_PRINT:
print( id );
break;
case MENU_CLOSE:
clearMatch( id );
break;
default:
break;
}
}
///////////////////////////////////////
//
// core::resetServer
//
///////////////////////////////////////
void core::resetServer( void )
{
command2IO( Command( Null, CMD_Reset_Server ) );
}
///////////////////////////////////////
//
// core::goOffline()
//
///////////////////////////////////////
void core::goOffline(void)
{
unsigned int index(0);
io_base *ioPtr(NULL);
while( index < myIOMap.count() )
{
if( myIOMap[index]->getType() == io_base::INTERNET )
{
ioPtr = myIOMap[index];
if( myIOMap.keyAt(index) != Null )
{
clearMatch( myIOMap.keyAt(index) );
}
else
{
myIOMap.remove( Null );
}
index = 0;
continue;
}
index++;
}
if( ioPtr != NULL )
delete ioPtr;
}

@ -0,0 +1,107 @@
/***************************************************************************
core.h - description
-------------------
begin : Tue Oct 2 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CORE_H
#define CORE_H
#include <qwidget.h>
#include <qtimer.h>
#include "definitions.h"
#include "resource.h"
#include "knightsmap.h"
#include "idmanager.h"
#include "io_base.h"
class list_pgn;
class thinbuttons;
class match;
class match_param;
/**
*@author Troy Corbin Jr.
*/
typedef KnightsMap<int, match*> MatchMap;
typedef KnightsMap<int, io_base*> IOMap;
class core : public QWidget
{
Q_OBJECT
public:
core(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~core();
QStringList* notation( void );
QString caption( void );
bool modified( void );
bool paused( void );
bool isOnline( void );
bool flag( const bool );
char onMove( void );
char whiteInput( void );
char blackInput( void );
char inputOnMove( bool reverse=FALSE );
void createNewIO( int type, int ID, int side=BLACK, int str=0 );
void goOffline(void);
public slots:
match* newMatch( match_param* );
bool clearMatch( int id=Null );
bool clearAll( void );
void setMatch( int );
void command2IO( const Command& );
void command2Match( const Command& );
void resetServer( void );
void matchMenu( int );
void resize( void );
bool save( const int ID, const bool Prompt, const bool SaveAs );
bool load( void );
bool load( const QString& );
bool load( const QString&, const int& );
void slot_setNotation( void );
void slot_setClocks( void );
void slot_setStatusBar( const int&, const QString& );
void print( int ID=Null );
void review( int );
QString clock( const bool );
signals:
void requestResize( void );
void setStatusBar( const int &ID, const QString& MSG=QString::null );
void setNotation( void );
void setClocks( void );
void initMatch( void );
void serverDestroyed( void );
protected:
bool findMatch( const int );
void serverSelfDestruct( void );
protected slots:
void thinButtonMenu( int id, int item );
private:
IDManager myIDManager;
resource *myResource;
QTimer myCoreClock;
thinbuttons *myButtonGroup;
list_pgn *listPGN;
IOMap myIOMap;
MatchMap myMatchMap;
match *currentMatch;
};
#endif

@ -0,0 +1,292 @@
/***************************************************************************
definitions.h - description
-------------------
begin : Sun Jul 1 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _DEFINITIONS_H
#define _DEFINITIONS_H
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif
#ifndef _VERSION_
# define _VERSION_ "0.6"
#endif
#define IMAGE_MAX 144
#define IMAGE_MIN 32
#define CONFIG_VERSION 1
#include <kdebug.h>
#include <qvaluelist.h>
/*
These are used to define the game's states.
*/
const int WHITE = 0x00;
const int BLACK = 0x01;
const int WHITE_HELPER = 0x02;
const int BLACK_HELPER = 0x03;
const int BOTH = 0x04;
const int PLAYERPC = 0x00; // Chess Engine
const int PLAYEREMAIL = 0x01; // Email Opponent
const int PLAYERTCP = 0x02; // Internet Chess Engine
const int PLAYERLOAD = 0x03; // Load from PGN
/* Add a mask of 0x10 to players that accept user input */
const int PLAYERLOCAL = 0x10; // Human sitting at the PC
const int PLAYEREXAMINE = 0x11; // ICS Examine Mode
const int ENGINE_WHITE = 0x01;
const int ENGINE_WHITE_BK = 0x02;
const int ENGINE_BLACK = 0x04;
const int ENGINE_BLACK_BK = 0x08;
/* Menu Entries */
/*
These represent the various choices found
throughout the game's menubar.
*/
/* File Menu */
const int MENU_NEWGAME = 0x01;
const int MENU_LOAD = 0x02;
const int MENU_SAVE = 0x03;
const int MENU_SAVEAS = 0x04;
const int MENU_PRINT = 0x05;
const int MENU_QUIT = 0x06;
const int MENU_CLOSE = 0x08;
const int MENU_CLOSEALL = 0x09;
const int MENU_CONNECT = 0x0A;
/* Options Menu */
const int MENU_BINDINGS_DIALOG = 0x13;
const int MENU_SETTINGS_DIALOG = 0x14;
const int MENU_INSTALL_THEMES = 0x15;
/* New Games Menu */
const int MENU_SOLITARE = 0x21;
const int MENU_VS_PC = 0x22;
const int MENU_VS_TCPIP = 0x23;
const int MENU_VS_EMAIL = 0x24;
const int MENU_PC_VS_PC = 0x25;
/* Match Menu */
const int MENU_RETRACT = 0x31;
const int MENU_DRAW = 0x32;
const int MENU_MOVE_NOW = 0x33;
const int MENU_HINT = 0x34;
const int MENU_PONDER = 0x35;
const int MENU_PAUSE = 0x36;
const int MENU_PAUSEALL = 0x37;
const int MENU_ORIENTATION = 0x38;
const int MENU_RESIGN = 0x39;
const int MENU_CALL_FLAG = 0x3A;
/* Draw Menu */
const int MENU_OFFER_DRAW = 0x41;
const int MENU_ACCEPT_DRAW = 0x42;
const int MENU_REJECT_DRAW = 0x43;
const int MENU_IGNORE_DRAW = 0x44;
/* Seek Menu */
const int MENU_SEEK = 0x51;
const int MENU_FINGER = 0x52;
const int MENU_TELL = 0x53;
const int MENU_NOTIFY = 0x54;
const int MENU_ACCEPT_MATCH = 0x55;
const int MENU_CENSOR = 0x56;
const int MENU_HISTORY = 0x57;
const int MENU_ASSESS = 0x58;
/* View Menu */
const int MENU_COPY = 0x61;
const int MENU_SELECT_ALL = 0x62;
const int MENU_CLEAR_ALL = 0x63;
const int MENU_FIND = 0x64;
const int MENU_FIND_NEXT = 0x65;
const int MENU_ZOOM_IN = 0x66;
const int MENU_ZOOM_OUT = 0x67;
/* Tutorial Menu */
const int MENU_OPEN_TUTORIAL = 0x71;
/* Messages */
/*
The following constants define messages
viewed in the statusbar.
*/
const int READY = 0x00000000;
const int WHITE_TURN = 0x00000001;
const int BLACK_TURN = 0x00000002;
const int WHITE_WIN = 0x00000003;
const int BLACK_WIN = 0x00000004;
const int GAME_DRAW = 0x00000005;
const int GAME_50_MOVES = 0x00000006;
const int WAITING = 0x00000007;
const int ILLEGAL_MOVE = 0x00000008;
const int NO_MOVE_WHILE_REVIEW = 0x00000009;
const int LOAD_OK = 0x00000010;
const int SAVE_OK = 0x00000011;
const int PAUSED = 0x00000012;
const int READING_FILE = 0x00000013;
const int WHITE_DRAW_OFFER = 0x00000014;
const int BLACK_DRAW_OFFER = 0x00000015;
const int LOAD_ERROR = 0x00000020;
const int SAVE_ERROR = 0x00000021;
const int BOOK_ERROR_1 = 0x00000022;
const int BOOK_ERROR_2 = 0x00000023;
const int BOOK_ERROR_3 = 0x00000024;
const int BOOK_ERROR_4 = 0x00000025;
const int ENGINE_DIED_ERROR = 0x00000026;
const int WHITE_RESIGN = 0x00000027;
const int BLACK_RESIGN = 0x00000028;
const int WHITE_FLAG = 0x00000029;
const int BLACK_FLAG = 0x00000030;
const int WHITE_CALL_FLAG = 0x00000031;
const int BLACK_CALL_FLAG = 0x00000032;
const int WHITE_CHECKMATE = 0x00000033;
const int BLACK_CHECKMATE = 0x00000034;
const int LOST_CONTACT = 0x00000035;
const int COMMENT = 0x00010000;
const int ERROR = 0x00100000;
/* Variations */
/*
These define the variations on chess
that can be supported.
*/
const int Type_Standard = 0x00000001;
const int Type_WildCastle = 0x00000002;
const int Type_NoCastle = 0x00000004;
const int Type_FischerRandom = 0x00000008;
const int Type_BugHouse = 0x00000010;
const int Type_CrazyHouse = 0x00000020;
const int Type_Losers = 0x00000040;
const int Type_Suicide = 0x00000080;
const int Type_Giveaway = 0x00000100;
const int Type_TwoKings = 0x00000200;
const int Type_Atomic = 0x00000400;
const int Type_Kriegspiel = 0x00000800;
const int Type_ThreeCheck = 0x00001000;
/* Protocols */
const int XBoard = 0x02;
const int UCI = 0x04;
/* Events */
/*
These constants represent QEvent types.
*/
const int EVENT_Del_IO_Net = 0x000003e9;
/* Position Notes */
/*
These represent the various NOTES that can appear on a
given position
*/
const char NOTE_NONE = 0x00;
const char NOTE_HIGHLIGHT = 0x01;
const char NOTE_SELECT = 0x02;
const char NOTE_MOVE = 0x10;
const char NOTE_CASTLE = 0x11;
const char NOTE_PAWN_DOUBLE = 0x12;
const char NOTE_ATTACK = 0x20;
const char NOTE_ENPASSANT = 0x21;
/* Chessmen */
/*
These represent the various chessmen, or Types of chessmen
found on the playing board.
*/
const char Null = -1;
const char King = 0;
const char Queen = 1;
const char Bishop = 2;
const char Knight = 3;
const char Rook = 4;
const char Pawn = 5;
/* ICS Game Modes */
const char ICS_Normal = 0;
const char ICS_Examine = 1;
const char ICS_Observe = 2;
const char ICS_Movelist = 3;
typedef struct ThemeHeader
{
QString name;
QString version;
QString author;
QString authorEmail;
QString authorWWW;
QString notes;
};
typedef struct ChessMove
{
char fromFile;
char fromRank;
char toFile;
char toRank;
char Promote;
char ManTaken;
char SAN[8];
char CAN[6];
unsigned char NAG;
/* Following used for ICS Only */
char ICS_Mode;
char ICS_PawnPushFile;
int ICS_MoveCounter;
bool ICS_OnMove;
bool ICS_ClockTicking;
};
typedef struct Chessman
{
bool Army;
char Type;
char File;
char Rank;
};
typedef struct Position
{
char File;
char Rank;
char ManPtr;
char Note;
};
/* Time Control Period */
typedef struct TCP
{
int Moves;
int Seconds;
int Increment;
};
typedef QValueList<TCP> TCPList;
#endif

@ -0,0 +1,159 @@
/***************************************************************************
dlg_challenge.cpp - description
-------------------
begin : Sun Jan 20 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qregexp.h>
#include "dlg_challenge.moc"
dlg_challenge::dlg_challenge(QWidget *parent, const char *name, resource *Rsrc ) :
KDialogBase( parent,
name,
FALSE,
i18n("You've Been Challenged:"),
User1|User2,
Ok,
TRUE,
i18n("Accept"),
i18n("Decline") )
{
Resource = Rsrc;
BOX_Parent = makeVBoxMainWidget();
LABEL_Headline = new QLabel( BOX_Parent );
COMBO_Rated = new KComboBox( BOX_Parent );
BOX_Time = new QHBox( BOX_Parent );
BOX_White = new QGroupBox( 2, Qt::Horizontal, "-", BOX_Time );
BOX_WhiteBase = new QSpinBox( BOX_White );
LABEL_WhiteBase = new QLabel( BOX_White );
BOX_WhiteInc = new QSpinBox( BOX_White );
LABEL_WhiteInc = new QLabel( BOX_White );
BOX_Black = new QGroupBox( 2, Qt::Horizontal, "-", BOX_Time );
BOX_BlackBase = new QSpinBox( BOX_Black );
LABEL_BlackBase = new QLabel( BOX_Black );
BOX_BlackInc = new QSpinBox( BOX_Black );
LABEL_BlackInc = new QLabel( BOX_Black );
BUTTON_TimeOdds = new QCheckBox( i18n("Time Odds Match"),BOX_Parent );
LABEL_Headline->setAlignment( Qt::AlignCenter );
COMBO_Rated->setEditable( FALSE );
COMBO_Rated->insertItem( i18n("Unrated"), 0 );
COMBO_Rated->insertItem( i18n("Rated"), 1 );
BOX_WhiteBase->setMinValue( 0 );
BOX_WhiteInc->setMinValue( 0 );
BOX_WhiteBase->setMaxValue( 300 );
BOX_WhiteInc->setMaxValue( 300 );
BOX_WhiteBase->setSuffix( i18n(" min.") );
BOX_WhiteInc->setSuffix( i18n(" sec.") );
LABEL_WhiteBase->setText( i18n( "Base Time" ) );
LABEL_WhiteInc->setText( i18n( "Increment" ) );
BOX_BlackBase->setMinValue( 0 );
BOX_BlackInc->setMinValue( 0 );
BOX_BlackBase->setMaxValue( 300 );
BOX_BlackInc->setMaxValue( 300 );
BOX_BlackBase->setSuffix( i18n(" min.") );
BOX_BlackInc->setSuffix( i18n(" sec.") );
LABEL_BlackBase->setText( i18n( "Base Time" ) );
LABEL_BlackInc->setText( i18n( "Increment" ) );
showButton( User1, TRUE );
showButton( User2, TRUE );
enableButton( User1, TRUE );
enableButton( User2, TRUE );
show();
}
dlg_challenge::~dlg_challenge()
{
}
void dlg_challenge::setValues( const QString &string, const QString &local )
{
/* we only need the first line, strip the rest */
QString myString( string.section('\n', 0, 0) );
QStringList list;
/*remove all the white space between the rating brackets*/
myString.replace( QRegExp("\\(\\s"), "(" );
myString.replace( QRegExp("\\s\\)"), ")" );
list = QStringList::split( QChar(' '), myString, FALSE );
list[7].replace(QRegExp("\\."), "");
if( list[0] == local )
{
localRating = list[1];
otherPlayer = list[2];
otherRating = list[3];
}
else
{
otherPlayer = list[0];
otherRating = list[1];
localRating = list[3];
}
LABEL_Headline->setText( i18n("%1 %2 vs. %3 %4\nin a %5 match.")
.arg(local).arg(localRating).arg(otherPlayer).arg(otherRating).arg(list[5]) );
if( list[4].lower() == "rated" )
{
COMBO_Rated->setCurrentItem(1);
}
else
{
COMBO_Rated->setCurrentItem(0);
}
BOX_WhiteBase->setValue( list[6].toInt() );
BOX_WhiteInc->setValue( list[7].toInt() );
BOX_BlackBase->setValue( list[6].toInt() );
BOX_BlackInc->setValue( list[7].toInt() );
BOX_White->setTitle( i18n("Time Controls") );
BOX_Black->setTitle( i18n("Time Controls") );
// BOX_Black->setEnabled( FALSE );
// BUTTON_TimeOdds->setChecked( FALSE );
connect( COMBO_Rated, SIGNAL( activated(int) ), this, SLOT( slot_changed(int) ) );
connect( BOX_WhiteBase, SIGNAL( valueChanged(int) ), this, SLOT( slot_changed(int) ) );
connect( BOX_WhiteInc, SIGNAL( valueChanged(int) ), this, SLOT( slot_changed(int) ) );
connect( BOX_BlackBase, SIGNAL( valueChanged(int) ), this, SLOT( slot_changed(int) ) );
connect( BOX_BlackInc, SIGNAL( valueChanged(int) ), this, SLOT( slot_changed(int) ) );
connect( BUTTON_TimeOdds, SIGNAL( stateChanged(int) ), this, SLOT( slot_changed(int) ) );
connect( BUTTON_TimeOdds, SIGNAL( toggled(bool) ), this, SLOT( slot_timeOdds(bool) ) );
}
QString dlg_challenge::values( void )
{
QString match;
match = QString("match %1").arg(otherPlayer);
if( COMBO_Rated->currentItem() == 0 )
match += " unrated";
else
match += " rated";
match += QString(" %1 %1").arg(BOX_WhiteBase->value()).arg(BOX_WhiteInc->value());
if( BUTTON_TimeOdds->isChecked() )
match += QString(" %1 %1").arg(BOX_BlackBase->value()).arg(BOX_BlackInc->value());
return match;
}
void dlg_challenge::slot_changed( int )
{
setButtonText( User1, i18n("Counter Offer") );
}
void dlg_challenge::slot_timeOdds( bool state )
{
BOX_Black->setEnabled( state );
}

@ -0,0 +1,69 @@
/***************************************************************************
dlg_challenge.h - description
-------------------
begin : Sun Jan 20 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_CHALLENGE_H
#define DLG_CHALLENGE_H
#include <kdialogbase.h>
#include <kcombobox.h>
#include <qgroupbox.h>
#include <qspinbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qhbox.h>
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class dlg_challenge : public KDialogBase
{
Q_OBJECT
public:
dlg_challenge(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~dlg_challenge();
void setValues( const QString&, const QString& );
QString values( void );
public slots:
void slot_changed( int );
void slot_timeOdds( bool );
private:
resource *Resource;
QString otherPlayer;
QString localRating;
QString otherRating;
QVBox *BOX_Parent;
QLabel *LABEL_Headline;
KComboBox *COMBO_Rated;
QHBox *BOX_Time;
QGroupBox *BOX_White;
QSpinBox *BOX_WhiteBase;
QSpinBox *BOX_WhiteInc;
QLabel *LABEL_WhiteBase;
QLabel *LABEL_WhiteInc;
QGroupBox *BOX_Black;
QSpinBox *BOX_BlackBase;
QSpinBox *BOX_BlackInc;
QLabel *LABEL_BlackBase;
QLabel *LABEL_BlackInc;
QCheckBox *BUTTON_TimeOdds;
};
#endif

@ -0,0 +1,226 @@
/***************************************************************************
dlg_engine.cpp - description
-------------------
begin : Wed Jul 18 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kfiledialog.h>
#include <kicontheme.h>
#include "dlg_engine.moc"
dlg_engine::dlg_engine(QWidget *parent, const char *name, resource *Rsrc, QString ItemName ) :
KDialogBase( parent,
name,
TRUE,
i18n("Configure Engine"),
Help|Ok|Apply|Cancel,
Ok,
TRUE )
{
Resource = Rsrc;
Name = ItemName;
BOX_Parent = makeVBoxMainWidget();
BOX_NameProto = new QHBox( BOX_Parent );
BOX_Name = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Engine Name" ),
BOX_NameProto );
EDIT_Name = new KLineEdit( BOX_Name );
BOX_Protocol = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Protocol" ),
BOX_NameProto );
EDIT_Protocol = new KComboBox( BOX_Protocol );
BOX_Filename = new QGroupBox( 2,
Qt::Horizontal,
i18n( "Engine Filename" ),
BOX_Parent );
EDIT_Filename = new KLineEdit( BOX_Filename );
BUTTON_Filename = new QPushButton( BOX_Filename );
BOX_Arguments = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Command Line Arguments" ),
BOX_Parent );
EDIT_Arguments = new KLineEdit( BOX_Arguments );
BOX_LogFile = new QGroupBox( 2,
Qt::Horizontal,
i18n( "Log File" ),
BOX_Parent );
EDIT_LogFile = new KLineEdit( BOX_LogFile );
BUTTON_LogFile = new QPushButton( BOX_LogFile );
setMainWidget( BOX_Parent );
BUTTON_Filename->setPixmap( Resource->LoadIcon( QString( "fileopen" ), KIcon::Toolbar ) );
BUTTON_LogFile->setPixmap( Resource->LoadIcon( QString( "fileopen" ), KIcon::Toolbar ) );
EDIT_Name->setMinimumWidth( 150 );
EDIT_Filename->setMinimumWidth( 300 );
EDIT_Arguments->setMinimumWidth( 300 );
/* Protocol ComboBox */
EDIT_Protocol->insertItem( QString( "XBoard" ) );
EDIT_Protocol->insertItem( QString( "UCI" ) );
EDIT_Protocol->setEditable( FALSE );
/* Load in data if this is a modification */
if( !Name.isEmpty() )
{
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).Name == Name ) break;
}
EDIT_Name->setText( (*enginesIT).Name );
EDIT_Filename->setText( (*enginesIT).Filename );
EDIT_Arguments->setText( (*enginesIT).Arguments );
EDIT_LogFile->setText( (*enginesIT).LogFile );
switch( (*enginesIT).Protocol )
{
case XBoard:
EDIT_Protocol->setCurrentItem(0);
break;
case UCI:
EDIT_Protocol->setCurrentItem(1);
break;
default:
break;
}
}
/* Init the buttons */
showButtonCancel( TRUE );
showButtonOK( TRUE );
showButtonApply( TRUE );
showButton( Help, TRUE );
enableButtonCancel( TRUE );
enableButtonOK( TRUE );
enableButtonApply( FALSE );
enableButton( Help, TRUE );
setHelp( QString( "configure-engines" ) );
/* Make Connections */
connect( BUTTON_Filename, SIGNAL( clicked() ), this, SLOT( slotFilenameDialog() ) );
connect( BUTTON_LogFile, SIGNAL( clicked() ), this, SLOT( slotLogFileDialog() ) );
connect( EDIT_Protocol, SIGNAL( activated(int) ), this, SLOT( slotProtocol(int) ) );
show();
}
///////////////////////////////////////
//
// dlg_engine::~dlg_engine
//
///////////////////////////////////////
dlg_engine::~dlg_engine()
{
}
///////////////////////////////////////
//
// dlg_engine::slotOk
//
///////////////////////////////////////
void dlg_engine::slotOk( void )
{
slotApply();
slotDelayedDestruct();
}
///////////////////////////////////////
//
// dlg_engine::slotApply
//
///////////////////////////////////////
void dlg_engine::slotApply( void )
{
engineResource newEngine;
if( Name.isEmpty() )
{
enginesIT = Resource->engines.append( newEngine );
Name = "notemptyanymore";
(*enginesIT).Wins = 0;
(*enginesIT).Losses = 0;
(*enginesIT).Draws = 0;
(*enginesIT).CurrentRef = 0;
}
(*enginesIT).Name = EDIT_Name->text();
(*enginesIT).Filename = EDIT_Filename->text();
(*enginesIT).Arguments = EDIT_Arguments->text();
(*enginesIT).LogFile = EDIT_LogFile->text();
switch( EDIT_Protocol->currentItem() )
{
case 0:
(*enginesIT).Protocol = XBoard;
break;
case 1:
(*enginesIT).Protocol = UCI;
break;
default:
break;
}
enableButtonApply( FALSE );
}
///////////////////////////////////////
//
// dlg_engine::slotCancel
//
///////////////////////////////////////
void dlg_engine::slotCancel( void )
{
slotDelayedDestruct();
}
///////////////////////////////////////
//
// dlg_engine::slotFilenameDialog
//
///////////////////////////////////////
void dlg_engine::slotFilenameDialog( void )
{
QString temp;
int tmp;
temp = KFileDialog::getOpenFileName( QString::null,
QString( "*" ),
this,
QString( "Find Engine..." ) );
if( temp.isEmpty() ) return;
EDIT_Filename->setText( temp );
if( EDIT_Name->text().isEmpty() )
{
tmp = temp.findRev( '/' );
EDIT_Name->setText( temp.remove( 0, tmp + 1 ) );
}
enableButtonApply( TRUE );
}
///////////////////////////////////////
//
// dlg_engine::slotLogFileDialog
//
///////////////////////////////////////
void dlg_engine::slotLogFileDialog( void )
{
QString temp;
temp = KFileDialog::getOpenFileName( QString::null,
QString( "*" ),
this,
QString( "Find Log..." ) );
if( temp.isEmpty() ) return;
EDIT_LogFile->setText( temp );
enableButtonApply( TRUE );
}
///////////////////////////////////////
//
// dlg_engine::slotProtocol
//
///////////////////////////////////////
void dlg_engine::slotProtocol( int Index )
{
if(Index); // No-op to stop compile warning.
enableButtonApply( TRUE );
}

@ -0,0 +1,77 @@
/***************************************************************************
dlg_engine.h - description
-------------------
begin : Wed Jul 18 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_ENGINE_H
#define DLG_ENGINE_H
#include <kdialogbase.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qstring.h>
#include "definitions.h"
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class dlg_engine : public KDialogBase
{
Q_OBJECT
public:
dlg_engine(QWidget *parent=0, const char *name=0, resource *Rsrc=0, QString ItemName="" );
~dlg_engine();
public slots:
void slotOk( void );
void slotApply( void );
void slotCancel( void );
void slotFilenameDialog( void );
void slotLogFileDialog( void );
void slotProtocol( int Index );
private:
engineList::Iterator enginesIT;
resource *Resource;
QString Name;
QVBox *BOX_Parent;
QHBox *BOX_NameProto;
QGroupBox *BOX_Name;
KLineEdit *EDIT_Name;
QGroupBox *BOX_Protocol;
KComboBox *EDIT_Protocol;
QGroupBox *BOX_Filename;
KLineEdit *EDIT_Filename;
QPushButton *BUTTON_Filename;
QGroupBox *BOX_LogFile;
KLineEdit *EDIT_LogFile;
QPushButton *BUTTON_LogFile;
QGroupBox *BOX_Arguments;
KLineEdit *EDIT_Arguments;
};
#endif

@ -0,0 +1,161 @@
/***************************************************************************
dlg_login.cpp - description
-------------------
begin : Sat Sep 29 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "dlg_login.moc"
dlg_login::dlg_login(QWidget *parent, const char *name, resource *rsrc) :
KDialogBase(parent, name, TRUE, i18n("Login Prompt"), Help|Ok|Cancel, Ok,TRUE )
{
serverList::Iterator i;
serverList::Iterator currentServer;
int counter = 0;
myResource = rsrc;
BOX_Parent = makeVBoxMainWidget();
/* Select which server to connect to */
GROUP_Select_Server = new QGroupBox( 1, Qt::Vertical, i18n( "Select Server" ), BOX_Parent );
COMBO_Select_Server = new KComboBox ( GROUP_Select_Server );
COMBO_Select_Server->setEditable( FALSE );
/* fill the combobox with servers */
for(i = myResource->servers.begin(); i != myResource->servers.end(); i++)
{
COMBO_Select_Server->insertItem((*i).Name);
if((*i).CurrentRef == TRUE)
{
COMBO_Select_Server->setCurrentItem(counter);
currentServer = i;
}
counter++;
}
/* connect to right signal to the combobox */
connect( COMBO_Select_Server, SIGNAL( activated(const QString &) ), this, SLOT( slotUpdateUser(const QString &) ) );
GROUP_Username = new QGroupBox( 1, Qt::Horizontal, i18n("User info"), BOX_Parent);
BOX_ALIGN = new QHBox( GROUP_Username );
BOX_TEXT = new QVBox( BOX_ALIGN );
TEXT_Login = new QLabel( BOX_TEXT );
TEXT_Password = new QLabel( BOX_TEXT );
TEXT_Login->setText( i18n("Login:") );
TEXT_Password->setText( i18n("Password:") );
BOX_EDIT = new QVBox( BOX_ALIGN );
EDIT_Login = new KLineEdit( BOX_EDIT );
EDIT_Password = new KLineEdit( BOX_EDIT );
CHECKBOX_GUEST = new QCheckBox(i18n("Log in as guest"), GROUP_Username);
EDIT_Password->setEchoMode( QLineEdit::Password );
connect(CHECKBOX_GUEST, SIGNAL(toggled(bool)), this, SLOT(slotGuestToggle(bool)));
/* Init the buttons */
showButtonCancel( TRUE );
showButtonOK( TRUE );
showButton( Help, TRUE );
enableButtonCancel( TRUE );
enableButtonOK( TRUE );
enableButton( Help, TRUE );
setButtonOKText( i18n("Login"), i18n("Log in to the chess server using this name and password.") );
setButtonCancelText( i18n("Cancel"), i18n("Abort logging into the server") );
setHelp("prefs");
disableResize();
show();
/* make sure the username for the default server is displayed */
slotUpdateUser((*currentServer).Name);
}
///////////////////////////////////////
//
// dlg_login::~dlg_login
//
///////////////////////////////////////
dlg_login::~dlg_login()
{
}
///////////////////////////////////////
//
// dlg_login::slotOk
//
///////////////////////////////////////
void dlg_login::slotOk( void )
{
if(BOX_ALIGN->isEnabled())
{
emit login(EDIT_Login->text(), EDIT_Password->text());
}
else
{
emit login("guest", "");
}
emit okClicked();
slotDelayedDestruct();
}
///////////////////////////////////////
//
// dlg_login::slotGuestToggle
//
///////////////////////////////////////
void dlg_login::slotGuestToggle( bool on )
{
BOX_ALIGN->setEnabled(!on);
}
///////////////////////////////////////
//
// dlg_login::slotUpdateUser
//
///////////////////////////////////////
void dlg_login::slotUpdateUser(const QString &name)
{
/* this function retrieves the correct serverResource from
the resources and uses that to fill in the username and
password fields */
serverList::Iterator i;
for(i = myResource->servers.begin(); i != myResource->servers.end(); i++)
{
if((*i).CurrentRef)
{
(*i).CurrentRef = FALSE;
}
if((*i).Name == name )
{
(*i).CurrentRef = TRUE;
EDIT_Login->setText((*i).UserName);
EDIT_Password->setText((*i).Password);
server = &(*i);
}
}
}
///////////////////////////////////////
//
// dlg_login::slotUpdateUser
//
///////////////////////////////////////
void dlg_login::disableServerSelect()
{
COMBO_Select_Server->setEnabled(false);
}

@ -0,0 +1,73 @@
/***************************************************************************
dlg_login.h - description
-------------------
begin : Sat Sep 29 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_LOGIN_H
#define DLG_LOGIN_H
#include <qwidget.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qgroupbox.h>
#include <kdialogbase.h>
#include <klineedit.h>
#include <kcombobox.h>
#include "resource.h"
/**
*@author Troy Corbin Jr. / Alexander Wels
*/
class dlg_login : public KDialogBase
{
Q_OBJECT
public:
dlg_login(QWidget *parent, const char *name=0, resource *rsrc = NULL);
~dlg_login();
void disableServerSelect();
public slots:
void slotOk( void );
void slotGuestToggle( bool );
void slotUpdateUser(const QString&);
signals:
void login(QString userName, QString passWord);
private:
QVBox *BOX_Parent;
QVBox *BOX_TEXT;
QVBox *BOX_EDIT;
QHBox *BOX_ALIGN;
KLineEdit *EDIT_Login;
KLineEdit *EDIT_Password;
QLabel *TEXT_Login;
QLabel *TEXT_Password;
QCheckBox *CHECKBOX_GUEST;
QGroupBox *GROUP_Select_Server;
QGroupBox *GROUP_Username;
KComboBox *COMBO_Select_Server;
resource *myResource;
struct serverResource *server;
};
#endif

@ -0,0 +1,385 @@
/***************************************************************************
dlg_newmatch.cpp - description
-------------------
begin : Tue Jun 25 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "dlg_newmatch.moc"
#include <kcombobox.h>
#include <qgroupbox.h>
#include <qbuttongroup.h>
#include <qspinbox.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qgrid.h>
#include "resource.h"
#include "dlg_selectengine.h"
#include "dlg_selectemail.h"
#define _TYPE_HUMAN_ 0
#define _TYPE_PC_ 1
#define _TYPE_EMAIL_ 2
dlg_newmatch::dlg_newmatch(QWidget *parent, const char *name, resource *Rsrc ) :
KDialogBase(parent, name, TRUE, i18n("Start a New Match"), Cancel|Ok|Help, Ok, TRUE )
{
myResource = Rsrc;
Param = new match_param( myResource );
BOX_Parent = makeHBoxMainWidget();
BOX_Players = new QVBox( BOX_Parent );
BOX_White = new QGroupBox(3, Qt::Horizontal, i18n("White"), BOX_Players );
BOX_Black = new QGroupBox(3, Qt::Horizontal, i18n("Black"), BOX_Players );
IMAGE_White = new QLabel( BOX_White );
IMAGE_Black = new QLabel( BOX_Black );
BOX_White_Detail = new QVBox( BOX_White );
BOX_Black_Detail = new QVBox( BOX_Black );
LABEL_White_Name = new QLabel( BOX_White_Detail );
LABEL_Black_Name = new QLabel( BOX_Black_Detail );
GROUP_White_Type = new QButtonGroup( 3, Qt::Vertical, BOX_White_Detail );
GROUP_White_Type->setExclusive( TRUE );
RADIO_White_Human = new QRadioButton( i18n("Human"), GROUP_White_Type );
RADIO_White_PC = new QRadioButton( i18n("Computer"), GROUP_White_Type );
RADIO_White_Email = new QRadioButton( i18n("Email"), GROUP_White_Type );
connect( GROUP_White_Type, SIGNAL( clicked(int)), this, SLOT( slotWhiteType(int)));
GROUP_Black_Type = new QButtonGroup( 3, Qt::Vertical, BOX_Black_Detail );
GROUP_Black_Type->setExclusive( TRUE );
RADIO_Black_Human = new QRadioButton( i18n("Human"), GROUP_Black_Type );
RADIO_Black_PC = new QRadioButton( i18n("Computer"), GROUP_Black_Type );
RADIO_Black_Email = new QRadioButton( i18n("Email"), GROUP_Black_Type );
connect( GROUP_Black_Type, SIGNAL( clicked(int)), this, SLOT( slotBlackType(int)));
/* Disable Unconfigured Types */
if( !myResource->engines.count() )
{
RADIO_White_PC->setEnabled( FALSE );
RADIO_Black_PC->setEnabled( FALSE );
}
if( 1 )
{
RADIO_White_Email->setEnabled( FALSE );
RADIO_Black_Email->setEnabled( FALSE );
}
/* Time for White */
GRID_White_Time = new QGrid( 2, Qt::Horizontal, BOX_White );
LABEL_White_Base = new QLabel( i18n("Base Time:"), GRID_White_Time );
SPIN_White_Base = new QSpinBox( 0, 120, 1, GRID_White_Time );
SPIN_White_Base->setSuffix( i18n(" min.") );
connect( SPIN_White_Base, SIGNAL( valueChanged(int)), this, SLOT( slotWhiteBase(int)));
LABEL_White_Moves = new QLabel( i18n("Moves Per Base Time"), GRID_White_Time );
SPIN_White_Moves = new QSpinBox( 0, 100, 5, GRID_White_Time );
SPIN_White_Moves->setSuffix( i18n(" moves") );
connect( SPIN_White_Moves, SIGNAL( valueChanged(int)), this, SLOT( slotWhiteMoves(int)));
LABEL_White_Inc = new QLabel( i18n("Increment Per Move"), GRID_White_Time );
SPIN_White_Inc = new QSpinBox( 0, 120, 1, GRID_White_Time );
SPIN_White_Inc->setSuffix( i18n(" sec.") );
connect( SPIN_White_Inc, SIGNAL( valueChanged(int)), this, SLOT( slotWhiteInc(int)));
/* Time for Black */
GRID_Black_Time = new QGrid( 2, Qt::Horizontal, BOX_Black );
LABEL_Black_Base = new QLabel( i18n("Base Time:"), GRID_Black_Time );
SPIN_Black_Base = new QSpinBox( 0, 120, 1, GRID_Black_Time );
SPIN_Black_Base->setSuffix( i18n(" min.") );
connect( SPIN_Black_Base, SIGNAL( valueChanged(int)), this, SLOT( slotBlackBase(int)));
LABEL_Black_Moves = new QLabel( i18n("Moves Per Base Time"), GRID_Black_Time );
SPIN_Black_Moves = new QSpinBox( 0, 100, 5, GRID_Black_Time );
SPIN_Black_Moves->setSuffix( i18n(" moves") );
connect( SPIN_Black_Moves, SIGNAL( valueChanged(int)), this, SLOT( slotBlackMoves(int)));
LABEL_Black_Inc = new QLabel( i18n("Increment Per Move"), GRID_Black_Time );
SPIN_Black_Inc = new QSpinBox( 0, 120, 1, GRID_Black_Time );
SPIN_Black_Inc->setSuffix( i18n(" sec.") );
connect( SPIN_Black_Inc, SIGNAL( valueChanged(int)), this, SLOT( slotBlackInc(int)));
setTCP();
setTypes();
setNames();
setImages();
setHelp( QString( "new-match-dialog" ) );
}
dlg_newmatch::~dlg_newmatch()
{
}
///////////////////////////////////////
//
// dlg_newmatch::setTCP
//
///////////////////////////////////////
void dlg_newmatch::setTCP( void )
{
TCPList tmpList( Param->time(WHITE) );
TCP tmpTCP = tmpList[0];
SPIN_White_Base->setValue( tmpTCP.Seconds / 60 );
SPIN_White_Moves->setValue( tmpTCP.Moves );
SPIN_White_Inc->setValue( tmpTCP.Increment );
tmpList = Param->time(BLACK);
tmpTCP = tmpList[0];
SPIN_Black_Base->setValue( tmpTCP.Seconds / 60 );
SPIN_Black_Moves->setValue( tmpTCP.Moves );
SPIN_Black_Inc->setValue( tmpTCP.Increment );
}
///////////////////////////////////////
//
// dlg_newmatch::setTypes
//
///////////////////////////////////////
void dlg_newmatch::setTypes( void )
{
switch( Param->type(WHITE) )
{
case PLAYERPC:
GROUP_White_Type->setButton( _TYPE_PC_ );
break;
case PLAYEREMAIL:
GROUP_White_Type->setButton( _TYPE_EMAIL_ );
break;
case PLAYERLOCAL:
default:
GROUP_White_Type->setButton( _TYPE_HUMAN_ );
slotWhiteType( _TYPE_HUMAN_ );
break;
}
if( GROUP_White_Type->selected() != _TYPE_HUMAN_ )
{
if( !GROUP_White_Type->selected()->isEnabled() )
{
GROUP_White_Type->setButton( _TYPE_HUMAN_ );
slotWhiteType( _TYPE_HUMAN_ );
}
}
else
{
Param->setType( WHITE, PLAYERLOCAL );
GROUP_White_Type->setButton( _TYPE_HUMAN_ );
}
switch( Param->type(BLACK) )
{
case PLAYERPC:
GROUP_Black_Type->setButton( _TYPE_PC_ );
break;
case PLAYEREMAIL:
GROUP_Black_Type->setButton( _TYPE_EMAIL_ );
break;
case PLAYERLOCAL:
default:
GROUP_Black_Type->setButton( _TYPE_HUMAN_ );
slotBlackType( _TYPE_HUMAN_ );
break;
}
if( GROUP_Black_Type->selected() != _TYPE_HUMAN_ )
{
if( !GROUP_Black_Type->selected()->isEnabled() )
{
GROUP_Black_Type->setButton( _TYPE_HUMAN_ );
slotBlackType( _TYPE_HUMAN_ );
}
}
else
{
Param->setType( BLACK, PLAYERLOCAL );
GROUP_Black_Type->setButton( _TYPE_HUMAN_ );
}
}
///////////////////////////////////////
//
// dlg_newmatch::setImages
//
///////////////////////////////////////
void dlg_newmatch::setImages( void )
{
IMAGE_White->setPixmap( Param->image( WHITE ) );
IMAGE_Black->setPixmap( Param->image( BLACK ) );
}
///////////////////////////////////////
//
// dlg_newmatch::setNames
//
///////////////////////////////////////
void dlg_newmatch::setNames( void )
{
LABEL_White_Name->setText( Param->name( WHITE ) );
LABEL_Black_Name->setText( Param->name( BLACK ) );
}
///////////////////////////////////////
//
// dlg_newmatch::slotWhiteType
//
///////////////////////////////////////
void dlg_newmatch::slotWhiteType( int type )
{
if( type == _TYPE_PC_ )
{
EngineSelect = new dlg_selectengine( this, myResource, WHITE );
connect( EngineSelect, SIGNAL( valuesChanged() ), this, SLOT( slotReparse() ) );
EngineSelect->exec();
Param->setType( WHITE, PLAYERPC );
}
else if( type == _TYPE_EMAIL_ )
{
EmailSelect = new dlg_selectemail( this, myResource );
connect( EmailSelect, SIGNAL( valuesChanged() ), this, SLOT( slotReparse() ) );
EmailSelect->exec();
Param->setType( WHITE, PLAYEREMAIL );
}
else
{
Param->setType( WHITE, PLAYERLOCAL );
}
setNames();
setImages();
}
///////////////////////////////////////
//
// dlg_newmatch::slotWhiteBase
//
///////////////////////////////////////
void dlg_newmatch::slotWhiteBase( int time )
{
TCPList tmpList( Param->time(WHITE) );
TCP tmpTCP = tmpList[0];
tmpTCP.Seconds = time * 60;
tmpList[0] = tmpTCP;
Param->setTime( WHITE, tmpList );
}
///////////////////////////////////////
//
// dlg_newmatch::slotWhiteMoves
//
///////////////////////////////////////
void dlg_newmatch::slotWhiteMoves( int time )
{
TCPList tmpList( Param->time(WHITE) );
TCP tmpTCP = tmpList[0];
tmpTCP.Moves = time;
tmpList[0] = tmpTCP;
Param->setTime( WHITE, tmpList );
}
///////////////////////////////////////
//
// dlg_newmatch::slotWhiteInc
//
///////////////////////////////////////
void dlg_newmatch::slotWhiteInc( int time )
{
TCPList tmpList( Param->time(WHITE) );
TCP tmpTCP = tmpList[0];
tmpTCP.Increment = time;
tmpList[0] = tmpTCP;
Param->setTime( WHITE, tmpList );
}
///////////////////////////////////////
//
// dlg_newmatch::slotBlackType
//
///////////////////////////////////////
void dlg_newmatch::slotBlackType( int type )
{
if( type == _TYPE_PC_ )
{
EngineSelect = new dlg_selectengine( this, myResource, BLACK );
connect( EngineSelect, SIGNAL( valuesChanged() ), this, SLOT( slotReparse() ) );
EngineSelect->exec();
Param->setType( BLACK, PLAYERPC );
}
else if( type == _TYPE_EMAIL_ )
{
EmailSelect = new dlg_selectemail( this, myResource );
connect( EmailSelect, SIGNAL( valuesChanged() ), this, SLOT( slotReparse() ) );
EmailSelect->exec();
Param->setType( BLACK, PLAYEREMAIL );
}
else
{
Param->setType( BLACK, PLAYERLOCAL );
}
setNames();
setImages();
}
///////////////////////////////////////
//
// dlg_newmatch::slotBlackBase
//
///////////////////////////////////////
void dlg_newmatch::slotBlackBase( int time )
{
TCPList tmpList( Param->time(BLACK) );
TCP tmpTCP = tmpList[0];
tmpTCP.Seconds = time * 60;
tmpList[0] = tmpTCP;
Param->setTime( BLACK, tmpList );
}
///////////////////////////////////////
//
// dlg_newmatch::slotBlackMoves
//
///////////////////////////////////////
void dlg_newmatch::slotBlackMoves( int time )
{
TCPList tmpList( Param->time(BLACK) );
TCP tmpTCP = tmpList[0];
tmpTCP.Moves = time;
tmpList[0] = tmpTCP;
Param->setTime( BLACK, tmpList );
}
///////////////////////////////////////
//
// dlg_newmatch::slotBlackInc
//
///////////////////////////////////////
void dlg_newmatch::slotBlackInc( int time )
{
TCPList tmpList( Param->time(BLACK) );
TCP tmpTCP = tmpList[0];
tmpTCP.Increment = time;
tmpList[0] = tmpTCP;
Param->setTime( BLACK, tmpList );
}
///////////////////////////////////////
//
// dlg_newmatch::slotReparse
//
///////////////////////////////////////
void dlg_newmatch::slotReparse( void )
{
setNames();
setImages();
Param->setStrength( WHITE, myResource->Strength[WHITE] );
Param->setStrength( BLACK, myResource->Strength[BLACK] );
}

@ -0,0 +1,110 @@
/***************************************************************************
dlg_newmatch.h - description
-------------------
begin : Tue Jun 25 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_NEWMATCH_H
#define DLG_NEWMATCH_H
#include <qwidget.h>
#include <kdialogbase.h>
#include "match_param.h"
/**
*@author Troy Corbin Jr.
*/
class dlg_selectengine;
class dlg_selectemail;
class resource;
class QLabel;
class QSpinBox;
class QRadioButton;
class QCheckBox;
class QVBox;
class QHBox;
class QGrid;
class QButtonGroup;
class QGroupBox;
class KComboBox;
class dlg_newmatch : public KDialogBase
{
Q_OBJECT
private:
resource *myResource;
match_param *Param;
dlg_selectengine *EngineSelect;
dlg_selectemail *EmailSelect;
QHBox *BOX_Parent;
QVBox *BOX_Players;
QGroupBox *BOX_White;
QLabel *IMAGE_White;
QVBox *BOX_White_Detail;
QLabel *LABEL_White_Name;
QButtonGroup *GROUP_White_Type;
QRadioButton *RADIO_White_Human;
QRadioButton *RADIO_White_PC;
QRadioButton *RADIO_White_Email;
QGrid *GRID_White_Time;
QLabel *LABEL_White_Base;
QSpinBox *SPIN_White_Base;
QLabel *LABEL_White_Inc;
QSpinBox *SPIN_White_Inc;
QLabel *LABEL_White_Moves;
QSpinBox *SPIN_White_Moves;
QGroupBox *BOX_Black;
QLabel *IMAGE_Black;
QVBox *BOX_Black_Detail;
QLabel *LABEL_Black_Name;
QButtonGroup *GROUP_Black_Type;
QRadioButton *RADIO_Black_Human;
QRadioButton *RADIO_Black_PC;
QRadioButton *RADIO_Black_Email;
QGrid *GRID_Black_Time;
QLabel *LABEL_Black_Base;
QSpinBox *SPIN_Black_Base;
QLabel *LABEL_Black_Inc;
QSpinBox *SPIN_Black_Inc;
QLabel *LABEL_Black_Moves;
QSpinBox *SPIN_Black_Moves;
public:
dlg_newmatch(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~dlg_newmatch();
match_param* paramaters( void ) { return Param; }
protected slots:
void slotWhiteType( int );
void slotWhiteBase( int );
void slotWhiteMoves( int );
void slotWhiteInc( int );
void slotBlackType( int );
void slotBlackBase( int );
void slotBlackMoves( int );
void slotBlackInc( int );
void slotReparse( void );
protected:
void setTCP( void );
void setTypes( void );
void setImages( void );
void setNames( void );
};
#endif

@ -0,0 +1,123 @@
/***************************************************************************
dlg_promote.cpp - description
-------------------
begin : Fri Jul 13 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "definitions.h"
#include "dlg_promote.moc"
#include "knightspixcache.h"
#include <qimage.h>
dlg_promote::dlg_promote(QWidget *parent, const char *name, resource *Rsrc ) :
QDialog( parent, name, TRUE, Qt::WStyle_Customize | Qt::WStyle_DialogBorder )
{
Resource = Rsrc;
Queen = new QPushButton( this );
Bishop = new QPushButton( this );
Knight = new QPushButton( this );
Rook = new QPushButton( this );
Description = new QLabel( this );
}
dlg_promote::~dlg_promote()
{
delete Queen;
delete Bishop;
delete Knight;
delete Rook;
delete Description;
}
void dlg_promote::Init( bool Army )
{
KnightsPixCache *cache = Resource->pixCache;
QImage tempImage;
QPixmap buffer;
int margin;
margin = 2;
buffer.resize( Resource->ThemeSize, Resource->ThemeSize );
Description->setFixedSize( Resource->ThemeSize * 2 , 20 );
Queen->setFixedSize( Resource->ThemeSize, Resource->ThemeSize );
Bishop->setFixedSize( Resource->ThemeSize, Resource->ThemeSize );
Knight->setFixedSize( Resource->ThemeSize, Resource->ThemeSize );
Rook->setFixedSize( Resource->ThemeSize, Resource->ThemeSize );
setFixedSize( ( margin * 4 ) + ( Resource->ThemeSize * 2 ),
( margin * 6 ) + ( Resource->ThemeSize * 2 ) + 20 );
Description->move( margin, margin );
Queen->move( margin, ( margin * 3 ) + 20 );
Bishop->move( ( margin * 3 ) + Resource->ThemeSize, ( margin * 3 ) + 20 );
Knight->move( margin, ( margin * 5 ) + 20 + Resource->ThemeSize );
Rook->move( ( margin * 3 ) + Resource->ThemeSize, ( margin * 5 ) + 20 + Resource->ThemeSize );
/* Queen */
buffer = cache->SquareLight;
if( Army == WHITE ) bitBlt( &buffer, 0, 0, &cache->WhiteQueen, 0, 0, -1, -1, Qt::CopyROP, FALSE);
else bitBlt( &buffer, 0, 0, &cache->BlackQueen, 0, 0, -1, -1, Qt::CopyROP, FALSE);
Queen->setPixmap( buffer );
Queen->show();
/* Bishop */
buffer = cache->SquareDark;
if( Army == WHITE ) bitBlt( &buffer, 0, 0, &cache->WhiteBishop, 0, 0, -1, -1, Qt::CopyROP, FALSE);
else bitBlt( &buffer, 0, 0, &cache->BlackBishop, 0, 0, -1, -1, Qt::CopyROP, FALSE);
Bishop->setPixmap( buffer );
Bishop->show();
/* Knight */
buffer = cache->SquareDark;
if( Army == WHITE ) bitBlt( &buffer, 0, 0, &cache->WhiteKnight, 0, 0, -1, -1, Qt::CopyROP, FALSE);
else bitBlt( &buffer, 0, 0, &cache->BlackKnight, 0, 0, -1, -1, Qt::CopyROP, FALSE);
Knight->setPixmap( buffer );
Knight->show();
/* Rook */
buffer = cache->SquareLight;
if( Army == WHITE ) bitBlt( &buffer, 0, 0, &cache->WhiteRook, 0, 0, -1, -1, Qt::CopyROP, FALSE);
else bitBlt( &buffer, 0, 0, &cache->BlackRook, 0, 0, -1, -1, Qt::CopyROP, FALSE);
Rook->setPixmap( buffer );
Rook->show();
Description->setText( i18n( "Promote your pawn to..." ) );
Description->show();
connect( Queen, SIGNAL( clicked() ), this, SLOT( queenClick() ) );
connect( Bishop, SIGNAL( clicked() ), this, SLOT( bishopClick() ) );
connect( Knight, SIGNAL( clicked() ), this, SLOT( knightClick() ) );
connect( Rook, SIGNAL( clicked() ), this, SLOT( rookClick() ) );
Queen->setFocus();
setCaption( i18n( "Pawn Promotion" ) );
}
void dlg_promote::queenClick( void )
{
done( 'q' );
}
void dlg_promote::bishopClick( void )
{
done( 'b' );
}
void dlg_promote::knightClick( void )
{
done( 'n' );
}
void dlg_promote::rookClick( void )
{
done( 'r' );
}

@ -0,0 +1,58 @@
/***************************************************************************
dlg_promote.h - description
-------------------
begin : Fri Jul 13 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_PROMOTE_H
#define DLG_PROMOTE_H
#include <klocale.h>
#include <qpixmap.h>
#include <qstring.h>
#include <qdialog.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class dlg_promote : public QDialog
{
Q_OBJECT
public:
dlg_promote(QWidget *parent=0, const char *name=0, resource *Rsrc=0 );
~dlg_promote();
void Init( bool Army );
public slots:
void queenClick( void );
void bishopClick( void );
void knightClick( void );
void rookClick( void );
private:
resource *Resource;
QLabel *Description;
QPushButton *Queen;
QPushButton *Bishop;
QPushButton *Knight;
QPushButton *Rook;
};
#endif

@ -0,0 +1,46 @@
/***************************************************************************
dlg_selectemail.cpp - description
-------------------
begin : Sun Oct 27 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "dlg_selectemail.moc"
#include <qvbox.h>
#include <qlineedit.h>
#include "resource.h"
dlg_selectemail::dlg_selectemail(QWidget *parent, resource *Rsrc ) :
KDialogBase( parent,
0,
TRUE,
i18n("Select Email Address"),
Help|Ok,
Ok,
TRUE )
{
myResource = Rsrc;
BOX_Parent = makeVBoxMainWidget();
EDIT_Email = new QLineEdit( BOX_Parent );
EDIT_Email->setText( myResource->Email_Address );
connect( EDIT_Email, SIGNAL( returnPressed() ), this, SLOT( changeValue() ) );
}
dlg_selectemail::~dlg_selectemail()
{
}
void dlg_selectemail::changeValue( void )
{
myResource->Email_Address = EDIT_Email->text();
emit valuesChanged();
}

@ -0,0 +1,52 @@
/***************************************************************************
dlg_selectemail.h - description
-------------------
begin : Sun Oct 27 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_SELECTEMAIL_H
#define DLG_SELECTEMAIL_H
#include <qwidget.h>
#include <kdialogbase.h>
/**
*@author Troy Corbin Jr.
*/
class resource;
class QVBox;
class QLineEdit;
class dlg_selectemail : public KDialogBase
{
Q_OBJECT
public:
dlg_selectemail(QWidget *parent, resource *Rsrc );
~dlg_selectemail();
signals:
void valuesChanged( void );
protected slots:
void changeValue( void );
private:
resource *myResource;
QVBox *BOX_Parent;
QLineEdit *EDIT_Email;
};
#endif

@ -0,0 +1,201 @@
/***************************************************************************
dlg_selectengine.cpp - description
-------------------
begin : Wed Aug 28 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "dlg_selectengine.moc"
#include <qvbox.h>
#include <qgroupbox.h>
#include <qslider.h>
#include <qlabel.h>
#include <kcombobox.h>
#include "resource.h"
dlg_selectengine::dlg_selectengine(QWidget *parent, resource *Rsrc, bool army ) :
KDialogBase( parent,
0,
TRUE,
i18n("Select Computer Player"),
Help|Ok,
Ok,
TRUE )
{
Resource = Rsrc;
Army = army;
BOX_Parent = makeVBoxMainWidget();
BOX_Engine = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Computer Players" ),
BOX_Parent );
COMBO_Engine = new KComboBox( BOX_Engine );
COMBO_Engine->setEditable( FALSE );
// BOX_EngineHelper = new QGroupBox( 1,
// Qt::Horizontal,
// i18n( "Computer Players' Helper" ),
// BOX_Parent );
// COMBO_EngineHelper = new KComboBox( BOX_Engine );
// COMBO_EngineHelper->setEditable( FALSE );
buildEngineData();
connect( COMBO_Engine, SIGNAL( activated(int) ), this, SLOT( slotCurrent(int) ) );
// connect( COMBO_EngineHelper, SIGNAL( activated(int) ), this, SLOT( slotCurrentHelper(int) ) );
GROUP_Strength = new QGroupBox( 3,
Qt::Horizontal,
i18n( "Player Strength" ),
BOX_Parent );
LABEL_Str_Min = new QLabel( i18n( "Weak" ), GROUP_Strength );
SLIDER_Strength = new QSlider ( 1,
7,
1,
Resource->Strength[ 1 * ( Army == BLACK ) ],
QSlider::Horizontal,
GROUP_Strength );
LABEL_Str_Max = new QLabel( i18n( "Strong" ), GROUP_Strength );
SLIDER_Strength->setTickmarks( QSlider::Below );
connect( SLIDER_Strength, SIGNAL( valueChanged(int) ), this, SLOT( slotStrength(int) ) );
}
dlg_selectengine::~dlg_selectengine()
{
}
///////////////////////////////////////
//
// dlg_selectengine::buildEngineData
//
///////////////////////////////////////
void dlg_selectengine::buildEngineData( void )
{
bool FLAG1(FALSE);
// bool FLAG2(FALSE);
int Index(0);
QStringList EngineList;
engineList::Iterator enginesIT;
/* Clear Comboboxes */
COMBO_Engine->clear();
// COMBO_EngineHelper->clear();
/* Handle status of Book-engine boxes */
// White_Use_Book->setChecked( Resource->OPTION_Book_White );
// Engines_White_Book->setEnabled( Resource->OPTION_Book_White );
if( Army == WHITE )
{
Engine1F = ENGINE_WHITE;
Engine2F = ENGINE_WHITE_BK;
}
else
{
Engine1F = ENGINE_BLACK;
Engine2F = ENGINE_BLACK_BK;
}
/* Read the engine list */
if( Resource->engines.isEmpty() ) return;
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
EngineList.append( (*enginesIT).Name );
}
/* Insert engines into comboboxes */
EngineList.sort();
COMBO_Engine->insertStringList( EngineList );
// COMBO_EngineHelper->insertStringList( EngineList );
/* Now run the list again, setting the current engine for each combobox */
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & Engine1F )
for( Index = 0; Index < COMBO_Engine->count(); Index++ )
if( COMBO_Engine->text(Index) == (*enginesIT).Name )
{
COMBO_Engine->setCurrentItem(Index);
FLAG1 = TRUE;
}
// if( (*enginesIT).CurrentRef & Engine2F )
// for( Index = 0; Index < COMBO_Engine->count(); Index++ )
// if( COMBO_EngineHelper->text(Index) == (*enginesIT).Name )
// {
// COMBO_EngineHelper->setCurrentItem(Index);
// FLAG2 = TRUE;
// }
}
/*
This prevents a bug where you had to modify the
current_engine_comboboxes before you could get any engines to run.
*/
if( ( !FLAG1 ) && ( COMBO_Engine->count() ) ) slotCurrent( COMBO_Engine->currentItem() );
// if( ( !FLAG2 ) && ( COMBO_EngineHelper->count() ) ) slotCurrentHelper( COMBO_EngineHelper->currentItem() );
}
///////////////////////////////////////
//
// dlg_selectengine::slotCurrent
//
///////////////////////////////////////
void dlg_selectengine::slotCurrent( int Index )
{
QString Name;
engineList::Iterator enginesIT;
Name = COMBO_Engine->text(Index);
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & Engine1F ) (*enginesIT).CurrentRef -= Engine1F;
if( (*enginesIT).Name == Name ) (*enginesIT).CurrentRef |= Engine1F;
}
emit valuesChanged();
}
///////////////////////////////////////
//
// dlg_selectengine::slotCurrentHelper
//
///////////////////////////////////////
void dlg_selectengine::slotCurrentHelper( int Index )
{
QString Name;
engineList::Iterator enginesIT;
Name = COMBO_EngineHelper->text(Index);
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & Engine2F ) (*enginesIT).CurrentRef -= Engine2F;
if( (*enginesIT).Name == Name ) (*enginesIT).CurrentRef |= Engine2F;
}
emit valuesChanged();
}
///////////////////////////////////////
//
// dlg_selectengine::strength
//
///////////////////////////////////////
int dlg_selectengine::strength( void )
{
return SLIDER_Strength->value();
}
///////////////////////////////////////
//
// dlg_selectengine::slotStrength
//
///////////////////////////////////////
void dlg_selectengine::slotStrength( int value )
{
Resource->Strength[Army] = value;
emit valuesChanged();
}

@ -0,0 +1,72 @@
/***************************************************************************
dlg_selectengine.h - description
-------------------
begin : Wed Aug 28 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_SELECTENGINE_H
#define DLG_SELECTENGINE_H
#include <qwidget.h>
#include <kdialogbase.h>
#include "definitions.h"
/**
*@author Troy Corbin Jr.
*/
class QVBox;
class QSlider;
class QLabel;
class KComboBox;
class QGroupBox;
class resource;
class dlg_selectengine : public KDialogBase
{
Q_OBJECT
public:
dlg_selectengine(QWidget *parent, resource *Rsrc, bool army );
~dlg_selectengine();
int strength( void );
bool Army;
protected:
void buildEngineData( void );
protected slots:
void slotCurrent( int Index );
void slotCurrentHelper( int Index );
void slotStrength( int );
signals:
void valuesChanged( void );
private:
resource *Resource;
int Engine1F;
int Engine2F;
QVBox *BOX_Parent;
QGroupBox *BOX_Engine;
KComboBox *COMBO_Engine;
QGroupBox *BOX_EngineHelper;
KComboBox *COMBO_EngineHelper;
QGroupBox *GROUP_Strength;
QLabel *LABEL_Str_Min;
QSlider *SLIDER_Strength;
QLabel *LABEL_Str_Max;
};
#endif

@ -0,0 +1,240 @@
/***************************************************************************
dlg_server.cpp - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kicontheme.h>
#include "dlg_server.moc"
dlg_server::dlg_server(QWidget *parent, const char *name, resource *Rsrc, QString ItemName ) :
KDialogBase( parent,
name,
TRUE,
i18n("Configure Server"),
Help|Ok|Apply|Cancel,
Ok,
TRUE )
{
Resource = Rsrc;
Name = ItemName;
BOX_Parent = makeVBoxMainWidget();
BOX_Name = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Server Name" ),
BOX_Parent );
EDIT_Name = new KLineEdit( BOX_Name );
BOX_URLPort = new QHBox( BOX_Parent );
BOX_URL = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Server URL" ),
BOX_URLPort );
EDIT_URL = new KLineEdit( BOX_URL );
BOX_Port = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Server Port" ),
BOX_URLPort );
EDIT_Port = new KLineEdit( BOX_Port );
BOX_UNameStore = new QHBox( BOX_Parent );
BOX_UserName = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Username" ),
BOX_UNameStore );
EDIT_UserName = new KLineEdit( BOX_UserName );
CHECK_StorePass = new QCheckBox( i18n( "Remember My Password" ), BOX_UNameStore );
BOX_Pass = new QHBox( BOX_Parent );
BOX_Password = new QGroupBox( 1,
Qt::Vertical,
i18n( "Password" ),
BOX_Pass );
EDIT_Password = new KLineEdit( BOX_Password );
EDIT_Password->setEchoMode( QLineEdit::Password );
BOX_PasswordRetype = new QGroupBox( 1,
Qt::Vertical,
i18n( "Confirm Password" ),
BOX_Pass );
EDIT_PasswordRetype = new KLineEdit( BOX_PasswordRetype );
EDIT_PasswordRetype->setEchoMode( QLineEdit::Password );
/* Use Timeseal? */
GROUP_Timeseal = new QGroupBox( 2,
Qt::Horizontal,
i18n( "Timeseal" ),
BOX_Parent );
EDIT_Timeseal = new KLineEdit( GROUP_Timeseal );
BUTTON_Timeseal = new QPushButton( GROUP_Timeseal );
BUTTON_Timeseal->setPixmap( Resource->LoadIcon( QString( "fileopen" ), KIcon::Toolbar ) );
connect( BUTTON_Timeseal, SIGNAL( clicked() ), this, SLOT( slot_Timeseal() ) );
BOX_LogFile = new QGroupBox( 2,
Qt::Horizontal,
i18n( "Log File" ),
BOX_Parent );
EDIT_LogFile = new KLineEdit( BOX_LogFile );
BUTTON_LogFile = new QPushButton( BOX_LogFile );
setMainWidget( BOX_Parent );
BUTTON_LogFile->setPixmap( Resource->LoadIcon( QString( "fileopen" ), KIcon::Toolbar ) );
EDIT_Name->setMinimumWidth( 120 );
EDIT_URL->setMinimumWidth( 120 );
EDIT_UserName->setMinimumWidth( 120 );
EDIT_Password->setMinimumWidth( 120 );
EDIT_PasswordRetype->setMinimumWidth( 120 );
/* Load in data if this is a modification */
if( !Name.isEmpty() )
{
for ( serversIT = Resource->servers.begin(); serversIT != Resource->servers.end(); ++serversIT )
{
if( (*serversIT).Name == Name ) break;
}
EDIT_Name->setText( (*serversIT).Name );
EDIT_URL->setText( (*serversIT).URL );
EDIT_Port->setText( QString("").setNum( (*serversIT).Port ) );
EDIT_UserName->setText( (*serversIT).UserName );
CHECK_StorePass->setChecked( (*serversIT).StorePass );
EDIT_Password->setText( (*serversIT).Password );
EDIT_PasswordRetype->setText( (*serversIT).Password );
EDIT_LogFile->setText( (*serversIT).LogFile );
EDIT_Timeseal->setText( (*serversIT).Timeseal );
}
if( CHECK_StorePass->isChecked() )
{
EDIT_Password->setEnabled( TRUE );
EDIT_PasswordRetype->setEnabled( TRUE );
}
else
{
EDIT_Password->setEnabled( FALSE );
EDIT_PasswordRetype->setEnabled( FALSE );
}
/* Init the buttons */
showButtonCancel( TRUE );
showButtonOK( TRUE );
showButtonApply( TRUE );
showButton( Help, TRUE );
enableButtonCancel( TRUE );
enableButtonOK( TRUE );
enableButtonApply( FALSE );
enableButton( Help, TRUE );
setHelp( QString( "configure-servers" ) );
/* Make Connections */
connect( BUTTON_LogFile, SIGNAL( clicked() ), this, SLOT( slotLogFileDialog() ) );
connect( CHECK_StorePass, SIGNAL( toggled(bool) ), this, SLOT( slotStorePass(bool) ) );
connect( EDIT_Name, SIGNAL( textChanged( const QString&) ), this, SLOT( slotEnableApply( const QString&) ) );
connect( EDIT_URL, SIGNAL( textChanged( const QString&) ), this, SLOT( slotEnableApply( const QString&) ) );
connect( EDIT_Port, SIGNAL( textChanged( const QString&) ), this, SLOT( slotEnableApply( const QString&) ) );
connect( EDIT_UserName, SIGNAL( textChanged( const QString&) ), this, SLOT( slotEnableApply( const QString&) ) );
connect( EDIT_Password, SIGNAL( textChanged( const QString&) ), this, SLOT( slotEnableApply( const QString&) ) );
connect( EDIT_Timeseal, SIGNAL( textChanged( const QString&) ), this, SLOT( slotEnableApply( const QString&) ) );
show();
}
dlg_server::~dlg_server()
{
}
void dlg_server::slotOk( void )
{
slotApply();
slotDelayedDestruct();
}
void dlg_server::slotApply( void )
{
serverResource newServer;
if( ( EDIT_Password->text() != EDIT_PasswordRetype->text() ) && ( CHECK_StorePass->isChecked() ) )
{
return;
}
if( Name.isEmpty() )
{
serversIT = Resource->servers.append( newServer );
Name = "notemptyanymore";
(*serversIT).CurrentRef = 0;
}
(*serversIT).Name = EDIT_Name->text();
(*serversIT).URL = EDIT_URL->text();
(*serversIT).Port = QString( EDIT_Port->text() ).toInt();
(*serversIT).UserName = EDIT_UserName->text();
(*serversIT).Password = EDIT_Password->text();
(*serversIT).LogFile = EDIT_LogFile->text();
(*serversIT).StorePass = CHECK_StorePass->isChecked();
(*serversIT).Timeseal = EDIT_Timeseal->text();
enableButtonApply( FALSE );
}
void dlg_server::slotCancel( void )
{
slotDelayedDestruct();
}
void dlg_server::slotLogFileDialog( void )
{
QString temp;
temp = KFileDialog::getOpenFileName( QString::null,
QString( "*" ),
this,
QString( "Find Log..." ) );
if( temp.isEmpty() ) return;
EDIT_LogFile->setText( temp );
enableButtonApply( TRUE );
}
void dlg_server::slotEnableApply( const QString& )
{
enableButtonApply( TRUE );
}
void dlg_server::slotStorePass( bool )
{
if( CHECK_StorePass->isChecked() )
{
EDIT_Password->setEnabled( TRUE );
EDIT_PasswordRetype->setEnabled( TRUE );
}
else
{
EDIT_Password->setEnabled( FALSE );
EDIT_PasswordRetype->setEnabled( FALSE );
}
enableButtonApply( TRUE );
}
///////////////////////////////////////
//
// dlg_server::slot_Timeseal
//
///////////////////////////////////////
void dlg_server::slot_Timeseal( void )
{
QString temp;
temp = KFileDialog::getOpenFileName( QString::null,
QString( "*" ),
0,
QString( "Find Timeseal..." ) );
if( temp.isEmpty() ) return;
EDIT_Timeseal->setText( temp );
enableButtonApply( TRUE );
}

@ -0,0 +1,92 @@
/***************************************************************************
dlg_server.h - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_SERVER_H
#define DLG_SERVER_H
#include <kdialogbase.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <kfiledialog.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qcheckbox.h>
#include <qstring.h>
#include "definitions.h"
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class dlg_server : public KDialogBase
{
Q_OBJECT
public:
dlg_server(QWidget *parent=0, const char *name=0, resource *Rsrc=0, QString ItemName="" );
~dlg_server();
public slots:
void slotOk( void );
void slotApply( void );
void slotCancel( void );
void slotLogFileDialog( void );
void slotEnableApply( const QString& );
void slotStorePass( bool state );
void slot_Timeseal( void );
private:
serverList::Iterator serversIT;
resource *Resource;
QString Name;
QVBox *BOX_Parent;
QHBox *BOX_URLPort;
QHBox *BOX_UNameStore;
QHBox *BOX_Pass;
QGroupBox *BOX_Name;
KLineEdit *EDIT_Name;
QGroupBox *BOX_URL;
KLineEdit *EDIT_URL;
QGroupBox *BOX_Port;
KLineEdit *EDIT_Port;
QGroupBox *BOX_UserName;
KLineEdit *EDIT_UserName;
QCheckBox *CHECK_StorePass;
QGroupBox *BOX_Password;
KLineEdit *EDIT_Password;
QGroupBox *BOX_PasswordRetype;
KLineEdit *EDIT_PasswordRetype;
QGroupBox *GROUP_Timeseal;
KLineEdit *EDIT_Timeseal;
QPushButton *BUTTON_Timeseal;
QGroupBox *BOX_LogFile;
KLineEdit *EDIT_LogFile;
QPushButton *BUTTON_LogFile;
};
#endif

@ -0,0 +1,201 @@
/***************************************************************************
dlg_settings.cpp - description
-------------------
begin : Mon Jul 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kicontheme.h>
#include <kstddirs.h>
#include "definitions.h"
#include "dlg_settings.moc"
#include "setpagedisplay.h"
#include "setpageaudio.h"
#include "setpageengines.h"
#include "setpageservers.h"
#include "setpagegeneral.h"
///////////////////////////////////////
//
// dlg_settings::Constructor
//
///////////////////////////////////////
dlg_settings::dlg_settings(QWidget *parent, const char *name, resource *Rsrc ) :
KDialogBase( IconList,
i18n("Configure"),
Help|Ok|Apply|Cancel,
Ok,
parent,
name,
FALSE,
FALSE )
{
QString buffer;
Resource = Rsrc;
Resource->ConfigWrite();
/* General Page */
FRAME_General = addPage( i18n( "General" ),
i18n( "Various aspects of Knights get configured here." ),
QPixmap( locate( "data", "knights/icon-general.png" ) ) );
PAGE_General = new setPageGeneral( FRAME_General, Resource );
connect( PAGE_General, SIGNAL( enableApply() ), this, SLOT( slotEnableApply() ) );
/* Display Page */
FRAME_Display = addPage( i18n( "Display" ),
i18n( "These settings determine how Knights displays itself to you." ),
QPixmap( locate( "data", "knights/icon-display.png" ) ) );
PAGE_Display = new setPageDisplay( FRAME_Display, Resource );
connect( PAGE_Display, SIGNAL( enableApply() ), this, SLOT( slotEnableApply() ) );
/* Audio Page */
FRAME_Audio = addPage( i18n( "Audio" ),
i18n( "These settings determine what Knights sounds like." ),
Resource->LoadIcon( QString("multimedia"), KIcon::Panel ) );
PAGE_Audio = new setPageAudio( FRAME_Audio, Resource );
connect( PAGE_Audio, SIGNAL( enableApply() ), this, SLOT( slotEnableApply() ) );
/* Engines Page */
FRAME_Engines = addPage( i18n( "Computer Opponents" ),
i18n( "Configure your chess engines here." ),
Resource->LoadIcon( QString("gear"), KIcon::Panel ) );
PAGE_Engines = new setPageEngines( FRAME_Engines, Resource );
connect( PAGE_Engines, SIGNAL( enableApply() ), this, SLOT( slotEnableApply() ) );
/* Servers Page */
FRAME_Servers = addPage( i18n( "Chess Servers" ),
i18n( "Configure your internet chess servers here." ),
Resource->LoadIcon( QString("network"), KIcon::Panel ) );
PAGE_Servers = new setPageServers( FRAME_Servers, Resource );
connect( PAGE_Servers, SIGNAL( enableApply() ), this, SLOT( slotEnableApply() ) );
connect( this, SIGNAL( aboutToShowPage( QWidget* ) ), this, SLOT( slotPageChanging( QWidget* ) ) );
/* Init the buttons */
showButtonCancel( TRUE );
showButtonOK( TRUE );
showButtonApply( TRUE );
showButton( Help, TRUE );
enableButtonCancel( TRUE );
enableButtonOK( TRUE );
enableButtonApply( FALSE );
enableButton( Help, TRUE );
setHelp( QString( "configure" ) );
show();
}
///////////////////////////////////////
//
// dlg_settings::Destructor
//
///////////////////////////////////////
dlg_settings::~dlg_settings()
{
}
///////////////////////////////////////
//
// dlg_settings::slotOk
//
///////////////////////////////////////
void dlg_settings::slotOk( void )
{
slotApply();
slotDelayedDestruct();
}
///////////////////////////////////////
//
// dlg_settings::slotApply
//
///////////////////////////////////////
void dlg_settings::slotApply( void )
{
if( PAGE_Display->changeTheme )
{
PAGE_Display->changeTheme = FALSE;
emit themeChanged( PAGE_Display->NewBoards, PAGE_Display->NewChessmen );
}
if( PAGE_Display->refreshBoard )
{
PAGE_Display->refreshBoard = FALSE;
emit redrawBoard();
}
if( PAGE_Display->rebuildConsole )
{
Resource->buildStyle();
PAGE_Display->rebuildConsole = FALSE;
emit rebuildConsole();
}
if( PAGE_Audio->changeTheme )
{
PAGE_Audio->changeTheme = FALSE;
Resource->setAudio( PAGE_Audio->NewSounds );
}
if( PAGE_Servers->resetServer )
{
PAGE_Servers->resetServer = FALSE;
emit resetServer();
}
Resource->ConfigWrite();
enableButtonApply( FALSE );
}
///////////////////////////////////////
//
// dlg_settings::slotCancel
//
///////////////////////////////////////
void dlg_settings::slotCancel( void )
{
Resource->ConfigRead();
slotDelayedDestruct();
}
///////////////////////////////////////
//
// dlg_settings::slotEnableApply
//
///////////////////////////////////////
void dlg_settings::slotEnableApply( void )
{
enableButtonApply( TRUE );
}
///////////////////////////////////////
//
// dlg_settings::slotThemesAdded
//
///////////////////////////////////////
void dlg_settings::slotThemesAdded( void )
{
PAGE_Display->buildThemeList();
PAGE_Audio->buildThemeList();
}
///////////////////////////////////////
//
// dlg_settings::slotPageChanging
//
///////////////////////////////////////
void dlg_settings::slotPageChanging( QWidget *page )
{
if( page == FRAME_General )
setHelp( QString( "configure-general" ) );
else if( page == FRAME_Display )
setHelp( QString( "configure-display" ) );
else if( page == FRAME_Audio )
setHelp( QString( "configure-audio" ) );
else if( page == FRAME_Engines )
setHelp( QString( "configure-engines" ) );
else if( page == FRAME_Servers )
setHelp( QString( "configure-servers" ) );
}

@ -0,0 +1,80 @@
/***************************************************************************
dlg_settings.h - description
-------------------
begin : Mon Jul 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef DLG_SETTINGS_H
#define DLG_SETTINGS_H
#include <klocale.h>
#include <kdialogbase.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qvbox.h>
#include "definitions.h"
#include "resource.h"
class setPageDisplay;
class setPageAudio;
class setPageEngines;
class setPageServers;
class setPageGeneral;
/**
*@author Troy Corbin Jr.
*/
class dlg_settings : public KDialogBase
{
Q_OBJECT
public:
dlg_settings(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~dlg_settings();
public slots:
void slotOk( void );
void slotApply( void );
void slotCancel( void );
void slotEnableApply( void );
void slotThemesAdded( void );
void slotPageChanging( QWidget* );
signals:
void themeChanged( int, int );
void redrawBoard( void );
void rebuildConsole( void );
void resetServer( void );
private:
resource *Resource;
QFrame *FRAME_General;
setPageGeneral *PAGE_General;
QFrame *FRAME_Display;
setPageDisplay *PAGE_Display;
QFrame *FRAME_Audio;
setPageAudio *PAGE_Audio;
QFrame *FRAME_Engines;
setPageEngines *PAGE_Engines;
QFrame *FRAME_Servers;
setPageServers *PAGE_Servers;
};
#endif

@ -0,0 +1,37 @@
/***************************************************************************
idmanager.cpp - description
-------------------
begin : Wed Jun 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "idmanager.h"
IDManager::IDManager()
{
counter = 0;
}
IDManager::~IDManager()
{
counter = 0;
}
unsigned int IDManager::getNewID()
{
counter++;
return counter;
/* this might be a problem if there are more than MAX
unsigned int matches going on at the same time */
}

@ -0,0 +1,42 @@
/***************************************************************************
idmanager.h - description
-------------------
begin : Wed Jun 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef IDMANAGER_H
#define IDMANAGER_H
#include <qobject.h>
/**
*@author Alexander Wels
*/
/////////////////////////////////////////////////////
// This class generates and manages ID's for matches
// The ID's generated are unsigned integers
/////////////////////////////////////////////////////
class IDManager : public QObject
{
public:
IDManager();
~IDManager();
unsigned int getNewID();
private:
unsigned int counter;
};
#endif

@ -0,0 +1,57 @@
/***************************************************************************
io_base.cpp - description
-------------------
begin : Tue Jun 18 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "io_base.moc"
io_base::io_base(resource *resc)
{
this->myResource = resc;
}
io_base::io_base(resource *resc, int ID)
{
this->myResource = resc;
this->myID = ID;
}
io_base::io_base(QWidget* parent, resource *rsrc)
{
this->myParent = parent;
this->myResource = rsrc;
}
io_base::~io_base()
{
}
void io_base::setID(const int ID)
{
this->myID = ID;
}
int io_base::getID()
{
return myID;
}
int io_base::getType()
{
return myType;
}

@ -0,0 +1,68 @@
/***************************************************************************
io_base.h - description
-------------------
begin : Tue Jun 18 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef IO_BASE_H
#define IO_BASE_H
#include "definitions.h"
#include "resource.h"
#include "command.h"
#include "match_param.h"
#include <qobject.h>
#include <qwidget.h>
/**
*@author Alexander Wels.
*/
class io_base : public QObject
{
Q_OBJECT
public:
enum ioType
{
INTERNET = 0,
LOCAL = 1
};
io_base(QWidget *parent=NULL, resource *rsrc=NULL);
io_base(resource *rsrc);
io_base(resource *rsrc, int ID);
virtual ~io_base();
int getID( void );
void setID( const int ID );
int getType( void );
public slots:
virtual void recvCMD(const Command& command) = 0; // sub classes have to implement this
signals:
virtual void sendCMD(const Command& command) = 0; // sub classes have to implement this
protected:
// The knightio object needs to know its ID
QWidget *myParent;
int myID;
resource *myResource;
ioType myType;
};
#endif

@ -0,0 +1,312 @@
/***************************************************************************
io_engine.cpp - description
-------------------
begin : Sat Jun 30 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kprocess.h>
#include <kicontheme.h>
#include <qregexp.h>
#include <qfile.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "io_engine.moc"
#include "definitions.h"
#include "proto_base.h"
#include "proto_xboard.h"
#include "proto_uci.h"
io_engine::io_engine( QWidget *parent, resource *Rsrc ) : io_base( parent, Rsrc )
{
myType = io_base::LOCAL;
engine = NULL;
Log = NULL;
proto = NULL;
SafeToSend = TRUE;
CleanBuffer = TRUE;
SendSIGINT = FALSE;
Forced = TRUE;
Protocol = XBoard;
FIFO_In = "";
FIFO_Out = "";
}
//
io_engine::~io_engine()
{
if( engine )
{
Kill();
}
if( Log )
{
Log->close();
delete Log;
}
if( proto )
{
delete proto;
}
}
///////////////////////////////////////
//
// io_engine::Start
//
///////////////////////////////////////
void io_engine::Start( const int side )
{
QStringList args;
unsigned int tmp;
int ID;
bool Army;
/* Stop accidents */
if( engine != NULL )
return;
engine = new KProcess();
/* Convert 'side' to 'ID' */
if( side == WHITE )
{
ID = ENGINE_WHITE;
Army = WHITE;
}
else if( side == BLACK )
{
ID = ENGINE_BLACK;
Army = BLACK;
}
else if( side == WHITE_HELPER )
{
ID = ENGINE_WHITE_BK;
Army = WHITE;
}
else
{
ID = ENGINE_BLACK_BK;
Army = BLACK;
}
/* Get and parse engine config from resource */
for( IT = myResource->engines.begin(); IT != myResource->engines.end(); ++IT )
{
if( (*IT).CurrentRef & ID )
break;
}
if( IT == myResource->engines.end() )
{
kdError() << "io_engine::Start: Can not find engine resource ID " << ID << endl;
return;
}
/* ...protocol */
Protocol = (*IT).Protocol;
switch( Protocol )
{
case UCI:
proto = new proto_uci( myID );
break;
case XBoard:
default:
proto = new proto_xboard( myID );
break;
}
connect( proto, SIGNAL( output( const QString& ) ), this, SLOT( WriteFIFO( const QString& ) ) );
connect( proto, SIGNAL( output( const Command& ) ), this, SLOT( recvProtoCMD( const Command& ) ) );
/* ...engine's display name */
proto->parse( Command( myID, CMD_Set_Name, (*IT).Name ) );
/* ...engine file name */
(*engine) << (*IT).Filename;
/* ...command line arguments */
args = QStringList::split( QString(" "), (*IT).Arguments, FALSE );
for( tmp = 0; tmp < args.count(); tmp++ )
{
(*engine) << args[tmp];
}
/* ...log file */
if( !(*IT).LogFile.isEmpty() )
{
Log = new QFile( (*IT).LogFile );
if( !Log->open( IO_WriteOnly | IO_Append ) )
if( !Log->open( IO_WriteOnly ) )
kdError() << "io_engine::Start: Can not open " << (*IT).LogFile << " for writing." << endl;
}
/* Showtime */
if( !engine->start( KProcess::NotifyOnExit, KProcess::All ) )
{
kdError() << "io_engine::Start: Can not run the engine: " << (*IT).Filename << endl;
return;
}
connect( engine, SIGNAL( wroteStdin( KProcess* ) ), this, SLOT( SendClear( KProcess* ) ) );
connect( engine, SIGNAL( receivedStdout( KProcess*, char*, int ) ), this, SLOT( Recv( KProcess*, char*, int ) ) );
connect( engine, SIGNAL( receivedStderr( KProcess*, char*, int ) ), this, SLOT( Recv( KProcess*, char*, int ) ) );
proto->parse( Command( myID, CMD_Init ) );
if( myResource->OPTION_Ponder )
proto->parse( Command( myID, CMD_Ponder ) );
else
proto->parse( Command( myID, CMD_No_Pondering ) );
proto->parse( Command( myID, CMD_NewGame ) );
if( Army == WHITE )
proto->parse( Command( myID, CMD_Play_White ) );
else
proto->parse( Command( myID, CMD_Play_Black ) );
return;
}
///////////////////////////////////////
//
// io_engine::Kill
//
///////////////////////////////////////
void io_engine::Kill( void )
{
proto->parse( Command( myID, CMD_Exit ) );
if( engine != NULL )
delete engine;
}
///////////////////////////////////////
//
// io_engine::sendToChild
//
///////////////////////////////////////
void io_engine::sendToChild( void )
{
if( !SafeToSend || FIFO_Out.isEmpty() || !engine->isRunning() )
return;
/* Interrupt those engines that want or need it */
if( SendSIGINT )
{
engine->kill( SIGINT );
SendSIGINT = FALSE;
}
/* Write it */
SafeToSend = FALSE;
if( engine->writeStdin( FIFO_Out.latin1(), FIFO_Out.length() ) )
{
/* Print the output to the log file */
if( Log )
{
FIFO_Out.prepend( "<- " );
Log->writeBlock( FIFO_Out.latin1(), FIFO_Out.length() );
}
FIFO_Out = "";
}
else
kdError() << "io_engine::sendToChild: Could not write to engine." << endl;
}
///////////////////////////////////////
//
// io_engine::Recv
//
///////////////////////////////////////
void io_engine::Recv( KProcess*, char *buffer, int bufLen )
{
char *newBuff = new char[bufLen + 1];
strncpy( newBuff, buffer, bufLen );
newBuff[bufLen] = 0;
FIFO_In += newBuff;
delete newBuff;
if( FIFO_In.contains( QChar('\n') ) )
{
QString proc = FIFO_In.left( FIFO_In.findRev( QChar('\n') ) );
FIFO_In = FIFO_In.right( FIFO_In.length() - proc.length() );
/* Split and Parse Full Lines of Input */
QStringList strList = QStringList::split( "\n", proc );
for( unsigned int loop = 0; loop < strList.count(); loop++ )
{
/* Print the input to the log file */
if( Log )
{
QString data = "-> " + strList[loop] + "\n";
Log->writeBlock( data.latin1(), data.length() );
}
proto->parse( strList[loop] );
}
}
return;
}
///////////////////////////////////////
//
// io_engine::WriteFIFO
//
///////////////////////////////////////
void io_engine::WriteFIFO( const QString &Data )
{
QString data = Data;
if( data.isEmpty() )
return;
if( data.right(1) != "\n" )
data += "\n";
FIFO_Out += data;
sendToChild();
return;
}
///////////////////////////////////////
//
// io_engine::recvCMD
//
///////////////////////////////////////
void io_engine::recvCMD( const Command &command )
{
proto->parse( command );
}
///////////////////////////////////////
//
// io_engine::recvProtoCMD
//
///////////////////////////////////////
void io_engine::recvProtoCMD( const Command &command )
{
Command cmd = command;
switch( cmd.getCommand() )
{
/* Command: Send_SIGTERM */
case CMD_Send_SIGTERM:
engine->kill();
break;
/* Command: Send_SIGINT */
case CMD_Send_SIGINT:
SendSIGINT = TRUE;
break;
/* Command to Core */
default:
emit sendCMD( command );
break;
}
}
void io_engine::SendClear( KProcess* )
{
SafeToSend = TRUE;
if( !FIFO_Out.isEmpty() )
sendToChild();
}

@ -0,0 +1,81 @@
/***************************************************************************
io_engine.h - description
-------------------
begin : Sat Jun 30 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef IO_ENGINE_H
#define IO_ENGINE_H
#include <qstring.h>
#include <qvaluelist.h>
#include "io_base.h"
/**
*@author Troy Corbin Jr.
*/
class QFile;
class KProcess;
class resource;
class proto_base;
class io_engine : public io_base
{
Q_OBJECT
public:
io_engine( QWidget *parent=NULL, resource *Rsrc=0 );
~io_engine();
void Start( const int side );
public slots:
virtual void recvCMD( const Command& command );
void recvProtoCMD( const Command& command );
void SendClear( KProcess* );
void Recv( KProcess*, char*, int );
signals:
virtual void sendCMD(const Command& command);
protected slots:
void sendToChild( void );
void WriteFIFO( const QString &Data );
protected:
void Kill( void );
private:
engineList::Iterator IT;
proto_base *proto;
/* States */
bool SafeToSend;
bool SendSIGINT;
bool CleanBuffer;
bool Forced;
/* References */
QFile *Log;
int Protocol;
ChessMove Move;
/* Data */
KProcess *engine;
QString FIFO_In;
QString FIFO_Out;
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,138 @@
/***************************************************************************
io_internet.h - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef IO_INTERNET_H
#define IO_INTERNET_H
/* Local */
#include "definitions.h"
#include "io_base.h"
#include "match_param.h"
#include "command.h"
/* Tabs */
#include "tabmanager.h"
#include "console.h"
#include "challenge_graph.h"
#include "tab_seeklist.h"
class KSocket;
class KProcess;
class resource;
class core;
class dlg_login;
class dlg_challenge;
#include <qfile.h>
/**
*@author Troy Corbin Jr / Alexander Wels.
*/
struct MatchRecord
{
int knightsID;
int serverID;
bool observing;
bool examining;
bool finished;
};
const int READ_BUFFER_SIZE = 64 * 1024; /* 64k is max ip packet size */
const int LOGIN_STAGE_NAME = 1;
const int LOGIN_STAGE_PASSWORD = 2;
const int LOGIN_STAGE_LOGGED_IN = 3;
const unsigned int NORMAL_MODE = 1;
const unsigned int UPDATE_SOUGHT_MODE = 2;
const unsigned int NEW_GAME_MODE = 3;
const unsigned int OBSERVE_GAME_MODE = 4;
const unsigned int CHALLENGE_MODE = 5;
const unsigned int PARSE_MOVE_LIST_MODE = 6;
const unsigned int PARSE12_MODE_NEW = 1;
const unsigned int PARSE12_MODE_MOVE = 2;
typedef QMap<QWidget *, QWidget *> TabMap;
class io_internet : public io_base
{
Q_OBJECT
public:
io_internet(QWidget *parent = NULL, resource *Rsrc = NULL);
~io_internet();
public slots:
virtual void recvCMD(const Command& command);
void readCommand(KSocket *);
void sendUserName(void);
void sendPassword(void);
void send(const QString&);
void nullifyChallenge( void );
void acceptChallenge( void );
void declineChallenge( void );
void processSeekTimer( void );
void connectToServer( void );
void selfDestruct( void );
void setUserInfo(QString userName, QString passWord);
signals:
virtual void sendCMD(const Command& command);
void setLastPrivateSource( const QString& );
void setLastChannelSource( const QString& );
protected:
void parseLine(QString command);
void parseLoginData(QString command);
void writeToConsole(QString text, QString tag);
void updateSoughtList(QString text);
void parseStyle12(QString line, const unsigned int mode);
void sendUserSettings(void);
void parseMoveList(QString data);
void sendEndOfGameCommand(QString line);
private:
dlg_login *loginDlg;
dlg_challenge *challenge;
/* These are used to handle the automagic seek command */
QTimer *seekTimer;
/* These are used for the connection & logon */
QFile *Log;
KSocket *socket;
KProcess *myTimeseal;
struct serverResource *myServer;
int loginStage;
unsigned int parseMode;
QString lastTag;
int ficsMoveListNumber;
QString lineBuffer;
bool connected;
QString userName;
QString passWord;
/* communication with the server */
QStringList command_list; /* this is a temp buffer while waiting for the movelist */
bool waiting_for_move_list;
QMap<match_param *, int> fics_ids;
QMap<int, int> fics_to_knights; /* maps fics id's to knights id's */
TabMap myTabList; /* maintains the list of the tabs currently owned by this io_internet */
QValueList<Command> myCommandBuffer; /* this is a buffer for all the commands io_internet received while not connected to a server */
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,16 @@
[Desktop Entry]
Type=Application
Exec=knights
Icon=knights.png
MiniIcon=knights.png
Name=Knights
Name[de]=Knights
Comment=A graphical chess interface
Comment[de]=A graphical chess interface
InitialPreference=1
MimeType=application/x-chess-pgn,Application
ServiceTypes=
DocPath=knights/index.html
Terminal=false

@ -0,0 +1,145 @@
/***************************************************************************
knights.h - description
-------------------
begin : Thu Mar 1 10:43:51 CST 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KNIGHTS_H
#define KNIGHTS_H
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
/* KDEBase */
#include <kapp.h>
#include <kmainwindow.h>
#include <khelpmenu.h>
#include <kaboutdata.h>
#include <kstatusbar.h>
#include <kcmdlineargs.h>
/* QT */
#include <qlayout.h>
#include <qwidget.h>
#include <qpixmap.h>
#include <qstring.h>
/* Local */
#include "definitions.h"
#include "resource.h"
#include "accel.h"
class KMenuBar;
class KPopupMenu;
class KComboBox;
class QLabel;
class QFrame;
class dlg_settings;
class dlg_newmatch;
class core;
class splash;
/**
Knights is the top-level widget of the project.
It is responsable for creating the menu bar and it's contents,
as well as creating an instance of the game itself ( class Grid )
**/
class Knights : public KMainWindow
{
Q_OBJECT
public:
KAboutData *aboutData;
resource *Resource;
Knights( KCmdLineArgs *Args, QWidget* parent=0, const char *name=0 );
~Knights();
bool init( void );
void initMenus( void );
void BirthAll( void );
void keyPressEvent( QKeyEvent* );
public slots:
void KillAll( void );
void menuClose( void );
/** Yeah, they're sloppy, but I need my own geometry managment routines
because I don't like the "default" look my statusbar was getting
( double-height ). Plus, I want the console to appear only when needed. */
void resizeMainFrame( void );
bool event( QEvent* );
void resizeEvent( QResizeEvent* );
void hideEvent( QHideEvent* );
void showEvent( QShowEvent* );
void wheelEvent( QWheelEvent* );
void setStatusBar( const int &ID, const QString& MSG=QString::null );
void setClocks( void );
void initMatch( void );
void setNotation( void );
void PrevNotation( void );
void NextNotation( void );
void SelectTheme( int boardIndex, int chessmenIndex );
void Settings( int opt );
void openSettingsDialog( void );
void openNewMatchDialog( void );
void openKeyBindingDialog( void );
bool SaveGame( void );
bool SaveGamePrompt( void );
bool SaveGameAs( void );
void netConnect( void );
signals:
void themesAdded( void );
void focus( const QChar& );
protected:
bool queryClose( void );
protected slots:
void boardSmaller( void );
void boardBigger( void );
void installThemes( void );
void newMatch( void );
private:
KCmdLineArgs *args;
KMenuBar *topMenu;
KPopupMenu *help;
KPopupMenu *fileMenu;
KPopupMenu *settingsMenu;
KPopupMenu *matchMenu;
KPopupMenu *drawMenu;
KPopupMenu *tutorialMenu;
KComboBox *notationBar;
QFrame *MainFrame;
QLabel *whiteTimeLabel;
QLabel *blackTimeLabel;
QLabel *Message;
dlg_settings *SettingsDialog;
dlg_newmatch *NewMatch;
core *Core;
splash *SplashScreen;
Accel *myAccel;
int NotationIndex;
bool InitAll;
bool Minimized;
bool ResizeFlag;
int margin;
};
#endif

@ -0,0 +1,178 @@
/***************************************************************************
knightsmap.h - description
-------------------
begin : Sun Aug 25 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qvaluelist.h>
#ifndef KNIGHTSMAP_H
#define KNIGHTSMAP_H
/**
*@author Troy Corbin Jr.
*/
template<class Key, class T>
class KnightsMap
{
public:
typedef Key KeyType;
typedef T DataType;
typedef struct Pair
{
KeyType key;
DataType data;
};
private:
QValueList<Pair> pairList;
Key searchKey;
unsigned int searchIndex;
T nullValue;
T tempValue;
public:
/*
Constructor
*/
KnightsMap()
{
nullValue = 0;
clear();
}
/*
Destructor
*/
~KnightsMap()
{ clear(); }
/*
Returns the number of items in the map
*/
unsigned int count( void )
{ return pairList.count(); }
/*
Clears the map
*/
void clear( void )
{
searchIndex = 0;
pairList.clear();
}
/*
Add a Key/Value pair to the map
*/
void add( KeyType key, DataType data )
{
Pair newPair;
newPair.key = key;
newPair.data = data;
pairList.append( newPair );
}
/*
Return the next Value associated with the Key given
in the last call to 'find'. If there are none, then
NULL is returned.
*/
T& findNext( void )
{
unsigned int maxIndex( pairList.count() );
for( ; searchIndex < maxIndex ; searchIndex++ )
{
if( searchKey != pairList[searchIndex].key )
{
continue;
}
return pairList[searchIndex++].data;
}
return nullValue;
}
/*
Lookup a Value by it's key. This will always return
the first Value that's associated with the given Key.
If no Value has the given Key, NULL is returned.
*/
T& find( KeyType key )
{
searchKey = key;
searchIndex = 0;
return findNext();
}
/* Removes all Values that are associated with Key */
T& remove( KeyType key )
{
QValueListIterator<Pair> IT( pairList.begin() );
while( IT != pairList.end() )
{
if( (*IT).key == key )
{
tempValue = (*IT).data;
IT = pairList.remove( IT );
return tempValue;
}
IT++;
}
return nullValue;
}
/* Return the Value stored at Index i */
T& operator[]( unsigned int i )
{ return pairList[i].data; }
/* Return the Key stored at Index i */
Key& keyAt( unsigned int i )
{ return pairList[i].key; }
/*
Return the Value stored one Index position previous
to the last returned search Value. If already at the
begining of the Map, then NULL is returned.
*/
T& operator--( void )
{
if( searchIndex > 1 )
{
searchIndex -= 2;
}
else
{
return nullValue;
}
return pairList[searchIndex++].data;
}
/*
Return the Value stored one Index position after
the last returned search Value. If already at the
end of the Map, then NULL is returned.
*/
T& operator++( void )
{
if( searchIndex >= count() )
{
return nullValue;
}
return pairList[searchIndex++].data;
}
};
#endif

@ -0,0 +1,156 @@
/***************************************************************************
knightspixcache.cpp - description
-------------------
begin : Mon Aug 20 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "knightspixcache.h"
#include "definitions.h"
KnightsPixCache::KnightsPixCache()
{
bytesTotal = 1024 * 1024;
bytesUsed = 0;
}
KnightsPixCache::~KnightsPixCache()
{
clear();
bytesUsed = 0;
}
///////////////////////////////////////
//
// KnightsPixCache::cacheLimit
//
///////////////////////////////////////
unsigned int KnightsPixCache::cacheLimit( void )
{
return ( bytesTotal / 1024 );
}
///////////////////////////////////////
//
// KnightsPixCache::setCacheLimit
//
///////////////////////////////////////
void KnightsPixCache::setCacheLimit( const unsigned int &limit )
{
bytesTotal = limit * 1024;
}
///////////////////////////////////////
//
// KnightsPixCache::clear
//
///////////////////////////////////////
void KnightsPixCache::clear( void )
{
list.clear();
}
///////////////////////////////////////
//
// KnightsPixCache::cleanCache
//
///////////////////////////////////////
void KnightsPixCache::cleanCache( const unsigned int &space )
{
pixmapList::Iterator tmpIT;
register unsigned int age;
while( bytesUsed + space > bytesTotal )
{
if( list.count() == 0 ) return;
age = 0;
for( IT = list.begin(); IT != list.end(); ++IT )
{
if( (*IT).age > age )
{
age = (*IT).age;
tmpIT = IT;
}
}
bytesUsed -= (*tmpIT).bytes;
list.remove( tmpIT );
}
}
///////////////////////////////////////
//
// KnightsPixCache::add
//
///////////////////////////////////////
void KnightsPixCache::add( const QString &label, const QPixmap &pixmap )
{
unsigned int tmp;
cacheItem newItem;
if( pixmap.isNull() )
return;
tmp = ( pixmap.width() * pixmap.height() * pixmap.depth() ) >> 3;
if( ( bytesUsed + tmp ) > bytesTotal )
cleanCache(tmp);
newItem.label = label;
newItem.bytes = tmp;
newItem.item = pixmap;
newItem.age = 0;
list.append( newItem );
bytesUsed += tmp;
}
///////////////////////////////////////
//
// KnightsPixCache::find
//
///////////////////////////////////////
bool KnightsPixCache::find( const QString &label, QPixmap &pixmap )
{
bool status(FALSE);
for( IT = list.begin(); IT != list.end(); ++IT )
{
if( (*IT).label == label )
{
pixmap = (*IT).item;
(*IT).age = 0;
status = TRUE;
}
else
(*IT).age++;
}
return status;
}
///////////////////////////////////////
//
// KnightsPixCache::resize
//
///////////////////////////////////////
void KnightsPixCache::resize( const int &size )
{
SquareLight.convertFromImage( Orig_SquareLight.smoothScale( size, size ) );
SquareDark.convertFromImage( Orig_SquareDark.smoothScale( size, size ) );
HighlightSelect.convertFromImage( Orig_HighlightSelect.smoothScale( size, size ) );
HighlightMove.convertFromImage( Orig_HighlightMove.smoothScale( size, size ) );
HighlightAttack.convertFromImage( Orig_HighlightAttack.smoothScale( size, size ) );
BlackKing.convertFromImage( Orig_BlackKing.smoothScale( size, size ) );
BlackQueen.convertFromImage( Orig_BlackQueen.smoothScale( size, size ) );
BlackBishop.convertFromImage( Orig_BlackBishop.smoothScale( size, size ) );
BlackKnight.convertFromImage( Orig_BlackKnight.smoothScale( size, size ) );
BlackRook.convertFromImage( Orig_BlackRook.smoothScale( size, size ) );
BlackPawn.convertFromImage( Orig_BlackPawn.smoothScale( size, size ) );
WhiteKing.convertFromImage( Orig_WhiteKing.smoothScale( size, size ) );
WhiteQueen.convertFromImage( Orig_WhiteQueen.smoothScale( size, size ) );
WhiteBishop.convertFromImage( Orig_WhiteBishop.smoothScale( size, size ) );
WhiteKnight.convertFromImage( Orig_WhiteKnight.smoothScale( size, size ) );
WhiteRook.convertFromImage( Orig_WhiteRook.smoothScale( size, size ) );
WhitePawn.convertFromImage( Orig_WhitePawn.smoothScale( size, size ) );
Border.convertFromImage( Orig_Border.smoothScale( size * 9, size * 9) );
BorderLightOn.convertFromImage( Orig_BorderLightOn.smoothScale( size / 2, size / 2) );
BorderLightOff.convertFromImage( Orig_BorderLightOff.smoothScale( size / 2, size / 2) );
return;
}

@ -0,0 +1,104 @@
/***************************************************************************
knightspixcache.h - description
-------------------
begin : Mon Aug 20 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KNIGHTSPIXCACHE_H
#define KNIGHTSPIXCACHE_H
#include <qvaluelist.h>
#include <qpixmap.h>
#include <qimage.h>
/**
*@author Troy Corbin Jr.
*/
typedef struct cacheItem
{
QString label;
QPixmap item;
unsigned int bytes;
unsigned int age;
};
typedef QValueList<cacheItem> pixmapList;
class KnightsPixCache
{
public:
QPixmap SquareLight;
QPixmap SquareDark;
QPixmap HighlightSelect;
QPixmap HighlightMove;
QPixmap HighlightAttack;
QPixmap BlackKing;
QPixmap BlackQueen;
QPixmap BlackBishop;
QPixmap BlackKnight;
QPixmap BlackRook;
QPixmap BlackPawn;
QPixmap WhiteKing;
QPixmap WhiteQueen;
QPixmap WhiteBishop;
QPixmap WhiteKnight;
QPixmap WhiteRook;
QPixmap WhitePawn;
QPixmap Border;
QPixmap BorderLightOn;
QPixmap BorderLightOff;
QImage Orig_SquareLight;
QImage Orig_SquareDark;
QImage Orig_HighlightSelect;
QImage Orig_HighlightMove;
QImage Orig_HighlightAttack;
QImage Orig_BlackKing;
QImage Orig_BlackQueen;
QImage Orig_BlackBishop;
QImage Orig_BlackKnight;
QImage Orig_BlackRook;
QImage Orig_BlackPawn;
QImage Orig_WhiteKing;
QImage Orig_WhiteQueen;
QImage Orig_WhiteBishop;
QImage Orig_WhiteKnight;
QImage Orig_WhiteRook;
QImage Orig_WhitePawn;
QImage Orig_Border;
QImage Orig_BorderLightOn;
QImage Orig_BorderLightOff;
KnightsPixCache();
~KnightsPixCache();
void clear( void );
void setCacheLimit( const unsigned int &limit );
unsigned int cacheLimit( void );
void add( const QString &label, const QPixmap &pixmap );
bool find( const QString &label, QPixmap &pixmap);
void resize( const int &size );
private:
pixmapList list;
pixmapList::Iterator IT;
unsigned int bytesUsed;
unsigned int bytesTotal;
void cleanCache( const unsigned int &space );
};
#endif

@ -0,0 +1,238 @@
/***************************************************************************
knightstextview.cpp - description
-------------------
begin : Sun Dec 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "knightstextview.moc"
#include "definitions.h"
#include "resource.h"
#include <kdebug.h>
#include <kpopupmenu.h>
#include <kiconloader.h>
#include <kurl.h>
#include <krun.h>
// Used for printing functionality
#include <qpaintdevicemetrics.h>
#include <qpainter.h>
#include <qfontmetrics.h>
#include <kprinter.h>
#include <qsimplerichtext.h>
KnightsTextView::KnightsTextView(QWidget *parent, resource *Rsrc ) : QTextBrowser(parent)
{
myResource = Rsrc;
setReadOnly( TRUE );
setTextFormat( Qt::RichText );
menuView = new KPopupMenu( this );
/*
Configure functions in the View right click menu
*/
menuView->insertItem( QIconSet( Rsrc->LoadIcon( QString("editcopy"), KIcon::Small ) ),
i18n( "&Copy" ), this, SLOT( menuFunct(int) ), CTRL+Key_C, MENU_COPY );
menuView->insertItem( i18n("Select &All"), this, SLOT( menuFunct(int) ), CTRL+Key_A, MENU_SELECT_ALL );
menuView->insertSeparator();
menuView->insertItem( QIconSet( Rsrc->LoadIcon( QString("fileprint"), KIcon::Small ) ),
i18n( "&Print" ), this, SLOT( menuFunct(int) ), CTRL+Key_P, MENU_PRINT );
// menuView->insertItem( QIconSet( Rsrc->LoadIcon( QString("find"), KIcon::Small ) ),
// i18n( "&Find" ), this, SLOT( menuFunct(int) ), CTRL+Key_F, MENU_FIND );
// menuView->insertItem( QIconSet( Rsrc->LoadIcon( QString("next"), KIcon::Small ) ),
// i18n( "Find &Next" ), this, SLOT( menuFunct(int) ), Key_F3, MENU_FIND_NEXT );
// menuView->insertSeparator();
menuView->insertSeparator();
menuView->insertItem( QIconSet( Rsrc->LoadIcon( QString("viewmag+"), KIcon::Small ) ),
i18n( "Zoom &In" ), this, SLOT( menuFunct(int) ), 0, MENU_ZOOM_IN );
menuView->insertItem( QIconSet( Rsrc->LoadIcon( QString("viewmag-"), KIcon::Small ) ),
i18n( "Zoom &Out" ), this, SLOT( menuFunct(int) ), 0, MENU_ZOOM_OUT );
/* disconnect the linkClicked signal so we can replace it with our own */
disconnect(this, SIGNAL(linkClicked(const QString&)),this ,0);
/* connect the linkClicked signal to displayLink slot */
connect(this, SIGNAL(linkClicked(const QString&)), this, SLOT(displayLink(const QString&)));
show();
}
KnightsTextView::~KnightsTextView()
{
delete menuView;
}
///////////////////////////////////////
//
// KnightsTextView::viewportMousePressEvent
//
///////////////////////////////////////
void KnightsTextView::viewportMousePressEvent( QMouseEvent *e )
{
if( e->button() == RightButton )
{
emit rightButtonClicked( e->globalPos() );
display_menuView( e->globalPos() );
}
QTextEdit::viewportMousePressEvent( e );
}
///////////////////////////////////////
//
// KnightsTextView::display_menuView
//
///////////////////////////////////////
void KnightsTextView::display_menuView( const QPoint &Pos )
{
if( hasSelectedText() )
{
menuView->setItemEnabled( MENU_COPY, TRUE );
}
else
{
menuView->setItemEnabled( MENU_COPY, FALSE );
}
menuView->popup( Pos );
}
///////////////////////////////////////
//
// KnightsTextView::menuFunct
//
///////////////////////////////////////
void KnightsTextView::menuFunct( int funct )
{
switch( funct )
{
case MENU_COPY:
copy();
break;
case MENU_SELECT_ALL:
selectAll();
break;
case MENU_ZOOM_IN:
zoomIn();
break;
case MENU_ZOOM_OUT:
zoomOut();
break;
case MENU_PRINT:
print();
break;
default:
break;
}
}
///////////////////////////////////////
//
// KnightsTextView::pageMove
//
///////////////////////////////////////
void KnightsTextView::pageMove( Qt::Key key )
{
int NewY;
if( key == Key_PageUp )
{
NewY = contentsY() - visibleHeight();
if( NewY < 0 )
NewY = 0;
}
else
{
NewY = contentsY() + visibleHeight();
if( NewY > ( contentsHeight() - visibleHeight() ) )
NewY = contentsHeight() - visibleHeight();
}
setContentsPos( 0, NewY );
updateContents( 0, NewY, visibleWidth(), visibleHeight() );
}
///////////////////////////////////////
//
// KnightsTextView::displayLink(QString url)
//
///////////////////////////////////////
void KnightsTextView::displayLink(const QString& urlString)
{
KURL url(urlString);
new KRun(url);
}
///////////////////////////////////////
//
// KnightsTextView::print
//
///////////////////////////////////////
void KnightsTextView::print( void )
{
KPrinter printer( true, QPrinter::ScreenResolution );
viewport()->setCursor( waitCursor );
/* Make sure we want to print */
if( printer.setup() )
{
QPainter paint( &printer );
QPaintDeviceMetrics pageMetrics( paint.device() );
/* Setup sizes */
int dpix = pageMetrics.logicalDpiX();
int dpiy = pageMetrics.logicalDpiY();
const int margin = 36; // pt
QRect body( margin * dpix / 72, margin * dpiy / 72,
pageMetrics.width() - margin * dpix / 72 * 2,
pageMetrics.height() - margin * dpiy / 72 * 2 );
QRect view( body );
printer.setFullPage( true );
printer.setCreator( "Knights" );
QSimpleRichText simpText( this->text(), this->font() );
simpText.setWidth( view.width() );
/* Count Pages */
int currentPage = 1;
int totalPages = simpText.height() / view.height();
if( view.height() * totalPages < simpText.height() )
{
totalPages++;
}
/* Print */
while( 1 )
{
/* Print the Contents */
paint.setClipRect( body );
simpText.draw( &paint, body.left(), body.top(), view, colorGroup() );
paint.setClipping( false );
view.moveBy( 0, body.height() );
paint.translate( 0, -body.height() );
/* Print the Page Number */
paint.setFont( myResource->FONT_Standard );
paint.setPen( myResource->COLOR_Black );
QString pageCount = i18n( "Page %1 of %2" ).arg( currentPage ).arg( totalPages );
paint.drawText( view.width() - paint.fontMetrics().width( pageCount ),
view.bottom() + paint.fontMetrics().ascent() + 5, pageCount );
if( view.top() >= simpText.height() )
{
break;
}
printer.newPage();
currentPage++;
}
}
/* Restore Playground */
viewport()->unsetCursor();
}
void QTextBrowser::setSource(const QString&)
{
/* overwrote this to stop clicked links from clearing the
console */
}

@ -0,0 +1,54 @@
/***************************************************************************
knightstextview.h - description
-------------------
begin : Sun Dec 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KNIGHTSTEXTVIEW_H
#define KNIGHTSTEXTVIEW_H
#include <qwidget.h>
#include <qtextbrowser.h>
/**
*@author Troy Corbin Jr./Alexander Wels
*/
class KPopupMenu;
class resource;
class KnightsTextView : public QTextBrowser
{
Q_OBJECT
public:
KnightsTextView(QWidget *parent, resource *Rsrc );
~KnightsTextView();
void pageMove( Qt::Key key=Key_PageUp );
public slots:
void display_menuView( const QPoint& );
void menuFunct( int );
void displayLink(const QString& urlString);
void print( void );
signals:
void rightButtonClicked( const QPoint& );
protected:
void viewportMousePressEvent( QMouseEvent *e );
resource *myResource;
KPopupMenu *menuView;
};
#endif

@ -0,0 +1,145 @@
/***************************************************************************
list_pgn.cpp - description
-------------------
begin : Thu Dec 13 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "list_pgn.moc"
#include <klistview.h>
#include <kstatusbar.h>
#include <kprogress.h>
#include <qhbox.h>
#include "resource.h"
#include "match_param.h"
list_pgn::list_pgn(QWidget *parent, const char *name) : QVBox(parent,name)
{
listView = new KListView( this, "listView" );
listView->addColumn( i18n( "Result" ) );
listView->addColumn( i18n( "White" ) );
listView->addColumn( i18n( "Black" ) );
listView->addColumn( i18n( "Round" ) );
listView->addColumn( i18n( "Site" ) );
listView->addColumn( i18n( "Date" ) );
listView->setSorting( 1 );
listView->setAllColumnsShowFocus( TRUE );
listView->setMultiSelection( FALSE );
listView->setShowSortIndicator( TRUE );
listView->restoreLayout( kapp->config(), "PGN_ListView" );
listView->show();
connect( listView, SIGNAL( executed( QListViewItem* ) ), this, SLOT( slot_selected( QListViewItem* ) ) );
/*
Showing listView while scanning can mean the difference between
a 12 second load time and a 40 second load time. dummyView is
just a placeholder for listView while scanning.
*/
dummyView = new KListView( this, "dummyView" );
dummyView->addColumn( i18n( "Result" ) );
dummyView->addColumn( i18n( "White" ) );
dummyView->addColumn( i18n( "Black" ) );
dummyView->addColumn( i18n( "Round" ) );
dummyView->addColumn( i18n( "Site" ) );
dummyView->addColumn( i18n( "Date" ) );
dummyView->restoreLayout( kapp->config(), "PGN_ListView" );
dummyView->hide();
statusBox = new QHBox( this, "statusBox" );
status = new KStatusBar( statusBox, "status" );
progress = new KProgress( statusBox, "progress" );
progress->setValue( 0 );
show();
}
list_pgn::~list_pgn()
{
listView->saveLayout( kapp->config(), "PGN_ListView" );
}
///////////////////////////////////////
//
// list_pgn::setURL
//
///////////////////////////////////////
void list_pgn::setURL( QString URL )
{
myURL = URL;
listView->clear();
setCaption( URL );
if( tmpPGN.open( URL ) == FALSE )
{
status->message( i18n( "Can not open %1" ).arg( URL ) );
return;
}
listView->hide();
dummyView->show();
startTimer( 0 );
}
///////////////////////////////////////
//
// list_pgn::setProgress
//
///////////////////////////////////////
void list_pgn::setProgress( const int num )
{
progress->setValue( num );
if( num == 100 )
progress->setEnabled( FALSE );
else
progress->setEnabled( TRUE );
}
///////////////////////////////////////
//
// list_pgn::slot_selected
//
///////////////////////////////////////
void list_pgn::slot_selected( QListViewItem *item )
{
emit selected( myURL, item->text(6).toInt() );
}
///////////////////////////////////////
//
// list_pgn::timerEvent
//
///////////////////////////////////////
void list_pgn::timerEvent( QTimerEvent* )
{
int fileProgress;
fileProgress = tmpPGN.scan();
setProgress( fileProgress );
if( tmpPGN.TAG_White.isEmpty() )
{
if( listView->childCount() == 1 )
{
emit selected( myURL, 0 );
}
killTimers();
listView->show();
dummyView->hide();
}
else
{
(void) new KListViewItem( listView,
tmpPGN.TAG_Result,
tmpPGN.TAG_White,
tmpPGN.TAG_Black,
tmpPGN.TAG_Round,
tmpPGN.TAG_Site,
tmpPGN.TAG_Date,
QString::number(tmpPGN.File_Position) );
status->message( i18n( QString( "%1 matches found." ).arg( listView->childCount() ) ) );
}
}

@ -0,0 +1,66 @@
/***************************************************************************
list_pgn.h - description
-------------------
begin : Thu Dec 13 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef LIST_PGN_H
#define LIST_PGN_H
#include <qvbox.h>
#include <qstring.h>
#include "pgn.h"
/**
*@author Troy Corbin Jr.
*/
class match_param;
class KStatusBar;
class KProgress;
class KListView;
class QHBox;
class list_pgn : public QVBox
{
Q_OBJECT
public:
list_pgn(QWidget *parent=0, const char *name=0);
void setURL( QString URL );
void setProgress( const int );
QString URL( void )
{ return myURL; }
~list_pgn();
signals:
void selected( const QString&, const int& );
protected slots:
void slot_selected( QListViewItem *item );
protected:
void timerEvent( QTimerEvent * );
private:
QString myURL;
QHBox *statusBox;
KListView *listView;
KListView *dummyView;
KStatusBar *status;
KProgress *progress;
pgn tmpPGN;
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,88 @@
/***************************************************************************
logic.h - description
-------------------
begin : Sat Sep 29 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef LOGIC_H
#define LOGIC_H
#include <qstring.h>
#include "definitions.h"
#include "resource.h"
#include "match_param.h"
/**
*@author Troy Corbin Jr.
*/
const char CF_King = 0x01;
const char CF_RookQ = 0x02;
const char CF_RookK = 0x04;
class logic
{
public:
char OnMove;
Position current[64];
Chessman chessman[64];
ChessMove chessMove;
/* This is used for the 50 move rule */
char MoveCounter;
logic( resource *Rsrc=0, match_param *param=0 );
~logic();
void Init( const int Var=Type_Standard );
void setBoard( const QString &board=QString::null, const short ppf=-2 );
void setBoardFromFen( const QString &fen );
QString board( void );
bool isChessman( const char ChessmanPtr );
bool isCheck( const bool Army );
bool isLegal( const bool Army );
bool isDraw( const bool Army );
bool Move( void );
void HashLegal( const char Man, const bool Recursion=FALSE );
int Pointer( const char File, const char Rank );
bool parseCAN( const bool Army );
bool parseSAN( void );
void writeCAN( void );
void writeSAN( void );
protected:
int CalcPointer( const char File, const char Rank );
void _HashLegal( const bool Recursion=FALSE );
void clearBoard( void );
int getKing( const bool Army );
void Init_Standard( void );
inline void copyPositions( Position *Src, Position *Dst )
{ memcpy( Dst, Src, sizeof(Position) << 6 ); }
inline void copyChessmen( Chessman *Src, Chessman *Dst )
{ memcpy( Dst, Src, sizeof(Chessman) << 6 ); }
private:
resource *Resource;
match_param *Param;
int GameType;
Position hash[64];
Position hashBackup[64];
Chessman chessmanBackup[64];
char CastleFlag[2];
char enPassant[2];
char ManPtr;
};
#endif

@ -0,0 +1,85 @@
/***************************************************************************
main.cpp - description
-------------------
begin : Thu Mar 1 10:43:51 CST 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kcmdlineargs.h>
#include <kaboutdata.h>
#include <klocale.h>
#include "knights.h"
static KCmdLineOptions options[] =
{
{ "d <path>", I18N_NOOP("Specify the location of your Knights data directory."), 0 },
{ "+[filename]", I18N_NOOP("A .pgn file to be loaded."), 0 },
{ 0, 0, 0 }
};
int main(int argc, char *argv[])
{
KAboutData aboutData( "knights",
I18N_NOOP("Knights"),
_VERSION_,
I18N_NOOP("The Knights Chess Interface\n\nKnights is a chess interface\nfor the K Desktop Environment."),
KAboutData::License_GPL_V2,
"(c) 2003, Troy Corbin Jr.",
0,
"http://knights-chess.com",
"troy@knights-chess.com");
aboutData.addAuthor("Troy Corbin Jr.",
I18N_NOOP("Project Manager and Programmer"),
"tcorbin@users.sourceforge.net",
"http://knights.sourceforge.net");
aboutData.addAuthor("Alexander Wels",
I18N_NOOP("Communications Programmer"),
"agpwels@adelphia.net",
"");
aboutData.addCredit("Mark Westcott",
I18N_NOOP("Qtopia port and patches"),
"mark@houseoffish.org",
"");
aboutData.addCredit("Kunnar Klauks",
I18N_NOOP("Patches and suggestions"),
"kunnk@yahoo.com",
"");
aboutData.addCredit("Harald Fernengel",
I18N_NOOP("KDE3 Compatability Patch"),
"harry@kdevelop.org",
"");
aboutData.addCredit("Tim Mann",
I18N_NOOP("XBoard protocol"),
"tim.mann@compaq.com",
"http://www.tim-mann.org/chess.html");
aboutData.setTranslator(I18N_NOOP("_: NAME OF TRANSLATORS\nYour names"),
I18N_NOOP("_: EMAIL OF TRANSLATORS\nYour emails"));
KCmdLineArgs::init( argc, argv, &aboutData );
KCmdLineArgs::addCmdLineOptions( options );
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KApplication a;
Knights *knights = new Knights(args);
a.setMainWidget(knights);
if( !knights->init() ) // Did we init ok?
{
return 0;
}
/* Without this connection, the destructors are not called, and some
housecleaning ( like destroying child processes ) isn't done */
a.connect( &a, SIGNAL( shutDown () ), knights, SLOT( KillAll() ) );
return a.exec();
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,133 @@
/***************************************************************************
match.h - description
-------------------
begin : Mon Jul 2 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef MATCH_H
#define MATCH_H
#include <qwidget.h>
#include "resource.h"
#include "match_param.h"
#include "command.h"
#include "chessclock.h"
#include "logic.h"
#include "pgn.h"
class board_base;
class match : public QWidget
{
Q_OBJECT
private:
resource *Resource;
board_base *Board;
pgn *Record;
logic *Logic;
chessclock *Clock;
ChessMove chessMove;
ChessMove preMove;
bool preMoved;
bool Modified;
bool Paused;
bool Loading;
bool JustMoved;
bool Current;
int myID;
int StatusCode;
int loadTimer;
QString StatusMessage;
char ICSGameMode;
char Draw_Offered[2];
public:
match(QWidget *parent, match_param *param, resource *Rsrc);
~match();
char inputOnMove( bool reverse=FALSE );
char input( char army );
QString url( void );
void flip( void );
void retract( void );
void requestHint( void );
void recvCMD( const Command &cmd );
void setVisibility( const bool vis );
void setPaused( const bool State );
/* Inline Function */
int getID( void )
{ return myID; }
void setID( const int &ID )
{ myID = ID; }
QString caption( void )
{ return Record->caption(); }
char onMove( void )
{ return Logic->OnMove; }
bool modified( void )
{ return Modified; }
bool paused( void )
{ return Paused; }
bool flag( const bool &Army )
{ return Clock->Flag[Army]; }
void setCurrent( const bool &State )
{ Current = State; }
void print( void )
{ Record->print(); }
bool loading( void )
{ return Loading; }
int centiseconds( const bool &Army )
{ return Clock->getCentiseconds( Army ); }
QStringList* notation( void )
{ return Record->notation(); }
void setModified( const bool &state )
{ Modified = state; }
void resendStatusBar( void )
{ emit setStatusBar( StatusCode, StatusMessage ); }
match_param* getParam( void )
{ return Record->Param; }
public slots:
void tick( void );
void resize( void );
void redraw( void );
QString clock( bool );
bool save( QString );
bool load( const QString URL, const int pos=0 );
void loadSpecial( void );
void slot_Select( int );
void slot_Preview( int );
void slot_flagFell( const bool );
void review( const int );
void parseMatchParam( void );
void saveStatusBar( const int &ID, const QString &MSG )
{ StatusCode = ID; StatusMessage = MSG; }
protected slots:
bool move( ChessMove );
signals:
void setNotation( void );
void setClocks( void );
void setStatusBar( const int &ID, const QString &MSG=QString::null );
void sendCMD( const Command& );
protected:
bool move( void );
void clearSelections( void );
void drawPosition( const int );
void playSound( const int );
void _retract( void );
};
#endif

@ -0,0 +1,243 @@
/***************************************************************************
match_param.cpp - description
-------------------
begin : Tue Jun 25 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kstddirs.h>
#include <qcstring.h>
#include <qfile.h>
#include <qregexp.h>
#include <string.h>
#include "match_param.moc"
match_param::match_param(resource *Rsrc) : QObject()
{
myResource = Rsrc;
initialize();
}
match_param::match_param(resource *Rsrc, const int &whiteType, const int &blackType) : QObject()
{
myResource = Rsrc;
initialize();
myResource->Type[WHITE] = Type[WHITE] = whiteType;
myResource->Type[BLACK] = Type[BLACK] = blackType;
lookupNames();
lookupImages();
}
match_param::~match_param()
{
}
///////////////////////////////////////
//
// match_param::initialize
//
///////////////////////////////////////
void match_param::initialize( void )
{
PlayerNames << "" << "" << "" << "";
PlayerImages << QPixmap() << QPixmap() << QPixmap() << QPixmap();
Type[WHITE] = myResource->Type[WHITE];
Type[WHITE_HELPER] = myResource->Type[WHITE_HELPER];
Type[BLACK] = myResource->Type[BLACK];
Type[BLACK_HELPER] = myResource->Type[BLACK_HELPER];
Strength[WHITE] = myResource->Strength[WHITE];
Strength[WHITE_HELPER] = myResource->Strength[WHITE_HELPER];
Strength[BLACK] = myResource->Strength[BLACK];
Strength[BLACK_HELPER] = myResource->Strength[BLACK_HELPER];
Variation = myResource->MatchRules;
lookupTCP();
lookupNames();
lookupImages();
}
///////////////////////////////////////
//
// match_param::lookupNames
//
///////////////////////////////////////
void match_param::lookupNames( void )
{
engineList::Iterator IT;
char ID = 0;
for( int loop=0; loop < 4; loop++)
{
switch( Type[loop] )
{
case PLAYERLOCAL:
PlayerNames[loop] = myResource->Local_Player;
break;
case PLAYERPC:
/* Convert standard player numbers into engine Reference IDs */
switch( loop )
{
case WHITE:
ID = ENGINE_WHITE;
break;
case BLACK:
ID = ENGINE_BLACK;
break;
case WHITE_HELPER:
ID = ENGINE_WHITE_BK;
break;
case BLACK_HELPER:
ID = ENGINE_BLACK_BK;
break;
}
/* Search for Engine. I'm starting to like the idea of maps. =) */
for( IT = myResource->engines.begin(); IT != myResource->engines.end(); ++IT )
{
if( (*IT).CurrentRef & ID ) break;
}
if( IT == myResource->engines.end() )
{
PlayerNames[loop] = i18n("Unknown");
}
else
{
PlayerNames[loop] = (*IT).Name;
}
break;
case PLAYEREMAIL:
PlayerNames[loop] = myResource->Email_Address;
break;
}
}
}
///////////////////////////////////////
//
// match_param::lookupTCP
//
///////////////////////////////////////
void match_param::lookupTCP( void )
{
Time_White = myResource->TCPWhite;
Time_Black = myResource->TCPBlack;
}
///////////////////////////////////////
//
// match_param::lookupImages
//
///////////////////////////////////////
void match_param::lookupImages( void )
{
for( int loop=0; loop < 4; loop++)
{
switch( Type[loop] )
{
case PLAYERLOCAL:
PlayerImages[loop] = myResource->loadSCIDImage( PlayerNames[loop] );
if( PlayerImages[loop].isNull() )
PlayerImages[loop].load( locate("data", "knights/default-portrait.jpg" ) );
break;
case PLAYERPC:
PlayerImages[loop] = myResource->loadSCIDImage( PlayerNames[loop] );
if( PlayerImages[loop].isNull() )
PlayerImages[loop].load( locate("data", "knights/default-engine-portrait.jpg" ) );
break;
case PLAYEREMAIL:
PlayerImages[loop] = myResource->loadSCIDImage( PlayerNames[loop] );
if( PlayerImages[loop].isNull() )
PlayerImages[loop].load( locate("data", "knights/default-portrait.jpg" ) );
break;
}
}
}
///////////////////////////////////////
//
// match_param::time
//
///////////////////////////////////////
TCPList match_param::time( const char &player )
{
if( player == BLACK )
return Time_Black;
return Time_White;
}
///////////////////////////////////////
//
// match_param::setTime
//
///////////////////////////////////////
void match_param::setTime( const char &player, const TCPList &tcp )
{
if( player == BLACK )
myResource->TCPBlack = Time_Black = tcp;
else
myResource->TCPWhite = Time_White = tcp;
setTimer();
}
///////////////////////////////////////
//
// match_param::getVariation
//
///////////////////////////////////////
int match_param::getVariation(void)
{
return Variation;
}
///////////////////////////////////////
//
// match_param::setVariation
//
///////////////////////////////////////
void match_param::setVariation(const int variation)
{
Variation = variation;
setTimer();
}
///////////////////////////////////////
//
// match_param::setTimer
//
///////////////////////////////////////
void match_param::setTimer( void )
{
if( TimerFlag ) return;
QTimer::singleShot( 0, this, SLOT( slot_Timer() ) );
TimerFlag = TRUE;
}
///////////////////////////////////////
//
// match_param::slot_Timer
//
///////////////////////////////////////
void match_param::slot_Timer( void )
{
emit valuesChanged();
TimerFlag = FALSE;
}
///////////////////////////////////////
//
// match_param::setType
//
///////////////////////////////////////
void match_param::setType( const int &player, const char &type )
{
myResource->Type[player] = Type[player] = type;
lookupNames();
lookupImages();
setTimer();
}

@ -0,0 +1,100 @@
/***************************************************************************
match_param.h - description
-------------------
begin : Tue Jun 25 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef MATCH_PARAM_H
#define MATCH_PARAM_H
/**
*@author Troy Corbin Jr.
*/
#include <qobject.h>
#include <qstringlist.h>
#include <qpixmap.h>
#include <qvaluelist.h>
#include <qtimer.h>
#include "definitions.h"
#include "resource.h"
class match_param : public QObject
{
Q_OBJECT
private:
resource *myResource;
QStringList PlayerNames;
QValueList<QPixmap> PlayerImages;
/*
This is used to keep the signal valuesChanged
from triggering multiple times in a row.
*/
bool TimerFlag;
char Type[4];
TCPList Time_White;
TCPList Time_Black;
char Strength[4];
int Variation;
protected:
void initialize( void );
void lookupTCP( void );
void lookupNames( void );
void lookupImages( void );
void setTimer( void );
public:
match_param( resource *Rsrc=0 );
match_param( resource*, const int &whiteType, const int &blackType );
~match_param();
char type( const int &player )
{ return Type[player]; }
char strength( const int &player )
{ return Strength[player]; }
QPixmap image( const char &player )
{ return PlayerImages[player]; }
QString name( const char &player )
{ return PlayerNames[player]; }
TCPList time( const char &player );
void setType( const int &player, const char &type );
void setStrength( const int &player, const char &str )
{ setTimer(); myResource->Strength[player] = Strength[player] = str; }
void setTime( const char &player, const TCPList &tcp );
void setName( const int &player, const QString &name )
{ PlayerNames[player] = name; }
void setVariation( const int variation );
int getVariation( void );
public slots:
void slot_Timer( void );
signals:
void valuesChanged( void );
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,11 @@
[Desktop Entry]
Type=MimeType
MimeType=application/x-chess-pgn
Icon=pgn.png
Comment=Portable Game Notation
X-KDE-AutoEmbed=false
Patterns=*.pgn *.PGN
Name=Chess Match

@ -0,0 +1,153 @@
/***************************************************************************
pgn.h - description
-------------------
begin : Mon Jul 30 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PGN_H
#define PGN_H
#include <klocale.h>
#include <ktempfile.h>
#include <kio/netaccess.h>
#include <qobject.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qvaluelist.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qpainter.h>
#include "definitions.h"
#include "resource.h"
#include "knightsmap.h"
#include "match_param.h"
/**
*@author Troy Corbin Jr.
*/
typedef struct Annotation
{
int RAV;
QString text;
};
typedef QValueList<ChessMove> MoveList;
typedef KnightsMap<int, Annotation*> Annotations;
class tab_pgnView;
class pgn : public QObject
{
Q_OBJECT
public:
/* Standard PGN Tags */
QString TAG_Event;
QString TAG_Site;
QString TAG_Date;
QString TAG_Round;
QString TAG_White;
QString TAG_Black;
QString TAG_Result;
QString TAG_EventDate;
QString TAG_EventSponsor;
QString TAG_Section;
QString TAG_Stage;
QString TAG_Board;
QString TAG_WhiteTitle;
QString TAG_WhiteElo;
QString TAG_WhiteUSCF;
QString TAG_WhiteNA;
QString TAG_WhiteType;
QString TAG_BlackTitle;
QString TAG_BlackElo;
QString TAG_BlackUSCF;
QString TAG_BlackNA;
QString TAG_BlackType;
QString TAG_Opening;
QString TAG_Variation;
QString TAG_SubVariation;
QString TAG_ECO;
QString TAG_NIC;
QString TAG_Time;
QString TAG_UTCTime;
QString TAG_UTCDate;
QString TAG_TimeControl;
QString TAG_SetUp;
QString TAG_FEN;
QString TAG_Termination;
QString TAG_Annotator;
QString TAG_Mode;
QString TAG_PlyCount;
int File_Position; // Used to scan PGN file
QStringList Move_Data;
/* The match_param */
match_param *Param;
/* These are used in unfinished save games */
int whiteTime;
int blackTime;
TCPList whiteTCP;
TCPList blackTCP;
QString CurrentURL;
MoveList Moves;
Annotations RAV;
Annotations annotations;
QStringList Positions;
unsigned int currentIndex;
pgn( resource *Rsrc=0, match_param *param=NULL );
~pgn();
void clear( void );
void init( void );
int scan( void );
bool load( const int pos=0 );
bool save( QString URL );
bool open( const QString& URL );
void print( void );
QStringList* notation( const int format=1 );
void close( void );
static QString getNAG( int num );
QString caption( void );
signals:
void processMove( ChessMove );
void processSpecial( void );
public slots:
bool loadNext( void );
void parseMatchParam( void );
void childViewDestroyed( void );
private:
resource *Resource;
tab_pgnView *pgnView;
QString tempFile;
QString currentLine;
QFile File;
QTextStream Input;
QChar getch( void );
QString getword( void );
void clearTags( void );
void parseTag( void );
void parseAnnotation( const int fromRAVnum=0 );
void parseRAV( void );
void parseKnightsData( void );
};
#endif

@ -0,0 +1,34 @@
/***************************************************************************
proto_base.cpp - description
-------------------
begin : Sat Oct 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "proto_base.moc"
proto_base::proto_base( const int ID ) : QObject()
{
myID = ID;
}
proto_base::~proto_base()
{
}
void proto_base::setID( const int ID )
{
myID = ID;
}
int proto_base::getID()
{
return myID;
}

@ -0,0 +1,54 @@
/***************************************************************************
proto_base.h - description
-------------------
begin : Sat Oct 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PROTO_BASE_H
#define PROTO_BASE_H
#include <qobject.h>
#include <qstring.h>
#include <qvaluelist.h>
#include "command.h"
#include "definitions.h"
/**
*@author Troy Corbin Jr.
*/
typedef QValueList<Command> CommandList;
class proto_base : public QObject
{
Q_OBJECT
public:
proto_base( const int ID );
virtual ~proto_base();
int getID( void );
void setID( const int ID );
public slots:
virtual void parse( const Command& ) = 0;
virtual void parse( const QString& ) = 0;
signals:
void output( const QString& );
void output( const Command& );
protected:
int myID;
ChessMove myMove;
};
#endif

@ -0,0 +1,218 @@
/***************************************************************************
proto_uci.cpp - description
-------------------
begin : Sat Oct 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qstringlist.h>
#include <qregexp.h>
#include "proto_uci.moc"
#include "definitions.h"
proto_uci::proto_uci( const int ID ) : proto_base( ID )
{
hintMode = FALSE;
initMode = FALSE;
JustMoved = FALSE;
myArmy = BLACK;
Turn = WHITE;
CMDList = new CommandList;
}
proto_uci::~proto_uci()
{
delete CMDList;
}
///////////////////////////////////////
//
// proto_uci::parse( const Command &command )
//
///////////////////////////////////////
void proto_uci::parse( const Command &command )
{
Command cmd = command;
if( initMode )
{
CMDList->append( command );
return;
}
switch( cmd.getCommand() )
{
/* Command: Init */
case CMD_Init:
emit output( "uci" );
initMode = TRUE;
break;
/* Command: New Game */
case CMD_NewGame:
emit output( "isready" );
break;
/* Command: Exit */
case CMD_Exit:
emit output( "quit" );
break;
/* Command: Move */
case CMD_Move:
if( JustMoved )
{
JustMoved = FALSE;
break;
}
if( FEN.isEmpty() )
{
emit output( QString("position startpos moves %1").arg( cmd.getData() ) );
}
else
{
emit output( QString("position fen %1 moves %2").arg( FEN ).arg( cmd.getData() ) );
}
emit output( QString("go wtime %1 btime %2 depth %3").arg( cmd.getWhiteTime() ).arg( cmd.getBlackTime() ).arg( difficulty ) );
break;
/* Command: Set Difficulty */
case CMD_Set_Difficulty:
difficulty = cmd.getData();
break;
/* Command: Set Board */
case CMD_Set_Board:
FEN = cmd.getData();
break;
/* Command: Move Now */
case CMD_MoveNow:
emit output( "stop" );
break;
/* Command: UCI Hint */
case CMD_UCI_Hint:
hintMode = TRUE;
if( FEN.isEmpty() )
{
emit output( QString("position startpos moves %1").arg( cmd.getData() ) );
}
else
{
emit output( QString("position fen %1 moves %2").arg( FEN ).arg( cmd.getData() ) );
}
emit output( QString("go wtime %1 btime %2 depth %3").arg( cmd.getWhiteTime() ).arg( cmd.getBlackTime() ).arg( difficulty ) );
break;
/* Command: Play White */
case CMD_Play_White:
myArmy = WHITE;
break;
/* Command: Play Black */
case CMD_Play_Black:
myArmy = BLACK;
break;
/* Command: Set Name */
case CMD_Set_Name:
engineName = cmd.getData();
break;
}
}
///////////////////////////////////////
//
// proto_uci::parse( const QString &string )
//
///////////////////////////////////////
void proto_uci::parse( const QString &string )
{
QString strIn = string;
QStringList strList( QStringList::split( ' ', strIn ) );
/* Bestmove */
if( strList[0] == "bestmove" )
{
if( strList.count() < 2 )
{
kdWarning() << "proto_uci::parse: Incomplete Bestmove command" << endl;
return;
}
Command::clearMove( &myMove );
strcpy( myMove.CAN, strList[1].latin1() );
if( hintMode )
{
/* The Engine Gives a Hint */
hintMode = FALSE;
// emit output( Command( myID, CMD_Hint, i18n( "%1 suggests this move:\n%2" ).arg( engineName ).arg( strList[1] ) ) );
emit output( Command( myID, CMD_Hint, QString( "%1 suggests this move:\n%2" ).arg( engineName ).arg( strList[1] ) ) );
}
else
{
/* The Engine Moves */
JustMoved = TRUE;
emit output( Command( myID, CMD_Move, 0, 0, myMove ) );
}
}
/* UCIOK */
if( strList[0] == "uciok" )
{
initMode = FALSE;
releaseBuffer();
}
/* READYOK */
if( strList[0] == "readyok" )
{
initMode = FALSE;
releaseBuffer();
}
/* ID */
if( strList[0] == "id" )
{
if( strList[1] == "name" )
{
engineName = strIn.right( strIn.length() - 8 );
}
if( strList[1] == "author" )
{
engineAuthor = strIn.right( strIn.length() - 10 );
}
}
/* COPYPROTECTION */
if( strList[0] == "copyprotection" )
{
if( strList[1] == "error" )
{
// emit output( Command( myID, CMD_Tell_User_Error, i18n( "%1 did not pass it's copy protection check." ).arg( engineName ) ) );
emit output( Command( myID, CMD_Tell_User_Error, QString( "%1 did not pass it's copy protection check." ).arg( engineName ) ) );
}
}
}
///////////////////////////////////////
//
// proto_uci::releaseBuffer
//
///////////////////////////////////////
void proto_uci::releaseBuffer( void )
{
CommandList::Iterator it;
for( it = CMDList->begin(); it != CMDList->end(); it++ )
{
parse( *it );
}
CMDList->clear();
}

@ -0,0 +1,55 @@
/***************************************************************************
proto_uci.h - description
-------------------
begin : Sat Oct 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PROTO_UCI_H
#define PROTO_UCI_H
#include <qvaluelist.h>
#include "proto_base.h"
/**
*@author Troy Corbin Jr.
*/
class proto_uci : public proto_base
{
Q_OBJECT
public:
proto_uci( const int ID );
~proto_uci();
virtual void parse( const Command& );
virtual void parse( const QString& );
protected slots:
void releaseBuffer( void );
private:
QString engineName;
QString engineAuthor;
QString difficulty;
QString FEN;
CommandList *CMDList;
bool hintMode;
bool initMode;
bool JustMoved;
bool myArmy;
bool Turn;
};
#endif

@ -0,0 +1,687 @@
/***************************************************************************
proto_xboard.cpp - description
-------------------
begin : Sat Oct 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <klocale.h>
#include <qtimer.h>
#include <qstringlist.h>
#include <qregexp.h>
#include "proto_xboard.moc"
#include "definitions.h"
proto_xboard::proto_xboard( const int ID ) : proto_base( ID )
{
FEATURE_Analyze = TRUE;
FEATURE_Colors = TRUE;
FEATURE_Draw = TRUE;
FEATURE_ICS = FALSE;
FEATURE_Name = TRUE;
FEATURE_Pause = FALSE;
FEATURE_Ping = FALSE;
FEATURE_PlayOther = FALSE;
FEATURE_Reuse = TRUE;
FEATURE_SetBoard = FALSE;
FEATURE_SAN = FALSE;
FEATURE_SIGINT = TRUE;
FEATURE_SIGTERM = TRUE;
FEATURE_Time = TRUE;
FEATURE_UserMove = FALSE;
FEATURE_Variants = 0;
FEATURE_Level = 1;
FEATURE_BookEngine = 0;
CMDList = new CommandList;
InitTimer = new QTimer( this );
connect( InitTimer, SIGNAL( timeout() ), this, SLOT( releaseBuffer() ) );
Check = TRUE;
Team = FALSE;
JustMoved = FALSE;
AcceptIllegal = FALSE;
DelayedGo = FALSE;
Forced = TRUE;
Turn = WHITE;
}
proto_xboard::~proto_xboard()
{
delete InitTimer;
delete CMDList;
}
///////////////////////////////////////
//
// proto_xboard::parse( const Command &command )
//
///////////////////////////////////////
void proto_xboard::parse( const Command &command )
{
QString temp;
Command cmd = command;
if( InitTimer->isActive() )
{
/*
Store Command for later use..
we're still waiting for the engine to finish
*/
CMDList->append( command );
return;
}
switch( cmd.getCommand() )
{
/* Command: Init */
case CMD_Init:
emit output( "xboard\nprotover 3" );
InitTimer->start( 2000, TRUE );
break;
/* Command: New Game */
case CMD_NewGame:
emit output( "new\nrandom" );
break;
/* Command: Exit */
case CMD_Exit:
emit output( "quit" );
if( FEATURE_SIGTERM )
emit output( Command( myID, CMD_Send_SIGTERM ) );
break;
/* Command: Move Now */
case CMD_MoveNow:
emit output( "?" );
break;
/* Command: Move */
case CMD_Move:
if( JustMoved )
{
JustMoved = FALSE;
break;
}
AcceptIllegal = TRUE;
myMove = cmd.getMove();
/* Send Time */
if( FEATURE_Time )
{
if( Army == WHITE )
{
emit output( QString( "time %1" ).arg( cmd.getWhiteTime() ) );
emit output( QString( "otim %1" ).arg( cmd.getBlackTime() ) );
}
else
{
emit output( QString( "time %1" ).arg( cmd.getBlackTime() ) );
emit output( QString( "otim %1" ).arg( cmd.getWhiteTime() ) );
}
}
if( FEATURE_UserMove )
temp = "usermove ";
if( FEATURE_SAN )
temp += myMove.SAN;
else
temp += myMove.CAN;
if( DelayedGo )
{
DelayedGo = FALSE;
temp += "\ngo";
Forced = FALSE;
}
emit output( temp );
break;
/* Command: Pause */
case CMD_Pause:
if( FEATURE_Pause )
emit output( "pause" );
else
{
emit output( "force" );
Forced = TRUE;
}
break;
/* Command: Resume */
case CMD_Resume:
if( FEATURE_Pause )
emit output( "resume" );
else
{
if( Turn == Army )
{
emit output( "go" );
Forced = FALSE;
}
else
DelayedGo = TRUE;
}
break;
/* Command: Play White */
case CMD_Play_White:
Army = WHITE;
if( Turn == BLACK )
{
if( FEATURE_PlayOther )
{
emit output( "playother" );
}
else if( FEATURE_Colors )
{
emit output( "black" );
}
else
{
emit output( "force" );
Forced = TRUE;
DelayedGo = TRUE;
}
break;
}
else
{
temp = "force";
if( FEATURE_Colors )
temp += "\nwhite";
temp += "\ngo";
emit output( temp );
break;
}
break;
/* Command: Play Black */
case CMD_Play_Black:
Army = BLACK;
if( Turn == WHITE )
{
if( FEATURE_PlayOther )
{
emit output( "playother" );
}
else if( FEATURE_Colors )
{
emit output( "white" );
}
else
{
emit output( "force" );
Forced = TRUE;
DelayedGo = TRUE;
}
break;
}
else
{
temp = "force";
if( FEATURE_Colors )
temp += "\nblack";
temp += "\ngo";
emit output( temp );
break;
}
break;
/* Command: Result White */
case CMD_Result_White:
emit output( "result 1-0 {White Mates}" );
AcceptIllegal = FALSE;
// if( Army == WHITE )
// (*IT).Wins++;
// else
// (*IT).Losses++;
break;
/* Command: Result Black */
case CMD_Result_Black:
emit output( "result 0-1 {Black Mates}" );
AcceptIllegal = FALSE;
// if( Army == BLACK )
// (*IT).Wins++;
// else
// (*IT).Losses++;
break;
/* Command: Result Draw */
case CMD_Result_Draw:
emit output( "result 1/2-1/2 {Draw Game}" );
AcceptIllegal = FALSE;
// (*IT).Draws++;
break;
/* Command: Your Time */
case CMD_Your_Time:
if( FEATURE_Time )
{
if( Army == WHITE )
emit output( QString( "time %1" ).arg( cmd.getWhiteTime() ) );
else
emit output( QString( "time %1" ).arg( cmd.getBlackTime() ) );
}
break;
/* Command: Enemy Time */
case CMD_Enemy_Time:
if( FEATURE_Time )
{
if( Army == WHITE )
emit output( QString( "otim %1" ).arg( cmd.getBlackTime() ) );
else
emit output( QString( "otim %1" ).arg( cmd.getWhiteTime() ) );
}
break;
/* Command: Offer Draw */
case CMD_Offer_Draw:
if( FEATURE_Draw )
emit output( "draw" );
break;
/* Command: Book Mode */
case CMD_Book_Mode:
if( FEATURE_BookEngine != 0 )
emit output( "bookengine" );
break;
/* Command: Check Book */
case CMD_Check_Book:
emit output( "go" );
Forced = FALSE;
break;
/* Command: Ponder */
case CMD_Ponder:
emit output( "hard" );
break;
/* Command: No Pondering */
case CMD_No_Pondering:
emit output( "hard\neasy" );
break;
/* Command: Retract Move */
case CMD_Retract_Move:
emit output( "remove" );
break;
/* Command: Hint */
case CMD_Hint:
emit output( "hint" );
break;
/* Command: Listen */
case CMD_Listen:
emit output( "force" );
Forced = TRUE;
DelayedGo = FALSE;
break;
/* Command: Play */
case CMD_Play:
if( Army == Turn )
{
emit output( "go" );
Forced = FALSE;
}
else
DelayedGo = TRUE;
break;
/* Command: White Resign */
case CMD_White_Resign:
parse( Command( 0, CMD_Result_White ) );
break;
/* Command: Black Resign */
case CMD_Black_Resign:
parse( Command( 0, CMD_Result_Black ) );
break;
/* Command: Set Board */
case CMD_Set_Board:
if( FEATURE_SetBoard == TRUE )
{
emit output( QString( "setboard %1" ).arg( cmd.getData() ) );
}
else
{
// Convert FEN to edit commands here and feed them to engine
}
break;
/* Command: Set Difficulty */
case CMD_Set_Difficulty:
emit output( "sd " + cmd.getData() );
// emit output( "st " + QString::number( cmd.getData().toInt() >> 1 ) );
break;
/* Command: Set Name */
case CMD_Set_Name:
FEATURE_MyName = cmd.getData();
break;
default:
break;
}
}
///////////////////////////////////////
//
// proto_xboard::parse( const QString &string )
//
///////////////////////////////////////
void proto_xboard::parse( const QString &string )
{
QString strIn = string;
QStringList strList( QStringList::split( ' ', strIn ) );
if( ( FEATURE_SIGINT ) && ( !Forced ) )
emit output( Command( myID, CMD_Send_SIGINT ) );
/* Illegal */
if( strList[0].contains( "illegal", FALSE ) )
{
if( AcceptIllegal )
{
if( strIn.contains("(no matching move)board") )
return;
if( strIn.contains("(no matching move)protover") )
return;
if( strIn.contains("(no matching move)sd") )
return;
AcceptIllegal = FALSE;
emit output( Command( myID, CMD_Illegal ) );
}
return;
}
/* A Move */
if( strList[0] == "move" )
{
if( strList.count() < 2 )
{
kdWarning() << "proto_xboard::parse: Incomplete Move command" << endl;
return;
}
Command::clearMove( &myMove );
strcpy( myMove.SAN, strList[1].latin1() );
strcpy( myMove.CAN, strList[1].latin1() );
if( Team )
{
emit output( "force" );
Forced = TRUE;
}
JustMoved = TRUE;
emit output( Command( myID, CMD_Move, 0, 0, myMove ) );
return;
}
/* A Move ( Old Variation ) */
if( ( strList[0].contains( QRegExp("\\d+\\.") ) ) && ( strList[1] == "..." ) )
{
Command::clearMove( &myMove );
strcpy( myMove.SAN, strList[2].latin1() );
strcpy( myMove.CAN, strList[2].latin1() );
if( Team )
{
emit output( "force" );
Forced = TRUE;
}
JustMoved = TRUE;
emit output( Command( myID, CMD_Move, 0, 0, myMove ) );
return;
}
/* Hint */
if( strList[0] == "Hint:" )
{
emit output( Command( myID, CMD_Hint, i18n( "%1 suggests this move:\n%2" ).arg( FEATURE_MyName ).arg( strList[1] ) ) );
return;
}
/* Offer Draw */
if( ( strList[0] == "offer" ) && ( strList[1] == "draw" ) )
{
emit output( Command( myID, CMD_Offer_Draw ) );
}
/* Out of Book */
if( strList[0] == "outofbook" )
{
emit output( "force" );
Forced = TRUE;
emit output( Command( myID, CMD_Out_Of_Book ) );
return;
}
/* Tell User */
if( strList[0] == "telluser" )
{
emit output( Command( myID, CMD_Tell_User, i18n( "%1 tells you:\n%2" ).arg( FEATURE_MyName ).arg( strIn.right( strIn.length() - 9 ) ) ) );
return;
}
/* Tell User Error */
if( strList[0] == "tellusererror" )
{
emit output( Command( myID, CMD_Tell_User_Error, i18n( "%1 tells you:\n%2" ).arg( FEATURE_MyName ).arg( strIn.right( strIn.length() - 14 ) ) ) );
return;
}
/* Error */
if( strList[0] == "Error" )
{
emit output( Command( myID, CMD_Tell_User_Error, i18n( "%1 tells you:\n%2" ).arg( FEATURE_MyName ).arg( strIn.right( strIn.length() ) ) ) );
return;
}
/* Tell Opponent */
if( strList[0] == "tellopponent" )
{
emit output( Command( myID, CMD_Tell_Opponent, QString( "%1" ).arg( strIn.right( strIn.length() - 13 ) ) ) );
return;
}
/* Tell Others */
if( strList[0] == "tellothers" )
{
emit output( Command( myID, CMD_Tell_Others, QString( "%1" ).arg( strIn.right( strIn.length() - 11 ) ) ) );
return;
}
/* Tell All */
if( strList[0] == "tellall" )
{
emit output( Command( myID, CMD_Tell_All, QString( "%1" ).arg( strIn.right( strIn.length() - 8 ) ) ) );
return;
}
/* Tell ICS */
if( strList[0] == "tellics" )
{
emit output( Command( myID, CMD_Tell_ICS, QString( "%1" ).arg( strIn.right( strIn.length() - 8 ) ) ) );
return;
}
/* Tell ICS No Alias */
if( strList[0] == "tellicsnoalias" )
{
emit output( Command( myID, CMD_Tell_ICS, QString( "%1" ).arg( strIn.right( strIn.length() - 15 ) ) ) );
return;
}
/* Resign */
if( strIn.contains( "resign", FALSE ) )
{
if( Army == WHITE )
emit output( Command( myID, CMD_White_Resign ) );
else
emit output( Command( myID, CMD_Black_Resign ) );
return;
}
/*
Parse Features
*/
if( !InitTimer->isActive() )
return;
for( unsigned int loop = 0; loop < strList.count(); loop++ )
{
if( strList[loop] == "done=1" )
{
InitTimer->stop();
releaseBuffer();
continue;
}
/* This buys you 10 minutes */
if( strList[loop] == "done=0" )
{
InitTimer->changeInterval( 600000 );
continue;
}
if( strList[loop] == "feature" )
{
continue;
}
if( strList[loop].left(3) == "ics" )
{
FEATURE_ICS = QString( strList[loop].right(1) ).toInt();
emit output( "accepted ics" );
continue;
}
if( strList[loop].left(3) == "san" )
{
FEATURE_SAN = QString( strList[loop].right(1) ).toInt();
emit output( "accepted san" );
continue;
}
if( strList[loop].left(4) == "draw" )
{
FEATURE_Draw = QString( strList[loop].right(1) ).toInt();
emit output( "accepted draw" );
continue;
}
if( strList[loop].left(4) == "name" )
{
FEATURE_Name = QString( strList[loop].right(1) ).toInt();
emit output( "accepted name" );
continue;
}
if( strList[loop].left(4) == "ping" )
{
FEATURE_Ping = QString( strList[loop].right(1) ).toInt();
emit output( "accepted ping" );
continue;
}
if( strList[loop].left(4) == "time" )
{
FEATURE_Time = QString( strList[loop].right(1) ).toInt();
emit output( "accepted time" );
continue;
}
if( strList[loop].left(5) == "level" )
{
FEATURE_Level = QString( strList[loop].right( strList[loop].length() - 6 ) ).toInt();
emit output( "accepted level" );
continue;
}
if( strList[loop].left(5) == "pause" )
{
FEATURE_Pause = QString( strList[loop].right(1) ).toInt();
emit output( "accepted pause" );
continue;
}
if( strList[loop].left(5) == "reuse" )
{
FEATURE_Reuse = QString( strList[loop].right(1) ).toInt();
emit output( "accepted reuse" );
continue;
}
if( strList[loop].left(6) == "colors" )
{
FEATURE_Colors = QString( strList[loop].right(1) ).toInt();
emit output( "accepted colors" );
continue;
}
if( strList[loop].left(6) == "myname" )
{
FEATURE_MyName = QString( strList[loop].right( strList[loop].length() - 8 ) );
emit output( "accepted myname" );
continue;
}
if( strList[loop].left(6) == "sigint" )
{
FEATURE_SIGINT = QString( strList[loop].right(1) ).toInt();
emit output( "accepted sigint" );
continue;
}
if( strList[loop].left(7) == "analyze" )
{
FEATURE_Analyze = QString( strList[loop].right(1) ).toInt();
emit output( "accepted analyze" );
continue;
}
if( strList[loop].left(7) == "sigterm" )
{
FEATURE_SIGTERM = QString( strList[loop].right(1) ).toInt();
emit output( "accepted sigterm" );
continue;
}
if( strList[loop].left(8) == "setboard" )
{
FEATURE_SetBoard = QString( strList[loop].right(1) ).toInt();
emit output( "accepted setboard" );
continue;
}
if( strList[loop].left(8) == "usermove" )
{
FEATURE_UserMove = QString( strList[loop].right(1) ).toInt();
emit output( "accepted usermove" );
continue;
}
if( strList[loop].left(8) == "variants" )
{
// FIFO_Tmp = strList[loop].right( strList[loop].length() - 10 );
// This must be finished
emit output( "accepted variants" );
continue;
}
if( strList[loop].left(9) == "playother" )
{
FEATURE_PlayOther = QString( strList[loop].right(1) ).toInt();
emit output( "accepted playother" );
continue;
}
if( strList[loop].left(10) == "bookengine" )
{
FEATURE_BookEngine = QString( strList[loop].right( strList[loop].length() - 11 ) ).toInt();
emit output( "accepted bookengine" );
continue;
}
}
}
///////////////////////////////////////
//
// proto_xboard::releaseBuffer
//
///////////////////////////////////////
void proto_xboard::releaseBuffer( void )
{
CommandList::Iterator it;
for( it = CMDList->begin(); it != CMDList->end(); it++ )
{
parse( *it );
}
CMDList->clear();
}

@ -0,0 +1,78 @@
/***************************************************************************
proto_xboard.h - description
-------------------
begin : Sat Oct 26 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef PROTO_XBOARD_H
#define PROTO_XBOARD_H
#include "proto_base.h"
/**
*@author Troy Corbin Jr.
*/
class QTimer;
class proto_xboard : public proto_base
{
Q_OBJECT
public:
proto_xboard( const int ID );
~proto_xboard();
virtual void parse( const Command& );
virtual void parse( const QString& );
protected slots:
void releaseBuffer( void );
private:
/* XBoard protover 2 */
bool FEATURE_Analyze;
bool FEATURE_Colors;
bool FEATURE_Draw;
bool FEATURE_ICS;
bool FEATURE_Name;
bool FEATURE_Pause;
bool FEATURE_Ping;
bool FEATURE_PlayOther;
bool FEATURE_Reuse;
bool FEATURE_SetBoard;
bool FEATURE_SAN;
bool FEATURE_SIGINT;
bool FEATURE_SIGTERM;
bool FEATURE_Time;
bool FEATURE_UserMove;
int FEATURE_Variants;
QString FEATURE_MyName;
/* XBoard protover 3 */
int FEATURE_Level;
int FEATURE_BookEngine;
bool Check;
bool Turn;
bool Team;
bool Army;
bool JustMoved;
bool AcceptIllegal;
bool DelayedGo;
bool Forced;
QTimer *InitTimer;
CommandList *CMDList;
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,240 @@
/***************************************************************************
resource.h - description
-------------------
begin : Tue Jul 17 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef RESOURCE_H
#define RESOURCE_H
/**
*@author Troy Corbin Jr.
*/
/* KDE */
#include <kapp.h>
#include <klocale.h>
#include <kcursor.h>
#include <klistview.h>
#include <kcmdlineargs.h>
/* Qt */
#include <qstylesheet.h>
#include <qvaluelist.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qpixmap.h>
#include <qimage.h>
/* Local */
#include "definitions.h"
class audio;
class KnightsPixCache;
class TabManager;
class Accel;
typedef struct engineResource
{
QListViewItem *Item;
QString Name;
QString Filename;
QString Arguments;
QString LogFile;
int Protocol;
int Wins;
int Losses;
int Draws;
int CurrentRef;
};
typedef struct serverResource
{
QListViewItem *Item;
QString Name;
QString URL;
QString UserName;
QString Password;
QString LogFile;
QString Timeseal;
bool StorePass;
int Port;
int CurrentRef;
};
typedef QValueList<engineResource> engineList;
typedef QValueList<serverResource> serverList;
class resource
{
public:
/* The current Theme */
int ThemeSize;
bool ThemeBorder;
QStyleSheet *ConsoleStyle;
QString CurrentBoard;
QString CurrentChessmen;
QString CurrentAudio;
ThemeHeader boardHeader;
ThemeHeader chessmenHeader;
ThemeHeader audioHeader;
KnightsPixCache *pixCache;
TabManager *tabManager;
Accel *myAccel;
/* General Settings */
QString Local_Player;
QString Local_Email_Address;
int Config_Version;
bool Accepted_License;
int OPTION_On_Init;
int Audio_Volume;
bool OPTION_Audio;
bool OPTION_Audio_Current_Only;
bool OPTION_Auto_Queen;
bool OPTION_Auto_Preview;
bool OPTION_Auto_Call_Flag;
bool OPTION_Auto_Close_Last_ICS;
bool OPTION_Animate_Moves;
bool OPTION_Book_White;
bool OPTION_Book_Black;
bool OPTION_Board_Orientation;
bool OPTION_Ponder;
bool OPTION_Show_Coord;
bool OPTION_Show_Last_Move;
bool OPTION_Show_Splash;
bool OPTION_Show_Extended_PGN;
bool OPTION_Pause_On_Minimize;
bool OPTION_Reuse_PGN;
bool OPTION_3DBoard;
QString PGN_Filename;
QString Email_Command_Line;
QString Email_Address;
QString SCID_Image_Path;
int Widget_Height;
/* ICS Options */
int Seek_Timer;
int OPTION_Profanity;
bool OPTION_Premove;
bool OPTION_Kibitz;
bool OPTION_Private;
bool OPTION_Shout;
bool OPTION_Tell;
bool OPTION_Seek;
/* Notification Prompts */
QString PromptForSaving;
/* Colors */
QColor COLOR_White;
QColor COLOR_Black;
QColor COLOR_Background;
QColor COLOR_Standard;
QColor COLOR_PrivateTell;
QColor COLOR_ChannelTell;
QColor COLOR_Shout;
QColor COLOR_Whisper;
QColor COLOR_Notification;
QColor COLOR_Notation;
QColor COLOR_Notation_Shadow;
QColor COLOR_GraphBackground;
QColor COLOR_GraphForeground;
/* Fonts */
QFont FONT_Standard;
QFont FONT_PrivateTell;
QFont FONT_ChannelTell;
QFont FONT_Shout;
QFont FONT_Whisper;
QFont FONT_Notification;
/* Cursors */
QCursor CURSOR_Standard;
QCursor CURSOR_Thinking;
QCursor CURSOR_Text;
/* Chess Engines */
engineList engines;
engineList::Iterator enginesIT;
/* Chess Servers */
serverList servers;
serverList::Iterator serversIT;
/* New Match Presets */
TCPList TCPWhite;
TCPList TCPBlack;
char MatchRules;
char Type[4];
char Strength[4];
resource( KCmdLineArgs *args );
~resource();
void ConfigRead( void );
void ConfigWrite( void );
void readThemeDir( void );
QString getBoard( int Index=-1 );
QString getChessmen( int Index=-1 );
QString getSounds( int Index=-1 );
QString themeDir( void );
void setTheme( int BoardIndex=-1, int ChessmenIndex=-1 );
void setAudio( int AudioIndex=-1 );
void resizeTheme( const int &size );
/**
Call buildStyle whenever you need to reparse the Resource configuration */
void buildStyle( void );
QPixmap LoadIcon( QString Name, int Group );
QPixmap loadSCIDImage( const QString &name );
void play( const char );
private:
QStyleSheetItem *SSI_Default;
QStyleSheetItem *SSI_PrivateTell;
QStyleSheetItem *SSI_ChannelTell;
QStyleSheetItem *SSI_Shout;
QStyleSheetItem *SSI_Whisper;
QStyleSheetItem *SSI_Notification;
QString GlobalDataDir;
QString LocalDataDir;
QStringList Boards;
QStringList Chessmen;
QStringList Sounds;
KIconLoader *Icons;
audio *Audio;
void ReadEngines( void );
void WriteEngines( void );
void ReadServers( void );
void WriteServers( void );
void ReadMatchParam( void );
void WriteMatchParam( void );
void ReadColors( void );
void WriteColors( void );
void ReadFonts( void );
void WriteFonts( void );
/**
Borrowed from KMail
Very primitive en/de-cryption so that the password is not
readable in the config file. But still very easy breakable.
*/
QString encryptStr( const QString& inStr ) const;
QString decryptStr( const QString& inStr ) const;
QString themeURL( const QString );
void loadThemeItem( const QString& URL, QImage& Image );
};
#endif

@ -0,0 +1,133 @@
/***************************************************************************
setpageaudio.cpp - description
-------------------
begin : Thu Jan 10 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <qregexp.h>
#include "setpageaudio.moc"
setPageAudio::setPageAudio(QWidget *parent, resource *Rsrc ) : QVBoxLayout(parent)
{
Parent = parent;
Resource = Rsrc;
NewSounds = 0;
changeTheme = FALSE;
BUTTON_enableAudio = new QCheckBox( i18n( "Enable Audio" ), parent );
BUTTON_enableAudio->setChecked( Resource->OPTION_Audio );
addWidget( BUTTON_enableAudio );
connect( BUTTON_enableAudio, SIGNAL( toggled(bool) ),
this, SLOT( slot_enableAudio(bool) ) );
GROUP_Theme = new QGroupBox( 1,
Qt::Vertical,
i18n( "Audio Themes" ),
parent );
addWidget( GROUP_Theme );
Current_Theme = new KComboBox ( GROUP_Theme );
buildThemeList();
connect( Current_Theme, SIGNAL( activated(int) ),
this, SLOT( slot_currentTheme(int) ) );
BOX_Main = new QHBox( parent );
addWidget( BOX_Main );
GROUP_Volume = new QGroupBox( 3, Qt::Vertical, i18n( "Volume" ), BOX_Main );
Vol_Max = new QLabel( i18n( "Maximum" ), GROUP_Volume );
Current_Volume = new QSlider ( 0, 100, 10, Resource->Audio_Volume, QSlider::Vertical, GROUP_Volume );
connect( Current_Volume, SIGNAL( valueChanged(int) ), this, SLOT( slot_currentVolume(int) ) );
Current_Volume->setTickmarks( QSlider::Right );
Vol_Min = new QLabel( i18n( "Minimum" ), GROUP_Volume );
BOX_Options = new QVBox( BOX_Main );
BUTTON_AudioCurrentOnly = new QCheckBox( i18n( "For Current Match Only" ), BOX_Options );
BUTTON_AudioCurrentOnly->setChecked( Resource->OPTION_Audio_Current_Only );
connect( BUTTON_AudioCurrentOnly, SIGNAL( toggled(bool) ),
this, SLOT( slot_AudioCurrentOnly(bool) ) );
}
setPageAudio::~setPageAudio()
{
}
///////////////////////////////////////
//
// setPageAudio::slot_enableAudio
//
///////////////////////////////////////
void setPageAudio::slot_enableAudio( bool state )
{
Resource->OPTION_Audio = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageAudio::slot_currentTheme
//
///////////////////////////////////////
void setPageAudio::slot_currentTheme( int Index )
{
NewSounds = Index;
changeTheme = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageAudio::slot_currentVolume
//
///////////////////////////////////////
void setPageAudio::slot_currentVolume( int Level )
{
Resource->Audio_Volume = Level;
emit enableApply();
}
///////////////////////////////////////
//
// setPageAudio::slot_AudioCurrentOnly
//
///////////////////////////////////////
void setPageAudio::slot_AudioCurrentOnly( bool state )
{
Resource->OPTION_Audio_Current_Only = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageAudio::buildThemeList
//
///////////////////////////////////////
void setPageAudio::buildThemeList( void )
{
QString buffer;
int tmp(0);
Current_Theme->clear();
Resource->readThemeDir();
while(1)
{
buffer = Resource->getSounds( tmp );
if( buffer.isEmpty() ) break;
buffer.remove( 0, 2 );
buffer.replace( QRegExp("_"), " " );
buffer.replace( QRegExp(".tar"), "" );
buffer.replace( QRegExp(".gz"), "" );
buffer.replace( QRegExp(".bz2"), "" );
Current_Theme->insertItem( buffer, tmp );
if( Resource->getSounds() == Resource->getSounds( tmp ) )
{
Current_Theme->setCurrentItem( tmp );
NewSounds = tmp;
}
tmp++;
}
}

@ -0,0 +1,69 @@
/***************************************************************************
setpageaudio.h - description
-------------------
begin : Thu Jan 10 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SETPAGEAUDIO_H
#define SETPAGEAUDIO_H
#include <kcombobox.h>
#include <klineedit.h>
#include <qwidget.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qslider.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class setPageAudio : public QVBoxLayout
{
Q_OBJECT
public:
setPageAudio(QWidget *parent=0, resource *Rsrc=0);
~setPageAudio();
void buildThemeList( void );
int NewSounds;
bool changeTheme;
signals:
void enableApply( void );
public slots:
void slot_enableAudio( bool );
void slot_currentTheme( int );
void slot_currentVolume( int );
void slot_AudioCurrentOnly( bool );
private:
QWidget *Parent;
resource *Resource;
QCheckBox *BUTTON_enableAudio;
QGroupBox *GROUP_Theme;
KComboBox *Current_Theme;
QHBox *BOX_Main;
QGroupBox *GROUP_Volume;
QLabel *Vol_Min;
QSlider *Current_Volume;
QLabel *Vol_Max;
QVBox *BOX_Options;
QCheckBox *BUTTON_AudioCurrentOnly;
};
#endif

@ -0,0 +1,563 @@
/***************************************************************************
setpagedisplay.cpp - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "setpagedisplay.moc"
#include <kstddirs.h>
#include <kmessagebox.h>
#include <kcolordialog.h>
#include <kfontdialog.h>
#include <qstyle.h>
#include <qregexp.h>
#include <kiconloader.h>
#include <kfiledialog.h>
#include <kio/netaccess.h>
setPageDisplay::setPageDisplay(QWidget *parent, resource *Rsrc ) : QVBoxLayout(parent)
{
QStyle& Style = QApplication::style();
Resource = Rsrc;
margin = Style.defaultFrameWidth();
NewBoards = 0;
NewChessmen = 0;
changeTheme = FALSE;
refreshBoard = FALSE;
rebuildConsole = FALSE;
TabParent = new QTabWidget( parent, "setPageDisplay" );
initTab1();
initTab2();
addWidget( TabParent );
}
setPageDisplay::~setPageDisplay()
{
delete Show_Splashscreen;
delete Board_Orientation;
delete GROUP_General_Graphics;
delete Size_Max;
delete Size_Min;
delete Current_Theme_Size;
delete Current_Boards;
delete Current_Chessmen;
delete GROUP_Boards;
delete GROUP_Chessmen;
delete BOX_Themes;
delete Tab1;
delete Tab2;
delete TabParent;
}
///////////////////////////////////////
//
// setPageDisplay::initTab1
//
///////////////////////////////////////
void setPageDisplay::initTab1( void )
{
Tab1 = new QVBox( TabParent );
Tab1->setMargin( margin );
BOX_Themes = new QHBox( Tab1 );
GROUP_Boards = new QGroupBox( 1,
Qt::Vertical,
i18n( "Board Themes" ),
BOX_Themes );
Current_Boards = new KComboBox ( GROUP_Boards );
GROUP_Chessmen = new QGroupBox( 1,
Qt::Vertical,
i18n( "Chessman Themes" ),
BOX_Themes );
Current_Chessmen = new KComboBox ( GROUP_Chessmen );
GROUP_Theme_Size = new QGroupBox( 3,
Qt::Horizontal,
i18n( "Theme Size" ),
Tab1 );
Size_Min = new QLabel( i18n( "Small" ), GROUP_Theme_Size );
Current_Theme_Size = new QSlider ( 0,
14,
2,
( Resource->ThemeSize - IMAGE_MIN ) / 8 ,
QSlider::Horizontal,
GROUP_Theme_Size );
Size_Max = new QLabel( i18n( "Large" ), GROUP_Theme_Size );
GROUP_SCID_Images = new QGroupBox( 2, Qt::Horizontal, i18n("Player Images File:"), Tab1 );
EDIT_SCID_Images = new KLineEdit( GROUP_SCID_Images );
EDIT_SCID_Images->setText( Resource->SCID_Image_Path );
connect( EDIT_SCID_Images, SIGNAL( textChanged(const QString&) ), this, SLOT( slot_SCID_Images(const QString&) ) );
BUTTON_SCID_Images = new QPushButton( GROUP_SCID_Images );
BUTTON_SCID_Images->setPixmap( Resource->LoadIcon( QString( "fileopen" ), KIcon::Toolbar ) );
connect( BUTTON_SCID_Images, SIGNAL( clicked() ), this, SLOT( slot_SCID_Images_Button() ) );
GROUP_General_Graphics = new QGroupBox( 4,
Qt::Vertical,
i18n( "Other Display Options" ),
Tab1 );
Board_Orientation = new QCheckBox( i18n( "Reverse Board Orientation" ), GROUP_General_Graphics );
Board_Orientation->setChecked( Resource->OPTION_Board_Orientation );
connect( Board_Orientation, SIGNAL( toggled(bool) ),
this, SLOT( slotToggle_Board_Orientation(bool) ) );
Show_Splashscreen = new QCheckBox( i18n( "Display Startup Logo" ), GROUP_General_Graphics );
Show_Splashscreen->setChecked( Resource->OPTION_Show_Splash );
connect( Show_Splashscreen, SIGNAL( toggled(bool) ),
this, SLOT( slotToggle_Splashscreen(bool) ) );
Auto_Preview = new QCheckBox( i18n( "Automatic Preview" ), GROUP_General_Graphics );
Auto_Preview->setChecked( Resource->OPTION_Auto_Preview );
connect( Auto_Preview, SIGNAL( toggled(bool) ),
this, SLOT( slotToggle_Auto_Preview(bool) ) );
Show_Last_Move = new QCheckBox( i18n( "Show Last Move" ), GROUP_General_Graphics );
Show_Last_Move->setChecked( Resource->OPTION_Show_Last_Move );
connect( Show_Last_Move, SIGNAL( toggled(bool) ),
this, SLOT( slotToggle_Show_Last_Move(bool) ) );
Animate_Move = new QCheckBox( i18n( "Animate Moves" ), GROUP_General_Graphics );
Animate_Move->setChecked( Resource->OPTION_Animate_Moves );
connect( Animate_Move, SIGNAL( toggled(bool) ),
this, SLOT( slotToggle_Animate_Move(bool) ) );
Show_Coord = new QCheckBox( i18n( "Show Coordinates" ), GROUP_General_Graphics );
Show_Coord->setChecked( Resource->OPTION_Show_Coord );
connect( Show_Coord, SIGNAL( toggled(bool) ),
this, SLOT( slotToggle_Show_Coord(bool) ) );
Current_Theme_Size->setTickmarks( QSlider::Below );
Current_Boards->setEditable( FALSE );
Current_Chessmen->setEditable( FALSE );
buildThemeList();
connect( Current_Boards, SIGNAL( activated(int) ),
this, SLOT( slotCurrent_Boards(int) ) );
connect( Current_Chessmen, SIGNAL( activated(int) ),
this, SLOT( slotCurrent_Chessmen(int) ) );
connect( Current_Theme_Size, SIGNAL( valueChanged(int) ),
this, SLOT( slotCurrent_Theme_Size(int) ) );
TabParent->addTab( Tab1, i18n("General") );
}
///////////////////////////////////////
//
// setPageDisplay::initTab2
//
///////////////////////////////////////
void setPageDisplay::initTab2( void )
{
QPixmap ColorsIcon( Resource->LoadIcon( QString("colorize"), KIcon::Toolbar ) );
Tab2 = new QFrame( TabParent );
Tab2->setMargin( margin );
GRID_Style = new QGridLayout( Tab2, 11, 5, margin );
Console_Sample = new QTextView( Tab2 );
Console_Sample->setTextFormat( Qt::RichText );
GRID_Style->addMultiCellWidget( Console_Sample, 5, 10, 1, 1 );
Default_Button = new QPushButton( i18n("Restore Defaults"), Tab2 );
connect( Default_Button, SIGNAL( clicked() ), this, SLOT( slot_setDefault() ) );
GRID_Style->addWidget( Default_Button, 11, 1 );
Fonts_Button_Standard = new QPushButton( i18n("Standard Font..."), Tab2 );
connect( Fonts_Button_Standard, SIGNAL( clicked() ), this, SLOT( slot_Font_Standard() ) );
GRID_Style->addWidget( Fonts_Button_Standard, 5, 3 );
Colors_Button_Standard = new QPushButton( Tab2 );
Colors_Button_Standard->setPixmap( ColorsIcon );
connect( Colors_Button_Standard, SIGNAL( clicked() ), this, SLOT( slot_Color_Standard() ) );
GRID_Style->addWidget( Colors_Button_Standard, 5, 5 );
Fonts_Button_PrivateTell = new QPushButton( i18n("Private Font..."), Tab2 );
connect( Fonts_Button_PrivateTell, SIGNAL( clicked() ), this, SLOT( slot_Font_PrivateTell() ) );
GRID_Style->addWidget( Fonts_Button_PrivateTell, 6, 3 );
Colors_Button_PrivateTell = new QPushButton( Tab2 );
Colors_Button_PrivateTell->setPixmap( ColorsIcon );
connect( Colors_Button_PrivateTell, SIGNAL( clicked() ), this, SLOT( slot_Color_PrivateTell() ) );
GRID_Style->addWidget( Colors_Button_PrivateTell, 6, 5 );
Fonts_Button_ChannelTell = new QPushButton( i18n("Channel Font..."), Tab2 );
connect( Fonts_Button_ChannelTell, SIGNAL( clicked() ), this, SLOT( slot_Font_ChannelTell() ) );
GRID_Style->addWidget( Fonts_Button_ChannelTell, 7, 3 );
Colors_Button_ChannelTell = new QPushButton( Tab2 );
Colors_Button_ChannelTell->setPixmap( ColorsIcon );
connect( Colors_Button_ChannelTell, SIGNAL( clicked() ), this, SLOT( slot_Color_ChannelTell() ) );
GRID_Style->addWidget( Colors_Button_ChannelTell, 7, 5 );
Fonts_Button_Shout = new QPushButton( i18n("Shout Font..."), Tab2 );
connect( Fonts_Button_Shout, SIGNAL( clicked() ), this, SLOT( slot_Font_Shout() ) );
GRID_Style->addWidget( Fonts_Button_Shout, 8, 3 );
Colors_Button_Shout = new QPushButton( Tab2 );
Colors_Button_Shout->setPixmap( ColorsIcon );
connect( Colors_Button_Shout, SIGNAL( clicked() ), this, SLOT( slot_Color_Shout() ) );
GRID_Style->addWidget( Colors_Button_Shout, 8, 5 );
Fonts_Button_Whisper = new QPushButton( i18n("Whisper Font..."), Tab2 );
connect( Fonts_Button_Whisper, SIGNAL( clicked() ), this, SLOT( slot_Font_Whisper() ) );
GRID_Style->addWidget( Fonts_Button_Whisper, 9, 3 );
Colors_Button_Whisper = new QPushButton( Tab2 );
Colors_Button_Whisper->setPixmap( ColorsIcon );
connect( Colors_Button_Whisper, SIGNAL( clicked() ), this, SLOT( slot_Color_Whisper() ) );
GRID_Style->addWidget( Colors_Button_Whisper, 9, 5 );
Fonts_Button_Notification = new QPushButton( i18n("Notification Font..."), Tab2 );
connect( Fonts_Button_Notification, SIGNAL( clicked() ), this, SLOT( slot_Font_Notification() ) );
GRID_Style->addWidget( Fonts_Button_Notification, 10, 3 );
Colors_Button_Notification = new QPushButton( Tab2 );
Colors_Button_Notification->setPixmap( ColorsIcon );
connect( Colors_Button_Notification, SIGNAL( clicked() ), this, SLOT( slot_Color_Notification() ) );
GRID_Style->addWidget( Colors_Button_Notification, 10, 5 );
Colors_Button_Background = new QPushButton( Tab2 );
Colors_Button_Background->setPixmap( ColorsIcon );
connect( Colors_Button_Background, SIGNAL( clicked() ), this, SLOT( slot_Color_Background() ) );
GRID_Style->addWidget( Colors_Button_Background, 11, 5 );
resetSampleConsole();
TabParent->addTab( Tab2, i18n("Console") );
}
///////////////////////////////////////
//
// setPageDisplay::slot_setDefault
//
///////////////////////////////////////
void setPageDisplay::slot_setDefault(void)
{
Resource->FONT_Standard = KGlobalSettings::fixedFont();
Resource->FONT_PrivateTell = KGlobalSettings::fixedFont();
Resource->FONT_ChannelTell = KGlobalSettings::fixedFont();
Resource->FONT_Shout = KGlobalSettings::fixedFont();
Resource->FONT_Whisper = KGlobalSettings::fixedFont();
Resource->FONT_Notification = KGlobalSettings::fixedFont();
Resource->COLOR_Background = Resource->COLOR_White;
Resource->COLOR_Standard = Resource->COLOR_Black;
Resource->COLOR_PrivateTell = QColor( 128, 0, 128 ); // Purple
Resource->COLOR_ChannelTell = QColor( 0, 0, 160 ); // Blue
Resource->COLOR_Shout = QColor( 160, 0, 0 ); // Red
Resource->COLOR_Whisper = QColor( 0, 160, 0 ); // Green
Resource->COLOR_Notification = QColor( 0, 128, 128 ); // Cyan
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slot_Font_?????
//
///////////////////////////////////////
void setPageDisplay::slot_Font_Standard(void)
{
int value = KFontDialog::getFont( Resource->FONT_Standard );
if( value != KFontDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Font_PrivateTell(void)
{
int value = KFontDialog::getFont( Resource->FONT_PrivateTell );
if( value != KFontDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Font_ChannelTell(void)
{
int value = KFontDialog::getFont( Resource->FONT_ChannelTell );
if( value != KFontDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Font_Shout(void)
{
int value = KFontDialog::getFont( Resource->FONT_Shout );
if( value != KFontDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Font_Whisper(void)
{
int value = KFontDialog::getFont( Resource->FONT_Whisper );
if( value != KFontDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Font_Notification(void)
{
int value = KFontDialog::getFont( Resource->FONT_Notification );
if( value != KFontDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slot_Color_?????
//
///////////////////////////////////////
void setPageDisplay::slot_Color_Background(void)
{
int value = KColorDialog::getColor( Resource->COLOR_Background );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Color_Standard(void)
{
int value = KColorDialog::getColor( Resource->COLOR_Standard );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Color_PrivateTell(void)
{
int value = KColorDialog::getColor( Resource->COLOR_PrivateTell );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Color_ChannelTell(void)
{
int value = KColorDialog::getColor( Resource->COLOR_ChannelTell );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Color_Shout(void)
{
int value = KColorDialog::getColor( Resource->COLOR_Shout );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Color_Whisper(void)
{
int value = KColorDialog::getColor( Resource->COLOR_Whisper );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
void setPageDisplay::slot_Color_Notification(void)
{
int value = KColorDialog::getColor( Resource->COLOR_Notification );
if( value != KColorDialog::Accepted ) return;
resetSampleConsole();
rebuildConsole = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotCurrent_Boards
//
///////////////////////////////////////
void setPageDisplay::slotCurrent_Boards( int Index )
{
NewBoards = Index;
changeTheme = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotCurrent_Chessmen
//
///////////////////////////////////////
void setPageDisplay::slotCurrent_Chessmen( int Index )
{
NewChessmen = Index;
changeTheme = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotCurrent_Theme_Size
//
///////////////////////////////////////
void setPageDisplay::slotCurrent_Theme_Size( int Index )
{
Resource->ThemeSize = 32 + ( Index * 8 );
changeTheme = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotToggle_Board_Orientation
//
///////////////////////////////////////
void setPageDisplay::slotToggle_Board_Orientation( bool state )
{
Resource->OPTION_Board_Orientation = state;
refreshBoard = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotToggle_Splashscreen
//
///////////////////////////////////////
void setPageDisplay::slotToggle_Splashscreen( bool state )
{
Resource->OPTION_Show_Splash = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotToggle_Auto_Preview
//
///////////////////////////////////////
void setPageDisplay::slotToggle_Auto_Preview( bool state )
{
Resource->OPTION_Auto_Preview = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotToggle_Show_Last_Move
//
///////////////////////////////////////
void setPageDisplay::slotToggle_Show_Last_Move( bool state )
{
Resource->OPTION_Show_Last_Move = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotToggle_Animate_Move
//
///////////////////////////////////////
void setPageDisplay::slotToggle_Animate_Move( bool state )
{
Resource->OPTION_Animate_Moves = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slotToggle_Show_Coord
//
///////////////////////////////////////
void setPageDisplay::slotToggle_Show_Coord( bool state )
{
Resource->OPTION_Show_Coord = state;
refreshBoard = TRUE;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::buildThemeList
//
///////////////////////////////////////
void setPageDisplay::buildThemeList( void )
{
QString buffer;
int tmp(0);
Current_Boards->clear();
Current_Chessmen->clear();
Resource->readThemeDir();
while(1)
{
buffer = Resource->getBoard( tmp );
if( buffer.isEmpty() ) break;
buffer.remove( 0, 2 );
buffer.replace( QRegExp("_"), " " );
buffer.replace( QRegExp(".tar"), "" );
buffer.replace( QRegExp(".gz"), "" );
buffer.replace( QRegExp(".bz2"), "" );
Current_Boards->insertItem( buffer, tmp );
if( Resource->getBoard() == Resource->getBoard( tmp ) )
{
Current_Boards->setCurrentItem( tmp );
NewBoards = tmp;
}
tmp++;
}
/* ...and for Chessmen */
tmp = 0;
while(1)
{
buffer = Resource->getChessmen( tmp );
if( buffer.isEmpty() ) break;
buffer.remove( 0, 2 );
buffer.replace( QRegExp("_"), " " );
buffer.replace( QRegExp(".tar"), "" );
buffer.replace( QRegExp(".gz"), "" );
buffer.replace( QRegExp(".bz2"), "" );
Current_Chessmen->insertItem( buffer, tmp );
if( Resource->getChessmen() == Resource->getChessmen( tmp ) )
{
Current_Chessmen->setCurrentItem( tmp );
NewChessmen = tmp;
}
tmp++;
}
}
///////////////////////////////////////
//
// setPageDisplay::resetSampleConsole
//
///////////////////////////////////////
void setPageDisplay::resetSampleConsole( void )
{
Resource->buildStyle();
Console_Sample->setPaper( QBrush( Resource->COLOR_Background ) );
Console_Sample->setText( QString( "<K_STD>" + i18n( "Standard" ) + "</K_STD>\n" ) );
Console_Sample->append( QString( "<K_PVT>" + i18n( "Private Tell" ) + "</K_PVT>\n" ) );
Console_Sample->append( QString( "<K_CH>" + i18n( "Channel Tell" ) + "</K_CH>\n" ) );
Console_Sample->append( QString( "<K_SHT>" + i18n( "Shout" ) + "</K_SHT>\n" ) );
Console_Sample->append( QString( "<K_WSP>" + i18n( "Whisper" ) + "</K_WSP>\n" ) );
Console_Sample->append( QString( "<K_NOT>" + i18n( "Notification" ) + "</K_NOT>" ) );
}
///////////////////////////////////////
//
// setPageDisplay::slot_SCID_Images
//
///////////////////////////////////////
void setPageDisplay::slot_SCID_Images( const QString& string )
{
Resource->SCID_Image_Path = string;
emit enableApply();
}
///////////////////////////////////////
//
// setPageDisplay::slot_SCID_Images_Button
//
///////////////////////////////////////
void setPageDisplay::slot_SCID_Images_Button( void )
{
QString temp;
temp = KFileDialog::getOpenFileName( QString::null,
QString( "*" ),
Tab1,
i18n( "Find Player Images File..." ) );
if( temp.isEmpty() ) return;
EDIT_SCID_Images->setText( temp );
Resource->SCID_Image_Path = temp;
emit enableApply();
}

@ -0,0 +1,139 @@
/***************************************************************************
setpagedisplay.h - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SETPAGEDISPLAY_H
#define SETPAGEDISPLAY_H
#include <klineedit.h>
#include <kcombobox.h>
#include <qtextview.h>
#include <qtabwidget.h>
#include <qbuttongroup.h>
#include <qpushbutton.h>
#include <qslider.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class setPageDisplay : public QVBoxLayout
{
Q_OBJECT
public:
setPageDisplay(QWidget *parent=0, resource *Rsrc=0);
~setPageDisplay();
void buildThemeList( void );
int NewBoards;
int NewChessmen;
bool changeTheme;
bool refreshBoard;
bool rebuildConsole;
public slots:
void slotCurrent_Boards( int );
void slotCurrent_Chessmen( int );
void slotCurrent_Theme_Size( int );
void slotToggle_Board_Orientation( bool );
void slotToggle_Splashscreen( bool );
void slotToggle_Auto_Preview( bool );
void slotToggle_Show_Last_Move( bool );
void slotToggle_Animate_Move( bool );
void slotToggle_Show_Coord( bool );
void slot_SCID_Images( const QString& );
void slot_SCID_Images_Button( void );
void slot_setDefault(void);
void slot_Color_Background(void);
void slot_Color_Standard(void);
void slot_Color_PrivateTell(void);
void slot_Color_ChannelTell(void);
void slot_Color_Shout(void);
void slot_Color_Whisper(void);
void slot_Color_Notification(void);
void slot_Font_Standard(void);
void slot_Font_PrivateTell(void);
void slot_Font_ChannelTell(void);
void slot_Font_Shout(void);
void slot_Font_Whisper(void);
void slot_Font_Notification(void);
signals:
void enableApply( void );
protected:
void initTab1( void );
void initTab2( void );
void resetSampleConsole( void );
private:
resource *Resource;
int margin;
QTabWidget *TabParent;
/* Tab 1 : General */
QVBox *Tab1;
QHBox *BOX_Themes;
QGroupBox *GROUP_Boards;
KComboBox *Current_Boards;
QGroupBox *GROUP_Chessmen;
KComboBox *Current_Chessmen;
QGroupBox *GROUP_Theme_Size;
QLabel *Size_Min;
QSlider *Current_Theme_Size;
QLabel *Size_Max;
QGroupBox *GROUP_SCID_Images;
KLineEdit *EDIT_SCID_Images;
QPushButton *BUTTON_SCID_Images;
QGroupBox *GROUP_General_Graphics;
QCheckBox *Board_Orientation;
QCheckBox *Show_Splashscreen;
QCheckBox *Auto_Preview;
QCheckBox *Show_Last_Move;
QCheckBox *Animate_Move;
QCheckBox *Show_Coord;
/* Tab 2 : Console */
QFrame *Tab2;
QGridLayout *GRID_Style;
QTextView *Console_Sample;
QPushButton *Default_Button;
QPushButton *Fonts_Button_Standard;
QPushButton *Fonts_Button_PrivateTell;
QPushButton *Fonts_Button_ChannelTell;
QPushButton *Fonts_Button_Shout;
QPushButton *Fonts_Button_Whisper;
QPushButton *Fonts_Button_Notification;
QPushButton *Colors_Button_Standard;
QPushButton *Colors_Button_PrivateTell;
QPushButton *Colors_Button_ChannelTell;
QPushButton *Colors_Button_Shout;
QPushButton *Colors_Button_Whisper;
QPushButton *Colors_Button_Notification;
QPushButton *Colors_Button_Background;
};
#endif

@ -0,0 +1,362 @@
/***************************************************************************
setpageengines.cpp - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "setpageengines.moc"
setPageEngines::setPageEngines(QWidget *parent, resource *Rsrc ) : QVBoxLayout(parent)
{
Parent = parent;
Resource = Rsrc;
Engine_Dialog = NULL;
Engines_ListView = NULL;
BOX_Current = new QHBox( parent );
addWidget( BOX_Current );
/* Engines to play White */
GROUP_White_Current = new QGroupBox( 3,
Qt::Vertical,
i18n( "Engines to Play White" ),
BOX_Current );
White_Use_Book = new QCheckBox( i18n( "Enable Book Engine" ), GROUP_White_Current );
Engines_White = new KComboBox ( GROUP_White_Current );
Engines_White_Book = new KComboBox ( GROUP_White_Current );
Engines_White->setEditable( FALSE );
Engines_White_Book->setEditable( FALSE );
/* Engines to play Black */
GROUP_Black_Current = new QGroupBox( 3,
Qt::Vertical,
i18n( "Engines to Play Black" ),
BOX_Current );
Black_Use_Book = new QCheckBox( i18n( "Enable Book Engine" ), GROUP_Black_Current );
Engines_Black = new KComboBox ( GROUP_Black_Current );
Engines_Black_Book = new KComboBox ( GROUP_Black_Current );
Engines_Black->setEditable( FALSE );
Engines_Black_Book->setEditable( FALSE );
/* Chess Engines ListView */
GROUP_Engines = new QGroupBox( 2,
Qt::Horizontal,
i18n( "Chess Engines" ),
parent );
addWidget( GROUP_Engines );
Engines_ListView = new KListView( GROUP_Engines );
Engines_ListView->addColumn( i18n( "Name" ) );
Engines_ListView->addColumn( i18n( "Protocol" ) );
Engines_ListView->addColumn( i18n( "Wins" ) );
Engines_ListView->addColumn( i18n( "Losses" ) );
Engines_ListView->addColumn( i18n( "Draws" ) );
Engines_ListView->setAllColumnsShowFocus( TRUE );
Engines_ListView->setMultiSelection( FALSE );
Engines_ListView->setShowSortIndicator( TRUE );
Engines_ListView->restoreLayout( kapp->config(), "Engines_ListView" );
Engines_ButtonBox = new KButtonBox( GROUP_Engines, Vertical );
Engines_Button_Add = Engines_ButtonBox->addButton( i18n( "&Add..." ) );
Engines_Button_Change = Engines_ButtonBox->addButton( i18n( "&Modify..." ) );
Engines_Button_Delete = Engines_ButtonBox->addButton( i18n( "&Delete..." ) );
Engines_ButtonBox->layout();
BuildEngineData();
connect( Engines_Button_Add, SIGNAL( clicked() ), this, SLOT( slotEngine_Add() ) );
connect( Engines_Button_Change, SIGNAL( clicked() ), this, SLOT( slotEngine_Modify() ) );
connect( Engines_Button_Delete, SIGNAL( clicked() ), this, SLOT( slotEngine_Delete() ) );
connect( Engines_White, SIGNAL( activated(int) ), this, SLOT( slotCurrent_White(int) ) );
connect( Engines_White_Book, SIGNAL( activated(int) ), this, SLOT( slotCurrent_White_Book(int) ) );
connect( Engines_Black, SIGNAL( activated(int) ), this, SLOT( slotCurrent_Black(int) ) );
connect( Engines_Black_Book, SIGNAL( activated(int) ), this, SLOT( slotCurrent_Black_Book(int) ) );
connect( White_Use_Book, SIGNAL( toggled(bool) ), this, SLOT( slotToggle_White_Book(bool) ) );
connect( Black_Use_Book, SIGNAL( toggled(bool) ), this, SLOT( slotToggle_Black_Book(bool) ) );
connect( Engines_ListView, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
}
setPageEngines::~setPageEngines()
{
Engines_ListView->saveLayout( kapp->config(), "Engines_ListView" );
delete Engines_ButtonBox;
delete Engines_ListView;
delete GROUP_Engines;
delete GROUP_Black_Current;
delete GROUP_White_Current;
}
///////////////////////////////////////
//
// setPageEngines::BuildEngineData
//
///////////////////////////////////////
void setPageEngines::BuildEngineData( void )
{
bool WHITE_FLAG(FALSE),
WHITE_BK_FLAG(FALSE),
BLACK_FLAG(FALSE),
BLACK_BK_FLAG(FALSE);
QStringList EngineList;
QString proto;
int Index(0);
engineList::Iterator enginesIT;
/* Clear Comboboxes */
Engines_White->clear();
Engines_White_Book->clear();
Engines_Black->clear();
Engines_Black_Book->clear();
Engines_ListView->clear();
/* Handle status of Book-engine boxes */
White_Use_Book->setChecked( Resource->OPTION_Book_White );
Black_Use_Book->setChecked( Resource->OPTION_Book_Black );
Engines_White_Book->setEnabled( Resource->OPTION_Book_White );
Engines_Black_Book->setEnabled( Resource->OPTION_Book_Black );
/* Read the engine list */
if( Resource->engines.isEmpty() ) return;
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
switch( (*enginesIT).Protocol )
{
case UCI:
proto = "UCI";
break;
case XBoard: // Fall through
default:
proto = "XBoard";
break;
}
(void) new QListViewItem( Engines_ListView,
(*enginesIT).Name,
proto,
QString( "%1" ).arg( (*enginesIT).Wins ),
QString( "%1" ).arg( (*enginesIT).Losses ),
QString( "%1" ).arg( (*enginesIT).Draws ) );
EngineList.append( (*enginesIT).Name );
}
/* Insert engines into comboboxes */
EngineList.sort();
Engines_White->insertStringList( EngineList );
Engines_Black->insertStringList( EngineList );
Engines_White_Book->insertStringList( EngineList );
Engines_Black_Book->insertStringList( EngineList );
/* Now run the list again, setting the current engine for each combobox */
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & ENGINE_WHITE_BK )
for( Index = 0; Index < Engines_White_Book->count(); Index++ )
if( Engines_White_Book->text(Index) == (*enginesIT).Name )
{
Engines_White_Book->setCurrentItem(Index);
WHITE_BK_FLAG = TRUE;
}
if( (*enginesIT).CurrentRef & ENGINE_BLACK_BK )
for( Index = 0; Index < Engines_Black_Book->count(); Index++ )
if( Engines_Black_Book->text(Index) == (*enginesIT).Name )
{
Engines_Black_Book->setCurrentItem(Index);
BLACK_BK_FLAG = TRUE;
}
if( (*enginesIT).CurrentRef & ENGINE_WHITE )
for( Index = 0; Index < Engines_White->count(); Index++ )
if( Engines_White->text(Index) == (*enginesIT).Name )
{
Engines_White->setCurrentItem(Index);
WHITE_FLAG = TRUE;
}
if( (*enginesIT).CurrentRef & ENGINE_BLACK )
for( Index = 0; Index < Engines_Black->count(); Index++ )
if( Engines_Black->text(Index) == (*enginesIT).Name )
{
Engines_Black->setCurrentItem(Index);
BLACK_FLAG = TRUE;
}
}
/* This prevents a bug where you had to modify the current_engine_comboboxes
before you could get any engines to run. */
if( ( !WHITE_FLAG ) && ( Engines_White->count() ) ) slotCurrent_White( Engines_White->currentItem() );
if( ( !BLACK_FLAG ) && ( Engines_Black->count() ) ) slotCurrent_Black( Engines_Black->currentItem() );
if( ( !WHITE_BK_FLAG ) && ( Engines_White_Book->count() ) ) slotCurrent_White_Book( Engines_White_Book->currentItem() );
if( ( !BLACK_BK_FLAG ) && ( Engines_Black_Book->count() ) ) slotCurrent_Black_Book( Engines_Black_Book->currentItem() );
Engines_Button_Change->setEnabled( FALSE );
Engines_Button_Delete->setEnabled( FALSE );
}
///////////////////////////////////////
//
// setPageEngines::slotEngine_Add
//
///////////////////////////////////////
void setPageEngines::slotEngine_Add( void )
{
Engine_Dialog = new dlg_engine( Parent, "EngineDialog", Resource );
connect( Engine_Dialog, SIGNAL( destroyed() ), this, SLOT( BuildEngineData() ) );
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotEngine_Modify
//
///////////////////////////////////////
void setPageEngines::slotEngine_Modify( void )
{
QListViewItem *Item;
QList<QListViewItem> Select = Engines_ListView->selectedItems();
if( Select.isEmpty() ) return;
Item = Select.first();
Engine_Dialog = new dlg_engine( Parent, "EngineDialog", Resource, Item->text(0) );
connect( Engine_Dialog, SIGNAL( destroyed() ), this, SLOT( BuildEngineData() ) );
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotEngine_Delete
//
///////////////////////////////////////
void setPageEngines::slotEngine_Delete( void )
{
engineList::Iterator enginesIT;
QListViewItem *Item;
QList<QListViewItem> Select = Engines_ListView->selectedItems();
if( Select.isEmpty() ) return;
Item = Select.first();
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).Name == Item->text(0) ) break;
}
Resource->engines.remove(enginesIT);
BuildEngineData();
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotCurrent_White
//
///////////////////////////////////////
void setPageEngines::slotCurrent_White( int Index )
{
QString Name;
engineList::Iterator enginesIT;
Name = Engines_White->text(Index);
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & ENGINE_WHITE ) (*enginesIT).CurrentRef -= ENGINE_WHITE;
if( (*enginesIT).Name == Name ) (*enginesIT).CurrentRef |= ENGINE_WHITE;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotCurrent_White_Book
//
///////////////////////////////////////
void setPageEngines::slotCurrent_White_Book( int Index )
{
QString Name;
engineList::Iterator enginesIT;
Name = Engines_White_Book->text(Index);
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & ENGINE_WHITE_BK ) (*enginesIT).CurrentRef -= ENGINE_WHITE_BK;
if( (*enginesIT).Name == Name ) (*enginesIT).CurrentRef |= ENGINE_WHITE_BK;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotCurrent_Black
//
///////////////////////////////////////
void setPageEngines::slotCurrent_Black( int Index )
{
QString Name;
engineList::Iterator enginesIT;
Name = Engines_Black->text(Index);
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & ENGINE_BLACK ) (*enginesIT).CurrentRef -= ENGINE_BLACK;
if( (*enginesIT).Name == Name ) (*enginesIT).CurrentRef |= ENGINE_BLACK;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotCurrent_Black_Book
//
///////////////////////////////////////
void setPageEngines::slotCurrent_Black_Book( int Index )
{
QString Name;
engineList::Iterator enginesIT;
Name = Engines_Black_Book->text(Index);
for ( enginesIT = Resource->engines.begin(); enginesIT != Resource->engines.end(); ++enginesIT )
{
if( (*enginesIT).CurrentRef & ENGINE_BLACK_BK ) (*enginesIT).CurrentRef -= ENGINE_BLACK_BK;
if( (*enginesIT).Name == Name ) (*enginesIT).CurrentRef |= ENGINE_BLACK_BK;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotToggle_White_Book
//
///////////////////////////////////////
void setPageEngines::slotToggle_White_Book( bool state )
{
Resource->OPTION_Book_White = state;
BuildEngineData();
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::slotToggle_Black_Book
//
///////////////////////////////////////
void setPageEngines::slotToggle_Black_Book( bool state )
{
Resource->OPTION_Book_Black = state;
BuildEngineData();
emit enableApply();
}
///////////////////////////////////////
//
// setPageEngines::selectionChanged
//
///////////////////////////////////////
void setPageEngines::selectionChanged( void )
{
if( Engines_ListView->selectedItem() == 0 )
{
Engines_Button_Change->setEnabled( FALSE );
Engines_Button_Delete->setEnabled( FALSE );
}
else
{
Engines_Button_Change->setEnabled( TRUE );
Engines_Button_Delete->setEnabled( TRUE );
}
}

@ -0,0 +1,90 @@
/***************************************************************************
setpageengines.h - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SETPAGEENGINES_H
#define SETPAGEENGINES_H
#include <kbuttonbox.h>
#include <klistview.h>
#include <kcombobox.h>
#include <qstringlist.h>
#include <qcheckbox.h>
#include <qwidget.h>
#include <qgroupbox.h>
#include <qptrlist.h>
#include <qhbox.h>
#include <qlayout.h>
#include "resource.h"
#include "dlg_engine.h"
/**
*@author Troy Corbin Jr.
*/
class setPageEngines : public QVBoxLayout
{
Q_OBJECT
public:
setPageEngines(QWidget *parent=0, resource *Rsrc=0);
~setPageEngines();
public slots:
void slotEngine_Add( void );
void slotEngine_Modify( void );
void slotEngine_Delete( void );
void slotCurrent_White( int );
void slotCurrent_White_Book( int );
void slotCurrent_Black( int );
void slotCurrent_Black_Book( int );
void slotToggle_White_Book( bool );
void slotToggle_Black_Book( bool );
signals:
void enableApply( void );
protected slots:
void BuildEngineData( void );
void selectionChanged( void );
private:
QWidget *Parent;
resource *Resource;
QHBox *BOX_Current;
QGroupBox *GROUP_White_Current;
KComboBox *Engines_White;
QCheckBox *White_Use_Book;
KComboBox *Engines_White_Book;
QGroupBox *GROUP_Black_Current;
KComboBox *Engines_Black;
QCheckBox *Black_Use_Book;
KComboBox *Engines_Black_Book;
QGroupBox *GROUP_Engines;
KListView *Engines_ListView;
KButtonBox *Engines_ButtonBox;
QPushButton *Engines_Button_Add;
QPushButton *Engines_Button_Change;
QPushButton *Engines_Button_Delete;
dlg_engine *Engine_Dialog;
};
#endif

@ -0,0 +1,224 @@
/***************************************************************************
setpagegeneral.cpp - description
-------------------
begin : Fri Nov 23 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kfiledialog.h>
#include <kicontheme.h>
#include "setpagegeneral.moc"
setPageGeneral::setPageGeneral(QWidget *parent, resource *Rsrc ) : QVBoxLayout(parent)
{
Parent = parent;
Resource = Rsrc;
GROUP_UserName = new QGroupBox( 1,
Qt::Horizontal,
i18n( "Your Name:" ),
parent );
addWidget( GROUP_UserName );
EDIT_UserName = new KLineEdit( GROUP_UserName );
EDIT_UserName->setText( Resource->Local_Player );
connect( EDIT_UserName, SIGNAL( textChanged(const QString&) ), this, SLOT( slot_UserName(const QString&) ) );
BOX_SaveInit = new QHBox( parent );
addWidget( BOX_SaveInit );
GROUP_OnInit = new QButtonGroup( 3, Qt::Vertical, i18n("When Knights Begins It Should:"), BOX_SaveInit );
BUTTON_Init_Nothing = new QRadioButton( i18n( "Do Nothing" ), GROUP_OnInit );
BUTTON_Init_VsPC = new QRadioButton( i18n( "Start a Match vs. PC" ), GROUP_OnInit );
BUTTON_Init_Connect = new QRadioButton( i18n( "Connect to ICS" ), GROUP_OnInit );
GROUP_OnInit->setExclusive( TRUE );
if( Resource->OPTION_On_Init == 0 ) GROUP_OnInit->setButton( 0 );
else if( Resource->OPTION_On_Init == MENU_VS_PC ) GROUP_OnInit->setButton( 1 );
else GROUP_OnInit->setButton( 2 );
connect( GROUP_OnInit, SIGNAL( clicked(int) ),
this, SLOT( slot_Init(int) ) );
GROUP_AutoSave = new QButtonGroup( 3, Qt::Vertical, i18n("Save Match on Close?"), BOX_SaveInit );
BUTTON_AutoSave_Yes = new QRadioButton( i18n( "Yes" ), GROUP_AutoSave );
BUTTON_AutoSave_No = new QRadioButton( i18n( "No" ), GROUP_AutoSave );
BUTTON_AutoSave_Ask = new QRadioButton( i18n( "Ask" ), GROUP_AutoSave );
GROUP_AutoSave->setExclusive( TRUE );
if( Resource->PromptForSaving == "Yes" ) GROUP_AutoSave->setButton( 0 );
else if( Resource->PromptForSaving == "No" ) GROUP_AutoSave->setButton( 1 );
else GROUP_AutoSave->setButton( 2 );
connect( GROUP_AutoSave, SIGNAL( clicked(int) ),
this, SLOT( slot_AutoSave(int) ) );
GROUP_Reuse_PGN = new QGroupBox( 2,
Qt::Vertical,
i18n( "Append to Save File:" ),
parent );
addWidget( GROUP_Reuse_PGN );
BUTTON_Reuse_PGN = new QCheckBox( i18n( "Append to Save File" ), GROUP_Reuse_PGN );
BUTTON_Reuse_PGN->setChecked( Resource->OPTION_Reuse_PGN );
connect( BUTTON_Reuse_PGN, SIGNAL( toggled(bool) ),
this, SLOT( slot_Reuse_PGN(bool) ) );
BOX_Reuse_PGN = new QHBox( GROUP_Reuse_PGN );
EDIT_PGN_Filename = new KLineEdit( BOX_Reuse_PGN );
EDIT_PGN_Filename->setText( Resource->PGN_Filename );
connect( EDIT_PGN_Filename, SIGNAL( textChanged(const QString&) ), this, SLOT( slot_PGN_Filename(const QString&) ) );
BUTTON_PGN_Filename = new QPushButton( BOX_Reuse_PGN );
BUTTON_PGN_Filename->setPixmap( Resource->LoadIcon( QString( "fileopen" ), KIcon::Toolbar ) );
connect( BUTTON_PGN_Filename, SIGNAL( clicked() ), this, SLOT( slot_PGN_Filename_Button() ) );
EDIT_PGN_Filename->setEnabled( Resource->OPTION_Reuse_PGN );
BUTTON_PGN_Filename->setEnabled( Resource->OPTION_Reuse_PGN );
BUTTON_Pause_On_Minimize = new QCheckBox( i18n( "Pause on Minimize" ), parent );
BUTTON_Pause_On_Minimize->setChecked( Resource->OPTION_Pause_On_Minimize );
connect( BUTTON_Pause_On_Minimize, SIGNAL( toggled(bool) ),
this, SLOT( slot_Pause_On_Minimize(bool) ) );
addWidget( BUTTON_Pause_On_Minimize );
BUTTON_Auto_Queen = new QCheckBox( i18n( "Always Promote to Queen" ), parent );
BUTTON_Auto_Queen->setChecked( Resource->OPTION_Auto_Queen );
connect( BUTTON_Auto_Queen, SIGNAL( toggled(bool) ),
this, SLOT( slot_Auto_Queen(bool) ) );
addWidget( BUTTON_Auto_Queen );
BUTTON_Auto_Flag = new QCheckBox( i18n( "Call Flag Automatically" ), parent );
BUTTON_Auto_Flag->setChecked( Resource->OPTION_Auto_Call_Flag );
connect( BUTTON_Auto_Flag, SIGNAL( toggled(bool) ),
this, SLOT( slot_Auto_Flag(bool) ) );
addWidget( BUTTON_Auto_Flag );
}
setPageGeneral::~setPageGeneral()
{
}
///////////////////////////////////////
//
// setPageGeneral::slot_AutoSave
//
///////////////////////////////////////
void setPageGeneral::slot_AutoSave( int state )
{
switch( state )
{
case 0:
Resource->PromptForSaving = "Yes";
break;
case 1:
Resource->PromptForSaving = "No";
break;
case 2:
Resource->PromptForSaving = "";
break;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_Init
//
///////////////////////////////////////
void setPageGeneral::slot_Init( int state )
{
switch( state )
{
case 0:
Resource->OPTION_On_Init = 0;
break;
case 1:
Resource->OPTION_On_Init = MENU_VS_PC;
break;
case 2:
Resource->OPTION_On_Init = MENU_CONNECT;
break;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_Pause_On_Minimize
//
///////////////////////////////////////
void setPageGeneral::slot_Pause_On_Minimize( bool state )
{
Resource->OPTION_Pause_On_Minimize = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_Auto_Queen
//
///////////////////////////////////////
void setPageGeneral::slot_Auto_Queen( bool state )
{
Resource->OPTION_Auto_Queen = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_Auto_Flag
//
///////////////////////////////////////
void setPageGeneral::slot_Auto_Flag( bool state )
{
Resource->OPTION_Auto_Call_Flag = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_UserName
//
///////////////////////////////////////
void setPageGeneral::slot_UserName( const QString& string )
{
Resource->Local_Player = string;
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_Reuse_PGN
//
///////////////////////////////////////
void setPageGeneral::slot_Reuse_PGN( bool state )
{
Resource->OPTION_Reuse_PGN = state;
EDIT_PGN_Filename->setEnabled( state );
BUTTON_PGN_Filename->setEnabled( state );
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_PGN_Filename
//
///////////////////////////////////////
void setPageGeneral::slot_PGN_Filename( const QString& string )
{
Resource->PGN_Filename = string;
emit enableApply();
}
///////////////////////////////////////
//
// setPageGeneral::slot_PGN_Filename_Button
//
///////////////////////////////////////
void setPageGeneral::slot_PGN_Filename_Button( void )
{
QString temp;
temp = KFileDialog::getOpenFileName( QString::null,
QString( "*" ),
BOX_Reuse_PGN,
i18n( "Find PGN..." ) );
if( temp.isEmpty() ) return;
EDIT_PGN_Filename->setText( temp );
Resource->PGN_Filename = temp;
emit enableApply();
}

@ -0,0 +1,80 @@
/***************************************************************************
setpagegeneral.h - description
-------------------
begin : Fri Nov 23 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SETPAGEGENERAL_H
#define SETPAGEGENERAL_H
#include <klineedit.h>
#include <qwidget.h>
#include <qhbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qgroupbox.h>
#include <qbuttongroup.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qcheckbox.h>
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
class setPageGeneral : public QVBoxLayout
{
Q_OBJECT
public:
setPageGeneral(QWidget *parent=0, resource *Rsrc=0);
~setPageGeneral();
signals:
void enableApply( void );
public slots:
void slot_AutoSave( int state );
void slot_Init( int state );
void slot_UserName( const QString& );
void slot_Pause_On_Minimize( bool state );
void slot_Auto_Queen( bool state );
void slot_Auto_Flag( bool state );
void slot_Reuse_PGN( bool );
void slot_PGN_Filename( const QString& );
void slot_PGN_Filename_Button( void );
private:
QWidget *Parent;
resource *Resource;
QGroupBox *GROUP_UserName;
KLineEdit *EDIT_UserName;
QHBox *BOX_SaveInit;
QButtonGroup *GROUP_AutoSave;
QRadioButton *BUTTON_AutoSave_Yes;
QRadioButton *BUTTON_AutoSave_No;
QRadioButton *BUTTON_AutoSave_Ask;
QButtonGroup *GROUP_OnInit;
QRadioButton *BUTTON_Init_Nothing;
QRadioButton *BUTTON_Init_VsPC;
QRadioButton *BUTTON_Init_Connect;
QGroupBox *GROUP_Reuse_PGN;
QCheckBox *BUTTON_Reuse_PGN;
QHBox *BOX_Reuse_PGN;
KLineEdit *EDIT_PGN_Filename;
QPushButton *BUTTON_PGN_Filename;
QCheckBox *BUTTON_Pause_On_Minimize;
QCheckBox *BUTTON_Auto_Queen;
QCheckBox *BUTTON_Auto_Flag;
};
#endif

@ -0,0 +1,379 @@
/***************************************************************************
setpageservers.cpp - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "setpageservers.moc"
#include <qstyle.h>
#include <kicontheme.h>
setPageServers::setPageServers(QWidget *parent, resource *Rsrc ) : QVBoxLayout(parent)
{
QStyle& Style = QApplication::style();
margin = Style.defaultFrameWidth();
Resource = Rsrc;
Servers_ListView = NULL;
resetServer = FALSE;
TabParent = new QTabWidget( parent, "setPageDisplay" );
initTab1();
initTab2();
addWidget( TabParent );
}
setPageServers::~setPageServers()
{
Servers_ListView->saveLayout( kapp->config(), "Servers_ListView" );
delete Servers_ButtonBox;
delete Servers_ListView;
delete GROUP_Servers;
delete GROUP_Current;
}
///////////////////////////////////////
//
// setPageServers::initTab1
//
///////////////////////////////////////
void setPageServers::initTab1( void )
{
Tab1 = new QVBox( TabParent );
Tab1->setMargin( margin );
/* Current Server */
GROUP_Current = new QGroupBox( 1,
Qt::Vertical,
i18n( "Current Server" ),
Tab1 );
Servers = new KComboBox ( GROUP_Current );
Servers->setEditable( FALSE );
/* Chess Servers ListView */
GROUP_Servers = new QGroupBox( 2,
Qt::Horizontal,
i18n( "Chess Servers" ),
Tab1 );
Servers_ListView = new KListView( GROUP_Servers );
Servers_ListView->addColumn( i18n( "Name" ) );
Servers_ListView->addColumn( i18n( "URL" ) );
Servers_ListView->setAllColumnsShowFocus( TRUE );
Servers_ListView->setMultiSelection( FALSE );
Servers_ListView->setShowSortIndicator( TRUE );
Servers_ListView->restoreLayout( kapp->config(), "Servers_ListView" );
Servers_ButtonBox = new KButtonBox( GROUP_Servers, Vertical );
Servers_Button_Add = Servers_ButtonBox->addButton( i18n( "&Add..." ) );
Servers_Button_Change = Servers_ButtonBox->addButton( i18n( "&Modify..." ) );
Servers_Button_Delete = Servers_ButtonBox->addButton( i18n( "&Delete..." ) );
Servers_ButtonBox->layout();
BuildServerData();
connect( Servers_Button_Add, SIGNAL( clicked() ), this, SLOT( slotServer_Add() ) );
connect( Servers_Button_Change, SIGNAL( clicked() ), this, SLOT( slotServer_Modify() ) );
connect( Servers_Button_Delete, SIGNAL( clicked() ), this, SLOT( slotServer_Delete() ) );
connect( Servers, SIGNAL( activated(int) ), this, SLOT( slotCurrent(int) ) );
connect( Servers_ListView, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
TabParent->addTab( Tab1, i18n("Servers") );
}
///////////////////////////////////////
//
// setPageServers::initTab2
//
///////////////////////////////////////
void setPageServers::initTab2( void )
{
QStringList FilterLevels;
Tab2 = new QVBox( TabParent );
Tab2->setMargin( margin );
/* Current Profanity Filter */
BOX_Profanity = new QGroupBox( 1,
Qt::Vertical,
i18n( "Profanity Filter" ),
Tab2 );
COMBO_Profanity = new KComboBox ( BOX_Profanity );
COMBO_Profanity->setEditable( FALSE );
FilterLevels << i18n("Filter Everything") << i18n("Default") << "---" << "---" << "---" << i18n("No Filtering");
COMBO_Profanity->insertStringList( FilterLevels );
COMBO_Profanity->setCurrentItem( Resource->OPTION_Profanity );
connect( COMBO_Profanity, SIGNAL( activated(int) ), this, SLOT( slot_Profanity(int) ) );
BUTTON_Auto_Close_ICS = new QCheckBox( i18n( "Automatically Close Previous ICS Match" ), Tab2 );
BUTTON_Auto_Close_ICS->setChecked( Resource->OPTION_Auto_Close_Last_ICS );
connect( BUTTON_Auto_Close_ICS, SIGNAL( toggled(bool) ),
this, SLOT( slot_Auto_Close_ICS(bool) ) );
BUTTON_Private = new QCheckBox( i18n( "Private Matches" ), Tab2 );
BUTTON_Private->setChecked( Resource->OPTION_Private );
connect( BUTTON_Private, SIGNAL( toggled(bool) ), this, SLOT( slot_Private(bool) ) );
BUTTON_Premove = new QCheckBox( i18n( "Enable Premove" ), Tab2 );
BUTTON_Premove->setChecked( Resource->OPTION_Premove );
connect( BUTTON_Premove, SIGNAL( toggled(bool) ), this, SLOT( slot_Premove(bool) ) );
BUTTON_Kibitz = new QCheckBox( i18n( "Enable Kibitzes" ), Tab2 );
BUTTON_Kibitz->setChecked( Resource->OPTION_Kibitz );
connect( BUTTON_Kibitz, SIGNAL( toggled(bool) ), this, SLOT( slot_Kibitz(bool) ) );
BUTTON_Tell = new QCheckBox( i18n( "Enable Unregistered Tells" ), Tab2 );
BUTTON_Tell->setChecked( Resource->OPTION_Tell );
connect( BUTTON_Tell, SIGNAL( toggled(bool) ), this, SLOT( slot_Tell(bool) ) );
BUTTON_Shout = new QCheckBox( i18n( "Enable Shouts" ), Tab2 );
BUTTON_Shout->setChecked( Resource->OPTION_Shout );
connect( BUTTON_Shout, SIGNAL( toggled(bool) ), this, SLOT( slot_Shout(bool) ) );
BUTTON_Seek = new QCheckBox( i18n( "Enable Seeks" ), Tab2 );
BUTTON_Seek->setChecked( Resource->OPTION_Seek );
connect( BUTTON_Seek, SIGNAL( toggled(bool) ), this, SLOT( slot_Seek(bool) ) );
BOX_SeekTimer = new QHBox( Tab2 );
BUTTON_SeekTimer = new QSpinBox( 3, 120, 1, BOX_SeekTimer );
BUTTON_SeekTimer->setSuffix( i18n(" sec.") );
BUTTON_SeekTimer->setValue( Resource->Seek_Timer / 10 );
connect( BUTTON_SeekTimer, SIGNAL( valueChanged(int) ),
this, SLOT( slot_SeekTimer(int) ) );
LABEL_SeekTimer = new QLabel( i18n("Seconds Between Seek Updates"), BOX_SeekTimer );
TabParent->addTab( Tab2, i18n("Options") );
}
///////////////////////////////////////
//
// setPageServers::BuildServerData
//
///////////////////////////////////////
void setPageServers::BuildServerData( void )
{
bool SERVER_FLAG(FALSE);
QStringList ServerList;
int Index(0);
serverList::Iterator serversIT;
/* Clear Comboboxes */
Servers->clear();
Servers_ListView->clear();
/* Read the server list */
if( Resource->servers.isEmpty() ) return;
for ( serversIT = Resource->servers.begin(); serversIT != Resource->servers.end(); ++serversIT )
{
(void) new QListViewItem( Servers_ListView,
(*serversIT).Name,
(*serversIT).URL );
ServerList.append( (*serversIT).Name );
}
/* Insert engines into comboboxes */
ServerList.sort();
Servers->insertStringList( ServerList );
/* Now run the list again, setting the current engine for each combobox */
for ( serversIT = Resource->servers.begin(); serversIT != Resource->servers.end(); ++serversIT )
{
if( (*serversIT).CurrentRef )
for( Index = 0; Index < Servers->count(); Index++ )
if( Servers->text(Index) == (*serversIT).Name )
{
Servers->setCurrentItem(Index);
SERVER_FLAG = TRUE;
}
}
/* This prevents a bug where you had to modify the current_server_combobox
before you could get any servers to run. */
if( ( !SERVER_FLAG ) && ( Servers->count() ) ) slotCurrent( Servers->currentItem() );
Servers_Button_Change->setEnabled( FALSE );
Servers_Button_Delete->setEnabled( FALSE );
}
///////////////////////////////////////
//
// setPageServers::slotServer_Add
//
///////////////////////////////////////
void setPageServers::slotServer_Add( void )
{
Server_Dialog = new dlg_server( TabParent, "ServerDialog", Resource );
connect( Server_Dialog, SIGNAL( destroyed() ), this, SLOT( BuildServerData() ) );
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::slotServer_Modify
//
///////////////////////////////////////
void setPageServers::slotServer_Modify( void )
{
QListViewItem *Item;
QList<QListViewItem> Select = Servers_ListView->selectedItems();
if( Select.isEmpty() ) return;
Item = Select.first();
Server_Dialog = new dlg_server( TabParent, "ServerDialog", Resource, Item->text(0) );
connect( Server_Dialog, SIGNAL( destroyed() ), this, SLOT( BuildServerData() ) );
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::slotServer_Delete
//
///////////////////////////////////////
void setPageServers::slotServer_Delete( void )
{
serverList::Iterator serversIT;
QListViewItem *Item;
QList<QListViewItem> Select = Servers_ListView->selectedItems();
if( Select.isEmpty() ) return;
Item = Select.first();
for ( serversIT = Resource->servers.begin(); serversIT != Resource->servers.end(); ++serversIT )
{
if( (*serversIT).Name == Item->text(0) ) break;
}
Resource->servers.remove(serversIT);
BuildServerData();
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::slotCurrent
//
///////////////////////////////////////
void setPageServers::slotCurrent( int Index )
{
QString Name;
serverList::Iterator serversIT;
Name = Servers->text(Index);
for ( serversIT = Resource->servers.begin(); serversIT != Resource->servers.end(); ++serversIT )
{
if( (*serversIT).CurrentRef ) (*serversIT).CurrentRef = FALSE;
if( (*serversIT).Name == Name ) (*serversIT).CurrentRef = TRUE;
}
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::slot_Profanity
//
///////////////////////////////////////
void setPageServers::slot_Profanity( int Index )
{
Resource->OPTION_Profanity = Index;
emit enableApply();
resetServer = TRUE;
}
///////////////////////////////////////
//
// setPageServers::slot_Premove
//
///////////////////////////////////////
void setPageServers::slot_Premove( bool state )
{
Resource->OPTION_Premove = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::slot_Shout
//
///////////////////////////////////////
void setPageServers::slot_Shout( bool state )
{
Resource->OPTION_Shout = state;
emit enableApply();
resetServer = TRUE;
}
///////////////////////////////////////
//
// setPageServers::slot_Private
//
///////////////////////////////////////
void setPageServers::slot_Private( bool state )
{
Resource->OPTION_Private = state;
emit enableApply();
resetServer = TRUE;
}
///////////////////////////////////////
//
// setPageServers::slot_Kibitz
//
///////////////////////////////////////
void setPageServers::slot_Kibitz( bool state )
{
Resource->OPTION_Kibitz = state;
emit enableApply();
resetServer = TRUE;
}
///////////////////////////////////////
//
// setPageServers::slot_Tell
//
///////////////////////////////////////
void setPageServers::slot_Tell( bool state )
{
Resource->OPTION_Tell = state;
emit enableApply();
resetServer = TRUE;
}
///////////////////////////////////////
//
// setPageServers::slot_Seek
//
///////////////////////////////////////
void setPageServers::slot_Seek( bool state )
{
Resource->OPTION_Seek = state;
emit enableApply();
resetServer = TRUE;
}
///////////////////////////////////////
//
// setPageServers::slot_Auto_Close_ICS
//
///////////////////////////////////////
void setPageServers::slot_Auto_Close_ICS( bool state )
{
Resource->OPTION_Auto_Close_Last_ICS = state;
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::slot_SeekTimer
//
///////////////////////////////////////
void setPageServers::slot_SeekTimer( int value )
{
Resource->Seek_Timer = value * 10;
emit enableApply();
}
///////////////////////////////////////
//
// setPageServers::selectionChanged
//
///////////////////////////////////////
void setPageServers::selectionChanged( void )
{
if( Servers_ListView->selectedItem() == 0 )
{
Servers_Button_Change->setEnabled( FALSE );
Servers_Button_Delete->setEnabled( FALSE );
}
else
{
Servers_Button_Change->setEnabled( TRUE );
Servers_Button_Delete->setEnabled( TRUE );
}
}

@ -0,0 +1,112 @@
/***************************************************************************
setpageservers.h - description
-------------------
begin : Thu Aug 16 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SETPAGESERVERS_H
#define SETPAGESERVERS_H
#include <qtabwidget.h>
#include <kbuttonbox.h>
#include <klistview.h>
#include <klineedit.h>
#include <kcombobox.h>
#include <qlabel.h>
#include <qhbox.h>
#include <qstringlist.h>
#include <qcheckbox.h>
#include <qwidget.h>
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qcheckbox.h>
#include <qspinbox.h>
#include <qptrlist.h>
#include <qlayout.h>
#include "resource.h"
#include "dlg_server.h"
/**
*@author Troy Corbin Jr.
*/
class setPageServers : public QVBoxLayout
{
Q_OBJECT
public:
setPageServers(QWidget *parent=0, resource *Rsrc=0);
~setPageServers();
bool resetServer;
public slots:
void slotServer_Add( void );
void slotServer_Modify( void );
void slotServer_Delete( void );
void slotCurrent( int );
void slot_Premove( bool );
void slot_Private( bool );
void slot_Profanity( int );
void slot_Kibitz( bool );
void slot_Tell( bool );
void slot_Shout( bool );
void slot_Seek( bool );
void slot_SeekTimer( int value );
void slot_Auto_Close_ICS( bool state );
signals:
void enableApply( void );
protected slots:
void BuildServerData( void );
void selectionChanged( void );
protected:
void initTab1( void );
void initTab2( void );
private:
resource *Resource;
int margin;
QTabWidget *TabParent;
/* Tab 1 : Servers */
QVBox *Tab1;
QGroupBox *GROUP_Current;
QGroupBox *GROUP_Servers;
KComboBox *Servers;
KListView *Servers_ListView;
KButtonBox *Servers_ButtonBox;
QPushButton *Servers_Button_Add;
QPushButton *Servers_Button_Change;
QPushButton *Servers_Button_Delete;
dlg_server *Server_Dialog;
/* Tab 2 : Options */
QVBox *Tab2;
QGroupBox *BOX_Profanity;
KComboBox *COMBO_Profanity;
QCheckBox *BUTTON_Premove;
QCheckBox *BUTTON_Private;
QCheckBox *BUTTON_Kibitz;
QCheckBox *BUTTON_Tell;
QCheckBox *BUTTON_Shout;
QCheckBox *BUTTON_Seek;
QCheckBox *BUTTON_Auto_Close_ICS;
QHBox *BOX_SeekTimer;
QSpinBox *BUTTON_SeekTimer;
QLabel *LABEL_SeekTimer;
};
#endif

@ -0,0 +1,40 @@
/***************************************************************************
splash.cpp - description
-------------------
begin : Tue Jul 17 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "splash.moc"
#include <qpixmap.h>
#include <kstddirs.h>
#include <kwin.h>
#include <qapplication.h>
splash::splash() :
QWidget( 0, "splash", Qt::WStyle_Customize | Qt::WStyle_NoBorder )
{
QPixmap SplashImage( locate("data", "knights/splash.png" ) );
setPaletteBackgroundPixmap( SplashImage );
QSize Hint = SplashImage.size();
setFixedSize( Hint );
move( ( QApplication::desktop()->width() - Hint.width() ) / 2,
( QApplication::desktop()->height() - Hint.height() ) / 2 );
show();
repaint( FALSE );
}
splash::~splash()
{
}

@ -0,0 +1,35 @@
/***************************************************************************
splash.h - description
-------------------
begin : Tue Jul 17 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef SPLASH_H
#define SPLASH_H
#include <qwidget.h>
/**
*@author Troy Corbin Jr.
*/
class splash : public QWidget
{
Q_OBJECT
public:
splash();
~splash();
};
#endif

@ -0,0 +1,160 @@
/***************************************************************************
tab_pgnview.cpp - description
-------------------
begin : Sat Jan 25 2003
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tab_pgnview.moc"
#include "tabmanager.h"
#include "resource.h"
#include "pgn.h"
#include <qfile.h>
#include <qregexp.h>
#include <qtextstream.h>
#include <kstddirs.h>
#include <ktempfile.h>
tab_pgnView::tab_pgnView(pgn *parent, resource *Rsrc ) : KnightsTextView(0,Rsrc)
{
myParent = parent;
whiteImage = NULL;
blackImage = NULL;
QString source = locate( "appdata", "pgn_template.kml" );
QFile file( source );
if( file.open( IO_ReadOnly ) )
{
QTextStream stream( &file );
document = stream.read();
file.close();
}
else
{
kdWarning() << "tab_pgnView::tab_pgnView: Can not find PGN Template" << endl;
}
}
tab_pgnView::~tab_pgnView()
{
if( whiteImage )
delete whiteImage;
if( blackImage )
delete blackImage;
}
///////////////////////////////////////
//
// tab_pgnView::init
//
///////////////////////////////////////
void tab_pgnView::init( void )
{
/* Replace macros with data */
document.replace( QRegExp( "%site%" ), myParent->TAG_Site );
document.replace( QRegExp( "%date%" ), myParent->TAG_Date );
document.replace( QRegExp( "%round%" ), myParent->TAG_Round );
document.replace( QRegExp( "%result%" ), myParent->TAG_Result );
document.replace( QRegExp( "%white%" ), myParent->TAG_White );
document.replace( QRegExp( "%whitetitle%" ), myParent->TAG_WhiteTitle );
document.replace( QRegExp( "%whiteelo%" ), myParent->TAG_WhiteElo );
document.replace( QRegExp( "%whiteuscf%" ), myParent->TAG_WhiteUSCF );
document.replace( QRegExp( "%whitena%" ), myParent->TAG_WhiteNA );
document.replace( QRegExp( "%whitetype%" ), myParent->TAG_WhiteType );
document.replace( QRegExp( "%black%" ), myParent->TAG_Black );
document.replace( QRegExp( "%blacktitle%" ), myParent->TAG_BlackTitle );
document.replace( QRegExp( "%blackelo%" ), myParent->TAG_BlackElo );
document.replace( QRegExp( "%blackuscf%" ), myParent->TAG_BlackUSCF );
document.replace( QRegExp( "%blackna%" ), myParent->TAG_BlackNA );
document.replace( QRegExp( "%blacktype%" ), myParent->TAG_BlackType );
document.replace( QRegExp( "%time%" ), myParent->TAG_Time );
document.replace( QRegExp( "%utctime%" ), myParent->TAG_UTCTime );
document.replace( QRegExp( "%utcdate%" ), myParent->TAG_UTCDate );
document.replace( QRegExp( "%event%" ), myParent->TAG_Event );
document.replace( QRegExp( "%eventdate%" ), myParent->TAG_EventDate );
document.replace( QRegExp( "%eventsponsor"), myParent->TAG_EventSponsor );
document.replace( QRegExp( "%section%" ), myParent->TAG_Section );
document.replace( QRegExp( "%stage%" ), myParent->TAG_Stage );
document.replace( QRegExp( "%board%" ), myParent->TAG_Board );
document.replace( QRegExp( "%opening%" ), myParent->TAG_Opening );
document.replace( QRegExp( "%variation%" ), myParent->TAG_Variation );
document.replace( QRegExp( "%subvariation%" ), myParent->TAG_SubVariation );
document.replace( QRegExp( "%eco%" ), myParent->TAG_ECO );
document.replace( QRegExp( "%nic%" ), myParent->TAG_NIC );
document.replace( QRegExp( "%timecontrol%" ), myParent->TAG_TimeControl );
document.replace( QRegExp( "%termination%" ), myParent->TAG_Termination );
document.replace( QRegExp( "%setup%" ), myParent->TAG_SetUp );
document.replace( QRegExp( "%fen%" ), myParent->TAG_FEN );
document.replace( QRegExp( "%annotator%" ), myParent->TAG_Annotator );
document.replace( QRegExp( "%mode%" ), myParent->TAG_Mode );
document.replace( QRegExp( "%plycount%" ), myParent->TAG_PlyCount );
/* Get the White Player's Image */
QPixmap wi = myResource->loadSCIDImage( myParent->TAG_White );
if( wi.isNull() )
{
if( myParent->TAG_WhiteType == "program" )
wi.load( locate("data", "knights/default-engine-portrait.jpg" ) );
else
wi.load( locate("data", "knights/default-portrait.jpg" ) );
}
whiteImage = new KTempFile();
whiteImage->setAutoDelete( TRUE );
wi.save( whiteImage->name(), "PNG" );
document.replace( QRegExp( "%whiteimage%" ), whiteImage->name() );
/* Get the Black Player's Image */
QPixmap bi = myResource->loadSCIDImage( myParent->TAG_Black );
if( bi.isNull() )
{
if( myParent->TAG_BlackType == "program" )
bi.load( locate("data", "knights/default-engine-portrait.jpg" ) );
else
bi.load( locate("data", "knights/default-portrait.jpg" ) );
}
blackImage = new KTempFile();
blackImage->setAutoDelete( TRUE );
bi.save( blackImage->name(), "PNG" );
document.replace( QRegExp( "%blackimage%" ), blackImage->name() );
/* Obtain the move data */
QString moves;
QStringList *list;
if( myParent->Move_Data.isEmpty() )
{
list = myParent->notation(2);
}
else
{
list = new QStringList( myParent->Move_Data );
}
/* Do some formatting and then merge the strings */
for( QStringList::Iterator i = list->begin(); i != list->end(); i++ )
{
(*i).replace( QRegExp( "[^\\0040-\\0176]" ), "" );
(*i).replace( QRegExp( "\\(" ), "<i>(" );
(*i).replace( QRegExp( "\\)" ), ")</i>" );
(*i).replace( QRegExp( "\\{" ), "<b>{" );
(*i).replace( QRegExp( "\\}" ), "}</b>" );
}
moves = list->join( " " );
delete list;
int pos = document.find( "%moves%" );
if( pos != -1 )
{
document.remove( (unsigned int)pos, 7 );
document.insert( (unsigned int)pos, moves );
}
setText( document );
}

@ -0,0 +1,47 @@
/***************************************************************************
tab_pgnview.h - description
-------------------
begin : Sat Jan 25 2003
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TAB_PGNVIEW_H
#define TAB_PGNVIEW_H
#include "knightstextview.h"
#include <qstring.h>
/**
*@author Troy Corbin Jr.
*/
class resource;
class pgn;
class KTempFile;
class tab_pgnView : public KnightsTextView
{
Q_OBJECT
public:
tab_pgnView(pgn *parent, resource *Rsrc );
~tab_pgnView();
void init( void );
protected:
pgn *myParent;
QString document;
KTempFile *whiteImage;
KTempFile *blackImage;
};
#endif

@ -0,0 +1,209 @@
/***************************************************************************
tab_seeklist.cpp - description
-------------------
begin : Sat Sep 14 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tab_seeklist.moc"
#include "resource.h"
#include <kiconloader.h>
#include <qregexp.h>
tab_SeekList::tab_SeekList(QWidget *parent, const char *name, resource *Rsrc ) : KListView(parent,name)
{
myResource = Rsrc;
seek = FALSE;
addColumn( i18n( "Name" ) );
addColumn( i18n( "Rating" ) );
addColumn( i18n( "Match Type" ) );
addColumn( i18n( "Is Rated?" ) );
addColumn( i18n( "Base Time" ) );
addColumn( i18n( "Increment" ) );
setShowSortIndicator( TRUE );
setAllColumnsShowFocus( TRUE );
setMultiSelection( FALSE );
restoreLayout( kapp->config(), "Sought_ListView" );
menuSeek = new KPopupMenu( this );
menuSeek->setCheckable( TRUE );
menuSeek->insertItem( i18n("Seek Matches"), this, SLOT( menuFunct(int) ), 0, MENU_SEEK );
menuSeek->insertSeparator();
menuSeek->insertItem( i18n("Accept This Match"), this, SLOT( menuFunct(int) ), 0, MENU_ACCEPT_MATCH );
menuSeek->insertItem( i18n("Tell..."), this, SLOT( menuFunct(int) ), 0, MENU_TELL );
menuSeek->insertItem( i18n("Assess..."), this, SLOT( menuFunct(int) ), 0, MENU_ASSESS );
menuSeek->insertItem( i18n("Player Info"), this, SLOT( menuFunct(int) ), 0, MENU_FINGER );
menuSeek->insertItem( QIconSet( myResource->LoadIcon( QString("history"), KIcon::Small ) ),
i18n("Player History"), this, SLOT( menuFunct(int) ), 0, MENU_HISTORY );
menuSeek->insertSeparator();
menuSeek->insertItem( i18n("Add to Friends"), this, SLOT( menuFunct(int) ), 0, MENU_NOTIFY );
menuSeek->insertItem( i18n("Ignore This Player"), this, SLOT( menuFunct(int) ), 0, MENU_CENSOR );
menuSeek->setItemChecked( MENU_SEEK, FALSE );
connect( this, SIGNAL( contextMenuRequested( QListViewItem*, const QPoint&, int ) ),
this, SLOT( display_menuSeek( QListViewItem*, const QPoint&, int ) ) );
connect( this, SIGNAL( executed( QListViewItem* ) ),
this, SLOT( selectMatch( QListViewItem* ) ) );
}
tab_SeekList::~tab_SeekList()
{
}
///////////////////////////////////////
//
// tab_SeekList::recvCMD
//
///////////////////////////////////////
void tab_SeekList::recvCMD( const Command& command )
{
switch(((Command)command).getCommand())
{
case CMD_Add_Sought_Match:
addSoughtItem( ((Command)command).getData() );
break;
case CMD_Show_Sought_List:
updateSoughtList();
break;
case CMD_Hide_Sought_List:
clear();
seek = FALSE;
break;
default:
break;
}
}
///////////////////////////////////////
//
// tab_SeekList::updateSoughtList
//
///////////////////////////////////////
void tab_SeekList::updateSoughtList( void )
{
unsigned int loop;
clear();
for( loop = 0; loop < SF_01.count(); loop++ )
{
(void) new KListViewItem( this,
SF_01[loop],
SF_02[loop],
SF_03[loop],
SF_04[loop],
SF_05[loop] + i18n(" min."),
SF_06[loop] + i18n(" sec."),
SF_07[loop] );
}
SF_01.clear();
SF_02.clear();
SF_03.clear();
SF_04.clear();
SF_05.clear();
SF_06.clear();
SF_07.clear();
seek = TRUE;
}
///////////////////////////////////////
//
// tab_SeekList::addSoughtItem
//
///////////////////////////////////////
void tab_SeekList::addSoughtItem( const QString &src )
{
QStringList fields = QStringList::split( QChar(' '), src, FALSE );
SF_01 << fields[2]; // Name
SF_02 << fields[1]; // Rating
SF_03 << fields[6]; // Match Type
SF_04 << fields[5]; // Is Rated?
SF_05 << fields[3]; // Base Time
SF_06 << fields[4]; // Increment
SF_07 << fields[0]; // ID#
}
///////////////////////////////////////
//
// tab_SeekList::display_menuSeek
//
///////////////////////////////////////
void tab_SeekList::display_menuSeek( QListViewItem *Item, const QPoint &Pos, int )
{
bool enable;
if( Item != NULL )
{
setSelected( Item, TRUE );
selectedPlayerName = Item->text(0).replace( QRegExp("\\(.+\\)"), QString("") );
selectedMatchID = Item->text(6).toInt();
enable = TRUE;
}
else
{
enable = FALSE;
}
menuSeek->setItemChecked( MENU_SEEK, seek );
menuSeek->setItemEnabled( MENU_FINGER, enable );
menuSeek->setItemEnabled( MENU_TELL, enable );
menuSeek->setItemEnabled( MENU_NOTIFY, enable );
menuSeek->setItemEnabled( MENU_CENSOR, enable );
menuSeek->setItemEnabled( MENU_HISTORY, enable );
menuSeek->setItemEnabled( MENU_ACCEPT_MATCH, enable );
menuSeek->setItemEnabled( MENU_ASSESS, enable );
menuSeek->popup( Pos );
}
///////////////////////////////////////
//
// tab_SeekList::selectMatch
//
///////////////////////////////////////
void tab_SeekList::selectMatch( int matchID )
{
if( matchID )
emit sendCMD( Command( 0, CMD_Start_Match, QString::number( matchID ) ) );
}
void tab_SeekList::selectMatch( QListViewItem *Item )
{
selectMatch( Item->text(6).toInt() );
}
///////////////////////////////////////
//
// tab_SeekList::menuFunct
//
///////////////////////////////////////
void tab_SeekList::menuFunct( int funct )
{
switch( funct )
{
case MENU_SEEK:
emit sendCMD( Command( 0, CMD_Toggle_Seek ) );
break;
case MENU_FINGER:
emit sendCMD( Command( 0, CMD_Player_Finger, selectedPlayerName ) );
break;
case MENU_TELL:
emit sendCMD( Command( 0, CMD_Set_Input, QString( "tell %1 " ).arg( selectedPlayerName ) ) );
break;
case MENU_NOTIFY:
emit sendCMD( Command( 0, CMD_Add_Friend, selectedPlayerName ) );
break;
case MENU_CENSOR:
emit sendCMD( Command( 0, CMD_Ignore_Player, selectedPlayerName ) );
break;
case MENU_HISTORY:
emit sendCMD( Command( 0, CMD_Player_History, selectedPlayerName ) );
break;
case MENU_ACCEPT_MATCH:
emit sendCMD( Command( 0, CMD_Start_Match, QString::number( selectedMatchID ) ) );
break;
case MENU_ASSESS:
emit sendCMD( Command( 0, CMD_Assess, selectedPlayerName ) );
break;
default:
break;
}
}

@ -0,0 +1,75 @@
/***************************************************************************
tab_seeklist.h - description
-------------------
begin : Sat Sep 14 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TAB_SEEKLIST_H
#define TAB_SEEKLIST_H
#include <kpopupmenu.h>
#include <klistview.h>
#include <qwidget.h>
#include <qstringlist.h>
#include "command.h"
/**
*@author Troy Corbin Jr.
*/
class resource;
class tab_SeekList : public KListView
{
Q_OBJECT
private:
resource *myResource;
KPopupMenu *menuSeek;
bool seek;
int selectedMatchID;
QString selectedPlayerName;
/*
These StringLists temporarily store Sought Game data
until all ads have been displayed.
*/
QStringList SF_01;
QStringList SF_02;
QStringList SF_03;
QStringList SF_04;
QStringList SF_05;
QStringList SF_06;
QStringList SF_07;
public:
tab_SeekList(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~tab_SeekList();
public slots:
void recvCMD( const Command& );
void display_menuSeek( QListViewItem*, const QPoint&, int );
void selectMatch( QListViewItem *Item );
void selectMatch( int );
void menuFunct( int );
signals:
void sendCMD( const Command& );
protected:
void addSoughtItem( const QString& );
void updateSoughtList( void );
};
#endif

@ -0,0 +1,208 @@
/***************************************************************************
tabbox.cpp - description
-------------------
begin : Fri Sep 13 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tabbox.moc"
#include "tabpage.h"
#include "resource.h"
#include "accel.h"
#include <klocale.h>
#include <qstyle.h>
#include <qtabwidget.h>
TabBox::TabBox( resource *rsrc ) : QVBox(0,"TabBox",Qt::WDestructiveClose)
{
myResource = rsrc;
setMargin( QApplication::style().defaultFrameWidth() );
myTabs = new QTabWidget( this, "myTabs" );
myTabs->setTabShape( QTabWidget::Rounded );
myTabs->setTabPosition( QTabWidget::Top );
myAccel = new Accel( this, myResource->myAccel );
connect( myTabs, SIGNAL( currentChanged( QWidget* ) ), this, SLOT( changeMyCaption( QWidget* ) ) );
connect( this, SIGNAL( focus( const QChar& ) ), myResource->myAccel, SIGNAL( focus( const QChar& ) ) );
}
TabBox::~TabBox()
{
while( myTabs->count() )
{
removeTab( myTabs->page(0), TRUE );
}
delete myAccel;
}
///////////////////////////////////////
//
// TabBox::keyPressEvent
//
///////////////////////////////////////
void TabBox::keyPressEvent( QKeyEvent *e )
{
QChar input;
if( ( e->state() | Qt::ShiftButton ) == Qt::ShiftButton )
{
input = e->text().at(0);
if( input.isLetterOrNumber() )
{
emit focus( input );
e->accept();
return;
}
}
e->ignore();
}
///////////////////////////////////////
//
// TabBox::addTab
//
///////////////////////////////////////
void TabBox::addTab( QWidget *child, const QString &caption )
{
if( QString( child->className() ) == "TabPage" )
{
myTabs->addTab( child, caption );
myTabs->showPage( child );
changeMyCaption( child );
connect( child, SIGNAL( newParent( TabBox* ) ), this, SIGNAL( newTabBox( TabBox* ) ) );
connect( child, SIGNAL( requestDestruction() ), this, SLOT( destroyChild() ) );
}
else
{
TabPage *newPage = new TabPage( (QWidget*)this, child, myResource );
newPage->setCaption( caption );
myTabs->addTab( newPage, caption );
myTabs->showPage( newPage );
changeMyCaption( newPage );
connect( newPage, SIGNAL( newParent( TabBox* ) ), this, SIGNAL( newTabBox( TabBox* ) ) );
connect( newPage, SIGNAL( requestDestruction() ), this, SLOT( destroyChild() ) );
}
}
///////////////////////////////////////
//
// TabBox::removeTab
//
///////////////////////////////////////
void TabBox::removeTab( QWidget *child, bool deleteChild )
{
if( QString( child->className() ) == "TabPage" )
{
emit saveTabGeometry( QString( ((TabPage*)child)->getChild()->className() ), size() );
myTabs->removePage( child );
}
else
{
emit saveTabGeometry( QString( child->className() ), size() );
myTabs->removePage( child->parentWidget() );
}
/* Delete it if requested */
if( deleteChild )
{
delete child;
}
}
///////////////////////////////////////
//
// TabBox::showTab
//
///////////////////////////////////////
void TabBox::showTab( QWidget *child )
{
if( isChild( child ) )
myTabs->showPage( child->parentWidget() );
}
///////////////////////////////////////
//
// TabBox::destroyChild
//
///////////////////////////////////////
void TabBox::destroyChild( void )
{
QObject *child = ((QObject*)sender());
/* Be careful... make sure we have a valid child calling us */
if( child == NULL )
return;
if( !child->isWidgetType() )
return;
if( !isChild( ((QWidget*)child) ) )
return;
/* Nuke it */
removeTab( ((QWidget*)child), TRUE );
if( count() == 0 )
{
/* TabManager will be notified of the delete via QObject::destroyed(QObject*) */
delete this;
}
}
///////////////////////////////////////
//
// TabBox::changeMyCaption
//
///////////////////////////////////////
void TabBox::changeMyCaption( QWidget *child )
{
setCaption( i18n("%1 - Knights").arg( myTabs->tabLabel( child ) ) );
}
///////////////////////////////////////
//
// TabBox::count
//
///////////////////////////////////////
int TabBox::count( void )
{
return myTabs->count();
}
///////////////////////////////////////
//
// TabBox::isChild
//
///////////////////////////////////////
bool TabBox::isChild( QWidget *child )
{
for( int tmp=0; tmp < myTabs->count(); tmp++ )
{
if( myTabs->page(tmp) == child )
return TRUE;
if( ((TabPage*)myTabs->page(tmp))->getChild() == child )
return TRUE;
}
return FALSE;
}
///////////////////////////////////////
//
// TabBox::changeCaption
//
///////////////////////////////////////
void TabBox::changeCaption( QWidget *child, const QString &caption )
{
if( QString( child->className() ) == "TabPage" )
{
((TabPage*)child)->setCaption( caption );
myTabs->setTabLabel( child, caption );
}
else if( isChild( child ) )
{
((TabPage*)child->parentWidget())->setCaption( caption );
myTabs->setTabLabel( child->parentWidget(), caption );
}
changeMyCaption( myTabs->currentPage() );
}

@ -0,0 +1,65 @@
/***************************************************************************
tabbox.h - description
-------------------
begin : Fri Sep 13 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TABBOX_H
#define TABBOX_H
#include <qvbox.h>
#include "accel.h"
class QTabWidget;
class resource;
/**
*@author Troy Corbin Jr.
*/
class TabBox : public QVBox
{
Q_OBJECT
public:
TabBox( resource *rsrc=0 );
virtual ~TabBox();
void keyPressEvent( QKeyEvent* );
void addTab( QWidget *child, const QString &caption );
void removeTab( QWidget *child, bool deleteChild=FALSE );
bool isChild( QWidget *child );
void showTab( QWidget *child );
void changeCaption( QWidget *child, const QString &caption );
int count( void );
signals:
void newTabBox( TabBox* );
void saveTabGeometry( const QString&, const QSize& );
void focus( const QChar& );
protected slots:
void changeMyCaption( QWidget *child );
/**
This removes and deletes a Tab if it's a child of this widget.
Never call this directly; Only with a Signal!
*/
void destroyChild( void );
private:
QTabWidget *myTabs;
Accel *myAccel;
resource *myResource;
};
#endif

@ -0,0 +1,109 @@
/***************************************************************************
tabgrip.cpp - description
-------------------
begin : Fri Sep 13 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tabgrip.moc"
#include "resource.h"
#include <qpainter.h>
TabGrip::TabGrip(QWidget *parent, const char *name ) : QWidget(parent,name)
{
setMaximumSize( 3200, 12 );
setMinimumSize( 32, 12 );
isDragging = FALSE;
couldDrag = FALSE;
setCursor( Qt::SizeAllCursor );
show();
}
TabGrip::~TabGrip()
{
}
///////////////////////////////////////
//
// TabGrip::paintEvent
//
///////////////////////////////////////
void TabGrip::paintEvent( QPaintEvent* )
{
QPainter paint( this );
QColorGroup group( colorGroup() );
paint.setPen( group.light() );
paint.drawLine( 2, 2, width() - 3, 2 );
paint.drawLine( 2, 5, width() - 3, 5 );
paint.drawLine( 2, 8, width() - 3, 8 );
paint.setPen( group.dark() );
paint.drawLine( 2, 3, width() - 3, 3 );
paint.drawLine( 2, 6, width() - 3, 6 );
paint.drawLine( 2, 9, width() - 3, 9 );
}
///////////////////////////////////////
//
// TabGrip::mousePressEvent
//
///////////////////////////////////////
void TabGrip::mousePressEvent( QMouseEvent *event )
{
event->accept();
if(event->button() == Qt::LeftButton)
{
couldDrag = TRUE;
offset = mapToGlobal( event->pos() );
offset.setX( topLevelWidget()->x() - offset.x() );
offset.setY( topLevelWidget()->y() - offset.y() );
}
}
///////////////////////////////////////
//
// TabGrip::mouseMoveEvent
//
///////////////////////////////////////
void TabGrip::mouseMoveEvent( QMouseEvent *event )
{
/*
By default, MouseMoveEvent is never called unless the user has
a button held down, so this should only be called if we're dragging.
*/
event->accept();
if( couldDrag == TRUE )
{
/* Dragging Page */
isDragging = TRUE;
couldDrag = FALSE;
QApplication::setOverrideCursor( Qt::SizeAllCursor );
}
}
///////////////////////////////////////
//
// TabGrip::mouseReleaseEvent
//
///////////////////////////////////////
void TabGrip::mouseReleaseEvent( QMouseEvent *event )
{
event->accept();
if(event->button() == Qt::LeftButton)
{
couldDrag = FALSE;
if( isDragging )
{
QApplication::restoreOverrideCursor();
isDragging = FALSE;
emit wasDragged( event->globalPos(), offset );
}
}
}

@ -0,0 +1,47 @@
/***************************************************************************
tabgrip.h - description
-------------------
begin : Fri Sep 13 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TABGRIP_H
#define TABGRIP_H
#include <qwidget.h>
/**
*@author Troy Corbin Jr.
*/
class TabGrip : public QWidget
{
Q_OBJECT
public:
TabGrip(QWidget *parent=0, const char *name=0);
~TabGrip();
void paintEvent( QPaintEvent* );
void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
signals:
void wasDragged( const QPoint&, const QPoint& );
private:
bool isDragging;
bool couldDrag;
QPoint offset;
};
#endif

@ -0,0 +1,202 @@
/***************************************************************************
tabmanager.cpp - description
-------------------
begin : Sat Sep 14 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tabmanager.moc"
#include "resource.h"
#include <kdebug.h>
static QString myConfigGroup( "TabManager" );
TabManager::TabManager( resource *rsrc ) : QObject()
{
myResource = rsrc;
appConfig = kapp->config();
}
TabManager::~TabManager()
{
}
///////////////////////////////////////
//
// TabManager::addTab
//
///////////////////////////////////////
void TabManager::addTab( QWidget *child, const QString &caption )
{
TabBox *boxPtr;
if( myList.count() == 0 )
{
/* First Tab always generates a new TabBox */
boxPtr = new TabBox( myResource );
manageNewBox( boxPtr );
boxPtr->addTab( child, caption );
/* Get Geometry from Saved Config */
appConfig->setGroup( myConfigGroup );
QSize defaultSize( 420, 360 );
QSize newSize = appConfig->readSizeEntry( QString( child->className() ), &defaultSize );
boxPtr->resize( newSize );
boxPtr->show();
}
else
{
boxPtr = myList.at(0);
boxPtr->addTab( child, caption );
}
}
///////////////////////////////////////
//
// TabManager::changeCaption
//
///////////////////////////////////////
void TabManager::changeCaption( QWidget *child, const QString &caption )
{
TabBox *boxPtr = getParentBox( child );
if( boxPtr != NULL )
{
boxPtr->changeCaption( child, caption );
}
}
///////////////////////////////////////
//
// TabManager::removeTab
//
///////////////////////////////////////
void TabManager::removeTab( QObject *child )
{
/* Make sure this is a QWidget we can manipulate */
if( !child->isWidgetType() )
{
kdError() << "TabManager::removeTab: Can not remove non-widget class " << child->className() << endl;
return;
}
if( myList.find( ((TabBox*)child) ) != -1 )
{
/* Remove Child Directly */
myList.remove( ((TabBox*)child) );
return;
}
QString childName( ((QWidget*)child)->className() );
TabBox *boxPtr = getParentBox( ((QWidget*)child) );
/* Remove this Child's Parent, the TabPage */
if( boxPtr != NULL )
{
kdDebug() << "Removing child: " << childName << endl;
boxPtr->removeTab( ((QWidget*)child), TRUE );
if( boxPtr->count() == 0 )
{
myList.remove( boxPtr );
delete boxPtr;
}
return;
}
kdWarning() << "Could not find child: " << childName << endl;
}
///////////////////////////////////////
//
// TabManager::showTab
//
///////////////////////////////////////
void TabManager::showTab( QWidget *child )
{
TabBox *boxPtr = getParentBox( child );
if( boxPtr != NULL )
{
boxPtr->showTab( child );
}
}
///////////////////////////////////////
//
// TabManager::isTab
//
///////////////////////////////////////
bool TabManager::isTab( QWidget *child )
{
if( getParentBox( child ) == NULL )
{
return FALSE;
}
return TRUE;
}
///////////////////////////////////////
//
// TabManager::saveTabGeometry
//
///////////////////////////////////////
void TabManager::saveTabGeometry( const QString &childName, const QSize &childSize )
{
/* Save This Widget's Size For Later */
appConfig->setGroup( myConfigGroup );
appConfig->writeEntry( childName, childSize );
appConfig->sync();
kdDebug() << "Saved geometry for Widget: " << childName << endl;
}
///////////////////////////////////////
//
// TabManager::childEvent
//
///////////////////////////////////////
void TabManager::childEvent( QChildEvent *event )
{
if( event->inserted() )
{
/* New Child */
if( QString( event->child()->className() ) == "TabBox" )
{
manageNewBox( ((TabBox*)event->child()) );
return;
}
addTab( ((QWidget*)event->child()), QString( "Untitled" ) );
}
}
///////////////////////////////////////
//
// TabManager::manageNewBox
//
///////////////////////////////////////
void TabManager::manageNewBox( TabBox *newBox )
{
myList.append( newBox );
connect( newBox, SIGNAL( destroyed( QObject* ) ), this, SLOT( removeTab( QObject* ) ) );
connect( newBox, SIGNAL( saveTabGeometry( const QString&, const QSize& ) ), this, SLOT( saveTabGeometry( const QString&, const QSize& ) ) );
connect( newBox, SIGNAL( newTabBox( TabBox* ) ), this, SLOT( manageNewBox( TabBox* ) ) );
}
///////////////////////////////////////
//
// TabManager::getParentBox
//
///////////////////////////////////////
TabBox* TabManager::getParentBox( QWidget *child )
{
TabBox *boxPtr;
for( unsigned int index=0; index < myList.count(); index++ )
{
boxPtr = myList.at(index);
if( boxPtr->isChild( child ) )
{
return boxPtr;
}
}
return NULL;
}

@ -0,0 +1,62 @@
/***************************************************************************
tabmanager.h - description
-------------------
begin : Sat Sep 14 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TABMANAGER_H
#define TABMANAGER_H
#include <qobject.h>
#include <qptrlist.h>
#include <kapp.h>
#include <kconfig.h>
#include "tabbox.h"
/**
*@author Troy Corbin Jr.
*/
typedef QPtrList<TabBox> TabBoxList;
class resource;
class TabManager : public QObject
{
Q_OBJECT
public:
TabManager( resource *rsrc );
~TabManager();
void addTab( QWidget *child, const QString &caption );
void childEvent( QChildEvent *event );
void changeCaption( QWidget *child, const QString &caption );
void showTab( QWidget *child );
bool isTab( QWidget *child );
public slots:
void removeTab( QObject *child );
protected slots:
void manageNewBox( TabBox *newBox );
void saveTabGeometry( const QString&, const QSize& );
protected:
TabBox* getParentBox( QWidget* );
private:
TabBoxList myList;
KConfig *appConfig;
resource *myResource;
};
#endif

@ -0,0 +1,164 @@
/***************************************************************************
tabpage.cpp - description
-------------------
begin : Fri Sep 13 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "tabpage.moc"
#include "tabmanager.h"
#include "tabgrip.h"
#include "resource.h"
#include <kiconloader.h>
#include <kdebug.h>
#include <klocale.h>
#include <qlayout.h>
#include <qtoolbutton.h>
///////////////////////////////////////
//
// TabPage::constructor
//
///////////////////////////////////////
TabPage::TabPage( QWidget *parent, QWidget *child, resource *rsrc ) : QVBox(parent)
{
myResource = rsrc;
myChild = child;
actionBar = new QHBox( this );
actionBar->show();
grip = new TabGrip( actionBar );
connect( grip, SIGNAL( wasDragged(const QPoint&, const QPoint&) ), this, SLOT( tabDragged(const QPoint&, const QPoint&) ) );
KIconLoader icons( QString( "knights" ) );
QPixmap map = icons.loadIcon( QString("tab_remove"), KIcon::Small, 0, KIcon::DefaultState, 0, TRUE );
if( map.isNull() )
{
/* Keep for backward compatability with KDE 3.0 */
map = icons.loadIcon( QString("fileclose"), KIcon::Small );
}
closeButton = new QToolButton( actionBar, "closeButton" );
closeButton->setIconSet( QIconSet( map ) );
closeButton->setAutoRaise( TRUE );
closeButton->setTextLabel( i18n( "Close This Tab" ), TRUE );
closeButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
connect( closeButton, SIGNAL( clicked() ), this, SIGNAL( requestDestruction() ) );
myChild->reparent( this, QPoint( 0, 0 ), TRUE );
myChild->show();
show();
}
///////////////////////////////////////
//
// TabPage::destructor
//
///////////////////////////////////////
TabPage::~TabPage()
{
}
///////////////////////////////////////
//
// TabPage::tabDragged
//
///////////////////////////////////////
void TabPage::tabDragged( const QPoint &dest, const QPoint &offset )
{
TabBox *myParent = parentTabBox();
if( myParent != NULL )
{
QWidget *destWidget = QApplication::widgetAt( dest, TRUE );
/* Find a TabBox */
while(1)
{
if( destWidget == NULL )
{
/* Create new TabBox */
TabBox *newBox = new TabBox( myResource );
newBox->resize( myParent->size() );
newBox->move( dest + offset );
newBox->show();
emit newParent( newBox );
myParent->removeTab( this );
newBox->addTab( this, myCaption );
break;
}
if( QString( destWidget->className() ) == "TabBox" )
{
if( myParent != ((TabBox*)destWidget) )
{
/* We can latch on here */
myParent->removeTab( this );
((TabBox*)destWidget)->addTab( this, myCaption );
break;
}
else
{
break;
}
}
destWidget = destWidget->parentWidget();
}
if( myParent->count() == 0 )
{
/* TabManager will be notified of the delete via QObject::destroyed(QObject*) */
delete myParent;
}
}
else
{
kdError() << "TabPage::tabDragged: Can not move without a parent TabBox." << endl;
}
}
///////////////////////////////////////
//
// TabPage::setCaption
//
///////////////////////////////////////
void TabPage::setCaption( const QString &caption )
{
myCaption = caption;
}
///////////////////////////////////////
//
// TabPage::parentTabBox
//
///////////////////////////////////////
TabBox* TabPage::parentTabBox( void )
{
QWidget *myParent = this->parentWidget();
if( QString( myParent->className() ) == "QWidgetStack" )
{
myParent = myParent->parentWidget();
if( QString( myParent->className() ) == "QTabWidget" )
{
myParent = myParent->parentWidget();
if( QString( myParent->className() ) == "TabBox" )
{
return ((TabBox*)myParent);
}
}
}
return NULL;
}
///////////////////////////////////////
//
// TabPage::getChild
//
///////////////////////////////////////
QWidget* TabPage::getChild( void )
{
return myChild;
}

@ -0,0 +1,64 @@
/***************************************************************************
tabpage.h - description
-------------------
begin : Fri Sep 13 2002
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sf.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TABPAGE_H
#define TABPAGE_H
#include <qframe.h>
#include <qwidget.h>
#include <qvbox.h>
#include <qhbox.h>
#include <qstring.h>
#include "tabbox.h"
/**
*@author Troy Corbin Jr.
*/
class resource;
class QToolButton;
class TabGrip;
class TabPage : public QVBox
{
Q_OBJECT
public:
TabPage( QWidget *parent, QWidget *child, resource *rsrc );
~TabPage();
void setCaption( const QString& );
QWidget* getChild( void );
protected slots:
void tabDragged( const QPoint&, const QPoint& );
signals:
void newParent( TabBox* );
void requestDestruction( void );
protected:
TabBox* parentTabBox( void );
private:
QString myCaption;
QHBox *actionBar;
TabGrip *grip;
QToolButton *closeButton;
QWidget *myChild;
resource *myResource;
};
#endif

@ -0,0 +1,262 @@
/***************************************************************************
thinbuttons.cpp - description
-------------------
begin : Tue Nov 13 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "thinbuttons.moc"
#include <kicontheme.h>
#include <qpushbutton.h>
#include <qstyle.h>
thinbuttons::thinbuttons(QWidget *parent, const char *name, resource *Rsrc ) : QFrame(parent,name)
{
Resource = Rsrc;
rightClickID = 0;
setFixedSize( 8, 8 );
/* Build the pop-up menu */
matchMenu = new KPopupMenu( this );
matchMenu->insertItem( QIconSet( Resource->LoadIcon( QString("filesave"), KIcon::Small ) ),
i18n("&Save Match"), MENU_SAVE );
matchMenu->insertItem( QIconSet( Resource->LoadIcon( QString("filesave"), KIcon::Small ) ),
i18n("Save Match &As..."), MENU_SAVEAS );
matchMenu->insertSeparator();
matchMenu->insertItem( QIconSet( Resource->LoadIcon( QString("fileprint"), KIcon::Small ) ),
i18n("&Print Notation..."), MENU_PRINT );
matchMenu->insertSeparator();
matchMenu->insertItem( QIconSet( Resource->LoadIcon( QString("fileclose"), KIcon::Small ) ),
i18n("&Close Match"), MENU_CLOSE );
connect( matchMenu, SIGNAL( activated(int) ), this, SLOT( menuClicked(int) ) );
}
thinbuttons::~thinbuttons()
{
}
///////////////////////////////////////
//
// thinbuttons::childEvent
//
///////////////////////////////////////
void thinbuttons::childEvent( QChildEvent * cev )
{
/* Make sure this method only effects child buttons */
if( QString( cev->child()->name() ) != QString( "MatchSelector" ) )
return;
if( cev->removed() )
remove( (QButton*)cev->child() );
}
///////////////////////////////////////
//
// thinbuttons::create
//
///////////////////////////////////////
QButton* thinbuttons::create( int id )
{
Buttons *newBut;
QPushButton *newButton;
newButton = new QPushButton( this, "MatchSelector" );
newBut = new Buttons;
newBut->button = newButton;
newBut->ID = id;
buttons.append( newBut );
newButton->setToggleButton( TRUE );
newButton->setText( QString("Match") );
newButton->show();
connect( newButton, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
return newButton;
}
///////////////////////////////////////
//
// thinbuttons::setButton
//
///////////////////////////////////////
void thinbuttons::setButton( int id )
{
Buttons *currentBut;
unsigned int Index;
for( Index = 0; Index < buttons.count(); Index++ )
{
currentBut = buttons.at( Index );
if( currentBut->ID == id )
{
currentBut->button->setDown( TRUE );
if( currentBut->button->isToggleButton() )
if( currentBut->button->state() != QButton::On )
currentBut->button->toggle();
}
else
{
currentBut->button->setDown( FALSE );
if( currentBut->button->isToggleButton() )
if( currentBut->button->state() == QButton::On )
currentBut->button->toggle();
}
}
}
///////////////////////////////////////
//
// thinbuttons::find
//
///////////////////////////////////////
QButton* thinbuttons::find( int id )
{
unsigned int tmp;
for( tmp = 0; tmp < buttons.count(); tmp++ )
if( buttons.at( tmp )->ID == id )
return buttons.at( tmp )->button;
return NULL;
}
///////////////////////////////////////
//
// thinbuttons::id
//
///////////////////////////////////////
int thinbuttons::id( QButton* button )
{
unsigned int tmp;
for( tmp = 0; tmp < buttons.count(); tmp++ )
if( buttons.at( tmp )->button == button )
return buttons.at( tmp )->ID;
return -1;
}
///////////////////////////////////////
//
// thinbuttons::remove
//
///////////////////////////////////////
void thinbuttons::remove( QButton* button )
{
unsigned int tmp;
for( tmp = 0; tmp < buttons.count(); tmp++ )
if( buttons.at( tmp )->button == button )
{
disconnect( buttons.at( tmp )->button, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) );
buttons.remove( tmp );
}
}
void thinbuttons::remove( const int &id )
{
QButton *butt;
butt = find(id);
if( butt != NULL )
{
remove( butt );
delete butt;
}
}
///////////////////////////////////////
//
// thinbuttons::buttonClicked
//
///////////////////////////////////////
void thinbuttons::buttonClicked( void )
{
const QObject *incomming;
int Clicked;
unsigned int tmp;
incomming = sender();
for( tmp = 0; tmp < buttons.count(); tmp++ )
if( buttons.at( tmp )->button == ( const QButton* )incomming )
{
Clicked = buttons.at( tmp )->ID;
if( Clicked == Null ) return;
setButton( Clicked );
emit leftClick( Clicked );
}
}
///////////////////////////////////////
//
// thinbuttons::resize
//
///////////////////////////////////////
void thinbuttons::resize( const int Width )
{
Buttons *button;
QStyle& Style = QApplication::style();
int margin;
unsigned int Index;
margin = Style.defaultFrameWidth();
if( buttons.count() != 0 ) buttWidth = ( Width / buttons.count() ) - ( margin * 2 );
else buttWidth = 0;
setFixedSize( Width, Resource->Widget_Height + margin );
for( Index = 0; Index < buttons.count(); Index++ )
{
button = buttons.at( Index );
button->button->setFixedSize( buttWidth, Resource->Widget_Height );
button->button->move( ( Index * ( buttWidth + ( margin * 2 ) ) ) + margin , margin );
}
}
///////////////////////////////////////
//
// thinbuttons::mousePressEvent
//
///////////////////////////////////////
void thinbuttons::mousePressEvent( QMouseEvent *event )
{
QStyle& Style = QApplication::style();
int margin, xpos(0), index(0);
/* We only want RightClick */
if(event->button() != Qt::RightButton)
{
return;
}
event->accept();
margin = Style.defaultFrameWidth();
/* No Buttons, No Menu */
if( !buttons.count() )
{
return;
}
/* Figure out which button was pressed */
xpos += margin;
while( xpos < event->x() )
{
if( ( event->x() >= xpos ) && ( event->x() <= ( xpos + buttWidth ) ) )
{
break;
}
xpos += ( margin << 1 ) + buttWidth;
index++;
}
/* Clicked the right margin */
if( xpos >= event->x() )
{
return;
}
/* Clicked a button, let's dance */
matchMenu->popup( event->globalPos() );
rightClickID = buttons.at(index)->ID;
emit rightClick( rightClickID );
}
///////////////////////////////////////
//
// thinbuttons::menuClicked
//
///////////////////////////////////////
void thinbuttons::menuClicked( int item )
{
emit menuItemSelected( rightClickID, item );
}

@ -0,0 +1,71 @@
/***************************************************************************
thinbuttons.h - description
-------------------
begin : Tue Nov 13 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef THINBUTTONS_H
#define THINBUTTONS_H
#include <kpopupmenu.h>
#include <qframe.h>
#include <qbutton.h>
#include "definitions.h"
#include "resource.h"
/**
*@author Troy Corbin Jr.
*/
struct Buttons
{
QButton *button;
int ID;
};
class thinbuttons : public QFrame
{
Q_OBJECT
public:
thinbuttons(QWidget *parent=0, const char *name=0, resource *Rsrc=0);
~thinbuttons();
void mousePressEvent( QMouseEvent *event );
void setButton( int id );
QButton* find( int id );
QButton* create( int id );
void remove( QButton* button );
void remove( const int &id );
void resize( const int Width );
int id( QButton * );
signals:
void leftClick( int id );
void rightClick( int id );
void menuItemSelected( int id, int item );
protected slots:
void buttonClicked(void);
void menuClicked( int item );
protected:
void childEvent( QChildEvent * );
private:
resource *Resource;
KPopupMenu *matchMenu;
QList<Buttons> buttons;
int buttWidth;
int rightClickID;
};
#endif

@ -0,0 +1,360 @@
/***************************************************************************
wiz_setup.cpp - description
-------------------
begin : Wed Nov 21 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <kglobalsettings.h>
#include <kprocess.h>
#include <kstddirs.h>
#include <qstringlist.h>
#include <qfile.h>
#include <qtextstream.h>
#include <qregexp.h>
#include "wiz_setup.moc"
wiz_setup::wiz_setup(QWidget *parent, const char *name, resource *Rsrc ) : KWizard(parent,name,TRUE)
{
myResource = Rsrc;
steps = 0;
setMaximumSize( 800, 600 );
/*
Call Order Of Pages:
Page 1 - Introduction
Page 6 - Accept License
Page 3 - Setup Engines
Page 4 - Setup Servers
Page 5 - Finished
*/
initPage1();
// initPage6();
if( myResource->Config_Version < 1 )
{
// initPage2();
initPage3();
initPage4();
}
initPage5();
setCaption( i18n( "Knights Setup Wizard" ) );
connect( this, SIGNAL( selected(const QString&) ), this, SLOT( slot_Work(const QString&) ) );
}
wiz_setup::~wiz_setup()
{
}
///////////////////////////////////////
//
// wiz_setup::initPage1
//
///////////////////////////////////////
void wiz_setup::initPage1( void )
{
Page1 = new QFrame( this );
P1B1 = new QGridLayout( Page1, 1, 4, 8 );
SideImage1 = new QLabel( Page1 );
SideImage1->setPixmap( locate("data", "knights/wizard.png" ) );
P1B1->addWidget( SideImage1, 1, 1 );
WelcomeMessage = new QLabel( Page1 );
WelcomeMessage->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
WelcomeMessage->setText( i18n( "Thank you for installing Knights, the graphical chess interface for KDE. To help you get started quickly, there are a few things Knights will need to setup. You should click 'Next' to see what they are." ) );
P1B1->addWidget( WelcomeMessage, 1, 3 );
addPage( Page1, i18n("Welcome to Knights v%1!").arg(_VERSION_) );
setNextEnabled( Page1, TRUE );
setHelpEnabled( Page1, FALSE );
}
///////////////////////////////////////
//
// wiz_setup::initPage2
//
///////////////////////////////////////
void wiz_setup::initPage2( void )
{
Page2 = new QFrame( this );
P2B1 = new QGridLayout( Page2, 2, 4, 8 );
SideImage2 = new QLabel( Page2 );
SideImage2->setPixmap( locate("data", "knights/wizard.png" ) );
P2B1->addMultiCellWidget( SideImage2, 1, 2, 1, 1 );
pgnExplain = new QLabel( Page2 );
pgnExplain->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
pgnExplain->setText( i18n( "When Knights saves a match to disk, it uses Portable Game Notation (PGN) to store the match. Several other computer chess games use PGN too. If you like, Knights can be the default PGN viewer on this system." ) );
P2B1->addWidget( pgnExplain, 1, 3 );
pgnButtons = new QButtonGroup( 2, Qt::Vertical, i18n( "Let Knights handle PGN files?" ), Page2 );
pgnYes = new QRadioButton( i18n( "Yes" ), pgnButtons );
pgnNo = new QRadioButton( i18n( "No" ), pgnButtons );
pgnButtons->setButton( 0 );
P2B1->addWidget( pgnButtons, 2, 3 );
addPage( Page2, i18n("Let Knights handle your .pgn files?") );
setHelpEnabled( Page2, FALSE );
}
///////////////////////////////////////
//
// wiz_setup::initPage3
//
///////////////////////////////////////
void wiz_setup::initPage3( void )
{
Page3 = new QFrame( this );
P3B1 = new QGridLayout( Page3, 2, 4, 8 );
SideImage3 = new QLabel( Page3 );
SideImage3->setPixmap( locate("data", "knights/wizard.png" ) );
P3B1->addMultiCellWidget( SideImage3, 1, 2, 1, 1 );
engineExplain = new QLabel( Page3 );
engineExplain->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
engineExplain->setText( i18n( "Knights can not play a chess match against you without help. Known as Chess Engines, these helpers can be found on the Internet and are often included with your distribution. Knights can look for Chess Engines that you may already have. If found, Knights will configure itself to use them." ) );
P3B1->addWidget( engineExplain, 1, 3 );
engineButtons = new QButtonGroup( 2, Qt::Vertical, i18n( "Let Knights search for chess engines?" ), Page3 );
engineYes = new QRadioButton( i18n( "Yes" ), engineButtons );
engineNo = new QRadioButton( i18n( "No" ), engineButtons );
engineButtons->setButton( 0 );
P3B1->addWidget( engineButtons, 2, 3 );
addPage( Page3, i18n("Let Knights search for chess engines?") );
setHelpEnabled( Page3, FALSE );
}
///////////////////////////////////////
//
// wiz_setup::initPage4
//
///////////////////////////////////////
void wiz_setup::initPage4( void )
{
Page4 = new QFrame( this );
P4B1 = new QGridLayout( Page4, 2, 4, 8 );
SideImage4 = new QLabel( Page4 );
SideImage4->setPixmap( locate("data", "knights/wizard.png" ) );
P4B1->addMultiCellWidget( SideImage4, 1, 2, 1, 1 );
serverExplain = new QLabel( Page4 );
serverExplain->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
serverExplain->setText( i18n( "In order for you to play chess online, Knights will have to connect to a chess server. Knights has a list of several of these servers. If you like, this list can be used to automatically configure Knights." ) );
P4B1->addWidget( serverExplain, 1, 3 );
serverButtons = new QButtonGroup( 2, Qt::Vertical, i18n( "Let Knights configure chess servers?" ), Page4 );
serverYes = new QRadioButton( i18n( "Yes" ), serverButtons );
serverNo = new QRadioButton( i18n( "No" ), serverButtons );
serverButtons->setButton( 0 );
P4B1->addWidget( serverButtons, 2, 3 );
addPage( Page4, i18n("Let Knights configure chess servers?") );
setHelpEnabled( Page4, FALSE );
}
///////////////////////////////////////
//
// wiz_setup::initPage5
//
///////////////////////////////////////
void wiz_setup::initPage5( void )
{
Page5 = new QFrame( this );
P5B1 = new QGridLayout( Page5, 2, 4, 8 );
SideImage5 = new QLabel( Page5 );
SideImage5->setPixmap( locate("data", "knights/wizard.png" ) );
P5B1->addMultiCellWidget( SideImage5, 1, 2, 1, 1 );
FinishExplain = new QLabel( Page5 );
FinishExplain->setAlignment( Qt::AlignLeft | Qt::AlignTop | Qt::WordBreak );
FinishExplain->setText( i18n( "Knights has now configured itself according to your choices. We strongly recommend that you read the documentation to make full use of all that Knights has to offer. You can access it by pressing F1." ) );
P5B1->addWidget( FinishExplain, 1, 3 );
addPage( Page5, i18n("Setup Complete") );
setFinish( Page5, TRUE );
setHelpEnabled( Page5, FALSE );
}
///////////////////////////////////////
//
// wiz_setup::initPage6
//
///////////////////////////////////////
void wiz_setup::initPage6( void )
{
QString f( locate("data", "LICENSES/GPL_V2") );
QString licenseText("<K_STD>");
Page6 = new QVBox( this );
/* Setup License View */
licenseView = new KnightsTextView( Page6, myResource );
if (!f.isEmpty())
{
QFile file(f);
if (file.open(IO_ReadOnly))
{
QTextStream str(&file);
licenseText += str.read();
}
}
licenseText.append( "</K_STD>" );
licenseView->setText( licenseText );
licenseButtons = new QButtonGroup( 2, Qt::Horizontal, i18n( "Do you accept the terms of our license?" ), Page6 );
licenseYes = new QRadioButton( i18n( "Yes" ), licenseButtons );
licenseNo = new QRadioButton( i18n( "No" ), licenseButtons );
licenseButtons->setButton( 1 );
addPage( Page6, i18n("Please read and accept our license:") );
setHelpEnabled( Page6, FALSE );
connect( licenseButtons, SIGNAL( clicked(int) ), this, SLOT( slot_License(int) ) );
}
///////////////////////////////////////
//
// wiz_setup::slot_Work
//
///////////////////////////////////////
void wiz_setup::slot_Work( const QString& pageTitle )
{
/* Don't let 'em past the license */
if( pageTitle == title( Page6 ) )
{
setNextEnabled( Page6, FALSE );
}
/* Don't proceed unless we're ready to work */
if( pageTitle != title( Page5 ) ) return;
setBackEnabled( Page5, FALSE );
if( myResource->Config_Version < 1 )
{
// if( pgnButtons->selected() == pgnYes )
// setupPGN();
if( engineButtons->selected() == engineYes )
findEngines();
if( serverButtons->selected() == serverYes )
setupServers();
}
myResource->ConfigWrite();
setFinishEnabled( Page5, TRUE );
}
///////////////////////////////////////
//
// wiz_setup::setupPGN
//
///////////////////////////////////////
void wiz_setup::setupPGN( void )
{
}
///////////////////////////////////////
//
// wiz_setup::setupServers
//
///////////////////////////////////////
void wiz_setup::setupServers( void )
{
serverResource *newServer;
QStringList names, urls, ports;
unsigned int loop;
names << i18n("Free Internet Chess Server") << i18n("Internet Chess Club") << i18n("Global Chess Server") << i18n("Chess.Net");
names << i18n("Chess-Square.Com") << i18n("Australian FICS") << i18n("Brazilian FICS") << i18n("Chilean FICS");
names << i18n("Croatian FICS") << i18n("Dutch FICS") << i18n("French FICS") << i18n("German FICS") << i18n("Swedish FICS");
urls << "freechess.org" << "chessclub.com" << "global.chessparlor.com" << "chess.net";
urls << "chess-square.com" << "zics.org" << "jogo.cex.org.br" << "ajedrez.cec.uchile.cl";
urls << "fly.cc.fer.hr" << "freechess.nl" << "jeu.echecs.com" << "chess.unix-ag.uni-kl.de" << "chess.mds.mdh.se";
ports << "5000" << "5000" << "6000" << "5000" << "5000" << "5000" << "5000" << "5000";
ports << "7890" << "5000" << "5000" << "5000" << "5000";
for( loop = 0; loop < names.count(); loop++ )
{
kdDebug() << "adding " << names[loop] << endl;
newServer = new serverResource;
newServer->Name = names[loop];
newServer->URL = urls[loop];
newServer->Port = ports[loop].toInt();
newServer->LogFile = QString::null;
newServer->UserName = QString::null;
newServer->Password = QString::null;
newServer->StorePass = FALSE;
if( !loop ) newServer->CurrentRef = TRUE;
else newServer->CurrentRef = FALSE;
myResource->servers.append( *newServer );
delete newServer;
}
}
///////////////////////////////////////
//
// wiz_setup::findEngines
//
///////////////////////////////////////
void wiz_setup::findEngines( void )
{
engineResource *newEngine;
QStringList names, filenames;
KProcess *Shell;
bool foundOne( FALSE );
unsigned int loop;
names << "GNUChess" << "Crafty" << "Sjeng" << "KnightCap" << "BabyChess" << "Phalanx-XXII";
names << "Bowron Abernethy Chess Engine" << "Cilian" << "Faile" << "OliThink" << "Pepito";
names << "Yace";
filenames << "gnuchessx" << "crafty" << "sjeng" << "KnightCap" << "babychess-xboard-engine";
filenames << "phalanx" << "BACE" << "linuxCilian.exe" << "faile" << "olithink" << "pepito";
filenames << "yace";
for( loop = 0; loop < filenames.count(); loop++ )
{
Shell = new KProcess();
(*Shell) << filenames[loop];
if( Shell->start() )
{
kdWarning() << "Adding " << names[loop] << " to knightsrc" << endl;
newEngine = new engineResource;
newEngine->Name = names[loop];
newEngine->Filename = filenames[loop];
newEngine->Arguments = QString::null;
newEngine->LogFile = QString::null;
newEngine->Protocol = XBoard;
newEngine->Wins = 0;
newEngine->Losses = 0;
newEngine->Draws = 0;
if( foundOne )
newEngine->CurrentRef = 0;
else
newEngine->CurrentRef = ENGINE_WHITE | ENGINE_BLACK | ENGINE_WHITE_BK | ENGINE_BLACK_BK;
myResource->engines.append( *newEngine );
delete newEngine;
foundOne = TRUE;
}
Shell->kill();
delete Shell;
}
}
///////////////////////////////////////
//
// wiz_setup::slot_License
//
///////////////////////////////////////
void wiz_setup::slot_License( int index )
{
if( index == 0 )
{
setNextEnabled( Page6, TRUE );
myResource->Accepted_License = TRUE;
}
else
{
setNextEnabled( Page6, FALSE );
myResource->Accepted_License = FALSE;
}
}

@ -0,0 +1,96 @@
/***************************************************************************
wiz_setup.h - description
-------------------
begin : Wed Nov 21 2001
copyright : (C) 2003 by Troy Corbin Jr.
email : tcorbin@users.sourceforge.net
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef WIZ_SETUP_H
#define WIZ_SETUP_H
#include <kwizard.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qradiobutton.h>
#include <qlabel.h>
#include "resource.h"
#include "definitions.h"
#include "knightstextview.h"
/**
*@author Troy Corbin Jr.
*/
class wiz_setup : public KWizard
{
Q_OBJECT
public:
wiz_setup( QWidget *parent=0, const char *name=0, resource *Rsrc=0 );
~wiz_setup();
protected slots:
void slot_Work( const QString& pageTitle );
void slot_License( int );
protected:
void initPage1( void );
void initPage2( void );
void initPage3( void );
void initPage4( void );
void initPage5( void );
void initPage6( void );
void findEngines( void );
void setupServers( void );
void setupPGN( void );
private:
resource *myResource;
int steps;
QFrame *Page1;
QGridLayout *P1B1;
QLabel *SideImage1;
QLabel *WelcomeMessage;
QFrame *Page2;
QGridLayout *P2B1;
QLabel *SideImage2;
QLabel *pgnExplain;
QButtonGroup *pgnButtons;
QRadioButton *pgnYes;
QRadioButton *pgnNo;
QFrame *Page3;
QGridLayout *P3B1;
QLabel *SideImage3;
QLabel *engineExplain;
QButtonGroup *engineButtons;
QRadioButton *engineYes;
QRadioButton *engineNo;
QFrame *Page4;
QGridLayout *P4B1;
QLabel *SideImage4;
QLabel *serverExplain;
QButtonGroup *serverButtons;
QRadioButton *serverYes;
QRadioButton *serverNo;
QFrame *Page5;
QGridLayout *P5B1;
QLabel *SideImage5;
QLabel *FinishExplain;
QVBox *Page6;
KnightsTextView *licenseView;
QButtonGroup *licenseButtons;
QRadioButton *licenseYes;
QRadioButton *licenseNo;
};
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,65 @@
####### kdevelop will overwrite this part!!! (begin)##########
EXTRA_DIST = hi48-mime-pgn.png hi16-mime-pgn.png KSDefault.tar.gz default-portrait.jpg hi64-app-knights.png pgn_template.kml hi64-mime-pgn.png hi32-mime-pgn.png icon-general.png hi32-app-knights.png default-engine-portrait.jpg KBDefault.tar.gz wizard.png hi48-app-knights.png KCDefault.tar.gz hi16-app-knights.png icon-display.png Makefile.am
install-data-local:
$(mkinstalldirs) $(kde_icondir)/hicolor/48x48/mimetypes/
$(INSTALL_DATA) $(srcdir)/hi48-mime-pgn.png $(kde_icondir)/hicolor/48x48/mimetypes/pgn.png
$(mkinstalldirs) $(kde_icondir)/hicolor/16x16/mimetypes/
$(INSTALL_DATA) $(srcdir)/hi16-mime-pgn.png $(kde_icondir)/hicolor/16x16/mimetypes/pgn.png
$(mkinstalldirs) $(kde_datadir)/knights/themes/
$(INSTALL_DATA) $(srcdir)/KSDefault.tar.gz $(kde_datadir)/knights/themes/KSDefault.tar.gz
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/default-portrait.jpg $(kde_datadir)/knights/default-portrait.jpg
$(mkinstalldirs) $(kde_icondir)/hicolor/64x64/apps/
$(INSTALL_DATA) $(srcdir)/hi64-app-knights.png $(kde_icondir)/hicolor/64x64/apps/knights.png
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/splash.png $(kde_datadir)/knights/splash.png
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/pgn_template.kml $(kde_datadir)/knights/pgn_template.kml
$(mkinstalldirs) $(kde_icondir)/hicolor/64x64/mimetypes/
$(INSTALL_DATA) $(srcdir)/hi64-mime-pgn.png $(kde_icondir)/hicolor/64x64/mimetypes/pgn.png
$(mkinstalldirs) $(kde_icondir)/hicolor/32x32/mimetypes/
$(INSTALL_DATA) $(srcdir)/hi32-mime-pgn.png $(kde_icondir)/hicolor/32x32/mimetypes/pgn.png
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/icon-general.png $(kde_datadir)/knights/icon-general.png
$(mkinstalldirs) $(kde_icondir)/hicolor/32x32/apps/
$(INSTALL_DATA) $(srcdir)/hi32-app-knights.png $(kde_icondir)/hicolor/32x32/apps/knights.png
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/default-engine-portrait.jpg $(kde_datadir)/knights/default-engine-portrait.jpg
$(mkinstalldirs) $(kde_datadir)/knights/themes/
$(INSTALL_DATA) $(srcdir)/KBDefault.tar.gz $(kde_datadir)/knights/themes/KBDefault.tar.gz
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/wizard.png $(kde_datadir)/knights/wizard.png
$(mkinstalldirs) $(kde_icondir)/hicolor/48x48/apps/
$(INSTALL_DATA) $(srcdir)/hi48-app-knights.png $(kde_icondir)/hicolor/48x48/apps/knights.png
$(mkinstalldirs) $(kde_datadir)/knights/themes/
$(INSTALL_DATA) $(srcdir)/KCDefault.tar.gz $(kde_datadir)/knights/themes/KCDefault.tar.gz
$(mkinstalldirs) $(kde_icondir)/hicolor/16x16/apps/
$(INSTALL_DATA) $(srcdir)/hi16-app-knights.png $(kde_icondir)/hicolor/16x16/apps/knights.png
$(mkinstalldirs) $(kde_datadir)/knights/
$(INSTALL_DATA) $(srcdir)/icon-display.png $(kde_datadir)/knights/icon-display.png
uninstall-local:
-rm -f $(kde_icondir)/hicolor/48x48/mimetypes/pgn.png
-rm -f $(kde_icondir)/hicolor/16x16/mimetypes/pgn.png
-rm -f $(kde_datadir)/knights/themes/KSDefault.tar.gz
-rm -f $(kde_datadir)/knights/default-portrait.jpg
-rm -f $(kde_icondir)/hicolor/64x64/apps/knights.png
-rm -f $(kde_datadir)/knights/splash.png
-rm -f $(kde_datadir)/knights/pgn_template.kml
-rm -f $(kde_icondir)/hicolor/64x64/mimetypes/pgn.png
-rm -f $(kde_icondir)/hicolor/32x32/mimetypes/pgn.png
-rm -f $(kde_datadir)/knights/icon-general.png
-rm -f $(kde_icondir)/hicolor/32x32/apps/knights.png
-rm -f $(kde_datadir)/knights/default-engine-portrait.jpg
-rm -f $(kde_datadir)/knights/themes/KBDefault.tar.gz
-rm -f $(kde_datadir)/knights/wizard.png
-rm -f $(kde_icondir)/hicolor/48x48/apps/knights.png
-rm -f $(kde_datadir)/knights/themes/KCDefault.tar.gz
-rm -f $(kde_icondir)/hicolor/16x16/apps/knights.png
-rm -f $(kde_datadir)/knights/icon-display.png
####### kdevelop will overwrite this part!!! (end)############

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,17 @@
<p align=center>
<table width="95%">
<tr><td align=center>
<img src="%whiteimage%" align=left width=80 height=100>
<img src="%blackimage%" align=right width=80 height=100>
<h2>%white% vs. %black%</h2>
<b>%event%</b><br>
<b>Round: %round%</b><br>
<b>%site%</b><br>
<b>%date% %time%</b><br>
</td></tr>
<tr><td align=left>
%moves%
<hr>
</td></tr>
</table>
</p>

Binary file not shown.

Binary file not shown.

@ -0,0 +1,17 @@
Patches applied in the Debian version of :
debian/patches/01_gcc-4.0-fix.dpatch (Tommaso Moroni <moronito@debian.org>):
No description.
debian/patches/02_de.po.dpatch (Tommaso Moroni <moronito@debian.org>):
No description.
debian/patches/03_noGPLonload.dpatch (Claudio Moratti <maxer@knio.it>):
No description.
debian/patches/04_qt3_headers.dpatch (<bdefreese@debian2.bddebian.com>):
No description.
debian/patches/kubuntu_01_fix_castle.dpatch (Martin Meredith <mez@ubuntu.com>):
Fixes crash on castling

@ -0,0 +1,7 @@
####### kdevelop will overwrite this part!!! (begin)##########
POFILES = AUTO
EXTRA_DIST = de.gmo es.gmo fi.gmo et.gmo fr.gmo it.gmo
####### kdevelop will overwrite this part!!! (end)############

2290
po/de.po

File diff suppressed because it is too large Load Diff

2043
po/es.po

File diff suppressed because it is too large Load Diff

2243
po/et.po

File diff suppressed because it is too large Load Diff

2116
po/fi.po

File diff suppressed because it is too large Load Diff

2258
po/fr.po

File diff suppressed because it is too large Load Diff

2242
po/it.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1 @@
timestamp

@ -0,0 +1,5 @@
admin
doc
knights
media
po
Loading…
Cancel
Save