pax_global_header00006660000000000000000000000064134425050650014516gustar00rootroot0000000000000052 comment=b4574edb8d1dde158136ca95f81fd2912f958e58 portnov-qcheckers-b4574ed/000077500000000000000000000000001344250506500156135ustar00rootroot00000000000000portnov-qcheckers-b4574ed/.gitignore000066400000000000000000000002021344250506500175750ustar00rootroot00000000000000*.o *.swp Makefile src/Makefile src/qcheckers src/moc_*.cpp src/qrc_*.cpp debian/.debhelper debian/qcheckers debian/control *.deb portnov-qcheckers-b4574ed/AUTHORS000066400000000000000000000004061344250506500166630ustar00rootroot00000000000000Andi Peredri Artur Wiebe Contributors: Sebastien Prud'homme Guillaume Bedot french translations Ilya V. Portnov Qt5 adaptation, SVG support. portnov-qcheckers-b4574ed/COPYING000066400000000000000000000354331344250506500166560ustar00rootroot00000000000000 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 portnov-qcheckers-b4574ed/ChangeLog000066400000000000000000000043221344250506500173660ustar00rootroot000000000000002005-12-29 Artur Wiebe * toplevel.cc, view.h: Removed unused slots. * Renamed info to histrory. * history.cc: Removed useless code. 2005-12-19 Artur Wiebe * KCheckers 0.8 released. * Added support for free men placement at the beginning of the game. * Added multiple undos/redos: free movement in move history. * Removed network code: there will be network in the next version. * See below for more changes since 0.6. 2005-09-09 Artur Wiebe * KCheckers 0.7 is done - will not be released. * Ported to Qt 4.0. So watch out for more bugs. * Added basic Theme support. * Improved thread termination. * Redesigned GUI. * echeckers.cc: Fixed bug: man reaching the king row became king and continued move. * Improved PDN support. Can now re-play games. 2005-04-11 Artur Wiebe * KCheckers 0.6 released. * New game mode: Human vs. Human. * Added Info widget next to game's board. * Added different board sizes. * Rewrote menubar and toolbar code. * Rewrote network code. * Fixed some bugs, introduced new. 2004-08-08 Artur Wiebe * KCheckers 0.5 released. * Machine thinks in a thread now. * Added Internationalization support. * Added Network support. * Altered GUI interface to match KDE specifications. * Extended Preview in File Open Dialog. * Various improvements. 2003-01-15 Andi Peredri * KCheckers 0.4 released. * Added support for Portable Draughts Notation database format. * Added saving, loading and restarting of game. * Added PDN preview widget. * Added 20 PDN compositions. * Added game information box. * Various improvements. 2002-06-10 Andi Peredri * KCheckers 0.3 released. * Ported to Qt 3. * Added toolbar. * Added green theme of the board. * Added undo of last move. * Added auto saving of settings. * Added optional notation of the board. 2002-03-10 Andi Peredri * KCheckers 0.2 released. * Ported to pure Qt. * KCheckers engine improvements. * Added support of english checkers. * Added wooden theme of the board. * Added auto change of the men's color. * Added on-line description of the play's rules. 2002-01-15 Andi Peredri * Initial Release. portnov-qcheckers-b4574ed/Dockerfile.debian000066400000000000000000000004621344250506500210300ustar00rootroot00000000000000FROM debian:buster MAINTAINER Ilya V. Portnov RUN apt-get update && apt-get install -y debhelper qt5-qmake-bin qtbase5-dev libqt5svg5-dev build-essential devscripts VOLUME /dst VOLUME /src WORKDIR /src ADD debian_entrypoint.sh . CMD ["/bin/bash", "-c", "./debian_entrypoint.sh"] portnov-qcheckers-b4574ed/Dockerfile.ubuntu000066400000000000000000000004561344250506500211330ustar00rootroot00000000000000FROM ubuntu:xenial MAINTAINER Ilya V. Portnov RUN apt-get update && apt-get install -y debhelper qt5-qmake qtbase5-dev libqt5svg5-dev build-essential devscripts VOLUME /dst VOLUME /src WORKDIR /src ADD debian_entrypoint.sh . CMD ["/bin/bash", "-c", "./debian_entrypoint.sh"] portnov-qcheckers-b4574ed/FAQ000066400000000000000000000034451344250506500161530ustar00rootroot00000000000000What is my IP address? ---------------------- Run ifconfig and loop for the eth0/ppp0/ippp0 entry. The second line starts with "inet addr". That's your IP address! How to create a themes? ----------------------- There are two places you can put your own theme directories: $SHARE/themes or $HOME/.qcheckers/themes. $SHARE is /usr/local/qcheckers on default. simply create a directory there that contains the following files: tile1.png - unused tiles. tile2.png - where men are placed. frame.png - around selected man. manblack.png - manwhite.png - kingblack.png - kingwhite.png - theme - the first line should be the default/english name - of the theme. This will be used if the correct locale - name should not be found. - Locale specific names can be provided with the - following syntax: [locale]=Theme Name. - Example theme file: - Line 1) This is a default theme name - Line 2) [de_DE]=Das ist Deutsch - Line 2) [en]=This is English Directory name will be shown as theme name. All pictures are the same size. My theme is not loaded. Why? ---------------------------- Start qcheckers in a x-terminal. Watch out for errors otherwise send me your compressed theme directory. PDN. ---- Because draught is a fast (compared to chess) game there are less situations one will save a game. Nevertheless, this is possible in qcheckers. Now, imagine you want to see how a match on the last WCM was played. You simply open the PDN file, select the game you are interested in from the list and click move after a move and watch how the men on the board are moved. If you want to continue a game at certain position, no problem, click on the "Continue" button in toolbar. But consider who is next on turn, what kind of game (against computer or human) you are playing. portnov-qcheckers-b4574ed/INSTALL.md000066400000000000000000000012501344250506500172410ustar00rootroot00000000000000qcheckers Installation Procedures ================================= Run the following commands: ``` qmake make make install ``` Shared files are installed in `/usr/local/share/qcheckers` by default. You can change this by providing `PREFIX` variable to qmake: ``` qmake PREFIX=/usr ``` Technically, `PREFIX` is where qcheckers will look up for it's shared files; and `INSTALL_ROOT` is where all files will be installed when you run `make install`. So if you want `make install` to install to some temporary directory, to actually install files later (for example, during building a package for one of linux distros), you may say ``` qmake PREFIX=/usr INSTALL_ROOT=/tmp ``` portnov-qcheckers-b4574ed/NEWS000066400000000000000000000000001344250506500163000ustar00rootroot00000000000000portnov-qcheckers-b4574ed/README.Debian.md000066400000000000000000000003451344250506500202550ustar00rootroot00000000000000Creating a Debian / Ubuntu package ================================== Prerequisites: docker. The procedure for Debian is encoded in `build_debian_package.sh`. The procedure for Ubuntu is encoded in `build_ubuntu_package.sh`. portnov-qcheckers-b4574ed/README.md000066400000000000000000000054361344250506500171020ustar00rootroot00000000000000QCheckers 0.9.0 README ====================== QCheckers (formely known as KCheckers) is a Qt-based checkers board game. It can play english draughts and russian draughts. There is some additional information in the FAQ file. Please address any bug reports or feature requests to [github issue tracker][1]. Formely this program was living at * http://qcheckers.sourceforge.net/ * http://qcheckers.wibix.de * http://qcheckers.org [1]: https://github.com/portnov/qcheckers/issues PDN format ---------- For storing the positions of games QCheckers uses the Portable Draughts Notation (PDN) database format. It is used by many other checkers programs, and is becoming the standard way to swap games. PDN is based on the Portable Game Notation (PGN) standard which is widely used for Chess. For details see http://www.chessandcheckers.com/pdn.htm ``` ----------------------------------------------------------------------- PDN File: [Event "Game 1"] [Black "Nemet,A"] [White "Terens,B"] [Date "11.05.2002"] [Result "1-0"] [GameType "21"] [SetUp "1"] [FEN "W:WK4,28:BK11,19."] 1. 4-8 11x4 2. 28-24 19x28 {black win...} 1-0 ----------------------------------------------------------------------- Results: 1-0 White wins 0-1 Black wins 1/2-1/2 Drawn game * Unfinished game ----------------------------------------------------------------------- Game Types: 0: Chess 1: Chinese chess 2-19: Future chess expansion 20: International draughts 21: English draughts 22: Italian draughts 23: American pool 24: Spanish draughts 25: Russian draughts 26: Brazilian draughts 27: Canadian draughts 28: Portugese draughts 29-49: Future draughts expansion 50: Othello ----------------------------------------------------------------------- FEN: If a game starts from a set-up position, a Forsyth-Edwards Notation (FEN) header is given with the position. W Turn :W White pieces K4 King on field 4 28 Man on field 28 :B Black pieces ----------------------------------------------------------------------- Rules: Board BackCapture MoveKing TakeMax International 10x10 + >1 + English 8x8 kings 1 - Italian 8x8 kings 1 + American pool 8x8 + >1 - Spanish 8x8 kings >1 + Russian 8x8 + >1 - Brasilian 8x8 + >1 + Canadian 12x12 + >1 + ----------------------------------------------------------------------- ``` Requirements ------------ Qt library version 5.0 or higher is required. Installation ------------ Please refer to INSTALL.md file. portnov-qcheckers-b4574ed/TODO000066400000000000000000000044171344250506500163110ustar00rootroot00000000000000- replace kcheckers with qcheckers - rewrite TODO file; some things may be outdated. - do we need to save "free men placement" state?! + move names/game type to info... + is void myView::slotNextRound() obsolete? + doMove() always redraws board - really needed? + Setting comments in Paused Mode disabled. Why? ! SHARE_PATH is hard coded in main.cc kcheckers.pro info: + Provide a function that returns what color is on turn. to Qt 4.0: + XML for theme files? + save: should not overwrite but add? maybe add an option. + info: columns should be resized to content's size. not working for taglist. translate themes. duplicate themes at the moment. comments of moves are not set on both sides. allow each player to change his own move comments? + MISC - Why not logging the time when a move is done? Easy to implement. - Place kcheckersrc in $HOME/.kcheckers? + CONTINUE ONLINE GAME. this is not yet implemented. although it is simple. kcheckers is ready for this - i am not. i still have to think about this. the server side should be able to open pdn file. + SERVER IP! show server's ip in the new game dialog. in normal case linux has more than one configured network interface (see ifconfig output). qt failes to resolv the "right" one. + NETWORK SPECTATOR MODE. I think this would be cool :) Do i? + RENAME to qcheckers? when reading "kcheckers" one might think the program depends on kdelibs what is not true. renaming it to "qcheckers" clarifies its dependency on qt. + ANIMATED MOVES. this need to be done not just for fun. as for me, i sometimes do not notice engine's moves. i just see that it's my turn. in such cases i have to look at the move's list and check the last move. + GUI. although i am quite happy with current gui. need better themes/pixmaps for big board size. + THEMES. - Warnings due to failures on loading themes are not i18n. qWarning is used to display these warnings. Erroneous themes are ignored. - I use a simple text file to provide translated theme names. + PDN. - The FEN tag is not parsed at all, at the moment. - Errors in PDN files are logged untranslated. - What to do on abort? Cancel everything? - When continuing the game one must be able to choose the size/color. portnov-qcheckers-b4574ed/_config.yml000066400000000000000000000000331344250506500177360ustar00rootroot00000000000000theme: jekyll-theme-minimalportnov-qcheckers-b4574ed/build_debian_package.sh000077500000000000000000000004201344250506500222220ustar00rootroot00000000000000#!/bin/bash set -e cp debian/control.debian debian/control rm Makefile src/Makefile qmake make clean rm Makefile src/Makefile docker build -t qcheckers-debian -f Dockerfile.debian . docker run --rm --name qcheckers-debian -v $(pwd):/src -v $(pwd):/dst qcheckers-debian portnov-qcheckers-b4574ed/build_ubuntu_package.sh000077500000000000000000000004201344250506500223220ustar00rootroot00000000000000#!/bin/bash set -e cp debian/control.ubuntu debian/control rm Makefile src/Makefile qmake make clean rm Makefile src/Makefile docker build -t qcheckers-ubuntu -f Dockerfile.ubuntu . docker run --rm --name qcheckers-ubuntu -v $(pwd):/src -v $(pwd):/dst qcheckers-ubuntu portnov-qcheckers-b4574ed/debian/000077500000000000000000000000001344250506500170355ustar00rootroot00000000000000portnov-qcheckers-b4574ed/debian/README.Debian000066400000000000000000000002701344250506500210750ustar00rootroot00000000000000qcheckers for Debian ------------------- -- Ilya Portnov Tue, 12 Mar 2019 23:57:32 +0500 portnov-qcheckers-b4574ed/debian/README.source000066400000000000000000000004151344250506500212140ustar00rootroot00000000000000qcheckers for Debian ------------------- -- Ilya Portnov Tue, 12 Mar 2019 23:57:32 +0500 portnov-qcheckers-b4574ed/debian/changelog000066400000000000000000000003021344250506500207020ustar00rootroot00000000000000qcheckers (0.9.0-1) unstable; urgency=medium * Initial release (Closes: #nnnn) -- Ilya Portnov Tue, 12 Mar 2019 23:57:32 +0500 portnov-qcheckers-b4574ed/debian/compat000066400000000000000000000000021344250506500202330ustar00rootroot000000000000009 portnov-qcheckers-b4574ed/debian/control000066400000000000000000000017011344250506500204370ustar00rootroot00000000000000Source: qcheckers Section: games Priority: optional Maintainer: Ilya Portnov Build-Depends: debhelper (>= 11), qt5-qmake-bin, qtbase5-dev, libqt5svg5-dev Standards-Version: 4.1.3 Homepage: https://portnov.github.io/qcheckers/ Package: qcheckers Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: Qt-based checkers board game. It can play english draughts and russian draughts. . * Pure Qt. * Built-in checkers engine. * English and Russian rules of play. * Beginner, Novice, Average, Good, Expert and Master levels of skill. * Several themes of the board. * Portable Draughts Notation database format support. * Saving, loading and restarting of game. * Auto change of the men’s color. * Multiple Undos/Redos. * Optional numeration of the board. * The on-line description of the play’s rules. * Threads support. * Internationalization support (English, German, Russian and French). portnov-qcheckers-b4574ed/debian/control.debian000066400000000000000000000017011344250506500216600ustar00rootroot00000000000000Source: qcheckers Section: games Priority: optional Maintainer: Ilya Portnov Build-Depends: debhelper (>= 11), qt5-qmake-bin, qtbase5-dev, libqt5svg5-dev Standards-Version: 4.1.3 Homepage: https://portnov.github.io/qcheckers/ Package: qcheckers Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: Qt-based checkers board game. It can play english draughts and russian draughts. . * Pure Qt. * Built-in checkers engine. * English and Russian rules of play. * Beginner, Novice, Average, Good, Expert and Master levels of skill. * Several themes of the board. * Portable Draughts Notation database format support. * Saving, loading and restarting of game. * Auto change of the men’s color. * Multiple Undos/Redos. * Optional numeration of the board. * The on-line description of the play’s rules. * Threads support. * Internationalization support (English, German, Russian and French). portnov-qcheckers-b4574ed/debian/control.ubuntu000066400000000000000000000016741344250506500217710ustar00rootroot00000000000000Source: qcheckers Section: games Priority: optional Maintainer: Ilya Portnov Build-Depends: debhelper (>= 9), qt5-qmake, qtbase5-dev, libqt5svg5-dev Standards-Version: 4.1.3 Homepage: https://portnov.github.io/qcheckers/ Package: qcheckers Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends} Description: Qt-based checkers board game. It can play english draughts and russian draughts. . * Pure Qt. * Built-in checkers engine. * English and Russian rules of play. * Beginner, Novice, Average, Good, Expert and Master levels of skill. * Several themes of the board. * Portable Draughts Notation database format support. * Saving, loading and restarting of game. * Auto change of the men’s color. * Multiple Undos/Redos. * Optional numeration of the board. * The on-line description of the play’s rules. * Threads support. * Internationalization support (English, German, Russian and French). portnov-qcheckers-b4574ed/debian/copyright000066400000000000000000000032241344250506500207710ustar00rootroot00000000000000Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: qcheckers Source: Files: * Copyright: License: . # If you want to use GPL v2 or later for the /debian/* files use # the following clauses, or change it to suit. Delete these two lines Files: debian/* Copyright: 2019 Ilya Portnov License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". # Please also look if there are files or directories which have a # different copyright/license attached and list them here. # Please avoid picking licenses with terms that are more restrictive than the # packaged work, as it may make Debian's contributions unacceptable upstream. portnov-qcheckers-b4574ed/debian/files000066400000000000000000000002341344250506500200610ustar00rootroot00000000000000qcheckers-dbgsym_0.9.0-1_amd64.deb debug optional automatic=yes qcheckers_0.9.0-1_amd64.buildinfo games optional qcheckers_0.9.0-1_amd64.deb games optional portnov-qcheckers-b4574ed/debian/qcheckers-docs.docs000066400000000000000000000000341344250506500226020ustar00rootroot00000000000000README.Debian README.source portnov-qcheckers-b4574ed/debian/qcheckers.doc-base.EX000066400000000000000000000010311344250506500227120ustar00rootroot00000000000000Document: qcheckers Title: Debian qcheckers Manual Author: Abstract: This manual describes what qcheckers is and how it can be used to manage online manuals on Debian systems. Section: unknown Format: debiandoc-sgml Files: /usr/share/doc/qcheckers/qcheckers.sgml.gz Format: postscript Files: /usr/share/doc/qcheckers/qcheckers.ps.gz Format: text Files: /usr/share/doc/qcheckers/qcheckers.text.gz Format: HTML Index: /usr/share/doc/qcheckers/html/index.html Files: /usr/share/doc/qcheckers/html/*.html portnov-qcheckers-b4574ed/debian/qcheckers.substvars000066400000000000000000000003321344250506500227610ustar00rootroot00000000000000shlibs:Depends=libc6 (>= 2.14), libgcc1 (>= 1:3.0), libgl1, libqt5core5a (>= 5.11.0~rc1), libqt5gui5 (>= 5.2.0), libqt5svg5 (>= 5.6.0~beta), libqt5widgets5 (>= 5.0.2), libstdc++6 (>= 5) misc:Depends= misc:Pre-Depends= portnov-qcheckers-b4574ed/debian/rules000077500000000000000000000013171344250506500201170ustar00rootroot00000000000000#!/usr/bin/make -f # See debhelper(7) (uncomment to enable) # output every command that modifies files on the build system. export DH_VERBOSE = 1 export QT_SELECT := 5 # see FEATURE AREAS in dpkg-buildflags(1) #export DEB_BUILD_MAINT_OPTIONS = hardening=+all # see ENVIRONMENT in dpkg-buildflags(1) # package maintainers to append CFLAGS #export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic # package maintainers to append LDFLAGS #export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed %: dh $@ --buildsystem=qmake # dh_make generated override targets # This is example for Cmake (See https://bugs.debian.org/641051 ) #override_dh_auto_configure: # dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) portnov-qcheckers-b4574ed/debian/source/000077500000000000000000000000001344250506500203355ustar00rootroot00000000000000portnov-qcheckers-b4574ed/debian/source/format000066400000000000000000000000141344250506500215430ustar00rootroot000000000000003.0 (quilt) portnov-qcheckers-b4574ed/debian/source/options000066400000000000000000000002771344250506500217610ustar00rootroot00000000000000tar-ignore = .git tar-ignore = .gitignore tar-ignore = debian tar-ignore = *.tar.xz tar-ignore = src/qcheckers extend-diff-ignore = "(^|/)(\.git|\.gitignore|debian|src/qcheckers|.*tar.xz)" portnov-qcheckers-b4574ed/debian_entrypoint.sh000077500000000000000000000001271344250506500216670ustar00rootroot00000000000000#!/bin/bash set -e ./prepare_tarball.sh debuild -uc -us mv ../qcheckers*.deb /dst/ portnov-qcheckers-b4574ed/helpers/000077500000000000000000000000001344250506500172555ustar00rootroot00000000000000portnov-qcheckers-b4574ed/helpers/extract_prefix.sh000077500000000000000000000000701344250506500226400ustar00rootroot00000000000000#!/bin/sh grep "define PREFIX" common.h | cut -d'"' -f2 portnov-qcheckers-b4574ed/icons.qrc000066400000000000000000000014631344250506500174410ustar00rootroot00000000000000 icons/logo.svg icons/fileopen.svg icons/filesave.svg icons/stop.svg icons/dialog.png icons/undo.svg icons/redo.svg icons/exit.svg icons/info.png icons/next.svg icons/context.png icons/paused.svg icons/freeplace.png icons/clear.svg icons/continue.svg icons/theme/frame.png icons/theme/kingwhite.png icons/theme/manwhite.png icons/theme/tile2.png icons/theme/kingblack.png icons/theme/manblack.png icons/theme/tile1.png portnov-qcheckers-b4574ed/icons/000077500000000000000000000000001344250506500167265ustar00rootroot00000000000000portnov-qcheckers-b4574ed/icons/.directory000066400000000000000000000001031344250506500207250ustar00rootroot00000000000000[Dolphin] PreviewsShown=true Timestamp=2018,10,6,11,9,55 Version=3 portnov-qcheckers-b4574ed/icons/biglogo.png000066400000000000000000000004431344250506500210570ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME')IDATxQ Dc"9CKhXQ u@2 (2k21ح~چHrD p{@=&-FD$qQ@)U8w|L޻":w"`f^kɗɧHO'&GĢ 3Zrf.^-+毣P4IENDB`portnov-qcheckers-b4574ed/icons/clear.png000066400000000000000000000005511344250506500205230ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  #utIME#&6IDAT8˥m0Eߠl[2RP 7(A@ pq.Kd^ /Y=cqq|P}߳, .(\ǦKiRh2#Z(躎a&7UU|g]GEQ030 portnov-qcheckers-b4574ed/icons/console.png000066400000000000000000000003251344250506500210760ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  tIME"-~bIDAT8S[ 0ͬ7Ͳ+ $I#2$d ,$R5uȫ`y&4-6c?PUptH+䙲+x'p|IENDB`portnov-qcheckers-b4574ed/icons/context.png000066400000000000000000000003431344250506500211200ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME)pIDATxŒ !Dgbۗ K +i/6)Hts-- Hϑ+ D"'IdG]rAf rU5^)H7IENDB`portnov-qcheckers-b4574ed/icons/continue.png000066400000000000000000000004311344250506500212560ustar00rootroot00000000000000PNG  IHDRa pHYs  tIME 0,>tEXtCommentCreated with The GIMP by Artur Wiebe artur@wiebenet.deaFnIDAT8˥K DIEi"t0$$' XRɚlG(,(^9%:#HM EF`fӭ4WgH3ʶK1*BK)8$ IENDB`portnov-qcheckers-b4574ed/icons/continue.svg000066400000000000000000000025411344250506500212750ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/dialog.png000066400000000000000000000021361344250506500206750ustar00rootroot00000000000000PNG  IHDR26bKGD pHYs  ~tIME&*G3IDATxn@QV4m X@X"eI@, 6\b&K339u>)rT?/g.N䌈V@hv:ˁi'i4d'M_s)cS,< ZzDDسloᐊl7k6#/3wWFD5\bց{b}PZ٢ꉝ]p'x-ZEQ=$Z?j UgbZj2oy;WܲEQk߈}'5NDQ1j5["^<3}eUՠ gN/ϵ~-u1Uw"O>7$QZm"jyv' -LmjI^Ji-SZ-`z8n$~ՊӐ1X'k@TxjU--SUKvf@ L-1%q >0Uj]y|jIn 4NB j!llܠu}DA2PKwaiQ|B|Ъ%4q >Zazd 3 vjMqZݿVT-9Z0 9Aa. Qb1=S؀8Q2q >`j龖T-ieZ`UkR:U eT-i a1 =.ZbjT-~ε6RjICՒZ컸JMV-iT-4PT-9U~v= #`őjZbUoSFX,cSt@Z: J[!,?\''{&IENDB`portnov-qcheckers-b4574ed/icons/down.png000066400000000000000000000003501344250506500204010ustar00rootroot00000000000000PNG  IHDRa pHYs  tIME .&tEXtCommentCreated with The GIMPd%n^IDAT8SA .Ka=-ZJBuޠI% *Av&{M1iCL&Ia)ƭgtD-,Hn2=gIENDB`portnov-qcheckers-b4574ed/icons/down.svg000066400000000000000000000047601344250506500204250ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/icons/exit.png000066400000000000000000000003431344250506500204050ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME(6QpIDATxRA 3{Q?@:nYBm\cu <9n$@s!"^-q3L. kC4eHQ1^Qow!SIENDB`portnov-qcheckers-b4574ed/icons/exit.svg000066400000000000000000000101071344250506500204170ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/fileopen.png000066400000000000000000000004431344250506500212360ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME'ziIDATxՑ 0 2A UPF+|^Vd9J_yk{CDTUoL⽿ Yk1YJUhk@*޴,KX׵*IHlV4Ǒ}߳t{94M8+ portnov-qcheckers-b4574ed/icons/filesave.png000066400000000000000000000003631344250506500212340ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME)H8-IDATx͓ $t6 S(1$S!.A2[aͽpJKbι[8x8W M-p}@o4uu0f@$!"6_id}!u!Z!&WjbIENDB`portnov-qcheckers-b4574ed/icons/filesave.svg000066400000000000000000000315141344250506500212510ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/freeplace.png000066400000000000000000000003021344250506500213550ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  tIME 8)V;tEXtCommentCreated with The GIMPd%n&IDAT8c`b3QQD=^"*IENDB`portnov-qcheckers-b4574ed/icons/go-previous.svg000066400000000000000000000043301344250506500217260ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/info.png000066400000000000000000000010571344250506500203720ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME' IDATxS@ƨ BM! &)3XD|=_q ,,9윳2`YVb8y>k:_een .c_B,Y4E ]QVl6q8p:0Hu,K-AT "RPJhqnR4Mc \RJ( Z mݲ,mA@A~J3PJ0 L&H)ߵ$I$ (c BX8F>GE( Ba0 !g/ۯt:|JJ)3yYEBx| `0 image/svg+xml portnov-qcheckers-b4574ed/icons/next.png000066400000000000000000000004301344250506500204070ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  tIME6>tEXtCommentCreated with The GIMP by Artur Wiebe artur@wiebenet.deaF[IDAT8Փ 0C_@֖)2h*tbЌv @l+&HZ[!GcR'[4B5V}*O3L7`I8AIENDB`portnov-qcheckers-b4574ed/icons/next.svg000066400000000000000000000042541344250506500204320ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/paused.png000066400000000000000000000003231344250506500207130ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  tIME 39jtEXtCommentCreated with The GIMPd%n7IDAT8c?%B@,FFF?0F 0,vIENDB`portnov-qcheckers-b4574ed/icons/paused.svg000066400000000000000000000046231344250506500207350ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/redo.png000066400000000000000000000003111344250506500203600ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME   ,߮VIDAT8c`$02?k( XlϥH0w "Kq#Ѷ 975nB"6 H*-`IENDB`portnov-qcheckers-b4574ed/icons/redo.svg000066400000000000000000000050341344250506500204020ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/stop.png000066400000000000000000000014661344250506500204300ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME)IeIDATxmkw? sLY?HyGY%,L25?ǪOY>{Z=ݭ;x/=}=ʿnݵ8dh iSS;F*z_vfsW T9jO2L81vHRoJ&zݳYS(fTEm2.?A xJIENDB`portnov-qcheckers-b4574ed/icons/stop.svg000066400000000000000000000061621344250506500204410ustar00rootroot00000000000000 portnov-qcheckers-b4574ed/icons/theme/000077500000000000000000000000001344250506500200305ustar00rootroot00000000000000portnov-qcheckers-b4574ed/icons/theme/.directory000066400000000000000000000001041344250506500220300ustar00rootroot00000000000000[Dolphin] PreviewsShown=true Timestamp=2018,10,6,10,58,23 Version=3 portnov-qcheckers-b4574ed/icons/theme/frame.png000066400000000000000000000002661344250506500216340ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME("׋eCIDATxױ 7bWfbZ)T|r͡Fg9E^  @ @|_Do@iIENDB`portnov-qcheckers-b4574ed/icons/theme/kingblack.png000066400000000000000000000010431344250506500224610ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME' lIDATx EW[H䐣 p)7\ CJpNCfX'Ex3`u =} HJYJ)L|>W 0Zkp:2ORX7xd#ۂo ]D|T4MY:hf_ce@[qd\.k#e!^BD`q;H-""? "'"aYzs+R|, /I?Puu)q0G}&"v%JKR ]9?>xk?SmϷ[]5UH)_f! ~n,0mۗ6mbZ ɮ"rM骹,)-nK0voI!9?_cƲ;IENDB`portnov-qcheckers-b4574ed/icons/theme/kingwhite.png000066400000000000000000000010211344250506500225210ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME(rIDATx10EO,XK1;` Y`i ;ɯ h7ކ»羘v7q9k vέ+5Ֆ z2>:zp<EHg `2O1^Yd1@,d5{Abf}6pιGchfH%6(Z'ZSEpo OBkMuniT4cg @Y [k9u{6 @~Q v/44s1}Yu1&_l>yu\.80M6xfii$}2jL[~ROKʗ$ZANOÒR$\۶)u?p5q>d$HֺIVwdV>;NR(HLRw5XSIENDB`portnov-qcheckers-b4574ed/icons/theme/manblack.png000066400000000000000000000011521344250506500223050ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME'8q:IDATxW; lo{8a9t |WKH/`$ #!VmWt3@On7/mY,@DEͩBDZ#|ߑ308+B%υDhq7JG{_\GD!7fJCMT/ D*ZPE"k- S3k ,\a9[>ג̛sZ?%LC DVT6#l9[iNGOJP0@特Y4Mx<0Ƭ`LZx(rWjn6CMZ2\;=SDUDa0 C$c3cߣ:}ٝ_;ِRp%Ebf8.fdɟGY@.V 3J!>Rj/W)x{!-㮃_W"Y"*rt:x^7T{D\ZLVoJ65IENDB`portnov-qcheckers-b4574ed/icons/theme/manwhite.png000066400000000000000000000014241344250506500223530ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME)v-IDATx嗡0ƿr+N 3S?aC/5=?`j !X/)wzvo1OR|dθWJٻEQEQOqsQJ)l[}( `!$ t:MLXͻC !РILBdx<9GP<s  M8!lV<ϵqV8RJrB|;*`5`J"01+A=1ָ:y&8u%W1Y+B|>ri!5-{ei^J1]3( !9GE}0IfK)!Y *_Ik&Eٓ9o6X`λ&2l6V%̜1(S^VA۶ɘz;zjҿ@leܴsmkB0Ɛe8~Y MӀsn5'UUˠ8Zx sE/4MSpα^u̢/!MD&DWU)%JC}E:SnF%&yUUc#06TeHRJv;m>%ĬJHܕ~Gm[u=i>! z@ps(`itx  tIENDB`portnov-qcheckers-b4574ed/icons/theme/tile1.png000066400000000000000000000026451344250506500215630ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME(2IDATx]4 (.1?4 AGTU骒R)o $Ia"N41m|'H<`L$u_BCؽn8  M66BCx MI(4 os] _1 Ϊ6t~<|lTIb~\hgNx̨\U TAP HGd&וF˧Bn<>sҁ|_\9Ʉ@ ~WlDhP 5z`Ԧ_hA'%G-Yז`vcֲPIENDB`portnov-qcheckers-b4574ed/icons/theme/tile2.png000066400000000000000000000031601344250506500215550ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME(/:2IDATx9s$?uܙц2)=,ɘgvmVPe,ԕĜW5(L*{֚\ @1lI3* 3ҦPQZ,߮hCL k۪|f/hquO?'4@rZ XCA,8CKfۤ]LIRx:dbΤ9  s5, 8|q6 0m- )0 v*f(o=h.F!jg!(BT9Zm; 0 (Ǿ ^^γe 0gu-]Ũ5qbO}Bx|Mp. mf% qJFSne[)YvVS"gW0̹ ZOS=PB[QuՕ16bNl^@9>(ǥb&ͽ,kjL JaL츢z:J^Ifhπ9e$*qLɻOOBI ̐3$Vrf^EHuɥ:HC 3=~BVϳ QpV S&}9~gϧ!0]@ʉz!b!`=KFr4 (oKDc5(*D`rh\XݑIS_;V=J-k|ɴ ]h1Se̯/3< qi^$:T1`tLL{\Ui\*+sskxg^ֽ)L\^Ĵe &ab&~~Loo<]\1f+"&as$p 2+mumk Tkx]0Kk=uB$bJ\%Ҁ5}Զh盒_cQ> * Na"LiJ/Iڞ6?a}kxpn4!|e퟿~|S M%&IkOi2חa)t1| \Z3!Gu=,e,F-ڦmZ0 b"R03h秮t-srt:0d]fefH5_(W('0ٍNKǝ]Z^/%c@l(TCӇ ] [)iڦЩ9VGWm);B1 C,-9$gd6 9ۗK_\&yZXmO? 3w)Ft׾xܳ\.?5G s"7fEa(8Ƙwzs`=x%Җ %$✫G2- $  [IENDB`portnov-qcheckers-b4574ed/icons/undo.png000066400000000000000000000003151344250506500204000ustar00rootroot00000000000000PNG  IHDRabKGD pHYs  ~tIME(^;jZIDAT8A ]s[AՈГ/RN"|xĤ4&H럱VnHÉ*-6wIENDB`portnov-qcheckers-b4574ed/icons/undo.svg000066400000000000000000000056341344250506500204240ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/icons/up.png000066400000000000000000000003371344250506500200630ustar00rootroot00000000000000PNG  IHDRa pHYs  tIME GtEXtCommentCreated with The GIMPd%nUIDAT810m:tWҡL aa@;Uڬ lcW$$nLR image/svg+xml portnov-qcheckers-b4574ed/lang/000077500000000000000000000000001344250506500165345ustar00rootroot00000000000000portnov-qcheckers-b4574ed/lang/qcheckers_de.qm000066400000000000000000000116161344250506500215200ustar00rootroot00000000000000Sie beginnen mit 12 Steinen. Sie knnen die Steine nur nach vorne bewegen. Diese knnen andere Steine schlagen:<ul><li>indem sie nur nach vorne springen (Englische Regeln);<li>indem sie sowohl nach vorn als auch nach hinten springen (Russische Regeln).</ul><p>Ein Stein der die gegenberliegende Seite erreicht, wird zur Dame.Die Dame bewegt sich sowohl vorwrts als auch rckwrts:<ul><li>immer nur ein Feld pro Zug (Englische Regeln);<li>beliebig viele Felder pro Zug (Russische Regeln).</ul><p>Die Dame kann vor-/ und rckwrts schlagen. Schlagen ist Pflicht. 1&Speichern... Setze Tag Z'Setze Kommentar 8Lsche &Log bei Rundenbeginn @Kommentar d< Platzieren-Modus 5A&bbrechen IPause-Modus 35&Neu... L.Lese Datei... Rr&Toolleiste f*2 Englische Regeln Anfnger PBSpiel laden U&Spielregeln GiSpielregeln GSpiel speichern tNeues Spiel u&Einstellungen s(Sie mssen Schlagen. ɞ Schwarz gewinnt! 4BZeige Notation &ber Spielsteinen0W&Zeige Notation^8^Spieler Zwei)_Spieler EinsH/p myView myNewGameDlg myHistory myHumanPlayer myTopLevelportnov-qcheckers-b4574ed/lang/qcheckers_de.ts000066400000000000000000000535131344250506500215330ustar00rootroot00000000000000 UTF-8 myHistory Move Zug Comment Kommentar Undo Rückgängig Redo Wiederholen Continue Fortsetzen Set Comment Setze Kommentar Set Tag Setze Tag Tag Tag Reading file... Lese Datei... Importing games... Importiere Spiele... English draughts Englische Regeln Russian draughts Russische Regeln Unknown game type Unbekannter Spieltyp Free Placement Mode Platzieren-Modus Paused Mode Pause-Modus Play Mode Spiel-Modus myHumanPlayer You must capture. Sie müssen Schlagen. Unmovable. Unbewegbar. you must capture Sie müssen Schlagen unmovable unbewegbar Cannot move this. Kann nicht bewegen. You must capture. Available moves are: %1 This unit does not have valid moves. This unit cannot be moved to field you pointed. myInfo Move Zug Comment Kommentar White Weiß Black Schwarz English draughts Englische Regeln Russian draughts Russische Regeln Unknown game type Unbekannter Spieltyp Importing games... Importiere Spiele... Reading file... Lese Datei... Continue Fortsetzen Previous Zurück Next Vor Undo Rückgängig Redo Wiederholen Set Comment Setze Kommentar Set Tag Setze Tag Free Placement Mode Platzieren-Modus Paused Mode Pause-Modus Play Mode Spiel-Modus Tag Tag myNewGameDlg New Game Neues Spiel Rules Regeln Skill Schwierigkeitsgrad Beginner Anfänger Novice Novize Average Durchschnitt Good Gut Expert Experte Master Meister Accept Akzeptieren Address: Adresse: Servername: Servername: Serverinfo: Serverinfo: &Start &Starten &Cancel A&bbrechen Wait... Warte... Waiting for client to connect... Warte auf Netzwerkspieler... Waiting for server to accept... Warte auf Serverbestätigung... Server denied. Server lehnt ab. Connection aborted. Verbindung getrennt. Human Mensch Player One Spieler Eins White Weiß Player Two Spieler Zwei Computer Computer Network - New Game Netzwerk - Neues Spiel Network - Join Game Netzwerk - Spiel betreten Server Server Could not create a game on the server. Konnte kein Spiel auf dem Server erstellen. Could not join the game. Konnte dem Spiel nicht beitreten. Client connected. Mit dem Client verbunden. Client disconnected. Client hat sich verabschiedet. Free Men Placement Freies Platzieren der Figuren myTopLevel &New... &Neu... CTRL+N File|New CTRL+N &Next Round &Nächste Runde &Stop &Stopp &Undo Move &Zug rückgängig CTRL+Z File|Undo CTRL+Z &Information &Information &Open... &Öffnen... CTRL+O File|Open CTRL+O &Save... &Speichern... CTRL+S File|Save CTRL+S &Quit &Beenden CTRL+Q File|Quit CTRL+Q &Show Notation &Zeige Notation &Green Board &Grünes Brett &Marble Board &Rotes Brett &Wooden Board &Hölzernes Brett &Console &Konsole What's This Was ist das SHIFT+F1 Help|WhatsThis SHIFT+F1 &Rules of Play &Spielregeln F1 Help|Help F1 About &Qt Über &Qt &Game &Spiel &View &Ansicht &Settings &Einstellungen &Help &Hilfe Error Fehler &Close &Schließen Save Game Spiel speichern Could not save: Konnte nicht speichern: Open Game Spiel laden Could not load: Konnte nicht öffnen: Game Info Spielinfo Rules of Play Spielregeln About Über Current game will be lost if you continue. Do you really want to discard it? Das aktuelle Spiel geht verloren, wenn Sie fortfahren. Wollen sie es wirklich verwerfen? Abort Game? Spiel abbrechen? <p>In the beginning of game you have 12 checkers (men). White always moves first. The men move forward only. The men can capture:<ul><li>by jumping forward only (english rules);<li>by jumping forward or backward (russian rules).</ul><p>A man which reaches the far side of the board becomes a king. The kings move forward or backward:<ul><li>to one square only (english rules);<li>to any number of squares (russian rules).</ul><p>The kings capture by jumping forward or backward. Whenever a player is able to make a capture he must do so. <p>Sie beginnen mit 12 Steinen. Weiß beginnt das Spiel. Sie können die Steine nur nach vorne bewegen. Diese können andere Steine schlagen:<ul><li>indem sie nur nach vorne springen (Englische Regeln);<li>indem sie sowohl nach vorn als auch nach hinten springen (Russische Regeln).</ul><p>Ein Stein der die gegenüberliegende Seite erreicht, wird zur Dame.Die Dame bewegt sich sowohl vorwärts als auch rückwärts:<ul><li>immer nur ein Feld pro Zug (Englische Regeln);<li>beliebig viele Felder pro Zug (Russische Regeln).</ul><p>Die Dame kann vor-/ und rückwärts schlagen. Schlagen ist Pflicht. &Confirm aborting current game &Bestätige Abbrechen des laufenden Spiels &Open console on new messages &Öffne Konsole beim Entreiffen neues Nachrichten &Small board &Kleines Brett &Big board &Großes Brett &About &Über Show notation &above Zeige Notation &über &Notation font... &Notationsschrift... <p>In the beginning of game you have 12 checkers (men). The men move forward only. The men can capture:<ul><li>by jumping forward only (english rules);<li>by jumping forward or backward (russian rules).</ul><p>A man which reaches the far side of the board becomes a king. The kings move forward or backward:<ul><li>to one square only (english rules);<li>to any number of squares (russian rules).</ul><p>The kings capture by jumping forward or backward. Whenever a player is able to make a capture he must do so. <p>Sie beginnen mit 12 Steinen. Sie können die Steine nur nach vorne bewegen. Diese können andere Steine schlagen:<ul><li>indem sie nur nach vorne springen (Englische Regeln);<li>indem sie sowohl nach vorn als auch nach hinten springen (Russische Regeln).</ul><p>Ein Stein der die gegenüberliegende Seite erreicht, wird zur Dame.Die Dame bewegt sich sowohl vorwärts als auch rückwärts:<ul><li>immer nur ein Feld pro Zug (Englische Regeln);<li>beliebig viele Felder pro Zug (Russische Regeln).</ul><p>Die Dame kann vor-/ und rückwärts schlagen. Schlagen ist Pflicht. File already exists. Do you really want to override it? Die Datei existiert bereits. Wollen Sie sie wirklich überschreiben? Clear &log on new round Lösche &Log bei Rundenbeginn Shift+/ Shift+/ Show notation &above men Zeige Notation &über Spielsteinen &Toolbar &Toolleiste %1 -> %2 capturing %3 History Log myView Go! Los! Game aborted. Spiel abgebrochen. Connection closed. Verbundung getrennt. Drawn game. Unentschieden. Invalid move. Ungültiger Zug. Waiting for opponent to move... Warte auf Gegenspieler... White wins! Weiß gewinnt! Black wins! Schwarz gewinnt! White Weiß Black Schwarz Invalid move Ungültiger Zug It's not your turn. Du bist nicht am Zug. opponent Gegner Warning! Some errors occured. Warnung! Es sind Fehler aufgetreten. Preview mode Vorschau-Modus Syntax error. Usage: /from-to Syntaxfehler. Gebrauch: /von-nach Saved: Gespeichert: Opened: Geöffnet: Play mode Spiel-Modus portnov-qcheckers-b4574ed/lang/qcheckers_fr.qm000066400000000000000000000121661344250506500215400ustar00rootroot00000000000000Au dbut vous avez 12 pions. Les pions peuvent se dplacer uniquement en avant. Ils peuvent capturer :<ul><li>en sautant en avant seulement (rgles anglaises),<li>en sautant en avant ou en arrire (rgles russes).</ul><p>Un pion qui arrive du ct adverse du plateau devient une dame. Les dames peuvent se dplacer en avant ou en arrire :<ul><li>d'une seule case (rgles anglaises),<li>de plusieurs cases (rgles russes).</ul><p>Les dames peuvent capturer en sautant en avant ou en arrire. Quand une capture est possible, elle doit obligatoirement tre excute.  1&Enregistrer... Dfinir le Tag Z',Dfinir le Commentaire BNettoyer le &log au niveau niveau @Commentaire d<.Mode de Placement Libre 5&Annuler IMode Pause 35&Nouveau... L.<Lecture du fichier en cours... Rr&Barre d'outils f*2Dames anglaises Dbutant PB$Charger une Partie U&Rgles du jeu GiRgles de jeu G*Enregistrer la Partie tNouveau Jeu u*&Configurer KCheckers s(Vous devez capturer. ɞ&Les noirs gagnent ! 4RAfficher la notation &au dessus des pions0W*&Afficher la notation^8^Joueur Deux)_Joueur UnH/p myView myNewGameDlg myHistory myHumanPlayer myTopLevelportnov-qcheckers-b4574ed/lang/qcheckers_fr.ts000066400000000000000000000474701344250506500215570ustar00rootroot00000000000000 UTF-8 myHistory Move Déplacer Comment Commentaire Undo Annuler Redo Refaire Continue Continuer Set Comment Définir le Commentaire Set Tag Définir le Tag Tag Tag Reading file... Lecture du fichier en cours... Importing games... Importe les jeux... English draughts Dames anglaises Russian draughts Dames russes Unknown game type Type de jeu inconnu Free Placement Mode Mode de Placement Libre Paused Mode Mode Pause Play Mode Mode Jeu myHumanPlayer Go! Commencer ! Incorrect course. Mouvement impossible. Peut-être une capture est-elle possible ? You must capture. Vous devez capturer. Cannot move this. Impossible de déplacer cet élément. You must capture. Available moves are: %1 This unit does not have valid moves. This unit cannot be moved to field you pointed. myInfo Move Déplacer Comment Commentaire Undo Annuler Redo Refaire Continue Continuer Set Comment Définir le Commentaire Set Tag Définir le Tag Reading file... Lecture du fichier en cours... Importing games... Importe les jeux... English draughts Dames anglaises Russian draughts Dames russes Unknown game type Type de jeu inconnu Free Placement Mode Mode de Placement Libre Paused Mode Mode Pause Play Mode Mode Jeu Tag Tag myNewGameDlg New Game Nouveau Jeu Against CPU on this PC Contre l'ordinateur local Against Human on Network - New Game Contre un humain en réseau - Nouvelle partie Against Human on Network - Join Game Contre un humain en réseau - Joindre une partie Rules Règles English Anglaises Russian Russes Skill Niveau de difficulté Beginner Débutant Novice Novice Average Moyen Good Bon Expert Expert Master Maître Server IP: IP du serveur: Pick free port Prendre un port libre &Start &Commencer &Cancel &Annuler Human Humain Player One Joueur Un White Blancs Player Two Joueur Deux Computer Ordinateur Free Men Placement Placement des Pions Libre myTopLevel &New... &Nouveau... CTRL+N File|New CTRL+N &Next Round Niveau &Suivant &Stop &Arrêter &Undo Move &Annuler le mouvement CTRL+Z File|Undo CTRL+Z &Information &Information &Open... &Ouvrir... CTRL+O File|Open CTRL+O &Save... &Enregistrer... CTRL+S File|Save CTRL+S &Quit &Quitter CTRL+Q File|Quit CTRL+Q &Show Notation &Afficher la notation &Green Board &Plateau vert &Marble Board &Plateau marbré &Wooden Board &Plateau en bois What's This Qu'est ce que c'est ? SHIFT+F1 Help|WhatsThis SHIFT+F1 &Rules of Play &Règles du jeu F1 Help|Help F1 &About À &propos About &Qt À propos de &Qt &Game &Jeu &View &Afficher &Settings &Configurer KCheckers &Help &Aide Error Erreur &Close &Fermer Save Game Enregistrer la Partie Could not save: Impossible d'enregistrer : Open Game Charger une Partie Could not load: Impossible d'ouvrir: Game Info Informations sur la partie Rules of Play Règles de jeu About À propos Quit Game? Quitter la partie ? Current game will be lost if you continue. Do you really want to discard it? La partie en cours sera perdue si vous continuez. Voulez-vous vraiment l'abandonner ? Abort Game? Abandonner la partie ? &Confirm aborting current game &Confirmer l'abandon de la partie &About &À Propos Show notation &above men Afficher la notation &au dessus des pions Clear &log on new round Nettoyer le &log au niveau niveau &Notation font... Fonte pour la &notation... &Toolbar &Barre d'outils <p>In the beginning of game you have 12 checkers (men). The men move forward only. The men can capture:<ul><li>by jumping forward only (english rules);<li>by jumping forward or backward (russian rules).</ul><p>A man which reaches the far side of the board becomes a king. The kings move forward or backward:<ul><li>to one square only (english rules);<li>to any number of squares (russian rules).</ul><p>The kings capture by jumping forward or backward. Whenever a player is able to make a capture he must do so. <p>Au début vous avez 12 pions. Les pions peuvent se déplacer uniquement en avant. Ils peuvent capturer :<ul><li>en sautant en avant seulement (règles anglaises),<li>en sautant en avant ou en arrière (règles russes).</ul><p>Un pion qui arrive du côté adverse du plateau devient une dame. Les dames peuvent se déplacer en avant ou en arrière :<ul><li>d'une seule case (règles anglaises),<li>de plusieurs cases (règles russes).</ul><p>Les dames peuvent capturer en sautant en avant ou en arrière. Quand une capture est possible, elle doit obligatoirement être exécutée. %1 -> %2 capturing %3 History Log myView Go! Commencer ! You have lost. Game over. Vous avez perdu. Fin de la partie. Congratulation! You have won! Félicitations ! Vous avez gagné ! I am thinking... Je pense... Waiting network player to move... En attente du mouvement du joueur distant... Incorrect course. Mouvement impossible. Peut-être une capture est-elle possible ? Waiting for network player to connect... En attente de la connexion du joueur distant... Waiting for server to reply... En attente de la réponse du serveur... Game aborted. Partie abandonnée. ENGLISH rules. Règles ANGLAISES. RUSSIAN rules. Règles RUSSES. New Network Game Nouvelle partie en réseau Join Network Game Rejoindre une partie en réseau Unknown rules. Playing current rules: Règles inconnues. Adopte les règles courantes : Unknown skill. Keeping current skill: Niveau inconnu. Conserve le niveau courant : Player Le joueur is played by KCheckers with current skill: est controllé par KCheckers avec le niveau courant : This is not implemented yet. Ceci n'est pas encore implémenté. Please consider Information mismatch. Veuillez considérer que les informations sont discordantes. Russian Russes Drawn game. Match nul. Invalid move. Mouvement invalide. White wins! Les blancs gagnent ! Black wins! Les noirs gagnent ! opponent adversaire Opened: Ouvert : Warning! Some errors occured. Attention ! Des erreurs sont survenues. Saved: Enregistré : portnov-qcheckers-b4574ed/lang/qcheckers_ru.ts000066400000000000000000000404541344250506500215710ustar00rootroot00000000000000 myHistory Move Ход Comment Комментарий Undo Отменить Redo Вернуть Continue Продолжить Set Comment Установить комментарий Set Tag Установить метку Tag Метка Reading file... Читаю файл... Importing games... Импортирую игры... English draughts Английские шашки Russian draughts Русские шашки Unknown game type Неизвестный вид игры Free Placement Mode Режим ручного размещения Paused Mode Режим паузы Play Mode Режим игры myHumanPlayer You must capture. Available moves are: %1 Вы должны брать. Доступные ходы: %1 This unit does not have valid moves. Эта фишка не имеет доступных ходов. This unit cannot be moved to field you pointed. Эта фишка не может быть передвинута на поле, которое вы указали. myNewGameDlg New Game Новая игра &Start &Старт &Cancel &Отмена Free Men Placement Режим ручной установки фишек Player One Первый игрок Rules Правила White Белые Player Two Второй игрок Computer Компьютер Human Человек Skill Опыт Beginner Начинающий Novice Новичок Average Средний Good Хороший Expert Эксперт Master Мастер myTopLevel History История Log Журнал &New... &Новая... CTRL+N File|New CTRL+N &Next Round &Следующий ход &Stop &Остановить &Open... &Открыть... CTRL+O File|Open CTRL+O &Save... &Сохранить... CTRL+S File|Save CTRL+S &Quit &Выход CTRL+Q File|Quit CTRL+Q &Show Notation &Показать нотацию Show notation &above men Показать нотацию &над фишками &Confirm aborting current game &Подтверждать завершение текущей игры Clear &log on new round Очищать &журнал при следующем раунде &Notation font... &Шрифт нотации... &Rules of Play Правила &игры F1 Help|Help F1 &About &О программе About &Qt О &Qt &Toolbar &Панель инструментов &Game &Игра &View &Вид &Settings &Настройки &Help &Помощь Error Ошибка &Close &Закрыть Save Game Сохранить игру Could not save: Не могу сохранить: Open Game Открыть игру <p>In the beginning of game you have 12 checkers (men). The men move forward only. The men can capture:<ul><li>by jumping forward only (english rules);<li>by jumping forward or backward (russian rules).</ul><p>A man which reaches the far side of the board becomes a king. The kings move forward or backward:<ul><li>to one square only (english rules);<li>to any number of squares (russian rules).</ul><p>The kings capture by jumping forward or backward. Whenever a player is able to make a capture he must do so. Rules of Play Правила игры About О программе Abort Game? Прервать игру? Current game will be lost if you continue. Do you really want to discard it? Текущая игра будет проиграна, если вы продолжите. Вы действительно хотите отбросить её? %1 -> %2 capturing %3 %1 -> %2 (брать %3) myView Drawn game. Invalid move. Неверный ход. Game aborted. Игра прервана. White wins! Белые выиграли! Black wins! Чёрные выиграли! Opened: Открыто: Warning! Some errors occured. Предупреждение: произошли некоторые ошибки. Saved: Сохранено: portnov-qcheckers-b4574ed/prepare_tarball.sh000077500000000000000000000002231344250506500213060ustar00rootroot00000000000000#!/bin/bash VERSION=0.9.0 #make clean tar cJ --exclude-vcs --exclude=./debian --exclude=./src/qcheckers -f ../qcheckers_$VERSION.orig.tar.xz . portnov-qcheckers-b4574ed/qcheckers.desktop000066400000000000000000000002341344250506500211550ustar00rootroot00000000000000[Desktop Entry] Categories=Game;BoardGame; Encoding=UTF-8 Name=QCheckers GenericName=Checkers board game Type=Application Exec=qcheckers Icon=qcheckers.svg portnov-qcheckers-b4574ed/qcheckers.pro000066400000000000000000000001061344250506500203020ustar00rootroot00000000000000TEMPLATE = subdirs SUBDIRS += src QT += widgets CONFIG += qt debug portnov-qcheckers-b4574ed/qcheckers.qrc000066400000000000000000000001651344250506500202740ustar00rootroot00000000000000 README.md COPYING portnov-qcheckers-b4574ed/qcheckers.svg000066400000000000000000000104271344250506500203100ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/src/000077500000000000000000000000001344250506500164025ustar00rootroot00000000000000portnov-qcheckers-b4574ed/src/board.cc000066400000000000000000000252371344250506500200110ustar00rootroot00000000000000// version: $Id$ /*************************************************************************** * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include "board.h" #include "common.h" #include "pdn.h" #include "echeckers.h" #include "rcheckers.h" /* #include "newgamedlg.h" #include "player.h" #include "humanplayer.h" #include "computerplayer.h" */ QColor myColorInterpolator(const QColor &start, const QColor &end, qreal progress) { qreal r = (1 - progress) * start.red() + progress * end.red(); qreal g = (1 - progress) * start.green() + progress * end.green(); qreal b = (1 - progress) * start.blue() + progress * end.blue(); //qDebug("from %s to %s, progress %f", qUtf8Printable(start.name()), qUtf8Printable(end.name()), progress); return QColor(r, g, b); } myBoard::myBoard(QWidget* parent) : QFrame(parent) { /* * board & info */ setFrameStyle(QFrame::Box|QFrame::Plain); for(int i=0; i<64; i++) { m_fields[i] = new Field(this, i); } pixmap_valid = false; m_src_field = NULL; m_dst_field = NULL; animation_steps = 10; current_step = 0; animation_timer = startTimer(100); // for(int i=0; i<32; i++) { // connect(m_fields[i], SIGNAL(click(int)), // this, SIGNAL(fieldClicked(int))); // } /* * game init */ m_game = 0; } myBoard::~myBoard() { for (int i = 0; i < 64; i++) { delete m_fields[i]; } if(m_game) { delete m_game; } if (pixmap) { delete pixmap; } } void myBoard::beginSetup() { for (int i = 0; i < 64; i++) { m_fields[i]->beginSetup(); } } void myBoard::endSetup() { for (int i = 0; i < 64; i++) { m_fields[i]->endSetup(); } } void myBoard::paintEvent(QPaintEvent*) { QPainter p(this); draw(); Q_ASSERT(pixmap_valid); p.drawPixmap(0, 0, *pixmap); p.end(); } void myBoard::setTheme(const QString& path, bool set_white) { int fieldSize = getTargetFieldSize(size()); m_theme = new Theme(this, path, 0); if (fieldSize > 3) { if (m_theme->getIsResizeable()) { m_theme->setTargetSize(fieldSize); } } for (int i = 0; i < 64; i++) { m_fields[i]->setTheme(m_theme); } beginSetup(); setColorWhite(set_white); for(int i=0; i<32; i++) { m_fields[i]->setPattern(2); } for(int i=32; i<64; i++) { m_fields[i]->setPattern(1); } //setFixedSize(sizeHint()); if (! m_theme->getIsResizeable()) { int width = m_theme->getFieldWidth()*8 + 2*frameWidth(); int height = m_theme->getFieldHeight()*8 + 2*frameWidth(); setFixedSize(width, height); } else { setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX); } if(m_game) { fieldsSetup(); } endSetup(); repaint(); } QSize myBoard::sizeHint() const { if (! m_theme) { return QSize(); } else { int width = m_theme->getFieldWidth()*8 + 2*frameWidth(); int height = m_theme->getFieldHeight()*8 + 2*frameWidth(); return QSize(width, height); //qInfo("Size is fixed: %d x %d", width, height); } } void myBoard::reset() { int new_board[32]; for(int i=0; i<12; i++) { new_board[i]=MAN2; } for(int i=12; i<20; i++) { new_board[i]=FREE; } for(int i=20; i<32; i++) { new_board[i]=MAN1; } // reset frames. for(int i=0; i<32; i++) { m_fields[i]->showFrame(false); } if(m_game) { m_game->setup(new_board); } fieldsSetup(); } void myBoard::adjustNotation(bool bottom_is_white) { if(!m_game) { return; } for(int i=0; i<32; i++) { m_fields[i]->setLabel(m_game->getFieldNotation(i, bottom_is_white)); } invalidate(); repaint(); } void myBoard::fieldsSetup() { for(int i=0; i<32; i++) { m_fields[i]->set(m_game->item(i), bottom_is_white); } invalidate(); } void myBoard::invalidate() { pixmap_valid = false; for (int i = 0; i < 64; i++) { m_fields[i]->invalidate(); } } void myBoard::drawField(QPainter& painter, Field* field, int row, int column) { int width = size().width(); int height = size().height(); int rowHeight = height / 8; int colWidth = width / 8; int size = rowHeight < colWidth ? rowHeight : colWidth; QRect rect(column * size, row * size, size, size); field->draw(painter, rect); } void myBoard::draw() { if (pixmap_valid) { return; } QPixmap* prev = pixmap; pixmap = new QPixmap(size()); pixmap->fill(Qt::white); QPainter painter(pixmap); for(int i=0; i<4; i++) { for(int k=0; k<4; k++) { drawField(painter, m_fields[i*8+k+32], i*2, k*2 ); drawField(painter, m_fields[i*8+k ], i*2, k*2+1); drawField(painter, m_fields[i*8+k+4 ], i*2+1,k*2 ); drawField(painter, m_fields[i*8+k+36], i*2+1,k*2+1); } } if (animation_in_progress && m_src_field && m_dst_field) { painter.setPen(QPen(m_src_color, 5)); painter.drawRect(m_src_field->rect()); painter.setPen(Qt::black); painter.setPen(QPen(m_dst_color, 5)); painter.drawRect(m_dst_field->rect()); painter.setPen(Qt::black); } painter.end(); update(); pixmap_valid = true; delete prev; } void myBoard::setColorWhite(bool b) { bottom_is_white = b; } void myBoard::setNotation(bool s, bool above) { for(int i=0; i<32; i++) { m_fields[i]->showLabel(s, above); } invalidate(); repaint(); } /* void myBoard::do_move(const QString& move) { qDebug() << __PRETTY_FUNCTION__; if(!m_current->isHuman()) { add_log(myBoard::Warning, tr("It's not your turn.")); return; } int from_num, to_num; if(extract_move(move, &from_num, &to_num)) { slot_click(from_num); slot_click(to_num); } else add_log(myBoard::Warning, tr("Syntax error. Usage: /from-to")); } */ bool myBoard::convert_move(const QString& move_orig, int* from_num, int* to_num) { QString move = move_orig.toUpper().replace('X', '-'); QString from; QString to; int sect = move.count('-'); *from_num = *to_num = -1; from = move.section('-', 0, 0); to = move.section('-', sect, sect); if(from!=QString::null && to!=QString::null) { for(int i=0; i<32; i++) { if(m_fields[i]->label()==from) { *from_num = m_fields[i]->number(); } if(m_fields[i]->label()==to) { *to_num = m_fields[i]->number(); } } if(*from_num>=0 && *to_num>=0) { return true; } } return false; } void myBoard::setNotationFont(const QFont& f) { setFont(f); for(int i=0; i<32; i++) { m_fields[i]->fontUpdate(); } } void myBoard::setGame(int rules) { if(m_game) { delete m_game; } if(rules==ENGLISH) { m_game = new ECheckers(); } else { m_game = new RCheckers(); } reset(); } void myBoard::selectField(int field_num, bool is_on) { for(int i=0; i<32; i++) { if(i==field_num) { m_fields[i]->showFrame(is_on); } else { m_fields[i]->showFrame(false); } } } QString myBoard::doMove(int from_num, int to_num, bool white_player) { bool bottom_player = (white_player && bottom_is_white) || (!white_player && !bottom_is_white); int from_pos = from_num; int to_pos = to_num; if(!bottom_player) { from_pos = 31-from_pos; to_pos = 31-to_pos; m_game->fromString(m_game->toString(true)); } if(!m_game->go1(from_pos, to_pos)) { return QString::null; /* qDebug() << __PRETTY_FUNCTION__ << from_pos << "," << to_pos << " could not move."; */ } if(!bottom_player) { m_game->fromString(m_game->toString(true)); } fieldsSetup(); highlight(from_num, to_num, bottom_player); return QString("%1?%3") .arg(m_fields[from_num]->label()) .arg(m_fields[to_num]->label()); } bool myBoard::doMove(const QString& move, bool white_player) { int from_pos, to_pos; if(convert_move(move, &from_pos, &to_pos)) { doMove(from_pos, to_pos, white_player); return true; } return false; } void myBoard::doFreeMove(int from, int to) { int old_to = m_game->item(to); int old_from = m_game->item(from); m_game->setItem(to, old_from); m_game->setItem(from, old_to); fieldsSetup(); } int myBoard::getTargetFieldSize(QSize size) { int w_max = size.width(); int h_max = size.height(); int max_size = w_max < h_max ? w_max : h_max; return (max_size - 2*frameWidth()) / 8; } void myBoard::resizeEvent(QResizeEvent* e) { if (m_theme) { int size = getTargetFieldSize(e->size()); m_theme->setTargetSize(size); fieldsSetup(); } } void myBoard::mousePressEvent(QMouseEvent* me) { if(me->button() != Qt::LeftButton) return; if (animation_in_progress) return; for (int i = 0; i < 32; i++) { if (m_fields[i]->rect().contains(me->pos())) { invalidate(); update(); emit fieldClicked(i); return; } } } void myBoard::highlight(int from, int to, bool bottom_player) { animation_in_progress = true; m_src_field = m_fields[from]; m_dst_field = m_fields[to]; animating_bottom_player = bottom_player; } void myBoard::timerEvent(QTimerEvent* e) { if (e->timerId() != animation_timer) { return; } if (animation_in_progress) { qreal progress = ((qreal)current_step) / ((qreal)animation_steps); QColor begin; QColor end; if (animating_bottom_player) { begin = QColor(0, 0, 0); end = QColor(0, 255, 0); } else { begin = QColor(0, 0, 0); end = QColor(255, 0, 0); } m_src_color = myColorInterpolator(begin, end, progress); m_dst_color = myColorInterpolator(begin, end, 1-progress); current_step ++; if (current_step >= animation_steps) { current_step = 0; animation_in_progress = false; m_src_field = NULL; m_dst_field = NULL; invalidate(); repaint(); } else { invalidate(); repaint(); } } } portnov-qcheckers-b4574ed/src/board.h000066400000000000000000000062331344250506500176460ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _BOARD_H_ #define _BOARD_H_ #include #include "theme.h" #include "field.h" #include "checkers.h" class myBoard : public QFrame { Q_OBJECT public: myBoard(QWidget* parent); ~myBoard(); QSize sizeHint() const; void resizeEvent(QResizeEvent*); // returns coded move string: from_pos_string?to_pos_string QString doMove(int from_pos, int to_pos, bool white_player); // coded move. bool doMove(const QString& move, bool white_player); // void doFreeMove(int from, int to); void selectField(int field_num, bool is_on); void setTheme(const QString& theme_path, bool set_white); void setNotation(bool enabled, bool show_above); void setNotationFont(const QFont& f); void setColorWhite(bool); void reset(); void adjustNotation(bool bottom_is_white); void setGame(int rules); bool whiteIsNext() const; int type() const { return m_game->type(); } // TODO const Checkers* game() const { return m_game; } signals: void fieldClicked(int); protected: void paintEvent(QPaintEvent*); void mousePressEvent(QMouseEvent*); void timerEvent(QTimerEvent*); private: bool convert_move(const QString&, int* from, int* to); void fieldsSetup(); void draw(); void drawField(QPainter&, Field*, int, int); void invalidate(); void beginSetup(); void endSetup(); int getTargetFieldSize(QSize size); void highlight(int, int, bool); private: Field* m_fields[64]; QPixmap* pixmap = NULL; bool pixmap_valid; Theme* m_theme; bool bottom_is_white; bool animation_in_progress; QColor m_src_color; QColor m_dst_color; Field* m_src_field; Field* m_dst_field; int animation_steps; int current_step; int animation_timer; bool animating_bottom_player; Checkers* m_game; }; #endif portnov-qcheckers-b4574ed/src/capture.cc000066400000000000000000000045701344250506500203620ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include "capture.h" Captures::Captures(int from, int capt, int to) { m_captures.append(Capture(from, to, capt)); } Captures::Captures(const Captures& capture) { m_captures.append(capture.m_captures); } Captures::Captures(const Captures* capture) { m_captures.append(capture->m_captures); } bool Captures::isEmpty() const { return m_captures.isEmpty(); } int Captures::size() const { return m_captures.size(); } void Captures::add(Captures& capture) { m_captures.append(capture.m_captures); } void Captures::add(Captures* capture) { m_captures.append(capture->m_captures); } const Capture Captures::at(int i) const { return m_captures.at(i); } Capture::Capture(int from, int to, int capt) { captured = capt; source = from; target = to; } portnov-qcheckers-b4574ed/src/capture.h000066400000000000000000000041651344250506500202240ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CAPTURE_H #define CAPTURE_H #include #include class Capture { public: Capture(int, int, int); ~Capture() { } int captured; int source; int target; }; class Captures { public: Captures() { } Captures(int, int, int); Captures(const Captures&); Captures(const Captures*); ~Captures() { } void add(Captures&); void add(Captures*); bool isEmpty() const; int size() const; const Capture at(int) const; private: QList m_captures; }; #endif portnov-qcheckers-b4574ed/src/checkers.cc000066400000000000000000000314701344250506500205050ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ // // KCheckers Engine // // Internal: External: // // Board = 54 Fields: Board = 32 Fields: // // | 06 07 08 09| MAN2 | 00 01 02 03| // |11 12 13 14 | |04 05 06 07 | // | 17 18 19 20| | 08 09 10 11| // |22 23 24 25 | |12 13 14 15 | // | 28 29 30 31| | 16 17 18 19| // |33 34 35 36 | |20 21 22 23 | // | 39 40 41 42| | 24 25 26 27| // |44 45 46 47 | MAN1 |28 29 30 31 | #include #include #include #include "checkers.h" #include "toplevel.h" int Checkers::internal(int external) const { const int i[]={6,7,8,9,11,12,13,14,17,18,19,20,22,23,24,25, 28,29,30,31,33,34,35,36,39,40,41,42,44,45,46,47}; return i[external]; } int Checkers::external(int internal) const { const int i[]={ -1,-1,-1,-1,-1,-1,0,1,2,3, // 0-9 internal -1,4,5,6,7,-1,-1,8,9,10, // 10-19 11,-1,12,13,14,15,-1,-1,16,17, // 20-29 18,19,-1,20,21,22,23,-1,-1,24, // 30-39 25,26,27,-1,28,29,30,31,-1,-1, // 40-49 -1,-1,-1,-1}; // 50-53 return i[internal]; } Checkers::Checkers() { for(int i=0;i<54;i++) board[i] = NONE; for(int i=0; i<12; i++) board[internal(i)] = MAN2; for(int i=12; i<20; i++) board[internal(i)] = FREE; for(int i=20; i<32; i++) board[internal(i)] = MAN1; levelmax = 2; srand(time(0)); // Seed the random number generator } bool Checkers::setup(int setupboard[]) { /*aw - caused problems int sum1=0; // Sum of MAN1 & KING1 int sum2=0; // Sum of MAN2 & KING2 for(int i=0; i<32; i++) { switch(setupboard[i]) { case MAN1: case KING1: sum1++; break; case MAN2: case KING2: sum2++; break; case FREE: break; default: return false; } } if(sum1>12 || sum1==0 || sum2>12 || sum2==0) return false; for(int i=0; i<4; i++) if(setupboard[i]==MAN1) return false; for(int i=28; i<32; i++) if(setupboard[i]==MAN2) return false; */ for(int i=0; i<32; i++) board[internal(i)] = setupboard[i]; return true; } /////////////////////////////////////////////////// // // Player Functions // /////////////////////////////////////////////////// bool Checkers::checkMove1() const { for(int i=6;i<48;i++) if(checkMove1(i)) return true; return false; } bool Checkers::checkMove1(int i) const { switch(board[i]) { case MAN1: if(board[i-6]==FREE) return true; if(board[i-5]==FREE) return true; break; case KING1: if(board[i-6]==FREE) return true; if(board[i-5]==FREE) return true; if(board[i+5]==FREE) return true; if(board[i+6]==FREE) return true; } return false; } //////////////////////////////////////////////////// // // Computer Functions // //////////////////////////////////////////////////// void Checkers::go2() { // level=0; for(int i=6;i<48;i++) bestboard[i] = board[i]; turn(); for(int i=6;i<48;i++) board[i] = bestboard[i]; ; } void Checkers::turn(int& resMax, bool capture) { if(levelresMax) { resMax=res; if(level==1) { for(int i=6;i<48;i++) bestboard[i]=board[i]; bestcounter=1; } } else if(res==resMax && level==1) { bestcounter++; if((rand()%bestcounter)==0) { for(int i=6;i<48;i++) bestboard[i]=board[i]; } } if(capture) { if(f12) board[12]=NONE; if(f13) board[13]=NONE; if(f14) board[14]=NONE; if(f17) board[17]=NONE; if(f18) board[18]=NONE; if(f19) board[19]=NONE; if(f23) board[23]=NONE; if(f24) board[24]=NONE; if(f25) board[25]=NONE; if(f28) board[28]=NONE; if(f29) board[29]=NONE; if(f30) board[30]=NONE; if(f34) board[34]=NONE; if(f35) board[35]=NONE; if(f36) board[36]=NONE; if(f39) board[39]=NONE; if(f40) board[40]=NONE; if(f41) board[41]=NONE; } } else if(resMax<0) resMax=0; } bool Checkers::checkMove2() const { for(int i=6;i<48;i++) { switch(board[i]) { case MAN2: if(board[i+5]==FREE) return true; if(board[i+6]==FREE) return true; break; case KING2: if(board[i-6]==FREE) return true; if(board[i-5]==FREE) return true; if(board[i+5]==FREE) return true; if(board[i+6]==FREE) return true; } } return false; } QString Checkers::describeCapture(bool bottom_is_white, Captures* capture) const { QString result; bool first = true; for (int i = 0; i < capture->size(); i++) { Capture move = capture->at(i); QString from = getFieldNotation(external(move.source), bottom_is_white); QString to = getFieldNotation(external(move.target), bottom_is_white); QString captured = getFieldNotation(external(move.captured), bottom_is_white); if (! first) { result += ", "; } first = false; result += myTopLevel::tr("%1 -> %2 capturing %3").arg(from).arg(to).arg(captured); } return result; } Captures* Checkers::getPossibleCapture() const { Captures capture; for (int i=6; i<48; i++) { Captures* c = getPossibleCapture(i); capture.add(c); delete c; } return new Captures(&capture); } int Checkers::turn() { int resMax=(level-levelmax)*10; level++; if(checkCapture2()) { for(int i=6; i<48; i++) { switch(board[i]) { case MAN2: manCapture2(i, resMax); break; case KING2: kingCapture2(i,UL,resMax); kingCapture2(i,UR,resMax); kingCapture2(i,DL,resMax); kingCapture2(i,DR,resMax); } } } else if(checkMove2()) { for(int i=6;i<48;i++) { switch(board[i]) { case MAN2: if(board[i+5]==FREE) { // down left board[i]=FREE; if(i>38) board[i+5]=KING2; else board[i+5]=MAN2; turn(resMax); board[i+5]=FREE; board[i]=MAN2; } if(board[i+6]==FREE) { // down right board[i]=FREE; if(i>38) board[i+6]=KING2; else board[i+6]=MAN2; turn(resMax); board[i+6]=FREE; board[i]=MAN2; } break; case KING2: kingMove2(i,resMax); break; } } } else ; level--; return resMax; } QString Checkers::toString(bool rotate) const { int fields[32]; int it; for(int i=0; i<32; i++) { it = item(i); if(rotate) fields[31-i] = (~it&7)-1; else fields[i] = it; } QString str; for(int i=0; i<32; i++) str += QString("").sprintf("%.2u", fields[i]); return str; } bool Checkers::fromString(const QString& str) { int fields[32]; for(int i=0; i<32; i++) fields[i] = str.mid(i*2, 2).toInt(); // apply if(!setup(fields)) { qDebug() << "Checkers::fromString:" << str; return false; } return true; } portnov-qcheckers-b4574ed/src/checkers.h000066400000000000000000000071331344250506500203460ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef CHECKERS_H #define CHECKERS_H #include #include "capture.h" // do not change - hard coded #define NONE 0 #define MAN1 1 #define KING1 2 #define FREE 3 #define KING2 4 #define MAN2 5 #define FULL 6 #define UL -6 #define UR -5 #define DL 5 #define DR 6 class Checkers { public: Checkers(); virtual ~Checkers() {} bool setup(int setupboard[]); virtual bool go1(int from, int to)=0; void go2(); void setSkill(int i) { levelmax=i; }; int skill() const { return levelmax; } virtual int type() const = 0; int item(int i) const { return board[internal(i)]; } void setItem(int i, int item) { board[internal(i)] = item; } // string representation of the game board. // set rotate to switch player sides. QString toString(bool rotate) const; bool fromString(const QString&); // checks for a capture/move for particular stone in external // representation. human player only. bool canCapture1(int i) { return checkCapture1(internal(i)); } bool canMove1(int i) { return checkMove1(internal(i)); } bool checkMove1() const; bool checkMove2() const; virtual bool checkCapture1() const = 0; virtual bool checkCapture2() const = 0; bool checkCapture1(const int i) { return ! getPossibleCapture(i)->isEmpty(); } Captures* getPossibleCapture() const; QString describeCapture(bool, Captures*) const; virtual QString getFieldNotation(int, bool) const = 0; protected: bool checkMove1(int) const; virtual Captures* getPossibleCapture(int) const = 0; int level; // Current level int levelmax; // Maximum level int turn(); void turn(int&, bool capture=false); int to; int board[54]; int bestboard[54]; int bestcounter; virtual void kingMove2(int,int &)=0; virtual bool manCapture2(int,int &)=0; virtual bool kingCapture2(int,int,int &)=0; virtual bool manCapture1(int,int,bool &)=0; virtual bool kingCapture1(int,int,bool &)=0; int internal(int) const; // Return internal board position int external(int) const; // Return extenal board position }; #endif portnov-qcheckers-b4574ed/src/common.h000066400000000000000000000045411344250506500200470ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _COMMON_H_ #define _COMMON_H_ #define APPNAME "QCheckers" #define VERSION "0.8.1" #define EXT "pdn" #define HOMEPAGE "http://qcheckers.wibix.de" #define COPYRIGHT "(c) 2002-2003, Andi Peredri (andi@ukr.net)
" \ "(c) 2004-2005, Artur Wiebe (wibix@gmx.de)" #define CONTRIBS "Sebastien Prud'homme (prudhomme@laposte.net)
" \ "Guillaume Bedot (guillaume.bedot@wanadoo.fr)" #ifndef PREFIX #define PREFIX "/usr/local" #endif #define USER_PATH ".qcheckers" // in $HOME #define THEME_DIR "themes/" // some keys for QSettings #define CFG_KEY "/"APPNAME"/" // #define DEFAULT_THEME "Default" // #define THEME_TILE1 "tile1.png" #define THEME_TILE2 "tile2.png" #define THEME_FRAME "frame.png" #define THEME_MANBLACK "manblack.png" #define THEME_MANWHITE "manwhite.png" #define THEME_KINGBLACK "kingblack.png" #define THEME_KINGWHITE "kingwhite.png" #define THEME_FILE "theme" // #define MAX_TILE_SIZE 64 #endif portnov-qcheckers-b4574ed/src/computerplayer.cc000066400000000000000000000057621344250506500217760ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include "computerplayer.h" #include "pdn.h" #include "rcheckers.h" #include "echeckers.h" #include "checkers.h" myComputerPlayer::myComputerPlayer(const QString& name, bool white, int skill) : myPlayer(name, white) { m_game = 0; m_thread = 0; m_skill = skill; } myComputerPlayer::~myComputerPlayer() { if(m_thread) { m_thread->stop(); // delete m_thread } delete m_game; } void myComputerPlayer::yourTurn(const Checkers* g) { if(m_thread) { qDebug("myComputerPlayer::yourTurn: a thread exists."); } // first create it. if(!m_game || m_game->type()!=g->type()) { delete m_game; if(g->type()==RUSSIAN) { m_game = new RCheckers(); } else { m_game = new ECheckers(); } } m_game->setSkill(m_skill); m_game->fromString(g->toString(false)); m_thread = new myThread(this, m_game); m_thread->start(); } void myComputerPlayer::stop() { if(m_thread) { m_thread->stop(); } } void myComputerPlayer::customEvent(QEvent* ev) { if(ev->type() == QEvent::MaxUser) { m_thread->wait(); delete m_thread; m_thread = 0; emit moveDone(m_game->toString(false)); } } /**************************************************************************** * * ***************************************************************************/ void myThread::run() { m_game->go2(); if(!m_aborted) { QEvent* ev = new QEvent(QEvent::MaxUser); QApplication::postEvent(m_player, ev); } else { qDebug("thread.aborted.done."); } } void myThread::stop() { m_aborted = true; m_game->setSkill(0); } portnov-qcheckers-b4574ed/src/computerplayer.h000066400000000000000000000044261344250506500216340ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _COMPUTERPLAYER_H_ #define _COMPUTERPLAYER_H_ #include #include "player.h" class myThread; class myComputerPlayer : public myPlayer { Q_OBJECT public: myComputerPlayer(const QString& name, bool white, int skill); ~myComputerPlayer(); virtual void yourTurn(const Checkers* game); virtual void stop(); // need this to process thread's events virtual void customEvent(QEvent*); private: myThread* m_thread; Checkers* m_game; int m_skill; }; /****************************************************************************/ class myThread : public QThread { public: myThread(myComputerPlayer* p, Checkers* g) : m_player(p), m_game(g), m_aborted(false) {} virtual void run(); void stop(); Checkers* game() const { return m_game; } private: myComputerPlayer* m_player; Checkers* m_game; bool m_aborted; }; #endif portnov-qcheckers-b4574ed/src/echeckers.cc000066400000000000000000000276341344250506500206610ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ // aw?1 - due to english rules a man reaching the king-row becomes a king // and the is complete. // // English Checkers #include "echeckers.h" /////////////////////////////////////////////////// // // Player Functions // /////////////////////////////////////////////////// bool ECheckers::go1(int from, int field) { from=internal(from); field=internal(field); to=field; if(checkCapture1()) { bool capture=false; switch(board[from]) { case MAN1: if(manCapture1(from, UL, capture)) return true; if(manCapture1(from, UR, capture)) return true; return false; case KING1: if(kingCapture1(from, UL, capture)) return true; if(kingCapture1(from, UR, capture)) return true; if(kingCapture1(from, DL, capture)) return true; if(kingCapture1(from, DR, capture)) return true; return false; } } else { switch(board[from]) { case MAN1: if((to==(from-6))||(to==(from-5))) { board[from]=FREE; if(to<10) board[to]=KING1; else board[to]=MAN1; return true; } return false; case KING1: if((to==(from-6))||(to==(from-5)) || (to==(from+5))||(to==(from+6)) ) { board[from]=FREE; board[to]=KING1; return true; } return false; } } return false; } bool ECheckers::checkCapture1() const { for(int i=6;i<48;i++) { Captures* captures = getPossibleCapture(i); bool result = ! captures->isEmpty(); delete captures; if (result) { return true; } } return false; } Captures* ECheckers::getPossibleCapture(int i) const { switch(board[i]) { case MAN1: // forward-left if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return new Captures(i, i-6, i-12); // forward-right if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return new Captures(i, i-5, i-10); break; case KING1: // forward-left if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return new Captures(i, i-6, i-12); // forward-right if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return new Captures(i, i-5, i-10); // backward-left if(board[i+5]==MAN2 || board[i+5]==KING2) if(board[i+10]==FREE) return new Captures(i, i+5, i+10); // backward-right if(board[i+6]==MAN2 || board[i+6]==KING2) if(board[i+12]==FREE) return new Captures(i, i+6, i+12); } return new Captures(); } /* ORIG FUNC aw??? bool ECheckers::checkCapture1() { for(int i=6;i<48;i++) { switch(board[i]) { case MAN1: // forward-left if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return true; // forward-right if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return true; break; case KING1: // forward-left if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return true; // forward-right if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return true; // backward-left if(board[i+5]==MAN2 || board[i+5]==KING2) if(board[i+10]==FREE) return true; // backward-right if(board[i+6]==MAN2 || board[i+6]==KING2) if(board[i+12]==FREE) return true; } } return false; } */ // Return TRUE if a course of the player true // Return FALSE if a course of the player incorrect bool ECheckers::manCapture1(int from, int direction, bool& capture) { int i=from+direction; if(board[i]==MAN2 || board[i]==KING2) { int k=i+direction; if(board[k]==FREE) { bool next=false; int save=board[i]; board[from]=FREE; board[i]=NONE; // become a king! if(k<10) { board[k]=KING1; /*aw?1 if(kingCapture1(k, direction+11, next)) { board[i]=FREE; return true; } */ } else { board[k]=MAN1; if(manCapture1(k,UL,next)) {board[i]=FREE; return true;} if(manCapture1(k,UR,next)) {board[i]=FREE; return true;} } //?? make move here, too??? if((!next) && k==to) {board[i]=FREE; return true;}// move success // move failed, restore board[k]=FREE; board[i]=save; board[from]=MAN1; capture=true; } } return false; } bool ECheckers::kingCapture1(int from, int direction, bool& capture) { int i=from+direction; if(board[i]==MAN2 || board[i]==KING2) { int k=i+direction; if(board[k]==FREE) { bool next=false; int save=board[i]; board[from]=FREE; board[i]=NONE; board[k]=KING1; if(direction==UL || direction==DR) { if(kingCapture1(k,UR,next)) {board[i]=FREE;return true;} if(kingCapture1(k,DL,next)) {board[i]=FREE;return true;} } else { if(kingCapture1(k,UL,next)) {board[i]=FREE;return true;} if(kingCapture1(k,DR,next)) {board[i]=FREE;return true;} } if(kingCapture1(k,direction,next)) {board[i]=FREE;return true;} if((!next) && k==to) {board[i]=FREE;return true;}// move ok // move failed, restore board[k]=FREE; board[i]=save; board[from]=KING1; capture=true; } } return false; } //////////////////////////////////////////////////// // // Computer Functions // //////////////////////////////////////////////////// void ECheckers::kingMove2(int from, int& resMax) { board[from]=FREE; int i=from-6; if(board[i]==FREE) { board[i]=KING2; turn(resMax); board[i]=FREE; } i=from-5; if(board[i]==FREE) { board[i]=KING2; turn(resMax); board[i]=FREE; } i=from+5; if(board[i]==FREE) { board[i]=KING2; turn(resMax); board[i]=FREE; } i=from+6; if(board[i]==FREE) { board[i]=KING2; turn(resMax); board[i]=FREE; } board[from]=KING2; } bool ECheckers::checkCapture2() const { for(int i=6;i<48;i++) { switch(board[i]) { case MAN2: if(board[i+5]==MAN1 || board[i+5]==KING1) if(board[i+10]==FREE) return true; if(board[i+6]==MAN1 || board[i+6]==KING1) if(board[i+12]==FREE) return true; break; case KING2: if(board[i-6]==MAN1 || board[i-6]==KING1) if(board[i-12]==FREE) return true; if(board[i-5]==MAN1 || board[i-5]==KING1) if(board[i-10]==FREE) return true; if(board[i+5]==MAN1 || board[i+5]==KING1) if(board[i+10]==FREE) return true; if(board[i+6]==MAN1 || board[i+6]==KING1) if(board[i+12]==FREE) return true; } } return false; } // Return TRUE if it is possible to capture // Return FALSE if it is impossible to capture bool ECheckers::manCapture2(int from, int& resMax) { bool capture=false; // try left-down int i=from+5; if(board[i]==MAN1 || board[i]==KING1) { int k=from+10; if(board[k]==FREE) { int save=board[i]; board[from]=FREE; board[i]=NONE; resMax--; // become a king! if(from>32) { board[k]=KING2; // aw?1 turn(resMax, true); //aw??? //aw??if(!kingCapture2(k, UL, resMax)) turn(resMax, true); } else { board[k]=MAN2; if(!manCapture2(k, resMax)) turn(resMax, true); } // restore resMax++; board[k]=FREE; board[i]=save; board[from]=MAN2; capture=true; } } // now right-down i=from+6; if(board[i]==MAN1 || board[i]==KING1) { int k=from+12; if(board[k]==FREE) { int save=board[i]; board[from]=FREE; board[i]=NONE; resMax--; // become a king! if(from>32) { board[k]=KING2; // aw?1 turn(resMax, true); // aw??? //aw???if(!kingCapture2(k,UR,resMax)) turn(resMax,true); } else { board[k]=MAN2; if(!manCapture2(k,resMax)) turn(resMax,true); } // restore resMax++; board[k]=FREE; board[i]=save; board[from]=MAN2; capture=true; } } if(capture) return true; return false; } bool ECheckers::kingCapture2(int from, int direction, int &resMax) { int i=from+direction; if(board[i]==MAN1 || board[i]==KING1) { int k=i+direction; if(board[k]==FREE) { bool capture=false; int save=board[i]; board[from]=FREE; board[i]=NONE; resMax--; board[k]=KING2; if(direction==UL || direction==DR) { if(kingCapture2(k,UR,resMax)) capture=true; if(kingCapture2(k,DL,resMax)) capture=true; } else { if(kingCapture2(k,UL,resMax)) capture=true; if(kingCapture2(k,DR,resMax)) capture=true; } if(kingCapture2(k,direction,resMax)) capture=true; if(!capture) turn(resMax,true); board[k]=FREE; //restore resMax++; board[i]=save; board[from]=KING2; return true; } } return false; } QString ECheckers::getFieldNotation(int i, bool bottom_is_white) const { QString notation = QString(ENOTATION); if (bottom_is_white) { return notation.mid(i*2, 2).trimmed(); } else { return notation.mid(62-i*2, 2).trimmed(); } } portnov-qcheckers-b4574ed/src/echeckers.h000066400000000000000000000042651344250506500205160ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef ECHECKERS_H #define ECHECKERS_H #include "checkers.h" #include "pdn.h" class ECheckers:public Checkers { public: virtual bool go1(int,int); virtual int type() const { return ENGLISH; } virtual bool checkCapture1() const; virtual bool checkCapture2() const; virtual QString getFieldNotation(int, bool) const; protected: virtual Captures* getPossibleCapture(int) const; private: void kingMove2(int,int &); bool manCapture1(int,int,bool &); bool kingCapture1(int,int,bool &); bool manCapture2(int,int &); bool kingCapture2(int,int,int &); }; #endif portnov-qcheckers-b4574ed/src/field.cc000066400000000000000000000123121344250506500177730ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * wibix@gmx.de * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include "theme.h" #include "field.h" #include "common.h" #include "checkers.h" Field::Field(QObject* parent,int i) : QObject(parent) { pixmap = new QPixmap(128, 128); pixmap_valid = false; m_number=i; show_frame = false; m_show_label = true; setup_mode = false; m_pattern_id = 0; m_checker_id = FREE; } Field::~Field() { if (pixmap) { delete pixmap; } } void Field::beginSetup() { Q_ASSERT(! setup_mode); //qInfo("beginSetup(%d)", m_number); setup_mode = true; } void Field::endSetup() { Q_ASSERT(setup_mode); //qInfo("endSetup(%d)", m_number); setup_mode = false; } /* void Field::paintEvent(QPaintEvent*) { QPainter p(this); draw(); Q_ASSERT(pixmap_valid); p.drawPixmap(0, 0, *pixmap); p.end(); } */ /* void Field::mousePressEvent(QMouseEvent* me) { if(me->button() != Qt::LeftButton) return; emit click(m_number); } */ void Field::invalidate() { pixmap_valid = false; } void Field::draw() { if (pixmap_valid) { return; } /*if (pixmap) { delete pixmap; }*/ /*QSize mySize = size(); if (mySize.height() == 0 || mySize.width() == 0) { return; }*/ //qInfo("Draw: %d x %d", mySize.width(), mySize.height()); //pixmap = new QPixmap(128, 128); pixmap->fill(Qt::white); QPainter paint; paint.begin(pixmap); //paint.setFont(font()); if (m_pattern_id) { QPixmap& pattern = m_theme->getPattern(m_pattern_id); if (! pattern.isNull()) { paint.drawPixmap(0, 0, pattern); } } // notation paint.setPen(Qt::white); QRect not_rect = paint.boundingRect(2, 2, 0, 0, Qt::AlignLeft, m_label); QPixmap& checker = m_theme->getChecker(m_checker_id, m_bottom_is_white); if (m_show_above) { if (! checker.isNull()) paint.drawPixmap(0, 0, checker); if (m_show_label) { paint.fillRect(not_rect, Qt::black); paint.drawText(not_rect, Qt::AlignTop|Qt::AlignLeft, m_label); } } else { if (m_show_label) paint.drawText(not_rect, Qt::AlignTop|Qt::AlignLeft, m_label); if (! checker.isNull()) paint.drawPixmap(0, 0, checker); } if (show_frame) { QPixmap& frame = m_theme->getFrame(); paint.drawPixmap(0, 0, frame); } paint.end(); //update(); pixmap_valid = true; } void Field::draw(QPainter& painter, QRect rect) { m_rect = rect; draw(); Q_ASSERT(pixmap_valid); painter.drawPixmap(rect.x(), rect.y(), *pixmap); } const QRect& Field::rect() const { return m_rect; } void Field::showFrame(bool b) { if(show_frame != b) { show_frame = b; invalidate(); draw(); } } void Field::setPattern(int i) { if (i != m_pattern_id) { m_pattern_id = i; invalidate(); } } void Field::setTheme(Theme* theme) { Q_ASSERT(theme); m_theme = theme; invalidate(); draw(); } void Field::set(int item, bool bottom_is_white) { if (m_checker_id != item || m_bottom_is_white != bottom_is_white) { m_checker_id = item; m_bottom_is_white = bottom_is_white; invalidate(); } } void Field::setLabel(const QString& str) { if(m_label!=str) { m_label=str; invalidate(); } } void Field::showLabel(bool s, bool a) { if(s!=m_show_label || a!=m_show_above) { m_show_above = a; m_show_label = s; invalidate(); } } /* QSize Field::sizeHint() const { if (! m_theme) { return QSize(); } else { return QSize(m_theme->getFieldWidth(), m_theme->getFieldHeight()); } } */ /* void Field::resizeEvent(QResizeEvent* e) { invalidate(); if (e->size().width() == 0 || e->size().height() == 0) { return; } draw(); } */ portnov-qcheckers-b4574ed/src/field.h000066400000000000000000000057141344250506500176450ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef FIELD_H #define FIELD_H #include #include #include "theme.h" class Field : public QObject { Q_OBJECT public: Field(QObject*, int num); ~Field(); //QSize sizeHint() const; //void resizeEvent(QResizeEvent*); const QString& label() const { return m_label; } void setLabel(const QString&); void showLabel(bool s, bool above); void showFrame(bool); void setTheme(Theme*); void setPattern(int); void set(int, bool); int number() const { return m_number; } int width() const { const QPixmap& checker = m_theme->getMan1(true); return checker.width(); } int height() const { const QPixmap& checker = m_theme->getMan1(true); return checker.height(); } void fontUpdate() { draw(); } void beginSetup(); void endSetup(); void draw(QPainter&, QRect); void invalidate(); const QRect& rect() const; signals: void click(int); protected: //void paintEvent(QPaintEvent*); //void mousePressEvent(QMouseEvent*); private: void draw(); //void setPicture(QPixmap*); int m_number; // pixmap = pattern + label + picture + frame; /*QPixmap* m_frame; QPixmap* m_checker; QPixmap* m_pattern;*/ int m_pattern_id; int m_checker_id; bool m_bottom_is_white; QString m_label; bool m_show_label; bool m_show_above; QPixmap* pixmap; bool pixmap_valid; bool show_frame; bool setup_mode; Theme* m_theme; QRect m_rect; }; #endif portnov-qcheckers-b4574ed/src/history.cc000066400000000000000000000317061344250506500204210ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include #include #include "history.h" #include "common.h" #define COL_TAG_NR 0 // m_tags, this col is hidden. #define COL_TAG_NAME 1 #define COL_TAG_VAL 2 #define COL_MOVE_NR 0 // m_movelist #define COL_MOVE 1 #define COL_MOVE_COMM 2 myHistory::myHistory(QWidget* parent) : QFrame(parent) { //setFixedWidth(240); m_gamelist = new QComboBox(this); connect(m_gamelist, SIGNAL(activated(int)), this, SLOT(slot_game_selected(int))); m_taglist = new QTreeWidget(this); m_taglist->setColumnCount(3); m_taglist->header()->hide(); m_taglist->setColumnHidden(COL_TAG_NR, true); // m_taglist->header()->setStretchLastSection(true); // m_taglist->header()->setResizeMode(QHeaderView::Stretch); m_taglist->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); connect(m_taglist, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(slot_modify_tag(QTreeWidgetItem*, int))); m_movelist = new QTreeWidget(this); m_movelist->setColumnCount(3); m_movelist->header()->setStretchLastSection(true); //m_movelist->header()->setMovable(false); m_movelist->setRootIsDecorated(false); QStringList header; header << "#" << tr("Move") << tr("Comment"); m_movelist->setHeaderLabels(header); // connect(m_movelist, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(slot_modify_comment(QTreeWidgetItem*, int))); connect(m_movelist, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(slot_move(QTreeWidgetItem*, QTreeWidgetItem*))); // history /* gameUndo = new QAction(QIcon(":/icons/undo.svg"), tr("&Undo"), this); connect(gameUndo, SIGNAL(triggered()), m_view, SLOT(slotUndo())); gameRedo = new QAction(QIcon(":/icons/redo.svg"), tr("&Redo"), this); connect(gameRedo, SIGNAL(triggered()), m_view, SLOT(slotRedo())); gameContinue = new QAction(QIcon(":/icons/continue.svg"), tr("&Continue"), this); connect(gameContinue, SIGNAL(triggered()), m_view, SLOT(slotContinue())); */ m_mode_icon = new QLabel(this); m_mode_icon->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_undo = new QToolButton(this); m_undo->setIcon(QIcon(":/icons/undo.svg")); m_undo->setToolTip(tr("Undo")); connect(m_undo, SIGNAL(clicked()), this, SLOT(slot_undo())); m_redo = new QToolButton(this); m_redo->setIcon(QIcon(":/icons/redo.svg")); m_redo->setToolTip(tr("Redo")); connect(m_redo, SIGNAL(clicked()), this, SLOT(slot_redo())); m_cont = new QToolButton(this); m_cont->setIcon(QIcon(":/icons/continue.svg")); m_cont->setToolTip(tr("Continue")); connect(m_cont, SIGNAL(clicked()), this, SLOT(slot_continue())); m_current = new QLabel(this); QHBoxLayout* history = new QHBoxLayout(); history->addWidget(m_mode_icon); //TODO history->addStretch(); history->addWidget(m_undo); history->addWidget(m_redo); history->addWidget(m_cont); history->addStretch(); history->addWidget(m_current); // layout QVBoxLayout* vb = new QVBoxLayout(this); vb->setMargin(0); vb->addWidget(m_gamelist, 0); vb->addWidget(m_taglist, 2); vb->addWidget(m_movelist, 4); vb->addLayout(history); /* * other stuff */ m_pdn = new Pdn(); m_disable_moves = false; // m_paused = true; // little hack ensures a mode change. m_freeplace = false; set_mode(false); } myHistory::~myHistory() { delete m_pdn; } void myHistory::clear() { m_gamelist->clear(); m_pdn->clear(); m_taglist->clear(); m_movelist->clear(); } void myHistory::setTag(PdnGame::Tag tag, const QString& val) { QTreeWidgetItem* item = 0; QList item_list = m_taglist->findItems( tag_to_string(tag), Qt::MatchExactly, COL_TAG_NAME); if(item_list.count()) { if(item_list.count() == 1) item = item_list[0]; else qDebug() << __PRETTY_FUNCTION__ << "ERR"; } if(item) { item->setText(COL_TAG_VAL, val); } else { item = new QTreeWidgetItem(m_taglist); item->setText(COL_TAG_NR, QString::number(tag)); item->setText(COL_TAG_NAME, tag_to_string(tag)); item->setText(COL_TAG_VAL, val); } if(tag==PdnGame::Type) { item->setText(COL_TAG_VAL, val + " (" + typeToString(QString("%1").arg(val).toInt()) + ")"); } m_game->set(tag, val); //TODO m_taglist->resizeColumnToContents(COL_TAG_NAME); } QString myHistory::getTag(PdnGame::Tag tag) { QList item_list = m_taglist->findItems( tag_to_string(tag), Qt::MatchExactly, COL_TAG_NAME); if(item_list.count() == 1) return item_list[0]->text(COL_TAG_VAL); return ""; } QString myHistory::tag_to_string(PdnGame::Tag tag) { switch(tag) { case PdnGame::Date: return /*tr(*/"Date";//); case PdnGame::Site: return /*tr(*/"Site";//); case PdnGame::Type: return /*tr(*/"Type";//); case PdnGame::Event: return /*tr(*/"Event";//); case PdnGame::Round: return /*tr(*/"Round";//); case PdnGame::White: return /*tr(*/"White";//); case PdnGame::Black: return /*tr(*/"Black";//); case PdnGame::Result: return /*tr(*/"Result";//); } return "Site"; // FIXME } void myHistory::appendMove(const QString& text, const QString& comm) { m_disable_moves = true; QTreeWidgetItem* new_item = new QTreeWidgetItem(m_movelist); new_item->setText(COL_MOVE, text); new_item->setText(COL_MOVE_COMM, comm); int move_nr = (m_movelist->topLevelItemCount() - 2) / 2; PdnMove* m = m_game->getMove(move_nr); if(m_movelist->topLevelItemCount()%2) { m->m_second = text; m->m_comsecond = comm; } else { new_item->setText(COL_MOVE_NR, QString("%1.").arg(move_nr+1)); m->m_first = text; m->m_comfirst = comm; } m_movelist->setCurrentItem(new_item); m_movelist->scrollToItem(new_item); // TODO m_movelist->resizeColumnToContents(COL_MOVE_NR); m_disable_moves = false; } void myHistory::slot_modify_comment(QTreeWidgetItem* item, int) { if(!item || item==m_movelist->topLevelItem(0) || m_paused) return; bool ok; QString new_text = QInputDialog::getText(this, tr("Set Comment"),//FIXME tr("Comment")+":", QLineEdit::Normal, item->text(COL_MOVE_COMM), &ok); if(!ok) return; new_text.remove('{'); new_text.remove('}'); if(new_text != item->text(COL_MOVE_COMM)) { // gui item->setText(COL_MOVE_COMM, new_text); // pdn int index = m_movelist->indexOfTopLevelItem(item); PdnMove* move = m_game->getMove((index - 1) / 2); if(index%2==1) move->m_comfirst = new_text; else move->m_comsecond = new_text; } } void myHistory::slot_modify_tag(QTreeWidgetItem* item, int/* col*/) { if(!item || m_paused) return; PdnGame::Tag tag =(PdnGame::Tag)item->text(COL_TAG_NR).toUInt(); if(tag==PdnGame::Type) { return; } bool ok; QString new_text = QInputDialog::getText(this, tr("Set Tag"),//FIXME tr("Tag")+":", QLineEdit::Normal, item->text(COL_TAG_VAL), &ok); if(!ok) return; new_text.remove('"'); new_text.remove('['); new_text.remove(']'); if(new_text != item->text(COL_TAG_VAL)) { item->setText(COL_TAG_VAL, new_text); m_game->set(tag, new_text); if(tag==PdnGame::Event) m_gamelist->setItemText(m_gamelist->currentIndex(), new_text); } } bool myHistory::openPdn(const QString& filename, QString& log_text) { if(!m_pdn->open(filename, this, tr("Reading file..."), log_text)) { set_mode(false); return false; } set_mode(true); m_gamelist->clear(); m_movelist->clear(); m_taglist->clear(); QProgressDialog progress(this); progress.setModal(true); progress.setLabelText(tr("Importing games...")); progress.setRange(0, m_pdn->count()); progress.setMinimumDuration(0); for(int i=0; icount(); ++i) { if((i%10)==0) progress.setValue(i); m_gamelist->insertItem(i, m_pdn->game(i)->get(PdnGame::Event)); } slot_game_selected(0); return true; } bool myHistory::savePdn(const QString& fn) { return m_pdn->save(fn); } void myHistory::slot_game_selected(int index) { if(index>=m_pdn->count()) { qDebug() << __PRETTY_FUNCTION__ << "Index" << index << "out of range >=" << m_pdn->count(); return; } m_game = m_pdn->game(index); m_movelist->clear(); QTreeWidgetItem* root = new QTreeWidgetItem(m_movelist); for(int i=0; imovesCount(); ++i) { PdnMove* m = m_game->getMove(i); appendMove(m->m_first, m->m_comfirst); if(m->m_second.length()) appendMove(m->m_second, m->m_comsecond); } setTag(PdnGame::Site, m_game->get(PdnGame::Site)); setTag(PdnGame::Black, m_game->get(PdnGame::Black)); setTag(PdnGame::White, m_game->get(PdnGame::White)); setTag(PdnGame::Result, m_game->get(PdnGame::Result)); setTag(PdnGame::Date, m_game->get(PdnGame::Date)); setTag(PdnGame::Site, m_game->get(PdnGame::Site)); setTag(PdnGame::Type, m_game->get(PdnGame::Type)); setTag(PdnGame::Round, m_game->get(PdnGame::Round)); setTag(PdnGame::Event, m_game->get(PdnGame::Event)); // signal to view if(m_paused && !m_freeplace) { emit previewGame(m_game->get(PdnGame::Type).toInt()); } m_movelist->setCurrentItem(root); slot_move(root, 0); } void myHistory::newPdn(const QString& event, bool freeplace) { m_freeplace = freeplace; m_paused = !m_freeplace; // FIXME - needed to force view update. set_mode(m_freeplace); PdnGame* game = m_pdn->newGame(); game->set(PdnGame::Event, event); int index = m_gamelist->count(); m_gamelist->insertItem(index, event); m_gamelist->setCurrentIndex(index); slot_game_selected(index); } QString myHistory::typeToString(int type) { switch(type) { case ENGLISH: return tr("English draughts"); case RUSSIAN: return tr("Russian draughts"); }; return tr("Unknown game type"); } void myHistory::set_mode(bool paused) { if(m_paused != paused) { m_paused = paused; if(m_paused) { if(m_freeplace) { m_mode_icon->setPixmap(QPixmap(":/icons/freeplace.png")); m_mode_icon->setToolTip(tr("Free Placement Mode")); } else { m_mode_icon->setPixmap(QPixmap(":/icons/paused.svg")); m_mode_icon->setToolTip(tr("Paused Mode")); } } else { m_mode_icon->setPixmap(QPixmap(":/icons/logo.svg")); m_mode_icon->setToolTip(tr("Play Mode")); } m_gamelist->setEnabled(m_paused); //FIXME m_movelist->setEnabled(yes); emit newMode(m_paused, m_freeplace); } } void myHistory::slot_move(QTreeWidgetItem* item, QTreeWidgetItem*) { // update history buttons. bool curr_is_first = (m_movelist->topLevelItem(0) == m_movelist->currentItem()); bool curr_is_last = (m_movelist->indexOfTopLevelItem(m_movelist->currentItem()) == m_movelist->topLevelItemCount()-1); m_undo->setEnabled(!curr_is_first); m_redo->setEnabled(!curr_is_last); m_cont->setEnabled(m_paused); // process if(!item || !m_paused || m_disable_moves) return; do_moves(); } void myHistory::history_undo(bool move_backwards) { int next = m_movelist->indexOfTopLevelItem(m_movelist->currentItem()) + (move_backwards ? -1 : +1); if(next>=0 && nexttopLevelItemCount()) m_movelist->setCurrentItem(m_movelist->topLevelItem(next)); } void myHistory::do_moves() { QString moves; QTreeWidgetItem* item = m_movelist->currentItem(); for(int i=0; itopLevelItemCount(); ++i) { QTreeWidgetItem* cur = m_movelist->topLevelItem(i); moves += cur->text(COL_MOVE) + MOVE_SPLIT; if(m_movelist->topLevelItem(i)==item) break; } emit applyMoves(moves); } void myHistory::delete_moves() { int curr = m_movelist->indexOfTopLevelItem(m_movelist->currentItem()); while(m_movelist->topLevelItemCount() > curr+1) { delete m_movelist->topLevelItem( m_movelist->topLevelItemCount()-1); } } void myHistory::slot_undo() { set_mode(true); history_undo(true); do_moves(); } void myHistory::slot_redo() { set_mode(true); history_undo(false); do_moves(); } void myHistory::slot_continue() { delete_moves(); set_mode(false); } void myHistory::slotWorking(bool b) { setEnabled(!b); } portnov-qcheckers-b4574ed/src/history.h000066400000000000000000000063471344250506500202660ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _HISTORY_H_ #define _HISTORY_H_ #include #include #include #include #include #include "pdn.h" #define MOVE_SPLIT '#' class myHistory : public QFrame { Q_OBJECT public: myHistory(QWidget* parent); ~myHistory(); void newPdn(const QString& event, bool freeplace); bool openPdn(const QString& filename, QString& log_text); bool savePdn(const QString& fn); void clear(); bool isPaused() const { return m_paused; } bool isFreePlacement() const { return m_freeplace; } void setTag(PdnGame::Tag, const QString& val); QString getTag(PdnGame::Tag); void appendMove(const QString& move, const QString& comment); // FIXME - provide a function that returns who is next, black or white. int moveCount() const { return m_movelist->topLevelItemCount()-1; } static QString typeToString(int type); void setCurrent(const QString& t) { m_current->setText(t); } signals: void previewGame(int game_type); void applyMoves(const QString& moves); void newMode(bool paused, bool freeplace); public slots: void slotWorking(bool); private slots: void slot_move(QTreeWidgetItem*, QTreeWidgetItem*); void slot_game_selected(int index); void slot_modify_tag(QTreeWidgetItem* item, int col); void slot_modify_comment(QTreeWidgetItem* item, int col); void slot_undo(); void slot_redo(); void slot_continue(); private: QString tag_to_string(PdnGame::Tag); void set_mode(bool); void do_moves(); void history_undo(bool move_backwards); void delete_moves(); private: QTreeWidget* m_taglist; QTreeWidget* m_movelist; QComboBox* m_gamelist; Pdn* m_pdn; PdnGame* m_game; bool m_paused; bool m_freeplace; bool m_disable_moves; QToolButton* m_undo; QToolButton* m_redo; QToolButton* m_cont; QLabel* m_mode_icon; QLabel* m_current; }; #endif portnov-qcheckers-b4574ed/src/humanplayer.cc000066400000000000000000000064651344250506500212510ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include "humanplayer.h" #include "rcheckers.h" #include "echeckers.h" #include "pdn.h" myHumanPlayer::myHumanPlayer(const QString& name, bool white, bool second_player) : myPlayer(name, white) { selected = false; m_second = second_player; m_game = 0; } myHumanPlayer::~myHumanPlayer() { } void myHumanPlayer::yourTurn(const Checkers* g) { if(!m_game || m_game->type()!=g->type()) { delete m_game; if(g->type()==RUSSIAN) { m_game = new RCheckers(); } else { m_game = new ECheckers(); } } // synchronize m_game->fromString(g->toString(m_second)); } bool myHumanPlayer::fieldClicked(int field_num, bool* select, bool bottom_is_white, QString& errmsg) { if(m_second) { field_num = 31 - field_num; } switch(m_game->item(field_num)) { case MAN1: case KING1: { Captures* capture = m_game->getPossibleCapture(); bool must_capture = !capture->isEmpty() && !m_game->canCapture1(field_num); QString captureStr = m_game->describeCapture(bottom_is_white, capture); delete capture; if (must_capture) { errmsg = tr("You must capture. Available moves are: %1").arg(captureStr); return false; } if(!m_game->canCapture1(field_num) && !m_game->canMove1(field_num)) { errmsg = tr("This unit does not have valid moves.");//TODO better text. return false; } // Player (re)selects from = field_num; fromField = field_num; selected = true; *select = true; return true; break; } case FREE: if(!selected) { return true; } if (!go(field_num)) { errmsg = tr("This unit cannot be moved to field you pointed."); return false; // incorrect course } // move done - unselect if(selected) { *select = false; } selected = false; emit moveDone(m_game->toString(m_second)); break; default: break; } return true; } bool myHumanPlayer::go(int to) { return m_game->go1(from, to); } portnov-qcheckers-b4574ed/src/humanplayer.h000066400000000000000000000043141344250506500211020ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _HUMANPLAYER_H_ #define _HUMANPLAYER_H_ #include "player.h" #include class myHumanPlayer : public myPlayer { Q_OBJECT public: // when playing player vs. player on same computer. the second // player must invert some things. myHumanPlayer(const QString& name, bool white, bool second_player); ~myHumanPlayer(); virtual void yourTurn(const Checkers* game); virtual bool fieldClicked(int fieldnumber, bool*, bool, QString& err_msg); virtual void stop() {} virtual bool isHuman() const { return true; } public slots: // virtual void getReady() { emit readyToPlay(); } private: bool go(int fieldnumber); private: bool m_second; Checkers* m_game; bool selected; int from; // on Checkers board int fromField; // on GUI board }; #endif portnov-qcheckers-b4574ed/src/main.cc000066400000000000000000000054601344250506500176420ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include //#include #include "toplevel.h" #include "common.h" int main(int argc, char *argv[]) { QApplication app(argc,argv); QString current_lang = QLocale::system().name().split("_").front(); QString qt_lang_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath); QString qcheckers_share_path = PREFIX"/share/qcheckers/lang"; qDebug() << "Your Locale:" << current_lang << endl << "QCheckers Prefix path:" << PREFIX << endl << "QT Translations path:" << qt_lang_path << endl; // Qt translations QTranslator qt_tr; if(qt_tr.load("qt_" + current_lang, qt_lang_path)) { app.installTranslator(&qt_tr); } else { qDebug() << "Loading Qt translations failed."; } // App translations QTranslator app_tr; if(app_tr.load("qcheckers_" + current_lang, qcheckers_share_path)) { app.installTranslator(&app_tr); } else { qDebug() << "Loading QCheckers translations failed."; } myTopLevel* top = new myTopLevel(); top->show(); // command line if(app.arguments().length()==2) { top->open(app.arguments()[1]); } int exit = app.exec(); delete top; return exit; } portnov-qcheckers-b4574ed/src/newgamedlg.cc000066400000000000000000000206611344250506500210300ustar00rootroot00000000000000// Version: $Id $ /*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include "newgamedlg.h" #include "pdn.h" #include "common.h" #include "history.h" #include "player.h" #define BEGINNER 2 #define NOVICE 4 #define AVERAGE 6 #define GOOD 7 #define EXPERT 8 #define MASTER 9 #define CFG_SKILL CFG_KEY"Skill" #define CFG_RULES CFG_KEY"Rules" #define CFG_WHITE CFG_KEY"White" #define CFG_PLAYER1 CFG_KEY"Player1" #define CFG_PLAYER2 CFG_KEY"Player2" myNewGameDlg::myNewGameDlg(QWidget* parent) : QDialog(parent) { setModal(true); setWindowTitle(tr("New Game")+QString(" - "APPNAME)); /* * buttons, options. */ start_button = new QPushButton(tr("&Start"), this); start_button->setDefault(true); connect(start_button, SIGNAL(clicked()), this, SLOT(slot_start())); QPushButton* cn = new QPushButton(tr("&Cancel"), this); connect(cn, SIGNAL(clicked()), this, SLOT(slot_reject())); // TODO - better text m_freeplace = new QCheckBox(tr("Free Men Placement"), this); QHBoxLayout* buttons_layout = new QHBoxLayout(); buttons_layout->addWidget(m_freeplace); buttons_layout->addStretch(); buttons_layout->addWidget(start_button); buttons_layout->addWidget(cn); /* * global layout. */ QHBoxLayout* players_layout = new QHBoxLayout(); players_layout->addWidget(create_player_one()); players_layout->addWidget(create_player_two()); QVBoxLayout* global_layout = new QVBoxLayout(this); global_layout->addLayout(players_layout); global_layout->addLayout(buttons_layout); } myNewGameDlg::~myNewGameDlg() { } QWidget* myNewGameDlg::create_human_options() { QFrame* frm = new QFrame(); QVBoxLayout* frm_layout = new QVBoxLayout(frm); frm_layout->addWidget(new QLabel("No options available.")); frm_layout->addStretch(); return frm; } QWidget* myNewGameDlg::create_player_one() { m_player_one.box = new QGroupBox(tr("Player One"), this); // name m_player_one.name = new QLineEdit(m_player_one.box); // rules group box m_player_one.rules = new QGroupBox(tr("Rules"), m_player_one.box); m_player_one.rule_english = new QRadioButton( myHistory::typeToString(ENGLISH), m_player_one.rules); m_player_one.rule_russian = new QRadioButton( myHistory::typeToString(RUSSIAN), m_player_one.rules); QVBoxLayout* rules_layout = new QVBoxLayout(m_player_one.rules); rules_layout->addWidget(m_player_one.rule_english); rules_layout->addWidget(m_player_one.rule_russian); // play white men? m_player_one.white = new QCheckBox(tr("White"), m_player_one.box); // layout QVBoxLayout* vb1_layout = new QVBoxLayout(m_player_one.box); vb1_layout->addWidget(m_player_one.name); vb1_layout->addWidget(m_player_one.rules); vb1_layout->addWidget(m_player_one.white); return m_player_one.box; } QWidget* myNewGameDlg::create_player_two() { m_player_two.box = new QGroupBox(tr("Player Two"), this); // name m_player_two.name = new QLineEdit(m_player_two.box); // options m_player_two.options = new QTabWidget(m_player_two.box); m_player_two.options->insertTab(COMPUTER, create_computer_options(), tr("Computer")); m_player_two.options->insertTab(HUMAN, create_human_options(), tr("Human")); connect(m_player_two.options, SIGNAL(currentChanged(int)), this, SLOT(slot_game(int))); /* * frame layout */ QVBoxLayout* frm_layout = new QVBoxLayout(m_player_two.box); frm_layout->addWidget(m_player_two.name); frm_layout->addWidget(m_player_two.options); return m_player_two.box; } QWidget* myNewGameDlg::create_computer_options() { QFrame* frm = new QFrame(); // skills QGroupBox* skills = new QGroupBox(tr("Skill"), frm); m_player_two.computer.skills[BEGINNER] = new QRadioButton(tr("Beginner"), skills); m_player_two.computer.skills[NOVICE] = new QRadioButton(tr("Novice"), skills); m_player_two.computer.skills[AVERAGE] = new QRadioButton(tr("Average"), skills); m_player_two.computer.skills[GOOD] = new QRadioButton(tr("Good"), skills); m_player_two.computer.skills[EXPERT] = new QRadioButton(tr("Expert"), skills); m_player_two.computer.skills[MASTER] = new QRadioButton(tr("Master"), skills); QGridLayout* skills_layout = new QGridLayout(skills); int row = 0; int col = 0; foreach(QRadioButton* rb, m_player_two.computer.skills) { skills_layout->addWidget(rb, row++, col); connect(rb, SIGNAL(clicked()), this, SLOT(slot_skills())); if(row > 2) { row = 0; col = 1; } } // layout QHBoxLayout* frm_layout = new QHBoxLayout(frm); frm_layout->addWidget(skills); return frm; } void myNewGameDlg::slot_reject() { reject(); } void myNewGameDlg::slot_start() { accept(); } void myNewGameDlg::slot_skills() { QRadioButton* skill = 0; foreach(QRadioButton* rb, m_player_two.computer.skills) { if(rb->isChecked()) { skill = rb; break; } } if(skill) m_player_two.name->setText("*"+skill->text()+"*"); } void myNewGameDlg::slot_game_start(int id) { slot_game(id); slot_start(); } void myNewGameDlg::slot_game(int id) { start_button->setEnabled(true); m_player_one.box->setEnabled(true); m_player_two.options->setEnabled(true); if(m_player_two.last_game_index==HUMAN) { m_cfg_player2 = m_player_two.name->text(); } m_player_two.last_game_index = id; switch(id) { case COMPUTER: m_player_two.name->setReadOnly(true); slot_skills(); m_player_one.rules->setEnabled(true); m_player_one.white->setEnabled(true); break; case HUMAN: m_player_two.name->setReadOnly(false); m_player_two.name->setText(m_cfg_player2); m_player_one.rules->setEnabled(true); m_player_one.white->setEnabled(true); break; default: qDebug() << __PRETTY_FUNCTION__ << "ERR"; break; } } void myNewGameDlg::writeSettings(QSettings* cfg) { cfg->setValue(CFG_SKILL, skill()); cfg->setValue(CFG_RULES, rules()); cfg->setValue(CFG_WHITE, m_player_one.white->isChecked()); cfg->setValue(CFG_PLAYER1, m_player_one.name->text()); cfg->setValue(CFG_PLAYER2, m_cfg_player2); } void myNewGameDlg::readSettings(QSettings* cfg) { int skills = cfg->value(CFG_SKILL, BEGINNER).toInt(); QMap::iterator it; it = m_player_two.computer.skills.find(skills); if(it != m_player_two.computer.skills.end()) { it.value()->setChecked(true); } else { m_player_two.computer.skills[BEGINNER]->setChecked(true); } slot_skills(); int rules = cfg->value(CFG_RULES, ENGLISH).toInt(); if(rules == ENGLISH) { m_player_one.rule_english->setChecked(true); } else { m_player_one.rule_russian->setChecked(true); } m_player_one.white->setChecked(cfg->value(CFG_WHITE, false).toBool()); m_player_one.name->setText(cfg->value(CFG_PLAYER1, getenv("USER")).toString()); m_cfg_player2 = cfg->value(CFG_PLAYER2, "Player2").toString(); } int myNewGameDlg::skill() const { QMap::const_iterator it; it = m_player_two.computer.skills.begin(); for(; it!=m_player_two.computer.skills.end(); ++it) { if(it.value()->isChecked()) { return it.key(); } } qDebug() << __PRETTY_FUNCTION__ << "No skill selected."; return BEGINNER; } int myNewGameDlg::rules() const { if(m_player_one.rule_english->isChecked()) { return ENGLISH; } return RUSSIAN; } portnov-qcheckers-b4574ed/src/newgamedlg.h000066400000000000000000000064021344250506500206670ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _NEWGAMEDLG_H_ #define _NEWGAMEDLG_H_ #include #include #include #include #include #include #include #include #include #include #define COMPUTER 0 #define HUMAN 1 class myPlayer; class myNewGameDlg : public QDialog { Q_OBJECT public: myNewGameDlg(QWidget* parent); ~myNewGameDlg(); // playing against the computer int rules() const; // return HUMAN/COMPUTER int opponent() const { return m_player_two.options->currentIndex(); } // int skill() const; // bool freePlacement() const { return m_freeplace->isChecked(); } // const QString name() const { return m_player_one.name->text(); } bool isWhite() const { return m_player_one.white->isChecked(); } const QString opponentName() const { return m_player_two.name->text(); } // for settings void writeSettings(QSettings*); void readSettings(QSettings*); private slots: void slot_game(int id); // ListWidget void slot_game_start(int id); void slot_skills(); void slot_reject(); void slot_start(); private: QWidget* create_player_one(); QWidget* create_player_two(); QWidget* create_human_options(); QWidget* create_computer_options(); private: struct player_one_struct { QGroupBox* box; QLineEdit* name; QGroupBox* rules; QRadioButton* rule_english; QRadioButton* rule_russian; QCheckBox* white; }; struct player_one_struct m_player_one; struct player_two_struct { QGroupBox* box; QLineEdit* name; int last_game_index; QTabWidget* options; // human options // computer options struct computer_stuct { QMap skills; }; struct computer_stuct computer; }; struct player_two_struct m_player_two; QCheckBox* m_freeplace; QPushButton* start_button; QString m_cfg_player2; }; #endif portnov-qcheckers-b4574ed/src/pdn.cc000066400000000000000000000312751344250506500175020ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include "checkers.h" #include "pdn.h" #define PLAYER true #define COMPUTER false #define END_OF_MOVELINE "@." Pdn::Pdn() { } Pdn::~Pdn() { qDeleteAll(m_database); m_database.clear(); } bool Pdn::open(const QString& filename, QWidget* parent, const QString& label, QString& text_to_log) { qDeleteAll(m_database); m_database.clear(); QFile file(filename); if(!file.open(QFile::ReadOnly)) { return false; } QTextStream ts(&file); QString str1, str2; QProgressDialog progress(parent); progress.setModal(true); progress.setLabelText(label); progress.setRange(0, file.size()); progress.setMinimumDuration(0); unsigned int line_nr = 1; unsigned int game_started = 1; bool in_tags = false; while(!ts.atEnd()) { str1 = ts.readLine().trimmed(); if(ts.atEnd()) { str2 += str1; } if((str1.length() && str1[0]=='[') || ts.atEnd()) { if(!in_tags) { // tags begin again, so a game is ended. if(str2.length()) { if((m_database.count()%10)==0) { progress.setValue(file.pos()); } QString log_txt; PdnGame* game = new PdnGame(str2, log_txt); m_database.append(game); if(log_txt.length()) { text_to_log += QString("%1. game begins at line %2:\n") .arg(m_database.count()) .arg(game_started); text_to_log += log_txt; } game_started = line_nr; str2=""; } in_tags = true; } } else { if(in_tags) { in_tags = false; } } str2.append(str1+"\n"); if(progress.wasCanceled()) { break; } line_nr++; } file.close(); return true; } bool Pdn::save(const QString& filename) { QFile file(filename); if(!file.open(QFile::WriteOnly)) { return false; } QTextStream ts(&file); foreach(PdnGame* game, m_database) { ts << game->toString() << endl << endl; } file.close(); return true; } PdnGame* Pdn::newGame() { QString log_txt; // here: ignore TODO PdnGame* game = new PdnGame("", log_txt); m_database.append(game); return game; } /*************************************************************************** * * * * ***************************************************************************/ PdnMove::PdnMove(QString line) { if(line[0]=='{') { qDebug("a move must not begin with a comment."); return; } // first move. m_first = line.section(' ', 0, 0); line = line.mid(m_first.length()).trimmed(); // check for a first comment. if(line[0]=='{') { int end = line.indexOf('}', 1); if(end>=0) { m_comfirst = line.mid(1, end-1); line.remove(0, end+1); line = line.trimmed(); } else { qDebug("no comment ending of the first comment."); } } // second move. m_second = line.section(' ', 0, 0); line = line.mid(m_second.length()).trimmed(); // check for a second comment. if(line[0]=='{') { int end = line.indexOf('}', 1); if(end>=0) { m_comsecond = line.mid(1, end-1); } else { qDebug("no comment ending of the second comment."); } } } /*************************************************************************** * * * * ***************************************************************************/ PdnGame::PdnGame(const QString& game_string, QString& log_txt) { white = PLAYER; for(int i=0; i<12; i++) { board[i]=MAN2; } for(int i=20; i<32; i++) { board[i]=MAN1; } if(!parse(game_string, log_txt)) { qDebug(" errors occured while processing game."); // TODO } } PdnGame::~PdnGame() { qDeleteAll(m_moves); m_moves.clear(); } QString PdnGame::get(Tag tag) const { switch(tag) { case Date: return pdnDate; case Site: return pdnSite; case Type: return pdnType; case Event: return pdnEvent; case Round: return pdnRound; case White: return pdnWhite; case Black: return pdnBlack; default: return pdnResult; } } void PdnGame::set(Tag tag, const QString& string) { switch(tag) { case Date: pdnDate=string; break; case Site: pdnSite=string; break; case Type: pdnType=string; break; case Event: pdnEvent=string; break; case Round: pdnRound=string; break; case White: pdnWhite=string; break; case Black: pdnBlack=string; break; default: pdnResult=string; } } bool PdnGame::parse_moves(const QString& line) { qDeleteAll(m_moves); m_moves.clear(); QStringList list = line.split(' '); QString current_move; int move_num = 0; bool in_comment = false; foreach(QString str, list) { if(str.startsWith("{")) { in_comment = true; } if(str.endsWith("}")) { in_comment = false; } if(str.endsWith(".") && !in_comment) { if(str!=END_OF_MOVELINE) { if((move_num+1) != str.mid(0, str.length()-1).toInt()) { qDebug() << "Move num expected:" << move_num+1 << "received:" << str; return false; } move_num++; } current_move = current_move.trimmed(); if(current_move.length()) { m_moves.append(new PdnMove(current_move)); current_move = ""; } continue; } if(str.isEmpty()) { current_move += " "; } else { current_move += str + " "; } } return true; } bool PdnGame::parse(const QString& pdngame, QString& log_txt) { QString fen; QString moves; int num = pdngame.count("\n"); // Number of lines for(int i=0; i<=num; i++) { QString line = pdngame.section('\n',i ,i); if(!line.length()) { continue; } if(line.startsWith("[")) { line.remove(0, 1); line = line.trimmed(); if(line.startsWith("GameType")) { pdnType=line.section('"',1,1); } else if(line.startsWith("FEN")) { fen=line.section('"',1,1); } else if(line.startsWith("Date")) { pdnDate=line.section('"',1,1); } else if(line.startsWith("Site")) { pdnSite=line.section('"',1,1); } else if(line.startsWith("Event")) { pdnEvent=line.section('"',1,1); } else if(line.startsWith("Round")) { pdnRound=line.section('"',1,1); } else if(line.startsWith("White")) { pdnWhite=line.section('"',1,1); } else if(line.startsWith("Black")) { pdnBlack=line.section('"',1,1); } else if(line.startsWith("Result")) { pdnResult=line.section('"',1,1); } else { ; // Skip other unsupported tags } } else { moves += " " + line; } } // parse move section. if(moves.endsWith(pdnResult)) { moves.truncate(moves.length()-pdnResult.length()); } else { log_txt += " +Different result at the end of the movelist:\n" + QString(" \"%1\" expected, got \"%2\"\n") .arg(pdnResult) .arg(moves.right(pdnResult.length())); // need to remove the incorrect result. if(moves.endsWith(" *")) { log_txt += " => Ignoring \" *\" from the end.\n"; moves.truncate(moves.length()-2); } else { int pos = moves.lastIndexOf('-') - 1; bool skip_ws = true; for(int i=pos; i>=0; i--) { if(moves[i]==' ') { if(!skip_ws) { log_txt += " => Ignoring \"" + moves.right(moves.length()-i-1) + "\" from the end.\n", moves.truncate(i+1); break; } } else { skip_ws = false; } } } } if(!parse_moves(moves+" "END_OF_MOVELINE)) { // :) log_txt += "\n +parsing moves failed."; return false; } // Translation of the GameType tag switch(pdnType.toInt()) { case ENGLISH: case RUSSIAN: break; default: // log_txt += "\n +setting game type to english."; pdnType.setNum(ENGLISH); break; } // Parsing of the Forsyth-Edwards Notation (FEN) tag if(fen.isNull()) { return true; } fen=fen.trimmed(); for(int i=fen.indexOf(" "); i!=-1; i=fen.indexOf(" ")) { fen=fen.remove(i,1); } if(fen.startsWith("W:W")) { white=PLAYER; } else if(fen.startsWith("B:W")) { white=COMPUTER; } else { return false; } QString string = fen.mid(3).section(":B",0,0); if(!parse(string, white)) { return false; } string=fen.section(":B",1,1); if(string.endsWith(".")) { string.truncate(string.length()-1); } if(!parse(string, !white)) { return false; } return true; } bool PdnGame::parse(const QString& str, bool side) { QString notation; if(pdnType.toInt() == ENGLISH) { notation=QString(ENOTATION); } else { notation=QString(RNOTATION); } QStringList sections = str.split(","); foreach(QString pos, sections) { bool king=false; if(pos.startsWith("K")) { pos=pos.remove(0,1); king=true; } if(pos.length()==1) { pos.append(' '); } if(pos.length()!=2) { return false; } int index = notation.indexOf(pos); if(index%2) { index=notation.indexOf(pos,index+1); } if(index == -1) { return false; } if(white==COMPUTER) { index=62-index; } if(side==PLAYER) { board[index/2]=(king ? KING1 : MAN1); } else { board[index/2]=(king ? KING2 : MAN2); } } return true; } PdnMove* PdnGame::getMove(int i) { if(im_moves.count()) { qDebug("PdnGame::getMove(%u) m_moves.count()=%u", i, m_moves.count()); } PdnMove* m = new PdnMove(""); m_moves.append(m); return m; } QString PdnGame::toString() { QString fen; QString moves; /* * fen */ if(!movesCount()) { qDebug("FEN tag with lots of errors."); QString string1; QString string2; QString notation; if(pdnType.toInt() == ENGLISH) { notation=QString(ENOTATION); } else { notation=QString(RNOTATION); } for(int i=0; i<32; i++) { int index=i*2; if(white==COMPUTER) { index=62-index; } QString pos; switch(board[i]) { case KING1: pos.append('K'); case MAN1: pos.append(notation.mid(index,2).trimmed()); if(string1.length()) { string1.append(','); } string1.append(pos); break; case KING2: pos.append('K'); case MAN2: pos.append(notation.mid(index,2).trimmed()); if(string2.length()) { string2.append(','); } string2.append(pos); default: break; } } if(white==PLAYER) { fen.append("W:W"+string1+":B"+string2+"."); } else { fen.append("B:W"+string2+":B"+string1+"."); } } /* * moves */ unsigned int count = 1; foreach(PdnMove* move, m_moves) { moves += QString("%1. %2 %3%4%5\n") .arg(count) .arg(move->m_first) .arg(move->m_comfirst.length() ? "{"+move->m_comfirst+"} " : "") .arg(move->m_second) .arg(move->m_comsecond.length() ? " {"+move->m_comsecond+"}" : ""); count++; } /* * create format and write tags+fen+moves. */ QString str; if(pdnEvent.length()) { str.append("[Event \""+pdnEvent+"\"]\n"); } if(pdnSite.length()) { str.append("[Site \"" +pdnSite +"\"]\n"); } if(pdnDate.length()) { str.append("[Date \"" +pdnDate +"\"]\n"); } if(pdnRound.length()) { str.append("[Round \""+pdnRound+"\"]\n"); } if(pdnWhite.length()) { str.append("[White \""+pdnWhite+"\"]\n"); } if(pdnBlack.length()) { str.append("[Black \""+pdnBlack+"\"]\n"); } if(fen.length()) { str.append("[SetUp \"1\"]\n"); str.append("[FEN \""+fen+"\"]\n\n"); } str.append("[Result \""+pdnResult+"\"]\n"); str.append("[GameType \""+pdnType+"\"]\n"); str.append(moves); str.append(pdnResult+"\n"); return str; } portnov-qcheckers-b4574ed/src/pdn.h000066400000000000000000000072051344250506500173400ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2007 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef PDN_H #define PDN_H #include #include #define ENOTATION "1 2 3 4 5 6 7 8 9 1011121314151617181920212223242526272829303132" //#define ENOTATION "32313029282726252423222120191817161514131211109 8 7 6 5 4 3 2 1 " #define RNOTATION "B8D8F8H8A7C7E7G7B6D6F6H6A5C5E5G5B4D4F4H4A3C3E3G3B2D2F2H2A1C1E1G1" #define ENGLISH 21 #define RUSSIAN 25 class PdnMove; class PdnGame; // Portable Draughts Notation Format File parser class Pdn { public: Pdn(); virtual ~Pdn(); int count() const { return m_database.count(); } PdnGame* game(int i) { return m_database.at(i); } PdnGame* newGame(); void clear() { m_database.clear(); } // parent is needed to display a progress dialog. bool open(const QString& filename, QWidget* parent, const QString& label, QString& text_to_log); bool save(const QString& filename); private: QList m_database; }; /* * m_first, m_second are mandatary. * comments are optional. */ class PdnMove { public: PdnMove(QString whole_line_of_move); QString m_first, m_comfirst; QString m_second, m_comsecond; }; /* * represents each game in a pdn-file. */ class PdnGame { public: PdnGame(const QString& game_string, QString& text_to_log); ~PdnGame(); enum Tag { Date, Site, Type, Event, Round, White, Black,Result }; int item(int i) const { return board[i]; } void setItem(int i, int set) { board[i]=set; } bool isWhite() const { return white; } void setWhite(bool set) { white=set; } void set(Tag tag, const QString& string); QString get(Tag tag) const; int movesCount() const { return m_moves.count(); } PdnMove* getMove(int i); PdnMove* addMove(); void clearMoves() { m_moves.clear(); } QString toString(); private: bool parse(const QString& game_string, QString& log_txt); bool parse(const QString& string, bool side); bool parse_moves(const QString& moves_line); private: bool white; int board[32]; QString pdnDate; QString pdnSite; QString pdnType; QString pdnEvent; QString pdnRound; QString pdnWhite; QString pdnBlack; QString pdnResult; QList m_moves; }; #endif portnov-qcheckers-b4574ed/src/player.h000066400000000000000000000052611344250506500200530ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 by Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _PLAYER_H_ #define _PLAYER_H_ #include class Checkers; class Field; class myPlayer : public QObject { Q_OBJECT public: myPlayer(const QString& name, bool white) : m_name(name), m_white(white), m_opponent(0) {} // information bool isWhite() const { return m_white; } void setWhite(bool b) { m_white = b; } // const QString& name() const { return m_name; } void setName(const QString& n) { m_name = n; } // virtual bool isHuman() const { return false; } // virtual void yourTurn(const Checkers* game) = 0; // return false on incorrect course. // set select to true to select the select, or unselect. // QString contains error msg. virtual bool fieldClicked(int, bool*, bool, QString&) { return true; } // computerplayer terminates his thinking thread. // humanplayer // networkplayer disconnects from the server. virtual void stop() = 0; void setOpponent(myPlayer* o) { m_opponent=o; } myPlayer* opponent() const { return m_opponent; } signals: // emitted when move is done, provides the complete board converted to // string. void moveDone(const QString&); private: QString m_name; bool m_white; myPlayer* m_opponent; }; #endif portnov-qcheckers-b4574ed/src/rcheckers.cc000066400000000000000000000366331344250506500206750ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ // // Russian Checkers #include "rcheckers.h" /////////////////////////////////////////////////// // // Player Functions // /////////////////////////////////////////////////// bool RCheckers::go1(int from,int field) { from=internal(from); field=internal(field); to=field; if(checkCapture1()) { bool capture=false; switch(board[from]) { case MAN1: if(manCapture1(from,UL,capture)) return true; if(manCapture1(from,UR,capture)) return true; if(manCapture1(from,DL,capture)) return true; if(manCapture1(from,DR,capture)) return true; return false; case KING1: if(kingCapture1(from,UL,capture)) return true; if(kingCapture1(from,UR,capture)) return true; if(kingCapture1(from,DL,capture)) return true; if(kingCapture1(from,DR,capture)) return true; return false; } } else { switch(board[from]) { case MAN1: if((to==(from-6))||(to==(from-5))) { board[from]=FREE; if(to<10) board[to]=KING1; else board[to]=MAN1; return true; } return false; case KING1: for(int i=from-6;;i-=6) { if(i==to) { board[from]=FREE; board[to]=KING1; return true; } else if(board[i]==FREE) continue; else break; } for(int i=from-5;;i-=5) { if(i==to) { board[from]=FREE; board[to]=KING1; return true; } else if(board[i]==FREE) continue; else break; } for(int i=from+5;;i+=5) { if(i==to) { board[from]=FREE; board[to]=KING1; return true; } else if(board[i]==FREE) continue; else break; } for(int i=from+6;;i+=6) { if(i==to) { board[from]=FREE; board[to]=KING1; return true; } else if(board[i]==FREE) continue; else break; } return false; } } return false; } bool RCheckers::checkCapture1() const { for(int i=6;i<48;i++) { Captures* captures = getPossibleCapture(i); bool result = ! captures->isEmpty(); delete captures; if (result) { return true; } } return false; } Captures* RCheckers::getPossibleCapture(int i) const { switch(board[i]) { case MAN1: if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return new Captures(i, i-6, i-12); if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return new Captures(i, i-5, i-10); if(board[i+5]==MAN2 || board[i+5]==KING2) if(board[i+10]==FREE) return new Captures(i, i+5, i+10); if(board[i+6]==MAN2 || board[i+6]==KING2) if(board[i+12]==FREE) return new Captures(i, i+6, i+12); break; case KING1: int k; for(k=i-6;board[k]==FREE;k-=6); if(board[k]==MAN2 || board[k]==KING2) if(board[k-6]==FREE) return new Captures(i, k, k-6); for(k=i-5;board[k]==FREE;k-=5); if(board[k]==MAN2 || board[k]==KING2) if(board[k-5]==FREE) return new Captures(i, k, k-5); for(k=i+5;board[k]==FREE;k+=5); if(board[k]==MAN2 || board[k]==KING2) if(board[k+5]==FREE) return new Captures(i, k, k+5); for(k=i+6;board[k]==FREE;k+=6); if(board[k]==MAN2 || board[k]==KING2) if(board[k+6]==FREE) return new Captures(i, k, k+6); } return new Captures(); } /* ORIG func aw bool RCheckers::checkCapture1() { for(int i=6;i<48;i++) { switch(board[i]) { case MAN1: if(board[i-6]==MAN2 || board[i-6]==KING2) if(board[i-12]==FREE) return true; if(board[i-5]==MAN2 || board[i-5]==KING2) if(board[i-10]==FREE) return true; if(board[i+5]==MAN2 || board[i+5]==KING2) if(board[i+10]==FREE) return true; if(board[i+6]==MAN2 || board[i+6]==KING2) if(board[i+12]==FREE) return true; break; case KING1: int k; for(k=i-6;board[k]==FREE;k-=6); if(board[k]==MAN2 || board[k]==KING2) if(board[k-6]==FREE) return true; for(k=i-5;board[k]==FREE;k-=5); if(board[k]==MAN2 || board[k]==KING2) if(board[k-5]==FREE) return true; for(k=i+5;board[k]==FREE;k+=5); if(board[k]==MAN2 || board[k]==KING2) if(board[k+5]==FREE) return true; for(k=i+6;board[k]==FREE;k+=6); if(board[k]==MAN2 || board[k]==KING2) if(board[k+6]==FREE) return true; } } return false; } */ // Return TRUE if a course of the player true // Return FALSE if a course of the player incorrect bool RCheckers::manCapture1(int from,int direction,bool &capture) { int i=from+direction; if(board[i]==MAN2 || board[i]==KING2) { int k=i+direction; if(board[k]==FREE) { bool next=false; int save=board[i]; board[from]=FREE; board[i]=NONE; if(k<10) { board[k]=KING1; if(kingCapture1(k,direction+11,next)) { board[i]=FREE; return true; } } else { board[k]=MAN1; if(direction==UL || direction==DR) { if(manCapture1(k,UR,next)) {board[i]=FREE;return true;} if(manCapture1(k,DL,next)) {board[i]=FREE;return true;} } else { if(manCapture1(k,UL,next)) {board[i]=FREE;return true;} if(manCapture1(k,DR,next)) {board[i]=FREE;return true;} } if(manCapture1(k,direction,next)) {board[i]=FREE;return true;} } if((!next) && k==to) {board[i]=FREE;return true;} board[k]=FREE; board[i]=save; board[from]=MAN1; capture=true; } } return false; } bool RCheckers::kingCapture1(int from,int direction,bool &capture) { int i; for(i=from+direction;board[i]==FREE;i+=direction); if(board[i]==MAN2 || board[i]==KING2) { int k=i+direction; if(board[k]==FREE) { bool next=false; int save=board[i]; board[from]=FREE; board[i]=NONE; for(;board[k]==FREE;k+=direction) { board[k]=KING1; if(direction==UL || direction==DR) { if(kingCapture1(k,UR,next)) {board[i]=FREE;return true;} if(kingCapture1(k,DL,next)) {board[i]=FREE;return true;} } else { if(kingCapture1(k,UL,next)) {board[i]=FREE;return true;} if(kingCapture1(k,DR,next)) {board[i]=FREE;return true;} } board[k]=FREE; } board[k-=direction]=KING1; if(kingCapture1(k,direction,next)) {board[i]=FREE;return true;} board[k]=FREE; if(!next) for(;k!=i;k-=direction) if(k==to) {board[i]=FREE;board[k]=KING1;return true;} board[i]=save; board[from]=KING1; capture=true; } } return false; } //////////////////////////////////////////////////// // // Computer Functions // //////////////////////////////////////////////////// void RCheckers::kingMove2(int from,int &resMax) { board[from]=FREE; for(int i=from-6;board[i]==FREE;i-=6) { board[i]=KING2; turn(resMax); board[i]=FREE; } for(int i=from-5;board[i]==FREE;i-=5) { board[i]=KING2; turn(resMax); board[i]=FREE; } for(int i=from+5;board[i]==FREE;i+=5) { board[i]=KING2; turn(resMax); board[i]=FREE; } for(int i=from+6;board[i]==FREE;i+=6) { board[i]=KING2; turn(resMax); board[i]=FREE; } board[from]=KING2; } bool RCheckers::checkCapture2() const { for(int i=6;i<48;i++) { switch(board[i]) { case MAN2: if(board[i-6]==MAN1 || board[i-6]==KING1) if(board[i-12]==FREE) return true; if(board[i-5]==MAN1 || board[i-5]==KING1) if(board[i-10]==FREE) return true; if(board[i+5]==MAN1 || board[i+5]==KING1) if(board[i+10]==FREE) return true; if(board[i+6]==MAN1 || board[i+6]==KING1) if(board[i+12]==FREE) return true; break; case KING2: int k; for(k=i-6;board[k]==FREE;k-=6); if(board[k]==MAN1 || board[k]==KING1) if(board[k-6]==FREE) return true; for(k=i-5;board[k]==FREE;k-=5); if(board[k]==MAN1 || board[k]==KING1) if(board[k-5]==FREE) return true; for(k=i+5;board[k]==FREE;k+=5); if(board[k]==MAN1 || board[k]==KING1) if(board[k+5]==FREE) return true; for(k=i+6;board[k]==FREE;k+=6); if(board[k]==MAN1 || board[k]==KING1) if(board[k+6]==FREE) return true; } } return false; } // Return TRUE if it is possible to capture // Return FALSE if it is impossible to capture bool RCheckers::manCapture2(int from,int &resMax) { bool capture=false; int i=from-6; if(board[i]==MAN1 || board[i]==KING1) { int k=from-12; if(board[k]==FREE) { int save=board[i]; board[from]=FREE; board[i]=NONE; board[k]=MAN2; resMax--; if(!manCapture2(k,resMax)) turn(resMax,true); resMax++; board[k]=FREE; board[i]=save; board[from]=MAN2; capture=true; } } i=from-5; if(board[i]==MAN1 || board[i]==KING1) { int k=from-10; if(board[k]==FREE) { int save=board[i]; board[from]=FREE; board[i]=NONE; board[k]=MAN2; resMax--; if(!manCapture2(k,resMax)) turn(resMax,true); resMax++; board[k]=FREE; board[i]=save; board[from]=MAN2; capture=true; } } i=from+5; if(board[i]==MAN1 || board[i]==KING1) { int k=from+10; if(board[k]==FREE) { int save=board[i]; board[from]=FREE; board[i]=NONE; resMax--; if(from>32) { board[k]=KING2; if(!kingCapture2(k,UL,resMax)) turn(resMax,true); } else { board[k]=MAN2; if(!manCapture2(k,resMax)) turn(resMax,true); } resMax++; board[k]=FREE; board[i]=save; board[from]=MAN2; capture=true; } } i=from+6; if(board[i]==MAN1 || board[i]==KING1) { int k=from+12; if(board[k]==FREE) { int save=board[i]; board[from]=FREE; board[i]=NONE; resMax--; if(from>32) { board[k]=KING2; if(!kingCapture2(k,UR,resMax)) turn(resMax,true); } else { board[k]=MAN2; if(!manCapture2(k,resMax)) turn(resMax,true); } resMax++; board[k]=FREE; board[i]=save; board[from]=MAN2; capture=true; } } if(capture) return true; return false; } bool RCheckers::kingCapture2(int from,int direction,int &resMax) { int i; for(i=from+direction;board[i]==FREE;i+=direction); if(board[i]==MAN1 || board[i]==KING1) { int k=i+direction; if(board[k]==FREE) { bool capture=false; int save=board[i]; board[from]=FREE; board[i]=NONE; resMax--; for(;board[k]==FREE;k+=direction) { board[k]=KING2; if(direction==UL || direction==DR) { if(kingCapture2(k,UR,resMax)) capture=true; if(kingCapture2(k,DL,resMax)) capture=true; } else { if(kingCapture2(k,UL,resMax)) capture=true; if(kingCapture2(k,DR,resMax)) capture=true; } board[k]=FREE; } board[k-=direction]=KING2; if(kingCapture2(k,direction,resMax)) capture=true; board[k]=FREE; if(!capture) for(;k!=i;k-=direction) { board[k]=KING2; turn(resMax,true); board[k]=FREE; } resMax++; board[i]=save; board[from]=KING2; return true; } } return false; } QString RCheckers::getFieldNotation(int i, bool bottom_is_white) const { QString notation = QString(RNOTATION); if (bottom_is_white) { return notation.mid(i*2, 2).trimmed(); } else { return notation.mid(62-i*2, 2).trimmed(); } } portnov-qcheckers-b4574ed/src/rcheckers.h000066400000000000000000000042711344250506500205300ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef RCHECKERS_H #define RCHECKERS_H #include "checkers.h" #include "pdn.h" class RCheckers:public Checkers { public: virtual bool go1(int,int); virtual int type() const { return RUSSIAN; } virtual bool checkCapture1() const; virtual bool checkCapture2() const; virtual QString getFieldNotation(int, bool) const; protected: virtual Captures* getPossibleCapture(int) const; private: void kingMove2(int,int &); bool manCapture1(int,int,bool &); bool kingCapture1(int,int,bool &); bool manCapture2(int,int &); bool kingCapture2(int,int,int &); }; #endif portnov-qcheckers-b4574ed/src/src.pro000066400000000000000000000025371344250506500177220ustar00rootroot00000000000000TEMPLATE= app TARGET = qcheckers CONFIG += qt warn_on debug isEmpty(PREFIX) { PREFIX = /usr/local } DEFINES += PREFIX=\\\"$$PREFIX\\\" QT += widgets svg HEADERS = pdn.h \ checkers.h echeckers.h rcheckers.h \ capture.h theme.h field.h toplevel.h view.h history.h board.h \ newgamedlg.h \ common.h \ player.h humanplayer.h computerplayer.h SOURCES = pdn.cc \ checkers.cc echeckers.cc rcheckers.cc \ capture.cc theme.cc field.cc toplevel.cc view.cc history.cc board.cc \ main.cc \ newgamedlg.cc \ humanplayer.cc computerplayer.cc RESOURCES = ../qcheckers.qrc ../icons.qrc # prefix can be set in common.h #PREFIX = $$system(sh ../helpers/extract_prefix.sh) message(PREFIX: $$PREFIX) TRANSLATIONS = ../lang/qcheckers_de.ts ../lang/qcheckers_fr.ts ../lang/qcheckers_ru.ts target.path = $$PREFIX/bin INSTALLS += target #DESTDIR = /usr/local #message(Destdir: $$DESTDIR) # # This hack is needed for i18n support. # share.path += $$PREFIX/share/qcheckers share.files += qcheckers.pdn ../COPYING ../AUTHORS ../ChangeLog ../README ../themes ../lang INSTALLS += share # Install desktop entry desktop.path += $$PREFIX/share/applications desktop.files += ../qcheckers.desktop INSTALLS += desktop # Install icon icon.path += $$PREFIX/share/icons/hicolor/scalable/apps icon.files += ../qcheckers.svg INSTALLS += icon portnov-qcheckers-b4574ed/src/theme.cc000066400000000000000000000161721344250506500200220ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * wibix@gmx.de * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include #include #include "theme.h" #include "common.h" #include "checkers.h" Theme::Theme(QObject* parent, const QString& path, int size) : QObject(parent) { m_path = path; settings = new QSettings(path + "/"THEME_FILE, QSettings::IniFormat, this); qInfo("Theme: %s\n", qUtf8Printable(name())); if (path == DEFAULT_THEME) { // just in case no themes installed. m_pat1_path = ":/icons/theme/tile1.png"; m_pat2_path = ":/icons/theme/tile2.png"; m_frame_path = ":/icons/theme/frame.png"; m_man_black_path = ":/icons/theme/manblack.png"; m_man_white_path = ":/icons/theme/manwhite.png"; m_king_black_path = ":/icons/theme/kingblack.png"; m_king_white_path = ":/icons/theme/kingwhite.png"; } else { m_pat1_path = path+"/" + settings->value("tile1", THEME_TILE1).toString(); m_pat2_path = path+"/" + settings->value("tile2", THEME_TILE2).toString(); m_frame_path = path+"/" + settings->value("frame", THEME_FRAME).toString(); m_man_black_path = path+"/" + settings->value("man_black", THEME_MANBLACK).toString(); m_man_white_path = path+"/" + settings->value("man_white", THEME_MANWHITE).toString(); m_king_black_path = path+"/" + settings->value("king_black", THEME_KINGBLACK).toString(); m_king_white_path = path+"/" + settings->value("king_white", THEME_KINGWHITE).toString(); } m_target_size = size; //m_target_size = size == 0 ? MAX_TILE_SIZE : size; reset(); } void Theme::reset() { m_man_white_valid = false; m_man_black_valid = false; m_king_black_valid = false; m_king_white_valid = false; m_pattern1_valid = false; m_pattern2_valid = false; m_frame_valid = false; } bool Theme::isValid() { if (m_path == DEFAULT_THEME) { return true; } else { if (! QFileInfo::exists(m_pat1_path) || ! QFileInfo::exists(m_pat2_path) || ! QFileInfo::exists(m_frame_path) || ! QFileInfo::exists(m_man_black_path) || ! QFileInfo::exists(m_man_white_path) || ! QFileInfo::exists(m_king_white_path) || ! QFileInfo::exists(m_king_black_path)) { qWarning("one of required files does not exist. "); return false; } return true; } } const QString Theme::name() { QFileInfo info(m_path); return settings->value("name", info.baseName()).toString(); } QPixmap& Theme::getFrame() { render(m_frame_path, m_frame, m_frame_valid); return m_frame; } QPixmap& Theme::getPattern1() { render(m_pat1_path, m_pattern1, m_pattern1_valid); return m_pattern1; } QPixmap& Theme::getPattern2() { render(m_pat2_path, m_pattern2, m_pattern2_valid); return m_pattern2; } QPixmap& Theme::getPattern(int i) { if (i == 1) { return getPattern1(); } else { return getPattern2(); } } QPixmap& Theme::getMan1(bool white) { if (white) { render(m_man_white_path, m_man_white, m_man_white_valid); return m_man_white; } else { render(m_man_black_path, m_man_black, m_man_black_valid); return m_man_black; } } QPixmap& Theme::getMan2(bool white) { if (! white) { render(m_man_white_path, m_man_white, m_man_white_valid); return m_man_white; } else { render(m_man_black_path, m_man_black, m_man_black_valid); return m_man_black; } } QPixmap& Theme::getKing1(bool white) { if (white) { render(m_king_white_path, m_king_white, m_king_white_valid); return m_king_white; } else { render(m_king_black_path, m_king_black, m_king_black_valid); return m_king_black; } } QPixmap& Theme::getKing2(bool white) { if (! white) { render(m_king_white_path, m_king_white, m_king_white_valid); return m_king_white; } else { render(m_king_black_path, m_king_black, m_king_black_valid); return m_king_black; } } QPixmap& Theme::getChecker(int item, bool white) { switch (item) { case MAN1: return getMan1(white); case MAN2: return getMan2(white); case KING1: return getKing1(white); case KING2: return getKing2(white); default: return m_empty_pixmap; } } int Theme::getFieldWidth() { render(m_man_white_path, m_man_white, m_man_white_valid); int result = m_man_white.width(); return result; //return result == 0 ? MAX_TILE_SIZE : result; } int Theme::getFieldHeight() { render(m_man_white_path, m_man_white, m_man_white_valid); int result = m_man_white.height(); return result; //return result == 0 ? MAX_TILE_SIZE : result; } void Theme::setTargetSize(int size) { /*if (size == 0) { size = MAX_TILE_SIZE; qInfo("Size is 0, set it to %d", size); }*/ if (m_target_size != size) { qInfo("Size: %d -> %d", m_target_size, size); m_target_size = size; // reset cached pixmaps, // so that they will be re-rendered reset(); } } bool Theme::getIsResizeable() { // FIXME return m_man_white_path.endsWith(".svg"); } void Theme::render(const QString& path, QPixmap& result, bool& valid) { if (valid) { //qDebug("Already valid: %s", qUtf8Printable(path)); return; } int size = m_target_size; valid = true; if (path.endsWith(".svg")) { QSvgRenderer renderer(path); if (size == 0) { size = renderer.defaultSize().width(); } qInfo("Rendering %s: %d", qUtf8Printable(path), size); Q_ASSERT(size > 0); result = QPixmap(size, size); result.fill(Qt::transparent); QPainter paint(&result); renderer.render(&paint); } else { qInfo("Rendering %s: %d", qUtf8Printable(path), size); if (size == 0) { result = QPixmap(path); } else { Q_ASSERT(size > 0); result = QPixmap(path).scaled(size, size); } } } portnov-qcheckers-b4574ed/src/theme.h000066400000000000000000000054051344250506500176610ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.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. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef THEME_H #define THEME_H #include #include class Theme : public QObject { Q_OBJECT public: Theme(QObject*, const QString&, int); QPixmap& getMan1(bool); QPixmap& getMan2(bool); QPixmap& getKing1(bool); QPixmap& getKing2(bool); QPixmap& getChecker(int, bool); QPixmap& getPattern1(); QPixmap& getPattern2(); QPixmap& getPattern(int); QPixmap& getFrame(); void setTargetSize(int); int getFieldWidth(); int getFieldHeight(); bool getIsResizeable(); bool isValid(); void reset(); const QString name(); private: void render(const QString&, QPixmap& result, bool&); QSettings* settings; QString m_path; int m_target_size; QString m_man_white_path; QString m_man_black_path; QString m_king_white_path; QString m_king_black_path; QString m_pat1_path; QString m_pat2_path; QString m_frame_path; QPixmap m_man_white; bool m_man_white_valid; QPixmap m_man_black; bool m_man_black_valid; QPixmap m_king_white; bool m_king_white_valid; QPixmap m_king_black; bool m_king_black_valid; QPixmap m_pattern1; bool m_pattern1_valid; QPixmap m_pattern2; bool m_pattern2_valid; QPixmap m_frame; bool m_frame_valid; QPixmap m_empty_pixmap; }; #endif portnov-qcheckers-b4574ed/src/toplevel.cc000066400000000000000000000371221344250506500205500ustar00rootroot00000000000000// Version: $Id$ /*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include "pdn.h" #include "toplevel.h" #include "newgamedlg.h" #include "history.h" #include "view.h" #include "common.h" #define CFG_THEME_PATH CFG_KEY"ThemePath" #define CFG_FILENAME CFG_KEY"Filename" #define CFG_KEEPDIALOG CFG_KEY"ShowKeepDialog" #define CFG_NOTATION CFG_KEY"Notation" #define CFG_NOT_ABOVE CFG_KEY"NotationAbove" #define CFG_NOT_FONT CFG_KEY"NotationFont" #define CFG_CLEAR_LOG CFG_KEY"ClearLogOnNewRound" #define CFG_GEOMETRY CFG_KEY"WindowGeometry" #define CFG_STATE CFG_KEY"WindowState" myTopLevel::myTopLevel() { setWindowTitle(APPNAME); setWindowIcon(QIcon(":/icons/logo.svg")); m_newgame = new myNewGameDlg(this); make_central_widget(); make_docks(); make_actions(); restore_settings(); /* * new computer game. */ m_view->newGame(m_newgame->rules(), m_newgame->freePlacement(), m_newgame->name(), m_newgame->isWhite(), m_newgame->opponent(), m_newgame->opponentName(), m_newgame->skill()); if(layout()) { //layout()->setSizeConstraint(QLayout::SetFixedSize); } } void myTopLevel::make_docks() { m_history = new myHistory(this); connect(m_history, SIGNAL(previewGame(int)), m_view, SLOT(slot_preview_game(int))); connect(m_history, SIGNAL(applyMoves(const QString&)), m_view, SLOT(slot_apply_moves(const QString&))); connect(m_history, SIGNAL(newMode(bool, bool)), m_view, SLOT(slot_new_mode(bool, bool))); connect(m_view, SIGNAL(working(bool)), m_history, SLOT(slotWorking(bool))); m_history_dock = make_dock("history", tr("History"), Qt::RightDockWidgetArea, m_history); m_log = new QTextEdit(this); //m_log->setFixedHeight(100); //FIXME m_log->setReadOnly(true); m_log_dock = make_dock("log", tr("Log"), Qt::BottomDockWidgetArea, m_log); } QDockWidget* myTopLevel::make_dock(const QString& name, const QString& title, Qt::DockWidgetArea area, QWidget* widget) { QDockWidget* dock = new QDockWidget(title, this); dock->setAllowedAreas(Qt::AllDockWidgetAreas); dock->setWidget(widget); dock->setObjectName(name); addDockWidget(area, dock); return dock; } void myTopLevel::make_actions() { // game menu actions gameNew = new QAction(QIcon(":/icons/logo.svg"), tr("&New..."), this); gameNew->setShortcut(tr("CTRL+N", "File|New")); connect(gameNew, SIGNAL(triggered()), this, SLOT(slot_new_game())); gameNextRound = new QAction(QIcon(":/icons/next.svg"), tr("&Next Round"), this); connect(gameNextRound, SIGNAL(triggered()), this, SLOT(slot_next_round())); gameStop = new QAction(QIcon(":/icons/stop.svg"), tr("&Stop"), this); connect(gameStop, SIGNAL(triggered()), m_view, SLOT(slotStopGame())); gameOpen = new QAction(QIcon(":/icons/fileopen.svg"), tr("&Open..."), this); gameOpen->setShortcut(tr("CTRL+O", "File|Open")); connect(gameOpen, SIGNAL(triggered()), this, SLOT(slot_open_game())); gameSave = new QAction(QIcon(":/icons/filesave.svg"), tr("&Save..."), this); gameSave->setShortcut(tr("CTRL+S", "File|Save")); connect(gameSave, SIGNAL(triggered()), this, SLOT(slot_save_game())); QAction* gameQuit = new QAction(QIcon(":/icons/exit.svg"), tr("&Quit"), this); gameQuit->setShortcut(tr("CTRL+Q", "File|Quit")); connect(gameQuit, SIGNAL(triggered()), this, SLOT(close())); // QApplication::instance(), SLOT(quit())); // view menu actions viewNotation = new QAction(tr("&Show Notation"), this); viewNotation->setCheckable(true); connect(viewNotation, SIGNAL(toggled(bool)), this, SLOT(slot_notation(bool))); viewNotationAbove = new QAction(tr("Show notation &above men"), this); viewNotationAbove->setCheckable(true); connect(viewNotationAbove, SIGNAL(toggled(bool)), this, SLOT(slot_notation(bool))); // settings menu settingsKeep = new QAction(tr("&Confirm aborting current game"), this); settingsKeep->setCheckable(true); // settingsClearLog = new QAction(tr("Clear &log on new round"), this); settingsClearLog->setCheckable(true); connect(settingsClearLog, SIGNAL(toggled(bool)), m_view, SLOT(slotClearLog(bool))); // QAction* settingsNotationFont = new QAction(tr("&Notation font..."), this); connect(settingsNotationFont, SIGNAL(triggered()), this, SLOT(slot_notation_font())); // help menu actions QAction* helpRules = new QAction(tr("&Rules of Play"), this); helpRules->setShortcut(tr("F1", "Help|Help")); connect(helpRules, SIGNAL(triggered()), this, SLOT(slot_help())); QAction* helpAbout = new QAction(QIcon(":/icons/logo.svg"), tr("&About")+" "APPNAME, this); connect(helpAbout, SIGNAL(triggered()), this, SLOT(slot_about())); QAction* helpAboutQt = new QAction(tr("About &Qt"), this); connect(helpAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); /* * toolbar */ QToolBar* tb = addToolBar(tr("&Toolbar")); tb->setMovable(false); tb->addAction(gameNew); tb->addAction(gameOpen); tb->addAction(gameSave); tb->addSeparator(); tb->addAction(gameNextRound); tb->addAction(gameStop); /* * menus */ QMenu* gameMenu = menuBar()->addMenu(myTopLevel::tr("&Game")); gameMenu->addAction(gameNew); gameMenu->addAction(gameOpen); gameMenu->addAction(gameSave); gameMenu->addSeparator(); gameMenu->addAction(gameNextRound); gameMenu->addAction(gameStop); gameMenu->addSeparator(); gameMenu->addAction(gameQuit); viewMenu = menuBar()->addMenu(tr("&View")); viewMenu->addAction(tb->toggleViewAction()); viewMenu->addSeparator(); viewMenu->addAction(viewNotation); viewMenu->addAction(viewNotationAbove); viewMenu->addAction(m_history_dock->toggleViewAction()); viewMenu->addAction(m_log_dock->toggleViewAction()); QMenu* settingsMenu = menuBar()->addMenu(tr("&Settings")); settingsMenu->addAction(settingsKeep); settingsMenu->addSeparator(); settingsMenu->addAction(settingsNotationFont); settingsMenu->addSeparator(); settingsMenu->addAction(settingsClearLog); QMenu* helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(helpRules); helpMenu->addSeparator(); helpMenu->addAction(helpAbout); helpMenu->addAction(helpAboutQt); /* * THEMES. create a default theme. */ QActionGroup* themes_grp = new QActionGroup(this); themes_grp->setExclusive(true); QAction* default_theme = new QAction(tr(DEFAULT_THEME), themes_grp); default_theme->setCheckable(true); m_themes[default_theme] = DEFAULT_THEME; default_theme->setChecked(true); set_theme(default_theme);//FIXME TODO themes_grp->addAction(default_theme); viewMenu->addSeparator(); viewMenu->addAction(default_theme); read_themes(themes_grp, viewMenu,QDir::homePath()+"/"USER_PATH"/"THEME_DIR); //TODO-hardcoded read_themes(themes_grp, viewMenu, PREFIX"/share/qcheckers/"THEME_DIR); connect(themes_grp, SIGNAL(triggered(QAction*)), this, SLOT(set_theme(QAction*))); } void myTopLevel::read_themes(QActionGroup* menu_grp, QMenu* menu, const QString& path) { QDir sharedir(path); QStringList themes = sharedir.entryList(QDir::Dirs|QDir::Readable); themes.removeAll("."); themes.removeAll(".."); for(QStringList::iterator it=themes.begin(); it!=themes.end(); ++it) { sharedir.cd(*it); QString theme_dir = sharedir.absolutePath(); qInfo("Check: %s", qUtf8Printable(theme_dir)); Theme* theme = new Theme(this, theme_dir, 0); if (! theme->isValid()) { qWarning() << "Theme in " << sharedir.absolutePath() << " is invalid"; } else { QString themename = theme->name(); QAction* action = new QAction(themename, this); menu_grp->addAction(action); menu->addAction(action); action->setCheckable(true); m_themes[action] = theme_dir; } sharedir.cdUp(); } } void myTopLevel::restore_settings() { QSettings cfg(APPNAME, APPNAME); QString theme_path = cfg.value(CFG_THEME_PATH, DEFAULT_THEME) .toString(); for(myThemeMap::iterator it = m_themes.begin(); it!=m_themes.end(); it++) { if(it.value() == theme_path) { it.key()->setChecked(true); set_theme(it.key()); break; } } filename = cfg.value(CFG_FILENAME).toString(); viewNotation->setChecked(cfg.value(CFG_NOTATION, false).toBool()); viewNotationAbove->setChecked(cfg.value(CFG_NOT_ABOVE, true).toBool()); slot_notation(true); // here: arg is ignored by the function bool clear_log = cfg.value(CFG_CLEAR_LOG, true).toBool(); settingsClearLog->setChecked(clear_log); m_view->slotClearLog(clear_log); // settingsKeep->setChecked(cfg.value(CFG_KEEPDIALOG, true).toBool()); QFont cfont; if(cfont.fromString(cfg.value(CFG_NOT_FONT, "").toString())) m_view->setNotationFont(cfont); // new game m_newgame->readSettings(&cfg); restoreGeometry(cfg.value(CFG_GEOMETRY).toByteArray()); restoreState(cfg.value(CFG_STATE).toByteArray()); } void myTopLevel::make_central_widget() { m_view = new myView(this); connect(m_view, SIGNAL(working(bool)), this, SLOT(slot_working(bool))); setCentralWidget(m_view); } void myTopLevel::warning(const QString& text) { QMessageBox::warning(this, tr("Error")+" - "APPNAME, text); } void myTopLevel::information(const QString& caption, const QString& text) { QDialog* dlg = new QDialog(this); dlg->setModal(true); dlg->setWindowTitle(caption+" - "APPNAME); // logo left QLabel* logo = new QLabel(dlg); logo->setPixmap(QPixmap(":/icons/dialog.png")); // text editor QTextEdit* te = new QTextEdit(text, dlg); te->setReadOnly(true); te->setMinimumWidth(m_view->width()-100); te->setMinimumHeight(m_view->height()-200); // close button QPushButton* button = new QPushButton(tr("&Close"), dlg); connect(button, SIGNAL(clicked()), dlg, SLOT(accept())); // Layout. QHBoxLayout* hb = new QHBoxLayout(); hb->addWidget(logo, 0, Qt::AlignTop); hb->addWidget(te, 1); QHBoxLayout* hb_button = new QHBoxLayout(); hb_button->addStretch(); hb_button->addWidget(button); QVBoxLayout* vb = new QVBoxLayout(dlg); vb->addLayout(hb, 1); vb->addSpacing(5); vb->addLayout(hb_button); // go dlg->exec(); delete dlg; } myHistory* myTopLevel::get_history() const { return m_history; } void myTopLevel::clear_log() { m_log->clear(); } void myTopLevel::append_log(const QString& text) { m_log->append(text); m_log->ensureCursorVisible(); } void myTopLevel::slot_save_game() { QString fn = QFileDialog::getSaveFileName(this, tr("Save Game")+" - "APPNAME, filename, "PDN Files (*."EXT")"); if(!fn.isEmpty()) { if(fn.right(3)!=EXT) { fn += "."EXT; } if(m_view->savePdn(fn)) { filename = fn; } else { warning(tr("Could not save: ")+filename); } } } void myTopLevel::slot_open_game() { QString fn = QFileDialog::getOpenFileName(this, tr("Open Game")+" - "APPNAME, filename, "PDN Files (*."EXT")"); if(!fn.isEmpty()) { open(fn); } } void myTopLevel::open(const QString& fn) { if(m_view->openPdn(fn)) { filename = fn; } } void myTopLevel::closeEvent(QCloseEvent* e) { if(!keep_game()) { store_settings(); e->accept(); } else { e->ignore(); } } void myTopLevel::store_settings() { QSettings config(APPNAME, APPNAME); for(myThemeMap::iterator it=m_themes.begin(); it!=m_themes.end(); it++) { if(it.key()->isChecked()) { config.setValue(CFG_THEME_PATH, it.value()); break; } } config.setValue(CFG_FILENAME, filename); config.setValue(CFG_NOTATION, viewNotation->isChecked()); config.setValue(CFG_NOT_ABOVE, viewNotationAbove->isChecked()); config.setValue(CFG_KEEPDIALOG, settingsKeep->isChecked()); config.setValue(CFG_NOT_FONT, m_view->notationFont().toString()); config.setValue(CFG_CLEAR_LOG, settingsClearLog->isChecked()); // new game m_newgame->writeSettings(&config); config.setValue(CFG_GEOMETRY, saveGeometry()); config.setValue(CFG_STATE, saveState()); } void myTopLevel::set_theme(QAction* action) { QString path = m_themes[action]; m_view->setTheme(path); } void myTopLevel::slot_help() { QString text = tr("

In the beginning of game you have 12 checkers (men). " "The men move forward only. The men can capture:" "

    " "
  • by jumping forward only (english rules);" "
  • by jumping forward or backward (russian rules)." "
" "

A man which reaches the far side of the board becomes a king. " "The kings move forward or backward:" "

    " "
  • to one square only (english rules);" "
  • to any number of squares (russian rules)." "
" "

The kings capture by jumping forward or backward. " "Whenever a player is able to make a capture he must do so."); information(tr("Rules of Play"), text); } void myTopLevel::slot_about() { QString text = APPNAME", a board game.
Version "VERSION"

" COPYRIGHT"
" ""HOMEPAGE"

" "Contributors:
"CONTRIBS"

" "This program is distributed under the terms " "of the GNU General Public License."; information(tr("About"), text); } void myTopLevel::slot_new_game() { if(keep_game()) return; if(m_newgame->exec()==QDialog::Accepted) { m_view->newGame(m_newgame->rules(), m_newgame->freePlacement(), m_newgame->name(), m_newgame->isWhite(), m_newgame->opponent(), m_newgame->opponentName(), m_newgame->skill()); } } void myTopLevel::slot_working(bool working) { bool disable = !working; gameNew->setEnabled(disable); gameSave->setEnabled(disable); gameNextRound->setEnabled(disable);// FIXME !m_view->isAborted()); gameOpen->setEnabled(disable); gameStop->setEnabled(!disable); m_view->setEnabled(disable); } bool myTopLevel::keep_game() { if(!settingsKeep->isChecked() || m_view->isAborted()) { return false; } int answer = QMessageBox::question(this, tr("Abort Game?")+" - "APPNAME, tr("Current game will be lost if you continue.\n" "Do you really want to discard it?"), QMessageBox::Yes, QMessageBox::No); if(answer == QMessageBox::Yes) { return false; } return true; } void myTopLevel::slot_next_round() { if(!keep_game()) { m_view->slotNextRound(); } } void myTopLevel::slot_notation_font() { bool ok; QFont font = QFontDialog::getFont(&ok, m_view->notationFont(), this); if(ok) { m_view->setNotationFont(font); } } void myTopLevel::slot_notation(bool) { m_view->setNotation(viewNotation->isChecked(), viewNotationAbove->isChecked()); } portnov-qcheckers-b4574ed/src/toplevel.h000066400000000000000000000064101344250506500204060ustar00rootroot00000000000000// Version: $Id $ /*************************************************************************** * Copyright (C) 2002-2003 Andi Peredri * * andi@ukr.net * * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _TOPLEVEL_H_ #define _TOPLEVEL_H_ #include #include #include #include #include "history.h" class myView; class myNewGameDlg; class myTopLevel : public QMainWindow { Q_OBJECT public: myTopLevel(); void open(const QString& filename); myHistory* get_history() const; void clear_log(); void append_log(const QString&); protected: void closeEvent(QCloseEvent*); private slots: void slot_help(); void slot_about(); void slot_new_game(); void slot_open_game(); void slot_save_game(); void slot_next_round(); void slot_notation(bool); void slot_notation_font(); void slot_working(bool); void set_theme(QAction*); void warning(const QString& text); private: void make_actions(); void make_central_widget(); void restore_settings(); void store_settings(); void make_docks(); QDockWidget* make_dock(const QString&, const QString&, Qt::DockWidgetArea, QWidget*); // add themes to this menu. void read_themes(QActionGroup*, QMenu*, const QString& path); void information(const QString& caption, const QString& text); // returns true if the user wishes to keep current game bool keep_game(); private: QMenu* viewMenu; // QAction* gameNew; QAction* gameStop; QAction* gameOpen; QAction* gameSave; QAction* gameNextRound; // QAction* viewNotation; QAction* viewNotationAbove; // QAction* settingsKeep; QAction* settingsClearLog; QString filename; // PDN File Name myView* m_view; myNewGameDlg* m_newgame; myHistory* m_history; QTextEdit* m_log; QDockWidget* m_history_dock; QDockWidget* m_log_dock; typedef QMap myThemeMap; myThemeMap m_themes; }; #endif portnov-qcheckers-b4574ed/src/view.cc000066400000000000000000000321661344250506500176730ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include #include #include #include #include "pdn.h" #include "echeckers.h" #include "rcheckers.h" #include "view.h" #include "common.h" #include "history.h" #include "newgamedlg.h" #include "toplevel.h" #include "player.h" #include "humanplayer.h" #include "computerplayer.h" #define MAX_CMD_LEN 80 #define MOVE_PAUSE 1000 // this class is used to note differencies between moves. class myDiff { public: myDiff(int pos, int from, int to) : m_pos(pos), m_from(from), m_to(to) {} int m_pos; int m_from; int m_to; }; myView::myView(myTopLevel* parent) : QFrame(parent) { m_toplevel = parent; /* * board & info */ m_board = new myBoard(this); connect(m_board, SIGNAL(fieldClicked(int)), this, SLOT(slot_click(int))); /* * it's the final layout. */ QVBoxLayout* vb = new QVBoxLayout(this); vb->addWidget(m_board); //vb->setSizeConstraint(QLayout::SetFixedSize); /* * game init */ m_player = m_current = 0; } myView::~myView() { if(m_player) { delete m_player; delete m_player->opponent(); } } void myView::setEnabled(bool b) { m_board->setEnabled(b); if(b) setCursor(Qt::ArrowCursor); // should be m_board bound. else setCursor(Qt::WaitCursor); } void myView::setTheme(const QString& path) { m_board->setTheme(path, m_player ? m_player->isWhite() : true); //m_toplevel->get_history()->setFixedHeight(m_board->height()); } void myView::newGame(int rules, bool freeplace, const QString& name, bool is_white, int opponent, const QString& opp_name, int skill) { m_freeplace_from = -1; if(m_player) { delete m_player; delete m_player->opponent(); } m_board->setColorWhite(is_white); // create players myPlayer* plr = new myHumanPlayer(name, is_white, false); myPlayer* opp = 0; if(opponent==HUMAN) opp = new myHumanPlayer(opp_name, !is_white, true); else opp = new myComputerPlayer(opp_name, !is_white, skill); emit working(true); /* * set up player stuff. slots/signals. */ m_player = plr; plr->setOpponent(opp); opp->setOpponent(plr); plr->disconnect(); opp->disconnect(); connect(plr, SIGNAL(moveDone(const QString&)), this, SLOT(slot_move_done(const QString&))); connect(opp, SIGNAL(moveDone(const QString&)), this, SLOT(slot_move_done(const QString&))); /* * create game board. */ m_board->setGame(rules); m_board->reset(); m_toplevel->get_history()->clear(); begin_game(1, freeplace); } void myView::begin_game(unsigned int round, bool freeplace) { if(m_clear_log) m_toplevel->clear_log(); m_board->adjustNotation(m_player->isWhite()); myHistory* history = m_toplevel->get_history(); history->newPdn(APPNAME" Game", freeplace); history->setTag(PdnGame::Type, QString::number(m_board->type())); history->setTag(PdnGame::Date, QDate::currentDate().toString("yyyy.MM.dd")); history->setTag(PdnGame::Result, "*"); history->setTag(PdnGame::Round, QString::number(round)); /* * go! */ myPlayer* last_player = get_first_player()->opponent(); m_game_over = false; m_aborted = false; m_current = last_player; // setup names if(m_player->isWhite()) { history->setTag(PdnGame::White, m_player->name()); history->setTag(PdnGame::Black, m_player->opponent()->name()); } else { history->setTag(PdnGame::White, m_player->opponent()->name()); history->setTag(PdnGame::Black, m_player->name()); } if(history->isFreePlacement()) emit working(false); else slot_move_done(m_board->game()->toString(false)); } bool myView::check_game_over() { if(m_game_over) // no further checks return true; m_game_over = true; bool player_can = m_board->game()->checkMove1() || m_board->game()->checkCapture1(); bool opp_can = m_board->game()->checkMove2() || m_board->game()->checkCapture2(); // player cannot go but opponent can -> player lost. if(/*FIXME*/m_player==m_current && !player_can && opp_can) { you_won(false); return m_game_over; } // player can go but opponent cannot -> player won. if(/*FIXME*/m_player!=m_current && player_can && !opp_can) { you_won(true); return m_game_over; } // neither of the player can go -> draw. if(!player_can && !opp_can) { add_log(myView::System, tr("Drawn game.")); m_toplevel->get_history()->setTag(PdnGame::Result, "1/2-1/2"); return m_game_over; } m_game_over = false; return m_game_over; } void myView::slot_click(int field_num) { if(m_game_over || m_aborted) return; myHistory* history = m_toplevel->get_history(); if(history->isPaused()) { if(history->isFreePlacement()) { // FIXME - hightlight fields if(m_freeplace_from < 0) { m_freeplace_from = field_num; m_board->selectField(field_num, true); } else { m_board->selectField(m_freeplace_from, false); m_board->doFreeMove(m_freeplace_from, field_num); m_freeplace_from = -1; } } } else { bool select = false; QString err_msg; if(!m_current->fieldClicked(field_num, &select, m_player->isWhite(), err_msg)) { add_log(myView::Warning, m_current->name()+": " + (err_msg.length() ? err_msg : tr("Invalid move."))); } else { m_board->selectField(field_num, select); } } } void myView::slotNextRound() { if(m_aborted) return; m_player->setWhite(!m_player->isWhite()); m_player->opponent()->setWhite(!m_player->isWhite()); m_board->setColorWhite(m_player->isWhite()); m_board->reset(); myHistory* history = m_toplevel->get_history(); unsigned int round = history->getTag(PdnGame::Round).toUInt() + 1; begin_game(round, history->isFreePlacement()); } void myView::slotStopGame() { m_player->stop(); m_player->opponent()->stop(); } void myView::stop_game(const QString& msg) { m_game_over = true; m_aborted = true; QString text(tr("Game aborted.")+(!msg.isEmpty() ? "\n"+msg : "")); add_log(myView::System, text); emit working(false); } void myView::slot_move_done(const QString& board_str) { myHistory* history = m_toplevel->get_history(); if (history->isPaused()) // FIXME - ??? return; perform_jumps(m_board->game()->toString(false), board_str); // show who is next? m_current = m_current->opponent(); history->setCurrent(m_current->name()); if(!m_current->isHuman()) { emit working(true); } else { emit working(false); } if(m_current->opponent()->isHuman() && !m_current->isHuman()) QTimer::singleShot(MOVE_PAUSE, this, SLOT(slot_move_done_step_two())); else slot_move_done_step_two(); } void myView::slot_move_done_step_two() { // m_current->yourTurn(m_board->game()); if(check_game_over()) emit working(false); } void myView::you_won(bool yes) { myHistory* history = m_toplevel->get_history(); if(yes&&m_player->isWhite() || !yes&&!m_player->isWhite()) { history->setTag(PdnGame::Result, "1-0"); // white wins add_log(myView::System, tr("White wins!")); } else { history->setTag(PdnGame::Result, "0-1"); // black wins add_log(myView::System, tr("Black wins!")); } emit working(false); } bool myView::openPdn(const QString& fn) { emit working(false); m_current->stop(); QString log_text; if(!m_toplevel->get_history()->openPdn(fn, log_text)) { return false; } if(log_text.length()) { add_log(myView::System, tr("Opened:")+" "+fn); add_log(myView::Error, log_text.trimmed()); add_log(myView::Warning, tr("Warning! Some errors occured.")); } return true; } bool myView::savePdn(const QString& fn) { if(!m_toplevel->get_history()->savePdn(fn)) { qDebug() << __PRETTY_FUNCTION__ << "failed."; return false; } add_log(myView::System, tr("Saved:")+" "+fn); return true; } void myView::slot_new_mode(bool paused, bool freeplace) { if(paused) { if(freeplace) m_board->setCursor(Qt::PointingHandCursor); else m_board->setCursor(Qt::ForbiddenCursor); } else { m_board->setCursor(Qt::ArrowCursor); } // resume game: ask info for who is next, black or white.XXX FIXME TODO if(!paused) { myPlayer* next = 0; if(m_toplevel->get_history()->moveCount()%2==0) next = get_first_player(); else next = get_first_player()->opponent(); m_current = next->opponent(); slot_move_done(m_board->game()->toString(false)); } } void myView::slot_preview_game(int rules) { if(rules!=RUSSIAN && rules!=ENGLISH) { qDebug() << __PRETTY_FUNCTION__ << rules << "Wrong game type."; return; } m_board->setGame(rules); myHistory* history = m_toplevel->get_history(); if(m_player->isWhite() && rules==RUSSIAN) { m_player->setName(history->getTag(PdnGame::White)); m_player->opponent()->setName(history->getTag(PdnGame::Black)); } else { m_player->setName(history->getTag(PdnGame::Black)); m_player->opponent()->setName(history->getTag(PdnGame::White)); } // FIXME m_player->setWhite(rules==RUSSIAN);// FIXME TODO m_player->opponent()->setWhite(!m_player->isWhite()); m_board->setColorWhite(m_player->isWhite()); m_board->adjustNotation(m_player->isWhite()); } void myView::slot_apply_moves(const QString& moves) { QStringList move_list= moves.split(MOVE_SPLIT, QString::SkipEmptyParts); m_board->reset(); bool white_player = get_first_player()->isWhite(); foreach(QString move, move_list) { m_board->doMove(move, white_player); white_player = !white_player; } // set current player who pulls next. assume is white. m_current = (m_player->isWhite() ? m_player : m_player->opponent()); if(!white_player) m_current = m_current->opponent(); m_toplevel->get_history()->setCurrent(m_current->name()); } void myView::add_log(enum LogType type, const QString& text) { QString str = text; str = str.replace('<', "<"); str = str.replace('>', ">"); QString tag_b, tag_e; switch(type) { case Error: tag_b="

    "; tag_e="
"; break; case Warning: tag_b=""; tag_e=""; break; case System: tag_b=""; tag_e=""; break; default: break; } m_toplevel->append_log(tag_b + str + tag_e); } void myView::perform_jumps(const QString& from_board, const QString& to_board) { if(from_board==to_board) { return; } QString new_to_board = to_board; //qDebug("F:%s\nT:%s", from_board.latin1(), new_to_board.latin1()); // diff QList diff_list; // collect information for(int i=0; i<32; i++) { if(from_board[2*i]!=new_to_board[2*i] || from_board[2*i+1]!=new_to_board[2*i+1]) { myDiff* diff = new myDiff(i, from_board.mid(2*i, 2).toInt(), new_to_board.mid(2*i, 2).toInt()); diff_list.append(diff); //qDebug(">%d: %d->%d", diff->m_pos, diff->m_from, diff->m_to); } } int from_pos = -1; int to_pos = -1; bool captured = (diff_list.count()>2); int man = -1; // find the dest. first: so we have the man moved. foreach(myDiff* diff, diff_list) { if(diff->m_to!=FREE) { man = diff->m_to; to_pos = diff->m_pos; break; } } int king = -1; switch(man) { case MAN1: king=KING1; break; case KING1: king=MAN1; break; case MAN2: king=KING2; break; case KING2: king=MAN2; break; } // find src. foreach(myDiff* diff, diff_list) { if(diff->m_to==FREE) { if(diff->m_from==man || diff->m_from==king) { from_pos = diff->m_pos; break; } } } /* qDebug(" to_pos=%d with man/king=%d from=%d", to_pos, man, from_pos); */ // finally - animate :) QString move = m_board->doMove(from_pos, to_pos, m_current->isWhite()); m_toplevel->get_history()->appendMove(move.replace("?", captured ? "x" : "-" ), ""); qDeleteAll(diff_list); } void myView::setNotation(bool enabled, bool show_above) { // TODO - intermediate function - remove somehow! m_board->setNotation(enabled, show_above); } void myView::setNotationFont(const QFont& f) { // TODO - intermediate function - remove somehow! m_board->setNotationFont(f); } myPlayer* myView::get_first_player() const { bool white = m_board->type()==RUSSIAN ? true : false; // it is white. if((white && m_player->isWhite()) || (!white && !m_player->isWhite())) return m_player; return m_player->opponent(); } portnov-qcheckers-b4574ed/src/view.h000066400000000000000000000064241344250506500175330ustar00rootroot00000000000000/*************************************************************************** * Copyright (C) 2004-2005 Artur Wiebe * * wibix@gmx.de * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _VIEW_H_ #define _VIEW_H_ #include #include #include #include #include "board.h" #include "toplevel.h" class Pdn; class myPlayer; class myHistory; class myView : public QFrame { Q_OBJECT public: myView(myTopLevel* parent); ~myView(); void newGame(int rules, bool free_place, const QString& name, bool is_white, int opponent, const QString& opp_name, int skill); bool openPdn(const QString& fn); bool savePdn(const QString& fn); void setTheme(const QString& theme_path); bool isAborted() const { return m_aborted; } void setNotation(bool enabled, bool show_above); void setNotationFont(const QFont& f); QFont notationFont() const { return m_board->font(); } public slots: virtual void setEnabled(bool); void slotClearLog(bool b) { m_clear_log = b; } void slotStopGame(); void slotNextRound(); signals: void working(bool); private slots: void slot_click(int); void slot_move_done(const QString& board_str); void slot_move_done_step_two(); void slot_preview_game(int game_type); void slot_apply_moves(const QString& moves); void slot_new_mode(bool paused, bool freeplace); private: void begin_game(unsigned int round, bool freeplacement); void perform_jumps(const QString& from_board, const QString& to_board); bool extract_move(const QString& move, int* from_num, int* to_num); void stop_game(const QString&); void you_won(bool really); bool check_game_over(); enum LogType { None, Error, Warning, System, User, Opponent, }; void add_log(enum LogType type, const QString& text); myPlayer* get_first_player() const; private: bool m_clear_log; bool m_game_over;// need this to avoid multiple calls to isGameOver() bool m_aborted; myPlayer* m_player; myPlayer* m_current; myTopLevel* m_toplevel; myBoard* m_board; int m_freeplace_from; }; #endif portnov-qcheckers-b4574ed/themes/000077500000000000000000000000001344250506500171005ustar00rootroot00000000000000portnov-qcheckers-b4574ed/themes/3dsimple/000077500000000000000000000000001344250506500206205ustar00rootroot00000000000000portnov-qcheckers-b4574ed/themes/3dsimple/captured.svg000066400000000000000000000047741344250506500231640ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/frame.svg000066400000000000000000000051561344250506500224420ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/kingblack.svg000066400000000000000000000526471344250506500233040ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/kingwhite.svg000066400000000000000000000526031344250506500233400ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/manblack.svg000066400000000000000000000445361344250506500231250ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/manwhite.svg000066400000000000000000000445721344250506500231710ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/theme000066400000000000000000000002571344250506500216510ustar00rootroot00000000000000name = Simple 3D tile1 = tile1.svg tile2 = tile2.svg frame = frame.svg man_white = manwhite.svg man_black = manblack.svg king_white = kingwhite.svg king_black = kingblack.svg portnov-qcheckers-b4574ed/themes/3dsimple/tile1.svg000066400000000000000000000050611344250506500223610ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/3dsimple/tile2.svg000066400000000000000000000050611344250506500223620ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/green/000077500000000000000000000000001344250506500202005ustar00rootroot00000000000000portnov-qcheckers-b4574ed/themes/green/frame.png000066400000000000000000000002671344250506500220050ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME)"ΐTDIDATxױ 7g1S]dQx4| @ >!67IENDB`portnov-qcheckers-b4574ed/themes/green/kingblack.png000066400000000000000000000010431344250506500226310ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME' lIDATx EW[H䐣 p)7\ CJpNCfX'Ex3`u =} HJYJ)L|>W 0Zkp:2ORX7xd#ۂo ]D|T4MY:hf_ce@[qd\.k#e!^BD`q;H-""? "'"aYzs+R|, /I?Puu)q0G}&"v%JKR ]9?>xk?SmϷ[]5UH)_f! ~n,0mۗ6mbZ ɮ"rM骹,)-nK0voI!9?_cƲ;IENDB`portnov-qcheckers-b4574ed/themes/green/kingwhite.png000066400000000000000000000010211344250506500226710ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME(rIDATx10EO,XK1;` Y`i ;ɯ h7ކ»羘v7q9k vέ+5Ֆ z2>:zp<EHg `2O1^Yd1@,d5{Abf}6pιGchfH%6(Z'ZSEpo OBkMuniT4cg @Y [k9u{6 @~Q v/44s1}Yu1&_l>yu\.80M6xfii$}2jL[~ROKʗ$ZANOÒR$\۶)u?p5q>d$HֺIVwdV>;NR(HLRw5XSIENDB`portnov-qcheckers-b4574ed/themes/green/manblack.png000066400000000000000000000011521344250506500224550ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME'8q:IDATxW; lo{8a9t |WKH/`$ #!VmWt3@On7/mY,@DEͩBDZ#|ߑ308+B%υDhq7JG{_\GD!7fJCMT/ D*ZPE"k- S3k ,\a9[>ג̛sZ?%LC DVT6#l9[iNGOJP0@特Y4Mx<0Ƭ`LZx(rWjn6CMZ2\;=SDUDa0 C$c3cߣ:}ٝ_;ِRp%Ebf8.fdɟGY@.V 3J!>Rj/W)x{!-㮃_W"Y"*rt:x^7T{D\ZLVoJ65IENDB`portnov-qcheckers-b4574ed/themes/green/manwhite.png000066400000000000000000000014241344250506500225230ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME)v-IDATx嗡0ƿr+N 3S?aC/5=?`j !X/)wzvo1OR|dθWJٻEQEQOqsQJ)l[}( `!$ t:MLXͻC !РILBdx<9GP<s  M8!lV<ϵqV8RJrB|;*`5`J"01+A=1ָ:y&8u%W1Y+B|>ri!5-{ei^J1]3( !9GE}0IfK)!Y *_Ik&Eٓ9o6X`λ&2l6V%̜1(S^VA۶ɘz;zjҿ@leܴsmkB0Ɛe8~Y MӀsn5'UUˠ8Zx sE/4MSpα^u̢/!MD&DWU)%JC}E:SnF%&yUUc#06TeHRJv;m>%ĬJHܕ~Gm[u=i>! z@ps(`itx  tIENDB`portnov-qcheckers-b4574ed/themes/green/theme000066400000000000000000000000061344250506500212210ustar00rootroot00000000000000Green portnov-qcheckers-b4574ed/themes/green/tile1.png000066400000000000000000000030751344250506500217310ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME'(IDATxub7?66ȱ96ϒD-s "9yjjwr΄H)ae۶koq! K\x񆵖R {y}y%s;)%cc HJ۱JbY}Nۏ7sc8,Nu/"A&QkEd\;_8?`'r889ZcY.c ZkVXZ+pBRI J+޹m7J)* Z+۱Q{cE_W8qd@gTk1hsID%AGpkZKk 1FRJ{ N|uaX~?1Q\BXkN/ *J){iA05SZ!b)V=u_q6!qZi,6T/aCW o1RHTsZk%L437w֏|7\Pt ӫjiI3+ୟ;9GqZr cM +'n6-5On=O!0ՂBo=nܘDD9AŦ8Om(uz}Y.0 Ķm87\;1FSK{"&l6z(Bh)RT.SI"2u6ܶ^w+N@ZC͕yjUZKwa%8h8y`{Zs3OZ##ZkljS6H ^ƚلZcwgn*\l,uRPP;,8qS;ס)qXkƲ+^?*LZ!VحMK3pbO;~?_k"2ri3 ]sVf>O[!"HAf4ZksS]2u7nhO;ƚٔNvבּT*Xpnn=vjCE("|_'#5Q=MFGs O{5}\P]roeEDiTDj+18\.ÎO[k1r:f8)̭9B9@ǧ} |:\V:P[žick,{Bl +5R }@sIeY&Bvc+mb!o8D;6徔RR[c~.("spyJ?G.AcX=r>g BH^ hۏHJ)}Zwy~G;R&\K\fZ+NxuQO]snӎ)%u=-m|g>iqx_R< x}y 3IRǏIF}\S>kVJm c|>FrڎSN<(JRr ٠B N.e<<;mW c#+EIENDB`portnov-qcheckers-b4574ed/themes/green/tile2.png000066400000000000000000000032251344250506500217270ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME&8j{"IDATx]nճ$%K8w A4.؎|-·Y EnWwWW~ ]st/t'Pkt<9:A_/#C8 a'hUoZ>p$ X2;3乘#D: kx 3Cձ?JAfF=8Vq^3 ( <9cͿGlGeP ԁ+< uq !$ 屜r.湖oLĐeWsh1#2X:0 2gн/ eNȡ+9ėzsy{04 6tqct$lmxFɑJP`fY=1؝e Ms =E~r_ wD;~3*GbRM ؂WcVMވ) )Jaʖ>ao,[$">Jؓ1hv.Ҧ4LIE=a5pe`C]`w5v*>}K|-JU-!=tqp#VP/Z٦lm"TJCrn L@y*F#>}z?>*M H#s̷&Qޖ)$aM>.!u:Eˋ}yǀWX.)F/ߕ\PC|,<+[O[gB/WA`CIK:4pIENDB`portnov-qcheckers-b4574ed/themes/marble/000077500000000000000000000000001344250506500203425ustar00rootroot00000000000000portnov-qcheckers-b4574ed/themes/marble/frame.png000066400000000000000000000002641344250506500221440ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME&!AIDATx!  \?N\U ޚ,w @ @@=6IENDB`portnov-qcheckers-b4574ed/themes/marble/kingblack.png000066400000000000000000000010431344250506500227730ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME' lIDATx EW[H䐣 p)7\ CJpNCfX'Ex3`u =} HJYJ)L|>W 0Zkp:2ORX7xd#ۂo ]D|T4MY:hf_ce@[qd\.k#e!^BD`q;H-""? "'"aYzs+R|, /I?Puu)q0G}&"v%JKR ]9?>xk?SmϷ[]5UH)_f! ~n,0mۗ6mbZ ɮ"rM骹,)-nK0voI!9?_cƲ;IENDB`portnov-qcheckers-b4574ed/themes/marble/kingwhite.png000066400000000000000000000010211344250506500230330ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME(rIDATx10EO,XK1;` Y`i ;ɯ h7ކ»羘v7q9k vέ+5Ֆ z2>:zp<EHg `2O1^Yd1@,d5{Abf}6pιGchfH%6(Z'ZSEpo OBkMuniT4cg @Y [k9u{6 @~Q v/44s1}Yu1&_l>yu\.80M6xfii$}2jL[~ROKʗ$ZANOÒR$\۶)u?p5q>d$HֺIVwdV>;NR(HLRw5XSIENDB`portnov-qcheckers-b4574ed/themes/marble/manblack.png000066400000000000000000000011521344250506500226170ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME'8q:IDATxW; lo{8a9t |WKH/`$ #!VmWt3@On7/mY,@DEͩBDZ#|ߑ308+B%υDhq7JG{_\GD!7fJCMT/ D*ZPE"k- S3k ,\a9[>ג̛sZ?%LC DVT6#l9[iNGOJP0@特Y4Mx<0Ƭ`LZx(rWjn6CMZ2\;=SDUDa0 C$c3cߣ:}ٝ_;ِRp%Ebf8.fdɟGY@.V 3J!>Rj/W)x{!-㮃_W"Y"*rt:x^7T{D\ZLVoJ65IENDB`portnov-qcheckers-b4574ed/themes/marble/manwhite.png000066400000000000000000000014241344250506500226650ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME)v-IDATx嗡0ƿr+N 3S?aC/5=?`j !X/)wzvo1OR|dθWJٻEQEQOqsQJ)l[}( `!$ t:MLXͻC !РILBdx<9GP<s  M8!lV<ϵqV8RJrB|;*`5`J"01+A=1ָ:y&8u%W1Y+B|>ri!5-{ei^J1]3( !9GE}0IfK)!Y *_Ik&Eٓ9o6X`λ&2l6V%̜1(S^VA۶ɘz;zjҿ@leܴsmkB0Ɛe8~Y MӀsn5'UUˠ8Zx sE/4MSpα^u̢/!MD&DWU)%JC}E:SnF%&yUUc#06TeHRJv;m>%ĬJHܕ~Gm[u=i>! z@ps(`itx  tIENDB`portnov-qcheckers-b4574ed/themes/marble/theme000066400000000000000000000000071344250506500213640ustar00rootroot00000000000000Marble portnov-qcheckers-b4574ed/themes/marble/tile1.png000066400000000000000000000036421344250506500220730ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME'q/IDATxMr8F@Rdnk;qےH{ڳr'9|n(`6(bf޹\R8ʺ.n7.߿.cPkED^omq|~ 57rwDnD;w``YWJ*--TZknF)^o?#"@jE <ϓ>("T<) "~rq\.TuRMx{P-ZHj~FDP-1pw}ٶ1 j˝sGTة" "8[ !qwa]W킈 "9RfBkZ*ó y @Rmu @5) /DZuewe!<\.WmEQ>견pĎQfPˆ9eY^/c nry>*fAkǒm[=XB5[Vjgk,BPkc[7zӖ43jDrha6a c>q߆$HSJpK9çtlL_ÉҨ}tX²4. ZUDR^Ejaz~OZk<|{Reغ -uY\f6J'ؒ|[`Y܍贶LjegFkQTXzVܓ=RHQ";/U j]"O8cn.]ez]{~fo)hNe/ﯥ»mP"׹ k,mɌ;Pc]Un%“IENDB`portnov-qcheckers-b4574ed/themes/marble/tile2.png000066400000000000000000000046321344250506500220740ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME( 9 'IDATxEGFvpp|,$Kj%OS-AsGAX,\: x|s0{wWW c J)jRPJ1 J)B("ZMmL)k9J)xe uؔ}Ck<ϔR93M"ukQ"4MCk iff=Rp}'ne¼, ,WWo!sjh0`:JEDp̀s9m[Bc }QfhnSk9=ژ)%oqXk9, "BΉZR2{(!łuHM4ͦk[9OX59G\cZc&E%/l6;B4v8yIQrϙ92{c@>~ Jsn=Px"T ]ុgnR f1BJb񊻻nUMkPc",B)gVx4(PJsJJV,K&r^s ,#nnnZs2/hfB +kF+yxӗoRZrԚ)*(TiaBCp!D ӋX8NX(yy~<:۸bi","BU`jcpE:oZu|5-ժ^~Pnn:c֙Җnh7<<>/'gb)pw ~W]4PJE)R\ d؋/$Q8JE K`L/i1Rր39VlmsuZqc\m/@eRʻwL un?P R,%^cX|`Yֳzg=!ݠyzx!FU 6FJy8x͎k_ 1f/m0F҅eB)[u~-qCB*ߍ{0q9 <+vYD%gYuJTF_]F+hj&ZlUAwc5ou Wx'l ΰzB_*IENDB`portnov-qcheckers-b4574ed/themes/simple_big/kingwhite.png000066400000000000000000000007561344250506500237210ustar00rootroot00000000000000PNG  IHDR00WbKGD pHYs  tIME6,s,tEXtCommentCreated with The GIMPd%nRIDATh Em B6Ow5܃@$"Ǘ`ljLADf3`=92 2l.}AxmNkpG 8b"p@ez5ZmSҙH:g+*Y^Wob{1jE-B?F2k 'D5{# sapw UmiA-ѾYi٨fEJx*2pK-RUOl=8!0Z1kRQ;}m-OswT~n-`D<0K%3|bIENDB`portnov-qcheckers-b4574ed/themes/simple_big/manblack.png000066400000000000000000000005771344250506500235010ustar00rootroot00000000000000PNG  IHDR00WbKGDC pHYs  tIME8ͧtEXtCommentCreated with The GIMPd%nIDATh홁 }ߙHl"u`LjXI*v HA-7 Vo܇ \D@]˳?9]GN\-y K\H@q5ͨ%Y>\ o(?D84"LM]kgTG//vĆu t8k wzuncIXQQX:eIIENDB`portnov-qcheckers-b4574ed/themes/simple_big/manwhite.png000066400000000000000000000006361344250506500235410ustar00rootroot00000000000000PNG  IHDR00WbKGDC pHYs  tIME7>tEXtCommentCreated with The GIMPd%nIDAThQ DW_IEA@>1c:9ux$@0\ H7"XN-D f'&L/#2%^ o7x&r(s ' ͮ5B^jgtleG#Zb!!-e$@dUXɹV#KfQ:gHoL@ h@82ЂXΑ*:ZpwMS #_:Hx3mgIENDB`portnov-qcheckers-b4574ed/themes/simple_big/theme000066400000000000000000000000131344250506500222310ustar00rootroot00000000000000Simple Big portnov-qcheckers-b4574ed/themes/simple_big/tile1.png000066400000000000000000000002641344250506500227400ustar00rootroot00000000000000PNG  IHDR00WbKGDC pHYs  ~tIME: DAIDATh 0B$ǦS\IENDB`portnov-qcheckers-b4574ed/themes/simple_big/tile2.png000066400000000000000000000002711344250506500227370ustar00rootroot00000000000000PNG  IHDR00WbKGD pHYs  ~tIME5wFIDATh1 007us߯X,c99 zdIENDB`portnov-qcheckers-b4574ed/themes/simple_small/000077500000000000000000000000001344250506500215615ustar00rootroot00000000000000portnov-qcheckers-b4574ed/themes/simple_small/frame.png000066400000000000000000000004441344250506500233630ustar00rootroot00000000000000PNG  IHDR szzbKGD pHYs  ~tIME8gIDATXA ' $XQdS2CD$4\grx6K4<[ޜ%p lwFW<~腻p!Y 7 j\% 1K{ҭ W;=@mjk/|DPI.PZz7#| IENDB`portnov-qcheckers-b4574ed/themes/simple_small/kingblack.png000066400000000000000000000006421344250506500242160ustar00rootroot00000000000000PNG  IHDR szzbKGDC pHYs  tIME-!|tEXtCommentCreated with The GIMPd%nIDATXW0 a.qANRU*Iv_Z@ 8j ;p[5PKon3> pM ]1]f=nQXr!ά͆L+RUTIYO9aa~bN@5L!w8Ԍ )ϣ%̄̋0 #

:ZAIENDB`portnov-qcheckers-b4574ed/themes/simple_small/manblack.png000066400000000000000000000005631344250506500240430ustar00rootroot00000000000000PNG  IHDR szzbKGDC pHYs  tIME-a>tEXtCommentCreated with The GIMPd%nIDATXWK p;Ec[u[8:taDfboV3p੷kC /|$Zm^GX=_L#lfX/5{}aY:ڞ6=V+aU|NUnkldfÒ0䒞)7ӽ ,̈F-7='W'itPIENDB`portnov-qcheckers-b4574ed/themes/simple_small/manwhite.png000066400000000000000000000005741344250506500241110ustar00rootroot00000000000000PNG  IHDR szzbKGDC pHYs  tIME,2JtEXtCommentCreated with The GIMPd%nIDATXWA0? ]f-I@fT}/cI=카 cMc "PӛaI-ŕ֡ qV}ȯtEwmvɥmE Ew./ URg{{ӼXWY WmwyQ(Lt{/vzoVB+ ;"d^K6)іLFf#'8."IENDB`portnov-qcheckers-b4574ed/themes/simple_small/theme000066400000000000000000000000151344250506500226020ustar00rootroot00000000000000Simple Small portnov-qcheckers-b4574ed/themes/simple_small/tile1.png000066400000000000000000000002371344250506500233070ustar00rootroot00000000000000PNG  IHDR szzbKGDC pHYs  ~tIME #0 L,IDATX1i3$`66M image/svg+xml portnov-qcheckers-b4574ed/themes/simple_svg/kingblack.svg000066400000000000000000000037701344250506500237250ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/simple_svg/kingwhite.svg000066400000000000000000000037751344250506500237760ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/simple_svg/manblack.svg000066400000000000000000000034701344250506500235450ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/simple_svg/manwhite.svg000066400000000000000000000034701344250506500236110ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/simple_svg/theme000066400000000000000000000002601344250506500222730ustar00rootroot00000000000000name = Simple SVG tile1 = tile1.svg tile2 = tile2.svg frame = frame.svg man_white = manwhite.svg man_black = manblack.svg king_white = kingwhite.svg king_black = kingblack.svg portnov-qcheckers-b4574ed/themes/simple_svg/tile1.svg000066400000000000000000000036131344250506500230120ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/simple_svg/tile2.svg000066400000000000000000000036131344250506500230130ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/000077500000000000000000000000001344250506500214005ustar00rootroot00000000000000portnov-qcheckers-b4574ed/themes/svg_classic/frame.svg000066400000000000000000000036501344250506500232170ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/kingblack.svg000066400000000000000000000040331344250506500240460ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/kingwhite.svg000066400000000000000000000040151344250506500241120ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/manblack.svg000066400000000000000000000043631344250506500236770ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/manwhite.svg000066400000000000000000000043541344250506500237430ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/theme000066400000000000000000000002611344250506500224240ustar00rootroot00000000000000name = SVG Classic tile1 = tile1.svg tile2 = tile2.svg frame = frame.svg man_white = manwhite.svg man_black = manblack.svg king_white = kingwhite.svg king_black = kingblack.svg portnov-qcheckers-b4574ed/themes/svg_classic/tile1.svg000066400000000000000000000036351344250506500231460ustar00rootroot00000000000000 image/svg+xml portnov-qcheckers-b4574ed/themes/svg_classic/tile2.svg000066400000000000000000000036351344250506500231470ustar00rootroot00000000000000 image/svg+xml